aboutsummaryrefslogtreecommitdiff
path: root/libiberty
diff options
context:
space:
mode:
Diffstat (limited to 'libiberty')
-rw-r--r--libiberty/COPYING.LIB504
-rw-r--r--libiberty/ChangeLog5176
-rw-r--r--libiberty/Makefile.in483
-rw-r--r--libiberty/README66
-rw-r--r--libiberty/_doprnt.c303
-rw-r--r--libiberty/aclocal.m4191
-rw-r--r--libiberty/alloca.c478
-rw-r--r--libiberty/argv.c355
-rw-r--r--libiberty/asprintf.c57
-rw-r--r--libiberty/atexit.c28
-rw-r--r--libiberty/basename.c60
-rw-r--r--libiberty/bcmp.c36
-rw-r--r--libiberty/bcopy.c27
-rw-r--r--libiberty/bsearch.c92
-rw-r--r--libiberty/bzero.c25
-rw-r--r--libiberty/calloc.c40
-rw-r--r--libiberty/choose-temp.c72
-rw-r--r--libiberty/clock.c103
-rw-r--r--libiberty/concat.c236
-rw-r--r--libiberty/config.h-vms13
-rw-r--r--libiberty/config.in254
-rw-r--r--libiberty/config.table67
-rw-r--r--libiberty/config/mh-aix9
-rw-r--r--libiberty/config/mh-cxux71
-rw-r--r--libiberty/config/mh-fbsd211
-rw-r--r--libiberty/config/mh-openedition3
-rw-r--r--libiberty/config/mh-windows1
-rwxr-xr-xlibiberty/configure3780
-rw-r--r--libiberty/configure.in459
-rw-r--r--libiberty/copying-lib.texi565
-rw-r--r--libiberty/copysign.c152
-rw-r--r--libiberty/cp-demangle.c4199
-rw-r--r--libiberty/cplus-dem.c4880
-rw-r--r--libiberty/dyn-string.c442
-rw-r--r--libiberty/fdmatch.c67
-rw-r--r--libiberty/ffs.c27
-rw-r--r--libiberty/fibheap.c523
-rw-r--r--libiberty/floatformat.c451
-rw-r--r--libiberty/fnmatch.c223
-rw-r--r--libiberty/fnmatch.txh48
-rw-r--r--libiberty/functions.texi965
-rw-r--r--libiberty/gather-docs128
-rw-r--r--libiberty/getcwd.c64
-rw-r--r--libiberty/getopt.c1056
-rw-r--r--libiberty/getopt1.c190
-rw-r--r--libiberty/getpagesize.c90
-rw-r--r--libiberty/getpwd.c127
-rw-r--r--libiberty/getruntime.c116
-rw-r--r--libiberty/hashtab.c616
-rw-r--r--libiberty/hex.c180
-rw-r--r--libiberty/index.c23
-rw-r--r--libiberty/insque.c53
-rw-r--r--libiberty/lbasename.c80
-rw-r--r--libiberty/libiberty.texi324
-rw-r--r--libiberty/maint-tool278
-rw-r--r--libiberty/make-temp-file.c179
-rw-r--r--libiberty/makefile.vms33
-rw-r--r--libiberty/md5.c421
-rw-r--r--libiberty/memchr.c39
-rw-r--r--libiberty/memcmp.c39
-rw-r--r--libiberty/memcpy.c27
-rw-r--r--libiberty/memmove.c30
-rw-r--r--libiberty/memset.c30
-rw-r--r--libiberty/mkstemps.c142
-rw-r--r--libiberty/mpw-config.in7
-rw-r--r--libiberty/mpw-make.sed51
-rw-r--r--libiberty/mpw.c1010
-rw-r--r--libiberty/msdos.c15
-rw-r--r--libiberty/objalloc.c298
-rw-r--r--libiberty/obstack.c593
-rw-r--r--libiberty/obstacks.texi758
-rw-r--r--libiberty/partition.c191
-rw-r--r--libiberty/pexecute.c792
-rw-r--r--libiberty/putenv.c85
-rw-r--r--libiberty/random.c408
-rw-r--r--libiberty/regex.c8317
-rw-r--r--libiberty/rename.c37
-rw-r--r--libiberty/rindex.c23
-rw-r--r--libiberty/safe-ctype.c163
-rw-r--r--libiberty/setenv.c187
-rw-r--r--libiberty/sigsetmask.c41
-rw-r--r--libiberty/sort.c190
-rw-r--r--libiberty/spaces.c70
-rw-r--r--libiberty/splay-tree.c559
-rw-r--r--libiberty/strcasecmp.c92
-rw-r--r--libiberty/strchr.c30
-rw-r--r--libiberty/strdup.c21
-rw-r--r--libiberty/strerror.c811
-rw-r--r--libiberty/strncasecmp.c92
-rw-r--r--libiberty/strncmp.c39
-rw-r--r--libiberty/strrchr.c30
-rw-r--r--libiberty/strsignal.c618
-rw-r--r--libiberty/strstr.c43
-rw-r--r--libiberty/strtod.c138
-rw-r--r--libiberty/strtol.c166
-rw-r--r--libiberty/strtoul.c118
-rw-r--r--libiberty/ternary.c166
-rw-r--r--libiberty/testsuite/Makefile.in69
-rw-r--r--libiberty/testsuite/demangle-expected2606
-rw-r--r--libiberty/testsuite/test-demangle.c175
-rw-r--r--libiberty/tmpnam.c53
-rw-r--r--libiberty/vasprintf.c195
-rw-r--r--libiberty/vfork.c22
-rw-r--r--libiberty/vfprintf.c21
-rw-r--r--libiberty/vmsbuild.com165
-rw-r--r--libiberty/vprintf.c32
-rw-r--r--libiberty/vsprintf.c59
-rw-r--r--libiberty/waitpid.c36
-rw-r--r--libiberty/xatexit.c101
-rw-r--r--libiberty/xexit.c53
-rw-r--r--libiberty/xmalloc.c183
-rw-r--r--libiberty/xmemdup.c38
-rw-r--r--libiberty/xstrdup.c34
-rw-r--r--libiberty/xstrerror.c67
114 files changed, 0 insertions, 49795 deletions
diff --git a/libiberty/COPYING.LIB b/libiberty/COPYING.LIB
deleted file mode 100644
index b1e3f5a..0000000
--- a/libiberty/COPYING.LIB
+++ /dev/null
@@ -1,504 +0,0 @@
- 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.
-
- <one line to give the library's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- 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.
-
- <signature of Ty Coon>, 1 April 1990
- Ty Coon, President of Vice
-
-That's all there is to it!
-
-
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
deleted file mode 100644
index df6f33f..0000000
--- a/libiberty/ChangeLog
+++ /dev/null
@@ -1,5176 +0,0 @@
-2002-09-19 John David Anglin <dave@hiuly1.hia.nrc.ca>
-
- * cp-demangle.c (demangling_new): Cast 0 to enum.
- (demangle_char): Cast return of strdup to char *.
- (is_gnu_v3_mangled_ctor): Cast 0 to enum.
- (is_gnu_v3_mangled_dtor): Likewise.
- * cplus-dem.c (grow_vect): Cast return of xrealloc to void *.
- (work_stuff_copy_to_from): Cast return of xmalloc to char **.
- * fibheap.c (fibnode_new): Cast return of xcalloc to fibnode_t.
- * md5.c (md5_process_bytes): Cast results back to const void *.
- (md5_process_block): Add cast to const md5_uint32 *.
- * regex.c (re_compile_fastmap): Cast enum to UCHAR_T.
- * safe-ctype.c (L, XL, U, XU, D, P, _, C, Z, M, V, T, S): Add cast to
- unsigned short.
- * splay-tree.c (splay_tree_xmalloc_allocate): Cast return of xmalloc
- to void *.
- * vasprintf.c (int_vasprintf): Cast return of malloc to char *.
-
-2002-09-19 Nick Clifton <nickc@redhat.com>
-
- * README: Update email addresses for bugs and patches.
-
-2002-09-10 Mike Stump <mrs@apple.com>
-
- * splay-tree.c (splay_tree_successor): Fix comments.
-
-2002-09-11 Zack Weinberg <zack@codesourcery.com>
-
- * cplus-dem.c: Code under #ifdef MAIN moved to gcc/cp/cxxfilt.c.
- * testsuite/Makefile.in: Adjust for test-demangle.
- * testsuite/regress-demangle: Deleted.
- * testsuite/test-demangle.c: New file.
- * testsuite/demangle-expected: Change \$ to $ throughout, now that
- this file is not being read by a shell script.
-
-2002-09-05 Roger Sayle <roger@eyesopen.com>
-
- * regex.c: Only use "#pragma alloca" on AIX when not using gcc.
-
-2002-08-07 DJ Delorie <dj@redhat.com>
-
- * regex.c (re_error_msgid): Just use a simple array of strings.
- (re_compile_pattern): Compensate.
- (re_comp): Likewise.
- (re_comp): Likewise.
- (regerror): Likewise.
-
-2002-07-29 Neil Booth <neil@daikokuya.co.uk>
-
- * cplus-dem.c (PREPEND_BLANK): Remove.
-
-2002-07-10 Jason Merrill <jason@redhat.com>
-
- * cp-demangle.c (demangle_identifier): Support extended Unicode
- characters.
-
-2002-07-08 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * cp-demangle.c (demangle_v3_with_details): Wrap in
- !defined IN_GLIBCPP_V3.
-
-2002-07-01 Mark Mitchell <mark@codesourcery.com>
-
- * cp-demangle.c (demangle_operator_name): Add type_arg parameter.
- Set it for the "st" operator.
- (demangle_expression): Handle expressions with types as arguments.
-
-2002-06-30 Douglas Rupp <rupp@gnat.com>
-
- * configure.in (OUTPUT_OPTION,NO_MINUS_C_MINUS_O): Configure.
- * Makefile.in (OUTPUT_OPTION): Use.
-
-2002-06-22 Peter Breitenlohner <peb@mppmu.mpg.de>
-
- * Makefile.in (install_to_libdir): Add $(DESTDIR).
- (install_to_tooldir): Likewise.
-
-2002-06-17 Douglas Rupp <rupp@gnat.com>
-
- * lbasename.c: Add 2002 to copyright.
- (IS_DIR_SEPARATOR): Remove VMS junk.
-
-2002-06-05 Geoffrey Keating <geoffk@redhat.com>
-
- * hashtab.c (htab_create): New stub function for backward
- compatibility.
- (htab_try_create): Likewise.
-
-2002-06-03 Geoffrey Keating <geoffk@redhat.com>
-
- * hashtab.c (htab_create): Delete.
- (htab_try_create): Delete.
- (htab_create_alloc): New.
- (htab_delete): Support user-specified memory allocation.
- (htab_expand): Likewise.
-
-2002-05-22 Roman Lechtchinsky <rl@cs.tu-berlin.de>
-
- * configure.in: Fix typo in the code checking for sys_errlist.
- * configure: Regenerated.
-
-2002-05-13 Andreas Schwab <schwab@suse.de>
-
- * config.table: Use mh-x86pic also for x86-64.
-
-2002-05-08 Alexandre Oliva <aoliva@redhat.com>
-
- * configure.in (ORIGINAL_LD_FOR_MULTILIBS): Preserve LD at
- script entry, and set LD to it when configuring multilibs.
- * configure: Rebuilt.
-
-2002-05-07 Mark Mitchell <mark@codesourcery.com>
-
- * configure.in (AC_TYPE_PID_T): Use it.
- * configure: Regenerated.
- * getruntime.c: Include <sys/types.h>.
- * waitpid.c: Likewise. Use pid_t, not int, as the type of "pid".
-
-2002-04-09 Richard Henderson <rth@redhat.com>
-
- * hashtab.c (higher_prime_number): Use 7 as minimum.
- (find_empty_slot_for_expand): Don't compute hash2 unless needed.
- (htab_find_slot_with_hash): Likewise.
-
-2002-04-01 Phil Edwards <pme@gcc.gnu.org>
-
- * cp-demangle.c (__cxa_demangle): Also protect with IN_GLIBCPP_V3.
- (is_gnu_v3_mangled_ctor, is_gnu_v3_mangled_ctor): Conditionally
- not compile if IN_GLIBCPP_V3 defined.
- * dyn-string.c: Also allow IN_GLIBCPP_V3 to change allocation scheme.
-
-2002-03-30 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
-
- * cp-demangle.c (java_demangle_v3): Don't try to release "demangled"
- if it is NULL.
-
-2002-03-27 DJ Delorie <dj@redhat.com>
-
- * hex.c: Add documentation.
- (_hex_value): Provide non-ASCII empty table.
- (hex_init): Initialize the non-ASCII table.
- * functions.texi: Regenerate.
-
-2002-03-27 Mark Mitchell <mark@codesourcery.com>
-
- * dyn-string.c: Add libgcc exception to copyright notice.
-
-2002-03-26 H.J. Lu (hjl@gnu.org)
-
- * config.table: Support --with-build-subdir.
- * configure.in: Likewise.
- * configure: Rebuild.
-
-2002-03-18 Stuart Griffith <Stuart_Griffith@credence.com>
-
- * strtod.c (strtod): Increment 8 chars, not 7, when `infinity'
- seen.
-
-2002-03-12 Mark Mitchell <mark@codesourcery.com>
-
- * cp-demangle.c: Add libgcc exception to cp-demangle.c copyright
- notice.
-
-2002-03-11 Douglas B Rupp <rupp@gnat.com>
-
- * xatexit.c [VMS]: Include stdlib.h and unixlib.h.
-
-2002-03-06 Jim Blandy <jimb@redhat.com>
-
- * splay-tree.c (splay_tree_xmalloc_allocate,
- splay_tree_xmalloc_deallocate): Use K&R-style definitions, not
- prototyped definitions. Mark `data' arguments as unused.
-
-2002-03-06 Andrew Cagney <ac131313@redhat.com>
-
- * floatformat.c (floatformat_arm_ext_big): Delete definition.
-
-2002-03-04 Phil Edwards <pme@gcc.gnu.org>
-
- * configure.in: Add --enable-install-libiberty option.
- * Makefile.in (INSTALLED_HEADERS): New variable.
- (install_to_libdir): Possibly also copy headers.
- * configure: Regenerated.
-
-2002-03-04 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * xmalloc.c (xmalloc_fail): Clarify error message further.
-
-2002-03-03 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * xmalloc.c (xmalloc_fail): Clarify error message.
-
-2002-02-22 Jim Blandy <jimb@redhat.com>
-
- * splay-tree.c (splay_tree_xmalloc_allocate,
- splay_tree_xmalloc_deallocate): New functions.
- (splay_tree_new): Call splay_tree_new_with_allocator, passing the
- above functions and a dummy data pointer.
- (splay_tree_new_with_allocator): New function.
- (splay_tree_delete_helper, splay_tree_delete, splay_tree_insert,
- splay_tree_remove): Use the splay tree's allocation and
- deallocation functions.
-
-2002-02-19 Scott Snyder <snyder@fnal.gov>
-
- * testsuite/demangle-expected: Add test case for infinite loop in
- demangler.
- * cplus-dem.c (demangle_arm_hp_template): Stop trying to demangle
- if do_type() doesn't make any progress --- prevents an infinite
- loop.
-
-2002-02-18 Carlo Wood <carlo@gnu.org>
-
- PR c++/5390
- * cplus-dem.c (demangle_integral_value): Accept multi-digit
- numbers that do not start with an underscore; This is needed
- for integer template parameters. This doesn't break anything
- because multi-digit numbers are never followed by a digit.
- * testsuite/demangle-expected: Corrected all mangled test
- cases with multi-digit template parameters: g++ 2.95.x does
- not generate underscores around these parameters.
-
-2002-02-05 Jason Merrill <jason@redhat.com>
-
- * cplus-dem.c (flags): Add DMGL_VERBOSE
- (cplus_demangle_v3_p): Remove.
- (demangle_it): Add DMGL_TYPES to passed flags.
- * cp-demangle.c (cplus_demangle_v3_all): Remove.
- (cplus_demangle_v3_type): Remove.
- (cplus_demangle_v3): Add options parm.
-
-2002-02-02 H.J. Lu (hjl@gnu.org)
-
- * cp-demangle.c (cp_demangle_type): Do not protect with
- IN_LIBGCC2.
- (cplus_demangle_v3_all): New.
- (cplus_demangle_v3): Call cplus_demangle_v3_all.
- (cplus_demangle_v3_type): Call cplus_demangle_v3_all.
-
- * cplus-dem.c (cplus_demangle_v3_p): New function pointer.
- Initialized to cplus_demangle_v3.
- (cplus_demangle_with_style): Call cplus_demangle_v3_p instead
- of cplus_demangle_v3.
- (main): Set cplus_demangle_v3_p to cplus_demangle_v3_type for
- command line symbol.
-
- * testsuite/regress-demangle: Pass the mangled name at the
- command line.
-
-2002-02-01 H.J. Lu <hjl@gnu.org>
-
- * cp-demangle.c (cp_demangle_type): Call demangling_new with
- DMGL_GNU_V3.
-
-2002-01-31 Phil Edwards <pme@gcc.gnu.org>
-
- * cp-demangle.c: Revert yesterday's change.
-
-2002-01-31 Adam Megacz <adam@xwt.org>
-
- * gcc/libiberty/configure.in: Treat mingw the same as cywin
- wrt HAVE_SYS_ERRLIST.
-
-2002-01-30 Phil Edwards <pme@gcc.gnu.org>
-
- * cp-demangle.c (cp_demangle_type): Do not protect with IN_LIBGCC2.
- (cplus_demangle_v3): Mimic __cxa_demangle and fall back on
- cp_demangle_type.
- * testsuite/demangle-expected: New gnu-v3 test.
-
-2002-01-22 Momchil Velikov <velco@fadata.bg>
-
- * configure.in (variable detection): Use arrays of unspecified
- size instead of plain integers.
-
-2002-01-18 DJ Delorie <dj@redhat.com>
-
- * Makefile.in (TESTLIB): New. This library is for future
- testsuites.
- (CFILES, REQUIRED_OFILES, CONFIGURED_OFILES): Re-alphabetize,
- break down by letter.
- (REQUIRED_OFILES): List long-to-compile files first.
- (maint-deps): New, target for updating dependencies.
- (dependencies): Update.
- * maint-tool: Add dependency-generating option.
- * configure.in: Check for _doprnt even if we're not providing it.
- * configure: Regenerate.
-
- * _doprnt.c: Modifications to allow compiling on any platform.
- * copysign.c: Likewise.
- * putenv.c: Likewise.
- * setenv.c: Likewise.
- * vsprintf.c: Likewise.
-
-2002-01-15 Douglas B Rupp <rupp@gnat.com>
-
- * mkstemps.c (mkstemps): On VMS, open temp file with option
- that causes it to be deleted when closed.
-
-2002-01-02 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * cp-demangle.c (long_options): Const-ify.
- * cplus-dem.c (long_options): Likewise.
-
- * cplus-dem.c (mystrstr): Delete. All callers changed to use
- strstr instead.
-
-2001-12-31 Ira Ruben <ira@apple.com>
-
- * aclocal.m4 (libiberty_AC_FUNC_STRNCMP): Use anon mmap as 2nd try.
- * configure: Regenerated.
-
-2001-12-24 Douglas B. Rupp <rupp@gnat.com>
-
- * configure.in (uintptr_t): Use AC_CHECK_TYPE.
- * configure: Regenerated.
-
-2001-12-12 Craig Rodrigues <rodrigc@gcc.gnu.org>
-
- PR other/2719
- * cplus-dem.c (consume_count): Treat negative count as an error.
- * testsuite/demangle-expected: Added testcase.
-
-Tue Dec 11 07:08:57 2001 Douglas B. Rupp <rupp@gnat.com>
-
- * configure.in: Hardcode that vfork works on VMS host.
- * configure: Regenerated.
-
-2001-12-06 Richard Henderson <rth@redhat.com>
-
- * cplus-dem.c (libiberty_demanglers): Add no_demangling case.
- (cplus_demangle): Support no_demangling.
-
-2001-11-27 Zack Weinberg <zack@codesourcery.com>
-
- * _doprnt.c: Moved here from gcc/doprint.c. Adjust to build
- in libiberty context. Fix typo in leading comment.
- * configure.in: Fix various AC_DEFINEs so autoheader works.
- If any of vprintf, vsprintf, vfprintf is missing from libc,
- then AC_REPLACE_FUNCS(_doprnt).
-
-2001-11-26 DJ Delorie <dj@redhat.com>
- Daniel Jacobowitz <drow@mvista.com>
-
- * Makefile.in (stamp-h): Depend on Makefile for proper
- serialization.
- (*-subdir): Depend on config.h for proper serialization.
-
-2001-11-26 DJ Delorie <dj@redhat.com>
-
- * configure.in: Check for alloca.h (for regex.c and putenv.c).
- * configure: Regenerate.
- * config.h: Add HAVE_ALLOCA_H.
-
-2001-11-16 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * regex.c: Check defined(__STDC__) || defined(ALMOST_STDC) ||
- defined(HAVE_STRINGIZE) to determine whether ISO CPP token pasting
- is available.
-
-Thu Nov 15 11:06:25 2001 Jeffrey A Law (law@cygnus.com)
-
- * config.in (HAVE_UINTPTR_T): Provide autoconf stub.
- * configure.in (HAVE_UINTPTR_T): Test for system defining
- uintptr_t and define HAVE_UINTPTR_T appropriately.
- * regex.c (uintptr_t): Do not provide a definition if the
- system provided one.
-
- * regex.c (PREFIX): Provide an alternate definition for
- non-ANSI/ISO compilers.
- (ARG_PREFIX): Likewise.
-
-2001-11-12 Jim Meyering <meyering@lucent.com>
-
- * obstack.c (_): Honor the setting of ENABLE_NLS. Otherwise,
- this code would end up calling gettext even in packages built
- with --disable-nls.
- * getopt.c (_): Likewise.
- * regex.c (_): Likewise.
-
-2001-11-03 Alan Modra <amodra@bigpond.net.au>
-
- * configure.in: Cope with missing makeinfo.
- * configure: Regenerate.
-
-2001-10-22 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * hex.c (hex_init): Provide empty stub.
-
- * hex.c (hex_init): Delete.
- (_hex_value): Const-ify and initialize at compile-time.
-
-2001-10-19 H.J. Lu <hjl@gnu.org>
-
- * Makefile.in ($(TARGETLIB)): Also generate pic/$(TARGETLIB) if
- necessary.
-
-2001-10-17 DJ Delorie <dj@redhat.com>
-
- * argv.c, asprintf.c, choose-temp.c, concat.c, cplus-dem.c,
- ffs.c, fnmatch.txh, getruntime.c, make-temp-file.c,
- mkstemps.c, pexecute.c, random.c, strsignal.c, vasprintf.c:
- Improve manual formatting.
- * functions.texi: Regenerate.
-
-2001-10-15 DJ Delorie <dj@redhat.com>
-
- * Makefile.in (TEXIFILES): Add fnmatch.txh.
- (maint-undoc): New.
- maint-tool: Add "undoc" tool.
- * alloca.c, argv.c, asprintf.c, choose-temp.c, concat.c,
- fdmatch.c, ffs.c, getruntime.c, insque.c, lbasename.c,
- make-temp-file.c, mkstemps.c, pexecute.c, random.c, spaces.c,
- strerror.s, strsignal.c, strtol.c, vasprintf.c: Add or update
- documentation.
- * fnmatch.txh: New.
- * functions.texi: Regenerate.
-
-2001-10-10 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * bcmp.c, setenv.c: Use "nonzero" instead of "non-zero".
- * strtod.c: Use "ISO C" instead of "ANSI C".
- * functions.texi: Regenerate.
-
-2001-10-07 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * alloca.c, clock.c, getcwd.c, getpagesize.c, getpwd.c, index.c,
- libiberty.texi, memchr.c, putenv.c, rindex.c, strchr.c, strdup.c,
- strerror.c, strrchr.c, strstr.c, strtod.c, tmpnam.c, vfork.c,
- xatexit.c, xmalloc.c, xstrerror.c: Improve manual formatting. Fix
- spelling. Give names to function arguments in documentation. Use
- (void) prototypes in documentation.
- * functions.texi: Regenerate.
-
-2001-10-07 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * argv.c (buildargv, tests, main): Const-ify.
- * cp-demangle.c (operator_code): Likewise.
- * cplus-dem.c (optable, libiberty_demanglers,
- cplus_demangle_set_style, cplus_demangle_name_to_style,
- print_demangler_list): Likewise.
- * hashtab.c (higher_prime_number): Likewise.
- * strcasecmp.c (charmap): Likewise.
- * strerror.c (error_info, strerror, main): Likewise.
- * strncasecmp.c (charmap): Likewise.
- * strsignal.c (signal_info): Likewise.
-
-2001-09-29 DJ Delorie <dj@redhat.com>
-
- * configure: Regenerate.
-
-2001-09-28 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * concat.c: Include stdlib.h.
-
-2001-09-27 Eli Zaretskii <eliz@is.elta.co.il>
-
- * libiberty.texi: (Top level): Add syncodeindex pg. Add
- @dircategory and @direntry directives. Add @finalout.
- (many nodes): Lose the next,prev,up pointers on the @nide line.
- (Using, Supplemental Functions, Replacement Functions): Fix
- markup.
- (Functions): Move around, to allow makeinfo to build the manual
- without next,prev,up pointers in thye node lines.
- (Licenses): Fix typos.
-
- * index.c, rindex.c, strchr.c, strerror.c, strrchr.c, strstr.c,
- strtol.c, xatexit.c, xexit.c, xmalloc.c: Fix spelling and markup.
- * functions.texi: Regenerate.
-
- * copying-lib.texi: Lose the next,prev,up pointers on the @node
- line.
-
-2001-09-27 DJ Delorie <dj@redhat.com>
-
- * configure.in: Don't use in-tree texinfo, because libiberty must
- be built before it. Check for makeinfo version 4 or higher.
- * functions.texi: Regenerate.
-
-2001-09-20 DJ Delorie <dj@redhat.com>
- Phil Edwards <pedwards@disaster.jaj.com>
-
- * configure.in (MAKEINFO, PERL): Detect these.
- (--enable-maintainer-mode): Add.
- * configure: Regenerate.
- * Makefile.in (MAKEINFO, PERL): Define.
- (libiberty.info, libiberty.dvi, libiberty.html): New.
- (CFILES): Add bsearch.c.
- (CONFIGURED_OFILES): New, list of objects configure might add.
- (maint-missing, maint-buildall): New, for maintainers only.
- (clean, mostlyclean): Add info/dvi/html files.
- * libiberty.texi, copying-lib.texi, obstacks.texi, functions.texi: New.
- * gather-docs: New, for maintainers.
- * maint-tool: New, for maintainers.
- * alloca.c, atexit.c, basename.c, bcmp.c, bcopy.c, bsearch.c,
- bzero.c, calloc.c, clock.c, configure.in, configure, getcwd.c,
- getpagesize.c, getpwd.c, index.c, memchr.c, memcmp.c, memcpy.c,
- memmove.c, memset.c, putenv.c, rename.c, rindex.c, setenv.c,
- sigsetmask.c, strcasecmp.c, strchr.c, strdup.c, strerror.c,
- strncasecmp.c, strncmp.c, strrchr.c, strstr.c, strtod.c, strtol.c,
- tmpnam.c, vfork.c, vprintf.c, waitpid.c, xatexit.c, xexit.c,
- xmalloc.c, xmemdup.c, xstrdup.c, xstrerror.c: Add or update
- documentation.
-
-2001-09-25 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * concat.c (reconcat): Fix for traditional C.
-
-2001-09-24 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * concat.c (reconcat): New function.
-
-2001-09-17 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * concat.c (vconcat_length, vconcat_copy, concat_length,
- concat_copy, concat_copy2): New functions.
- (concat): Use vconcat_length/vconcat_copy.
-
- * alloca.c (libiberty_optr, libiberty_nptr, libiberty_len):
- Define.
-
-2001-09-04 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * asprintf.c: Don't define USE_STDARG. Use VPARAMS, VA_OPEN,
- VA_FIXEDARG & VA_CLOSE.
-
- * vasprintf.c: Check HAVE_STRING_H when including string.h.
- (checkit): Delete redundant prototype. Add ATTRIBUTE_PRINTF_1.
- Use VA_OPEN, VA_FIXEDARG & VA_CLOSE. Free allocated string.
-
-2001-08-27 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * concat.c (concat): Use VPARAMS, VA_OPEN, VA_FIXEDARG & VA_CLOSE.
-
-2001-08-23 Ulrich Drepper <drepper@redhat.com>
-
- * regex.c (truncate_wchar): Use wcrtomb not wctomb.
-
-2001-08-23 Ulrich Drepper <drepper@redhat.com>
-
- * posix/regex.c [_LIBC] (convert_mbs_to_wcs): Use __mbrtowc
- instead of mbrtowc.
- [_LIBC]: Use __iswctype instead of iswctype, __wcslen instead of
- wcslen, and __wcscoll instead of wcscoll.
-
-2001-08-22 Matt Kraai <kraai@alumni.carnegiemellon.edu>
-
- * fibheap.c (fibheap_init, fibnode_init): Remove.
- (fibheap_new, fibnode_new): Use xcalloc to allocate and
- initialize memory.
- (fibheap_insert): Remove check for node allocation failure.
-
-2001-08-21 Richard Henderson <rth@redhat.com>
-
- * Makefile.in (fibheap.o): Depend on config.h.
- * fibheap.c: Tidy formatting. Use config.h.` Rearrange some
- functions for inlining.
-
-Tue Aug 21 12:35:04 2001 Christopher Faylor <cgf@cygnus.com>
-
- * configure.in: Need to set HAVE_SYS_ERRLIST and HAVE_SYS_NERR whenever
- hosting on cygwin.
- * configure: Regenerate.
-
-2001-08-20 Andrew Cagney <ac131313@redhat.com>
-
- * floatformat.c (floatformat_m88110_ext): Remove #ifdef
- HARRIS_FLOAT_FORMAT.
- (floatformat_ia64_spill_little, floatformat_ia64_quad_little)
- (floatformat_ia64_spill_big, floatformat_ia64_quad_big)
- (floatformat_arm_ext_big, floatformat_arm_ext_littlebyte_bigword)
- (floatformat_m88110_harris_ext): New float formats.
-
-2001-08-20 Daniel Berlin <dan@cgsoftware.com>
-
- * fibheap.c: New file. Fibonacci heap.
-
- * Makefile.in (CFILES): Add fibheap.c.
- (REQUIRED_OFILES): Add fibheap.o.
- (fibheap.o): Add dependencies for fibheap.o.
-
-2001-08-17 Christopher Faylor <cgf@cygnus.com>
-
- * configure.in: Always set HAVE_SYS_ERRLIST when targetting cygwin.
- * configure: Regenerate.
-
-2001-08-16 Richard Henderson <rth@redhat.com>
-
- * hashtab.c (htab_hash_string): New.
-
-2001-08-13 Andrew Cagney <ac131313@redhat.com>
-
- * floatformat.c (floatformat_ieee_double_littlebyte_bigword): Fix
- name.
-
-2001-08-12 Isamu Hasegawa <isamu@yamato.ibm.com>
-
- * regex.c (wcs_regex_compile): Use appropriate string
- to compare with collating element.
- Fix the padding for the alignment.
-
-2001-08-10 Andrew Cagney <ac131313@redhat.com>
-
- * lbasename.c (lbasename): Change function definition to return a
- const char pointer.
-
-2001-08-07 Jason Merrill <jason_merrill@redhat.com>
-
- * cp-demangle.c (demangle_special_name): "GR" -> "reference temporary
- for".
-
-2001-08-03 Richard Henderson <rth@redhat.com>
-
- * Makefile.in (concat.o): Depend on config.h.
-
-2001-07-30 Andreas Jaeger <aj@suse.de>
-
- * concat.c: Include "config.h".
-
-2001-07-30 Andreas Jaeger <aj@suse.de>
-
- * regex.c: Declare wcs functions only if compiling with
- MBS_SUPPORT.
- Don't use #elif for traditional C.
-
-2001-07-23 Ulrich Drepper <drepper@redhat.com>
-
- * regex.c: Revamp memory allocation for WCHAR functions to
- not use too much stack.
-
-2001-07-30 Andreas Jaeger <aj@suse.de>
-
- * regex.c: Declare wcs functions only if compiling with
- MBS_SUPPORT.
- Don't use #elif for traditional C.
-
-2001-07-25 Daniel Jacobowitz <drow@mvista.com>
-
- * Makefile.in (regex.o): Add dependency on config.h.
-
-2001-07-18 Andreas Schwab <schwab@suse.de>
-
- * regex.c (WORDCHAR_P) [WCHAR]: Also return true for the
- underscore character.
-
-2001-07-18 Ulrich Drepper <drepper@redhat.com>
-
- * regex.c: Limit string length printed in debug messages to 100
- chars.
-
-2001-07-18 Andreas Jaeger <aj@suse.de>
-
- * regex.c: Place under LGPL version 2.1.
-
-2001-07-10 Jeff Johnston <jjohnstn@redhat.com>
-
- * Makefile.in: Add support for regex code.
- * regex.c: New file.
-
-2001-07-05 Mark Klein <mklein@dis.com>
-
- * Makefile.in: Add ffs.c dependency.
- * configure.in: Add ffs.c.
- * ffs.c: New file.
-
-2001-06-18 Richard Henderson <rth@redhat.com>
-
- * concat.c: Include <sys/types.h>.
-
-2001-06-11 Loren J. Rittle <ljrittle@acm.org>
-
- bootstrap/3106
- * strerror.c (sys_nerr): Hide the OS header version.
- * strsignal.c (sys_nsig): Likewise.
-
-2001-06-10 Richard Henderson <rth@redhat.com>
-
- * concat.c: Include string.h. Fix int vs size_t usage.
- Simplify the iteration loops. Use memcpy.
-
-2001-05-16 Matt Kraai <kraai@alumni.carnegiemellon.edu>
-
- * partition.c: Fix misspelling of `implementation'.
-
-2001-05-09 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * md5.c (md5_init_ctx): Declare constants as unsigned.
- (md5_process_block): Likewise.
-
-2001-05-07 Zack Weinberg <zackw@stanford.edu>
-
- * cp-demangle.c (demangle_v3_with_details,
- is_gnu_v3_mangled_ctor, is_gnu_v3_mangled_dtor): Use K+R style
- function definition.
- * ternary.c: Use K+R style function definitions. Use PTR, not
- void *. Make arguments constant where possible.
-
-2001-05-07 Mark Mitchell <mark@codesourcery.com>
-
- * splay-tree.h (splay_tree_max): New function.
- (splay_tree_min): Likewise.
-
-2001-04-15 Daniel Berlin <dan@cgsoftware.com>
-
- * ternary.c: New file - Ternary search tree implementation.
-
- * Makefile.in: Add ternary.o, and ternary.c dependencies.
-
-2001-04-03 Zack Weinberg <zackw@stanford.edu>
-
- * make-temp-file.c (try): Inline.
-
-2001-02-28 Richard Henderson <rth@redhat.com>
-
- * Makefile.in (make-temp-file.o): Depend on config.h.
-
-2001-03-27 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * memchr.c (memchr): Adjust condition to avoid infinite loop.
-
-2001-03-23 Jakub Jelinek <jakub@redhat.com>
-
- * cp-demangle.c (demangle_discriminator): `_0' is discriminator #1,
- `_' not followed by a digit is invalid.
-
-2001-03-22 Jim Blandy <jimb@redhat.com>
-
- * cp-demangle.c (string_list_delete): Use dyn_string_delete
- instead of free, to free the contents as well as the string
- structure.
-
-2001-03-21 Zack Weinberg <zackw@stanford.edu>
-
- * make-temp-file.c: Always default DIR_SEPARATOR to '/'.
- Don't default P_tmpdir to anything. Try /var/tmp before
- /usr/tmp.
-
-2001-03-20 Zack Weinberg <zackw@stanford.edu>
-
- * choose-temp.c: Split off make_temp_file, and the code
- duplicated between it and choose_temp_base, into...
- * make-temp-file.c: ... here; new file.
-
- * Makefile.in (CFILES): Add make-temp-file.c.
- (REQUIRED_OFILES): Add make-temp-file.o.
-
-2001-03-20 Jim Blandy <jimb@redhat.com>
-
- * cp-demangle.c (struct demangling_def): New fields:
- is_constructor and is_destructor.
- (demangling_new): Initialize them.
- (demangle_ctor_dtor_name): Set them, if we detect a constructor
- or destructor.
- (demangle_v3_with_details, is_gnu_v3_mangled_ctor,
- is_gnu_v3_mangled_dtor): New functions.
-
-2001-03-20 Jason Merrill <jason@redhat.com>
-
- * cplus-dem.c (main): Skip initial $.
-
-2001-03-15 Michael Meissner <meissner@redhat.com>
-
- * hashtab.c (higher_prime_number): Silence warning that 4294967291
- might be a signed integer under pre-ISO C systems.
-
-2001-03-10 Neil Booth <neil@daikokuya.demon.co.uk>
- John David Anglin <dave@hiauly1.hia.nrc.ca>
-
- * libiberty/lbasename.c: New file.
- * libiberty/Makefile.in: Update for lbasename.
-
-2001-03-06 Zack Weinberg <zackw@stanford.edu>
-
- * aclocal.m4 (libiberty_AC_FUNC_C_ALLOCA): New.
- * configure.in: Replace all alloca logic with a simple use of
- the above new macro.
- * config.table: Kill *-*-beos* entry.
- * config/mh-beos: Delete.
- * configure, config.in: Regenerate.
-
- * Makefile.in (ALLOCA, HFILES): Kill.
- (REQUIRED_OFILES): Add alloca.o.
- (alloca.o): Depend on libiberty.h.
- (argv.o): Don't depend on alloca-conf.h.
- * alloca-conf.h: Delete.
- * alloca.c: Include libiberty.h. Kill all #ifdef emacs
- blocks. Provide the C alloca unconditionally. Use PTR where
- appropriate. Make i00afunc static.
- * argv.c: Don't include alloca-conf.h.
-
-2001-03-04 John David Anglin <dave@hiauly1.hia.nrc.ca>
-
- * cplus-dem.c (main): Cast enum style to int.
-
-2001-02-16 Loren J. Rittle <ljrittle@acm.org>
-
- * cplus-dem.c (main): Initialize style.
-
-2001-02-02 Phil Edwards <pme@sources.redhat.com>
-
- * COPYING.LIB: Update to LGPL 2.1 from the FSF.
-
-2001-01-31 Bryce McKinlay <bryce@albatross.co.nz>
-
- Add support for Java demangling under the v3 ABI:
- * cp-demangle.c (NAMESPACE_SEPARATOR): New define.
- (struct demangling_def): Add `style' field.
- (demangling_new): New parameter `style'. Set it in demangling_t.
- (demangle_prefix): Use NAMESPACE_SEPARATOR.
- (demangle_type_ptr): Don't emit pointer symbol if doing Java output.
- (cp_demangle): New parameter `style'. Pass it to demangling_new().
- (main): Call cp_demangle with extra parameter.
- (java_demangle_v3): New function.
- (java_builtin_type_names): New. Table of primitive type names used
- for Java demangling.
- (demangle_builtin_type): Look up in java_builtin_type_names if doing
- Java output.
- * cplus-dem.c (cplus_demangle): Use java_demangle_v3 to do Java
- demangling.
- (long_options): Remove obsolete `java' option.
- (main): Remove explicit handling of `java' option. Instead, pass style
- parameter in cplus_demangle flags as gdb does.
- * testsuite/demangle.expected: Add some Java test cases.
-
-2000-12-29 DJ Delorie <dj@redhat.com>
-
- * fnmatch.c: Make the note about the origins of this file more
- accurate, at least until we can sync with glibc.
- * getopt.c: Ditto.
- * getopt1.c: Ditto.
- * md5.c: Ditto.
- * obstack.c: Ditto.
-
-2000-12-26 Michael Sokolov <msokolov@ivan.Harhan.ORG>
-
- * bsearch.c: New file.
- * configure.in (funcs): Add bsearch.
- (AC_CHECK_FUNCS): Likewise.
- * configure, config.in: Regenerate.
-
-2000-12-13 Michael Sokolov <msokolov@ivan.Harhan.ORG>
-
- * safe-ctype.c: #include "ansidecl.h".
- * strtod.c: Likewise.
-
-2000-12-13 Michael Sokolov <msokolov@ivan.Harhan.ORG>
-
- * strtoul.c: Include safe-ctype.h, not ctype.h.
-
-2000-12-07 Zack Weinberg <zack@wolery.stanford.edu>
-
- * safe-ctype.c: New file.
- * Makefile.in (CFILES): Add safe-ctype.c.
- (REQUIRED_OFILES): Add safe-ctype.o.
-
- * argv.c: Define ISBLANK and use it, not isspace.
- * basename.c, cplus-dem.c, fnmatch.c, pexecute.c, strtod.c,
- strtol.c, strtoul.c: Include safe-ctype.h, not ctype.h. Use
- uppercase ctype macros. Don't test ISUPPER(c)/ISLOWER(c)
- before calling TOLOWER(c)/TOUPPER(c).
-
-2000-12-07 Mike Stump <mrs@wrs.com>
-
- * Makefile.in (distclean): When cleaning, remove testsuite.
-
-2000-12-05 Jason Merrill <jason@redhat.com>
-
- * cp-demangle.c (cplus_demangle_v3): Check that it's a v3 mangled
- name before allocating the dyn_string.
-
-2000-12-04 Jason Merrill <jason@redhat.com>
-
- * cp-demangle.c: s/new_abi/v3/.
- * cplus-dem.c: Likewise.
- (current_demangling_style): Now auto_demangling.
- (cplus_demangle): Try v3 demangling if AUTO_DEMANGLING.
- (main): Use standard symbol chars for auto_demangling.
-
-2000-11-26 Mark Mitchell <mark@codesourcery.com>
-
- * hashtab.c (higher_prime_number): Use a table, rather than a
- seive, to find the next prime.
-
-2000-11-22 H.J. Lu <hjl@gnu.org>
-
- * cplus-dem.c (main): Handle gnat_demangling.
-
-2000-11-22 Zack Weinberg <zack@wolery.stanford.edu>
-
- * aclocal.m4 (LIB_AC_PROG_CC): Moved here from configure.in.
- (AC_DEFINE_NOAUTOHEADER): New - work around bug in autoheader.
- * configure.in: Call AC_C_INLINE and AC_C_CONST. Use three
- argument form of AC_DEFINE in dummy definitions block. Use
- AC_DEFINE_NOAUTOHEADER for real definitions of things defined
- in dummy block. Preload cache variables instead of bypassing
- tests, where possible.
- * acconfig.h: Removed.
-
- * xmalloc.c (xmalloc_failed): New function, does error
- reporting on failed allocation.
- (xmalloc, xcalloc, xrealloc): Use it.
-
-2000-11-21 Hans-Peter Nilsson <hp@bitrange.com>
-
- * cplus-dem.c (cplus_demangle): Fix formatting.
- (grow_vect): Ditto.
- (ada_demangle): Ditto.
- (internal_cplus_demangle): Ditto.
- (mop_up): Ditto.
-
-2000-11-21 H.J. Lu <hjl@gnu.org>
-
- * cplus-dem.c (main): Handle java_demangling.
-
-2000-11-19 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * cplus-dem.c (grow_vect): Prototype.
- (ada_demangle): Cast the arg of ctype macros to unsigned char.
-
-2000-11-15 Hans-Peter Nilsson <hp@bitrange.com>
-
- * cplus-dem.c (ada_demangle): Add back ATTRIBUTE_UNUSED for
- parameter `option'.
-
-2000-11-15 Kenneth Block <kenneth.block@compaq.com>
-
- * cplus-dem.c: Eliminate use of DEFUN, it is obsolete and cannot
- be used in GCC.
-
-2000-11-15 Kenneth Block <kenneth.block@compaq.com>
-
- * cplus-dem.c: Add gnat demangler. Add java to demangle style
- list.
-
-2000-11-04 Hans-Peter Nilsson <hp@bitrange.com>
-
- * hashtab.c (htab_expand): Change to return int. Use calloc or
- xcalloc depending on htab->return_allocation_failure. Return zero
- if calloc fails.
- (htab_create): Update comment to cover memory allocation.
- (htab_try_create): New.
- (htab_find_slot_with_hash): Return NULL if htab_expand fails.
- Update comment to cover this.
-
-2000-11-03 Hans-Peter Nilsson <hp@bitrange.com>
-
- * hashtab.c: Change void * to PTR where necessary.
- (htab_create, htab_expand): Correct formatting of comment before
- function.
-
-2000-10-22 Alex Samuel <samuel@codesourcery.com>
-
- * cp-demangle.c (string_list_def): Add caret_position and comments.
- (result_caret_pos): New macro.
- (result_append_string): Rename to...
- (result_add_string): ... this, and insert at caret position.
- Rename throughout.
- (result_append): Rename to...
- (result_add): ... this, and insert at caret position. Rename
- throughout.
- (result_append_char): Rename to...
- (result_add_char): ... this, and insert at caret position. Rename
- throughout.
- (result_append_space): Remove.
- (string_list_new): Initialize caret position.
- (result_add_separated_char): Use caret position.
- (result_get_caret): New funtion.
- (result_set_caret): Likewise.
- (result_shift_caret): Likewise.
- (result_previous_char_is_space): Likewise.
- (substitution_start): Use caret position.
- (substitution_add): Likewise.
- (demangling_new): Initialize caret position.
- (demangle_encoding): Use caret position.
- (demanglin_nested_name): Put CV qualifiers after name.
- (demangle_type_ptr): Use switch statement. Handle pointers to
- arrays. Don't use result_append_space. Use caret position.
- (demangle_type): Emit CV qualifiers after underlying type. Adjust
- call to demangle_array_type.
- (demangle_array_type): Add parameter to handle pointers to arrays.
-
-2000-10-01 Mark Mitchell <mark@codesourcery.com>
-
- * splay-tree.c (splay_tree_insert): Fix formatting.
-
-2000-09-16 Mark Mitchell <mark@codesourcery.com>
-
- * splay-tree.c (splay_tree_predecessor): Fix typo in comment.
-
-2000-09-14 Michael Sokolov <msokolov@ivan.Harhan.ORG>
-
- * splay-tree.c: #include <stdio.h>.
-
-2000-09-14 Hans-Peter Nilsson <hp@axis.com>
-
- * testsuite/demangle-expected: Add two tests for anonymous
- namespaces.
- * cplus-dem.c (gnu_special): Handle anonymous namespaces.
-
-2000-09-10 Mark Mitchell <mark@codesourcery.com>
-
- * splay-tree.c (splay_tree_predecessor): New function.
- (splay_tree_successor): Likewise.
-
-2000-09-10 Hans-Peter Nilsson <hp@axis.com>
-
- * testsuite/demangle-expected: Add four tests for type_info
- mangling.
- * cplus-dem.c (gnu_special): Use do_type, not demangle_fund_type,
- for a non-template non-qualified type_info function or node.
-
-2000-09-08 Alex Samuel <samuel@codesourcery.com>
-
- * cp-demangle.c: Fix copyright banner.
-
-2000-09-07 Michael Sokolov <msokolov@ivan.Harhan.ORG>
-
- * md5.c: #include "ansidecl.h".
-
-2000-09-06 Alex Samuel <samuel@codesourcery.com>
-
- * cp-demangle.c (status_allocation_failed): Rearrange whitespace.
- (demangle_type): Handle substitution candidates correctly in the
- face of special substitutions.
-
-2000-09-05 Alex Samuel <samuel@codesourcery.com>
-
- * cp-demangle.c (demangle_encoding): Rename variable.
- (demangle_name): Rename parameter. Handle return type
- suppression.
- (demangle_nested_name): Rename parameter.
- (demangle_prefix): Likewise. Change return type suppression.
- (demangle_unqualified_name): Add parameter. Flag constructors and
- conversion operators.
- (demangle_special_name): Fix comment.
- (demangle_type): Rename variable.
- (demangle_bare_function_type): Check for missing return type and
- parameter.
- (demangle_class_enum_type): Rename parameter.
- (demangle_discriminator): Fix misspelling in comment.
-
-2000-08-31 DJ Delorie <dj@redhat.com>
-
- * configure.in (Cygwin): special case cygwin only when we're
- building cygwin, not when we're hosting cygwin.
-
-2000-09-04 Alex Samuel <samuel@codesourcery.com>
-
- * cp-demangle.c (demangle_template_arg): Eat an `E' after an
- <expression>.
-
-2000-09-04 Alex Samuel <samuel@codesourcery.com>
-
- * cp-demangle.c (demangle_type_ptr): Increment position past
- pointer and reference characters.
-
-2000-09-04 Alex Samuel <samuel@codesourcery.com>
-
- * cp-demangle.c (demangle_nv_offset): New function.
- (demangle_v_offset): Likewise.
- (demangle_call_offset): Likewise.
- (demangle_special_name): Update thunk demangling to comply with
- ABI changes.
-
-2000-09-03 Alex Samuel <samuel@codesourcery.com>
-
- * cp-demangle.c (ANONYMOUS_NAMESPACE_PREFIX): New macro.
- (substitution_def): Remove template_parm_number.
- (NOT_TEMPLATE_PARM): Remove.
- (result_insert_string): New macro.
- (result_insert): Likewise.
- (result_insert_char): Likewise.
- (substitution_add): Remove last parameter. Don't store template
- parm number.
- (BFT_NO_RETURN_TYPE): Define as NULL.
- (demangle_encoding): Adjust call to demangle_bare_function_type.
- (demangle_name): Adjust substitution. Adjust call to
- substitution_add.
- (demangle_prefix): Adjust call to substitution_add.
- (demangle_identifier): Handle anonymous namespaces.
- (demangle_operator_name): Change demangling of vendor-extended
- operator to match ABI changes.
- (demangle_type_ptr): Change parameters. Make recursive. Handle
- substitutions here.
- (demangle_type): Adjust calls to demangle_template_param,
- substitution_add, and demangle_type_ptr. Fix substitution of
- templated types.
- (demangle_function_type): Change parameter to a pointer.
- (demangle_bare_function_type): Likewise. Adjust insertion point.
- (demangle_template_param): Remove last parameter.
- (demangle_expr_primary): Remove unused variable. Adjust call to
- demangle_template_param.
- (is_mangled_char): Accept `$' and `.'.
- * cplus-dem.c (gnu_new_abi_symbol_characters): Add '$' and '.'.
- * dyn-string.c (dyn_string_insert_char): New function.
-
-2000-08-31 Hans-Peter Nilsson <hp@axis.com>
-
- * testsuite/demangle-expected: Add nine tests for
- underscore-after-number followed by five tests for name-signature
- delimiter.
-
-2000-08-28 Richard Henderson <rth@cygnus.com>
-
- * Makefile.in (md5.o): Depend on config.h.
-
-2000-08-28 Jason Merrill <jason@redhat.com>
-
- * Makefile.in (REQUIRED_OFILES): Add md5.o.
- (CFILES): Add md5.c.
- * md5.c: New file.
-
-2000-08-27 Alex Samuel <samuel@codesourcery.com>
-
- * cp-demangle.c (demangle_name): Initialize template_p in local
- name case. Don't re-add substitutions as candidates.
- (demangle_nested_name): Use <unqualified-name>.
- (demangle_prefix): Likewise. Don't add template names as
- substitution candidates twice, or re-add a substitution or the
- last prefix component.
- (demangle_local_name): Adjust output format.
-
-2000-08-25 Alex Samuel <samuel@codesourcery.com>
-
- * cp-demangle.c (result_add_separated_char): Change parameter to
- int.
- (substitution_add): Don't check for duplicates. Check if
- previously allocated size is zero.
- (demangle_name): Remove duplicate check for std substitution.
- Clear template flag appropriately.
- (demangle_prefix): Remove argument to demangle_substitution.
- Don't check that template flag is already set.
- (demangle_operator_name): Add pt operator.
- (demangle_type): Don't treat r as built-in type. Remove argument
- to demangle_substitution. Fix substitution candidate mechanics.
- Handle <template-template-parm>s. Improve comments.
- (demangle_template_param): Don't handle template arg lists here.
- (demangle_substitution): Remove parameter.
- (print_usage): Remove extra fprintf option.
-
-2000-08-24 Greg McGary <greg@mcgary.org>
-
- * libiberty/random.c (end_ptr): Revert previous change.
-
-2000-08-24 Greg McGary <greg@mcgary.org>
-
- * libiberty/cplus-dem.c (cplus_demangle_opname, cplus_mangle_opname,
- demangle_expression, demangle_function_name): Use ARRAY_SIZE.
- * libiberty/random.c (end_ptr): Likewise.
-
-2000-08-23 Alex Samuel <samuel@codesourcery.com>
-
- * cp-demangle.c (result_close_template_list): Remove function.
- (result_add_separated_char): New function.
- (result_open_template_list): New macro.
- (result_close_template_list): Likewise.
- (demangle_prefix): Don't set template_p if the
- prefix ends with a ctor name.
- (demangle_type_ptr): Remove duplicate RETURN_IF_ERROR.
- (demangle_type): Check for template args after substitution.
- (demangle_template_args): Use result_open_template_list.
-
-2000-08-02 Zack Weinberg <zack@wolery.cumb.org>
-
- * pexecute.c: Don't use vfork. Initialize 'pid' before retry loop.
-
-2000-07-26 Dave Pitts <dpitts@cozx.com>
-
- * config/mh-openedition.h: Added -DLE370 definition.
-
-2000-07-26 Mark Elbrecht <snowball3@bigfoot.com>
-
- * pexecute.c (pexecute) [__MSDOS__]: Change __GO32__ to
- __DJGPP__. Use P_WAIT instead of constant in the spawnv* call.
- Cast program to 'char *' in errmsg_arg assignment.
- (PWAIT_ERROR): Define.
- (pwait): Use PWAIT_ERROR. Adjust DJGPP's status code to conform
- to DJGPP's WIF* macros.
-
-2000-07-27 RodneyBrown <RodneyBrown@pmsc.com>
- Jeff Law <law@cygnus.com>
-
- * getcwd.c: Include string.h, stdlib.h for prototypes
-
- * Makefile.in (rename.o, waitpid.o): Depend on config.h
- * rename.c: Include config.h, unistd.h
- * waitpid.c: Include config.h, sys/wait.h
-
-2000-07-24 Hans-Peter Nilsson <hp@axis.com>
-
- * cplus-dem.c (work_stuff_copy_to_from): New.
- (delete_non_B_K_work_stuff): New.
- (delete_work_stuff): New.
- (mop_up): Break out work_stuff partly destruction to
- delete_non_B_K_work_stuff.
- (iterate_demangle_function): New.
- (demangle_prefix): Call iterate_demangle_function instead of
- demangle_function_name. Leave handling of name-signature
- __-delimiters to iterate_demangle_function.
- (demangle_integral_value): Strip an optional
- following underscore cautiously. Handle negative numbers.
-
-2000-07-24 Daniel Berlin <dberlin@redhat.com>
-
- * cplus-dem.c (demangle_signature): Change if (GNU_DEMANGLING) to
- if (AUTO_DEMANGLING || GNU_DEMANGLING)
-
-2000-07-21 Alex Samuel <samuel@codesourcery.com>
-
- * cp-demangle.c (demangle_ctor_dtor_name): Remove not-in-charge
- allocating ctor mangling.
- (demangle_array_type): Handle empty and non-constant array length.
-
-2000-07-23 Michael Sokolov <msokolov@ivan.Harhan.ORG>
- Jeff Law <law@cygnus.com>
-
- * configure.in (AC_CHECK_HEADERS): Add time.h.
- (AC_HEADER_TIME): Add check.
- * configure, config.in: Regenerate.
- * getruntime.c: Portably #include <sys/time.h> and/or <time.h>.
-
- * configure.in (AC_CHECK_HEADERS): Add limits.h.
- * configure, config.in: Regenerate.
- * sort.c: Portably #include <limits.h> and/or <sys/param.h>.
- * strtol.c, strtoul.c: #include "config.h". Portably #include
- <limits.h> and/or <sys/param.h>.
- * Makefile.in (strtol.o, strtoul.o): Update dependencies.
-
- * aclocal.m4 (libiberty_AC_DECLARE_ERRNO): New macro.
- * configure.in (libiberty_AC_DECLARE_ERRNO): Add check.
- * configure, config.in: Regenerate.
- * pexecute.c, strtol.c, strtoul.c: Declare errno if necessary.
-
- * cp-demangle.c, mkstemps.c: #include <sys/types.h>.
-
-2000-07-21 Mike Stump <mrs@wrs.com>
-
- * Makefile.in (xexit.o): Add dependency for config.h in xexit.c.
- * (vasprintf.o): Add dependency for config.h in vasprintf.c.
-
-2000-07-21 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * cp-demangle.c (cp_demangle_type): Wrap in IN_LIBGCC2.
-
- * setenv.c (setenv): Initialize variable `ep'.
-
- * sigsetmask.c (abort): Prototype.
-
- * vasprintf.c: Include config.h. Check ANSI_PROTOTYPES, not
- __STDC__ for stdarg.h include.
- (int_vasprintf): Prototype.
- (checkit): Prototype. Use VPARAMS/ANSI_PROTOTYPES/VA_START in
- definition. Cast `global_total_width' in comparison.
- (main): Prototype. Return a value.
-
- * vfork.c (fork): Prototype.
-
- * xexit.c: Include config.h.
-
-2000-07-20 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * cplus-dem.c (demangle_fund_type): Make 'dec' an unsigned int,
- and print it with %u.
-
-2000-07-17 Hans-Peter Nilsson <hp@axis.com>
-
- * testsuite/regress-demangle (failed test): Show result and
- expected output.
-
-2000-07-07 Andrew Haley <aph@cygnus.com>
-
- * cplus-dem.c (main): fflush() after emitting last char before
- waiting for input.
-
-2000-06-28 Alex Samuel <samuel@codesourcery.com>
-
- * cp-demangle.c (demangle_encoding): Accept no substitutions.
- (demangle_name): Handle <substitution> followed by
- <unqualified-template-name>.
- (demangle_type): Follow special substitutions with
- <class-enum-type>
- (demangle_subtitution): Set template_p for special substitutions.
- (main): Fix typos.
-
-2000-06-27 Alex Samuel <samuel@codesourcery.com>
-
- * cp-demangle.c (demangle_special_name): Swap base and derived
- class when demangling construction vtables.
-
-2000-06-21 Alex Samuel <samuel@codesourcery.com>
-
- * cp-demangle.c: Don't include ctype.h.
- (IS_DIGIT): New macro.
- (IS_ALPHA): Likewise. Use IS_DIGIT and IS_ALPHA throughout
- instead of isdigit and isalpanum.
- (demangling_def): Make name and next const pointers.
- (STATUS_ALLOCATION_FAILED): New status code.
- (dyn_string_append_space): Handle failure in
- dyn_string_append_char.
- (int_to_dyn_string): Likewise. Change return value to status_t.
- (string_list_new): Handle failure of dyn_string_init.
- (result_close_template_list): Change return type to status_t.
- Handle failure in dyn_string_append.
- (result_push): Change return value to status_t. Handle failure in
- string_list_new. Handle failure of result_push throughout.
- (substitution_add): Change return value to status_t. Handle
- dyn_string failures. Handle failure of substitution_add
- throughout.
- (template_arg_list_new): Return NULL on allocation failure.
- (result_append_string): Return STATUS_ALLOCATION_FAILED on error.
- Handle error result throughout.
- (result_append): Likewise.
- (result_append_char): Likewise.
- (result_append_space): Likewise.
- (demangling_new): Make argument a const pointer. Handle
- allocation failures.
- (demangle_template_args): Handle failure in template_arg_list_new
- and result_close_template_list.
- (demangle_discriminator): Return if int_to_dyn_string fails.
- (cp_demangle): Likewise.
- (cp_demangle_type): New function.
- (cplus_demangle_new_abi): Don't call dyn_string_delete. Abort on
- memory allocation failure.
- (main): Likewise.
- * dyn-string.c (RETURN_ON_ALLOCATION_FAILURE): Define if
- IN_LIBGCC2.
- (dyn_string_init): Change return value to int. Handle
- RETURN_ON_ALLOCATION_FAILURE case.
- (dyn_string_new): Handle RETURN_ON_ALLOCATION_FAILURE case.
- (dyn_string_release): Delete the dyn_string.
- (dyn_string_resize): Handle RETURN_ON_ALLOCATION_FAILURE case.
- (dyn_string_copy): Change return type to int.
- (dyn_string_copy_cstr): Likewise.
- (dyn_string_prepend): Likewise.
- (dyn_string_prepend_cstr): Likewise.
- (dyn_string_insert): Likewise.
- (dyn_string_insert_cstr): Likewise.
- (dyn_string_append): Likewise.
- (dyn_string_append_cstr): Likewise.
- (dyn_string_append_char): Likewise.
- (dyn_string_substring): Likewise.
-
-2000-06-09 Zack Weinberg <zack@wolery.cumb.org>
-
- * cp-demangle.c (demangle_operator_name): Add spaces before
- names beginning with a letter: delete, delete[], new, new[],
- sizeof.
- (demangle_special_name): Handle TF <type> and TJ <type>.
-
-Thu Jun 8 18:52:24 2000 Philippe De Muyter <phdm@macqel.be>
-
- * cp-demangle.c (template_arg_list_new): Revert previous PARAMS patch.
-
-Thu Jun 8 09:25:54 2000 Philippe De Muyter <phdm@macqel.be>
-
- * cp-demangle.c (stdio.h): File included unconditionaly.
- (template_arg_list_new): Parameter list is PARAMS ((void)), not ().
- * dyn-string.c (stdio.h): File included.
- * partition.c (partition_print): No `&' needed to take the address of
- a function.
-
-2000-06-07 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * configure.in (ac_libiberty_warn_cflags): Add -pedantic.
-
- * choose-temp.c (try, choose_temp_base, make_temp_file): Constify.
-
- * cp-demangle.c (demangle_char): Change parameter from char to int.
- (demangle_expression, demangle_expr_primary): Remove extra
- semi-colon in prototype.
-
- * dyn-string.c (dyn_string_append_char): Change parameter from
- char to int.
-
- * memcmp.c (memcmp): Constify.
-
- * mkstemps.c (gcc_uint64_t): Mark GNUC `long long' case with
- __extension__.
-
- * partition.c (elem_compare): Prototype. Don't cast away
- const-ness.
-
- * setenv.c (setenv): Use braces to avoid ambiguous `else'.
-
-2000-06-07 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * Makefile.in (cp-demangle.o): Depend on $(INCDIR)/demangle.h.
-
- * cp-demangle.c: Include demangle.h.
- (template_arg_list_new): DeANSIfy.
- (cp_demangle): Make static and add prototype.
- (operator_code, operators): Constify.
- (demangle_operator_name): Likewise for variables `p1', `p2' and `p'.
-
-2000-06-05 Alex Samuel <samuel@codesourcery.com>
-
- * cp-demangle.c (demangle_prefix): Cast argument to isdigit to
- unsigned char.
- (demangle_unqualified_name): Likewise.
- (demangle_number_literally): Likewise.
- (demangle_type): Likewise.
- (demangle_substitution): Likewise.
- (is_mangled_char): Likewise, for isalnum.
-
-2000-06-04 Alex Samuel <samuel@codesourcery.com>
-
- * Makefile.in (CFILES): Add cp-demangle.c and dyn-string.c.
- (REQUIRED_OFILES): Add cp-demangle.o and dyn-string.o.
- (cp-demangle.o): New dependency.
- (dyn-string.o): Likewise.
-
- * dyn-string.c: Move here from gcc/dyn-string.c. Add new functions.
-
- * cplus-dem.c (libiberty_demanglers): Add initializer for new-ABI
- demangler.
- (cplus_demangle): Call cplus_demangle_new_abi if in new-ABI
- demangling mode.
- (gnu_new_abi_symbol_characters): New function.
- (main): Use gnu_new_abi_symbol_characters. * cp-demangle.c: New
- file.
- * cp-demangle.c: New file.
-
-Tue May 30 16:45:25 2000 Andrew Cagney <cagney@b1.cygnus.com>
-
- * floatformat.c: Add name to each floatformat field.
-
-Tue May 30 15:07:52 2000 Jeffrey A Law (law@cygnus.com)
-
- * Makefile.in (objalloc.o): Depend on config.h
-
-2000-05-29 Zack Weinberg <zack@wolery.cumb.org>
-
- * hashtab.c, partition.c, sort.c, xmemdup.c: Include string.h
- if HAVE_STRING_H.
- * pexecute.c, xexit.c: Include stdlib.h if HAVE_STDLIB_H.
- * objalloc.c: Include config.h. Include stdlib.h and don't
- declare malloc or free if HAVE_STDLIB_H.
- * strerror.c, strsignal.c: Include stdlib.h if HAVE_STDLIB_H,
- else declare malloc without prototype. Include string.h if
- HAVE_STRING_H, else declare memset without prototype. Don't
- include stddef.h.
-
-2000-05-23 Mike Stump <mrs@wrs.com>
-
- * Makefile.in (xmalloc.o): Add dependency for config.h, fixes make
- -j3.
-
-2000-05-18 J. David Anglin <dave@hiauly1.hia.nrc.ca>
-
- * xmalloc.c: Include config.h for HAVE_SBRK definition.
-
-2000-05-16 Horst von Brand <vonbrand@sleipnir.valparaiso.cl>
-
- * hashtab.c (hash_pointer): Delete low-order bits which are
- probably zero, also eliminate a warning on alpha.
-
-2000-05-15 David Edelsohn <edelsohn@gnu.org>
-
- * Makefile.in: Change "pic" to depend on $(PICFLAG), not
- on $(enable_shared).
-
-2000-05-10 Jakub Jelinek <jakub@redhat.com>
-
- * config.table: Use mh-sparcpic for sparc*-*-*.
-
-2000-05-08 Nick Clifton <nickc@cygnus.com>
-
- * Makefile.in (CFILES): Add strncmp.c.
- (NEEDED): Add strncmp.
-
-2000-05-04 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * cplus-dem.c (cplus_demangle_opname, demangle_function_name):
- Cast the arguments to `islower' to `unsigned char'.
- (print_demangler_list): Prototype.
-
-Thu May 4 17:14:41 2000 Philippe De Muyter <phdm@macqel.be>
-
- * sort.c (UCHAR_MAX): Provide fallback definition.
-
-2000-04-29 Alexandre Oliva <aoliva@cygnus.com>
-
- * Makefile.in (maintainer-clean-subdir): Fix handling of empty
- SUBDIRS.
-
-2000-04-28 Kenneth Block <block@zk3.dec.com>
- Jason Merrill <jason@casey.cygnus.com>
-
- * cplus-dem.c (libiberty_demanglers): New table for demangle styles.
- (cplus_demangle_set_style): New function for setting style.
- (cplus_demangle_name_to_style): New function to translate name.
-
-2000-04-27 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * aclocal.m4: New file with new test libiberty_AC_FUNC_STRNCMP.
-
- * configure.in (AC_CHECK_HEADERS): Add sys/mman.h fcntl.h.
- (libiberty_AC_FUNC_STRNCMP): Invoke.
-
- * strncmp.c: New file.
-
-Thu Apr 27 16:58:43 MET DST 2000 Jan Hubicka <jh@suse.cz>
-
- * hashtab.c (htab_expand): Add prototype.
- (find_empty_slot_for_expand): Likewise.
-
-2000-04-24 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * hashtab.c (hash_pointer, eq_pointer): Make definition static to
- match prototype.
- (htab_expand): Cast the return value of xcalloc.
-
-2000-04-24 Mark Mitchell <mark@codesourcery.com>
-
- * hashtab.c (hash_pointer): New function.
- (eq_pointer): Likewise.
- (htab_hash_pointer): New variable.
- (htab_eq_pointer): Likewise.
-
-2000-04-23 Mark Mitchell <mark@codesourcery.com>
-
- * sort.c (sort_pointers): Fix endianness bugs.
-
- * sort.c: New file.
- * Makefile.in (CFILES): Add sort.c
- (REQUIRED_OFILES): Add sort.o.
- (sort.o): New target.
-
-2000-04-21 Michael Sokolov <msokolov@ivan.Harhan.ORG>
-
- * Makefile.in (*-subdir): Revamp slightly to avoid losing on
- 4.3BSD systems.
-
-Tue Apr 18 16:23:31 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
-
- * hashtab.c: Various minor cleanups.
- (htab_find_slot_with_hash): INSERT is now enum insert_option.
- (htab_find_slot): Likewise.
-
-2000-04-16 Dave Pitts <dpitts@cozx.com>
-
- * cplus-dem.c (cplus_demangle_opname): Changed to use islower.
-
-2000-04-05 Richard Henderson <rth@cygnus.com>
-
- * splay-tree.c (splay_tree_remove): New.
-
-2000-03-30 Mark Mitchell <mark@codesourcery.com>
-
- * hashtab.c (find_empty_slot_for_expand): Use hashval_t for hash
- codes.
- (htab_find_with_hash): Likewise.
- (htab_find_slot_with_hash): Likewise.
-
-2000-03-29 Zack Weinberg <zack@wolery.cumb.org>
-
- * hashtab.c (htab_find_with_hash): Avoid calculating hash2
- unless it will be used. Rearrange loop for better
- optimization.
- (higher_prime_number): Add static prototype.
-
-Thu Mar 16 01:33:58 2000 Jeffrey A Law (law@cygnus.com)
-
- * Makefile.in (partition.o): Depend on config.h
-
-2000-03-14 Bernd Schmidt <bernds@cygnus.co.uk>
-
- * hashtab.c (find_empty_slot_for_expand): New function.
- (htab_expand): Use it instead of htab_find_slot.
- (htab_find_with_hash): Renamed from htab_find; now accepts extra
- argument HASH.
- (htab_find_slot_with_hash): Likewise for htab_find_slot.
- (htab_find): New wrapper function.
- (htab_find_slot): Likewise.
- (htab_traverse): Pass slot, not entry, to called function.
-
-2000-03-09 Alex Samuel <samuel@codesourcery.com>
-
- * Makefile.in (CFILES): Add partition.c.
- (REQUIRED_OFILES): Add partition.o.
- (partition.o): New rule.
- * partition.c: New file.
-
-2000-03-09 Zack Weinberg <zack@wolery.cumb.org>
-
- * hashtab.c (htab_create): Set del_f.
- (htab_delete, htab_empty, htab_remove_elt, htab_clear_slot):
- Use it.
-
-2000-03-08 Zack Weinberg <zack@wolery.cumb.org>
-
- * hashtab.c: Remove debugging variables (all_searches,
- all_collisions, all_expansions). Delete
- all_hash_table_collisions.
- (create_hash_table, delete_hash_table, empty_hash_table,
- find_hash_table_entry, remove_element_from_hash_table_entry,
- clear_hash_table_slot, traverse_hash_table, hash_table_size,
- hash_table_elements_number, hash_table_collisions): Rename to:
- htab_create, htab_delete, htab_empty, htab_find_slot,
- htab_remove_elt, htab_clear_slot, htab_traverse, htab_size,
- htab_elements, htab_collisions.
- (htab_find): New function, handles common case where you don't
- plan to add or delete an entry.
- (htab_expand): Don't create a whole new table, just a new
- entry vector.
- (htab_find_slot): Simplify logic.
-
-1999-08-03 Ian Lance Taylor <ian@zembu.com>
-
- * floatformat.c: Add casts to avoid signed/unsigned warnings.
- * pexecute.c: Add ATTRIBUTE_UNUSED as needed on Unix.
-
- * Makefile.in (install_to_libdir): Change $(TARGETLIB).n to
- $(TARGETLIB)n so it works on MSDOS.
- (install_to_tooldir): Likewise.
-
-1999-07-21 Ian Lance Taylor <ian@zembu.com>
-
- From Mark Elbrecht:
- * makefile.dos: Remove; obsolete.
- * configure.bat: Remove; obsolete.
-
-1999-07-11 Ian Lance Taylor <ian@zembu.com>
-
- * splay-tree.c (splay_tree_insert): Add initialization to avoid
- warning.
-
-2000-01-04 Mumit Khan <khan@xraylith.wisc.edu>
-
- * pexecute.c: Conditionally include string.h.
- (fix_argv): Handle embedded whitespace in args for Mingw32.
-
-2000-01-04 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * configure.in (ac_libiberty_warn_cflags): Turn on warnings if
- we're using gcc.
-
- * Makefile.in (COMPILE.c): Add @ac_libiberty_warn_cflags@
-
-1999-12-27 Geoff Keating <geoffk@cygnus.com>
-
- * vasprintf.c (int_vasprintf): Don't re-read the format character
- as this mishandles strings like '%%s'.
-
-1999-12-05 Mark Mitchell <mark@codesourcery.com>
-
- * splay-tree.c (splay_tree_new): Use struct splay_tree_node_s
- rather than struct splay_tree_node.
- (splay_tree_insert): Use struct splay_tree_s rather than struct
- splay_tree.
-
-Sun Nov 28 00:59:39 1999 Philippe De Muyter <phdm@macqel.be>
-
- * hashtab.c (sys/types.h): File included.
-
-1999-11-22 Jason Merrill <jason@casey.cygnus.com>
-
- * strtoul.c, strtol.c, random.c: Remove advertising clause from
- BSD license, pursuant with
-
- ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change
-
-Wed Nov 10 09:42:39 1999 Jeffrey A Law (law@cygnus.com)
-
- * hashtab.c: Include stdio.h.
-
-Mon Nov 8 09:23:41 1999 Jeffrey A Law (law@cygnus.com)
-
- * hashtab.c (traverse_hash_table): Protect prototype with PARAMS.
-
-Tue Nov 2 03:23:13 1999 Philippe De Muyter <phdm@macqel.be>
-
- * xstrdup (sys/types.h): Include this file.
-
-1999-10-28 Nathan Sidwell <nathan@acm.org>
-
- * Makefile.in (SUBDIRS): New macro.
- (mostlyclean, clean, distclean, maintainer-clean): Adjust to
- avoid multiple subdirectory cleaning.
- (*-subdir): Use SUBDIRS.
-
-1999-10-25 Jim Kingdon <http://developer.redhat.com/>
-
- * cplus-dem.c: Move declarations of standard_symbol_characters and
- hp_symbol_characters inside #ifdef MAIN to avoid compiler
- warnings.
-
-1999-10-23 08:51 -0700 Zack Weinberg <zack@bitmover.com>
-
- * hashtab.c (find_hash_table_entry): When returning a
- DELETED_ENTRY slot, change it to EMPTY_ENTRY first.
- (clear_hash_table_slot): New function which deletes an entry
- by its position in the table, not its value.
- (traverse_hash_table): New function which calls a hook
- function for every live entry in the table.
-
-1999-10-19 Mark Mitchell <mark@codesourcery.com>
-
- * cplus-dem.c (INTBUF_SIZE): New macro.
- (string_append_template_idx): New function.
- (demangle_expression): Likewise.
- (demangle_integral_value): Use it.
- (demangle_real_value): New function, split out from ...
- (demangle_template_value_parm): ... here. Use
- string_append_template_idx. Use demangle_real_value.
- (demangle_template): Use string_append_template_idx.
- (demangle_qualified): Use consume_count_with_underscores.
- (get_count): Tweak formatting.
- (do_type): Use string_append_template_idx.
-
-1999-10-18 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * calloc.c: Add a public domain notice.
-
-Mon Oct 18 02:30:47 1999 Philippe De Muyter <phdm@macqel.be>
-
- * setenv.c (sys/types.h, stdio.h): Include those files unconditionaly.
-
-Fri Oct 15 01:47:51 1999 Vladimir Makarov <vmakarov@loony.cygnus.com>
-
- * Makefile.in (CFILES): Add hashtab.c
- (REQUIRED_OFILES): Add hashtab.o
- (hashtab.o): Add dependencies.
- * hashtab.c: New file
-
-Wed Oct 13 01:16:47 1999 Mumit Khan <khan@xraylith.wisc.edu>
-
- * basename.c (DIR_SEPARATOR): New macro.
- (DIR_SEPARATOR_2): Likewise.
- (HAVE_DOS_BASED_FILESYSTEM): Likewise.
- (IS_DIR_SEPARATOR): Likewise.
- (main): Handle MSDOS style pathname.
-
-1999-10-11 Mark Mitchell <mark@codesourcery.com>
-
- * cplus-dem.c (do_type): Handle pointer to member types whose
- enclosing classes have namespace scope.
-
-Sun Oct 10 01:23:50 1999 Marc Espie <espie@cvs.openbsd.org>
-
- * config.table: Provide a backup shell for executing move-if-change.
-
-1999-10-02 Mark Mitchell <mark@codesourcery.com>
-
- * xmalloc.c (xmalloc): Fix spelling error.
- (xcalloc, xrealloc): Likewise.
-
-1999-10-02 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * cplus-dem.c (fancy_abort, demangle_integral_value,
- demangle_arm_hp_template, recursively_demangle,
- standard_symbol_characters, hp_symbol_characters, main): Add prototype.
- (program_name, program_version, fatal): Constify a char*.
- (usage, fatal): Mark with ATTRIBUTE_NORETURN.
- (main): Call return, not exit.
-
-1999-09-25 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * choose-temp.c: Remove obsolete comment about gcc.
- (make_temp_file): Constify a char*.
-
-Wed Sep 8 20:03:28 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * xmemdup.c: Include sys/types.h.
-
-1999-09-07 Jeff Garzik <jgarzik@pobox.com>
-
- * xmemdup.c: New xmemdup function.
- * Makefile.in, makefile.vms, vmsbuild.com: Use xmemdup.[co].
-
-Tue Sep 7 23:32:18 1999 Linas Vepstas <linas@linas.org>
-
- * config.table: Add openedition target.
- * config/mh-openedition: New file.
-
-Thu Sep 2 01:36:12 1999 Marc Espie <espie@cvs.openbsd.org>
-
- * pexecute.c (pexecute): Fill in temp_base when needed.
-
-1999-08-31 Richard Henderson <rth@cygnus.com>
-
- * getpwd.c: Check HAVE_GETCWD before defining it away.
-
-1999-08-30 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * Makefile.in (CFILES): Add calloc.c and getpwd.c.
- (REQUIRED_OFILES): Add getpwd.o.
- (getpwd.o): Add target.
-
- * configure.in (AC_PREREQ): Bump to 2.13.
- (AC_CHECK_HEADERS): Add check for <sys/stat.h>.
-
- * getpwd.c: New file, moved here from gcc.
-
-1999-08-25 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * cplus-dem.c (gnu_special): Cast a `size_t' to `long' when
- comparing against a signed quantity.
- (arm_special): Likewise.
- (demangle_fund_type): Likewise.
- (do_hpacc_template_const_value): Mark parameter `work' with
- ATTRIBUTE_UNUSED.
- (main): Constify variable `valid_symbols'.
-
-Tue Aug 24 02:50:45 1999 Philippe De Muyter <phdm@macqel.be>
-
- * strtoul.c (strtoul): Add parentheses around && within ||.
-
-Fri Aug 6 23:32:29 1999 Daniel Jacobowitz <drow@drow.them.org>
-
- * Makefile.in (FLAGS_TO_PASS): Include prefix, exec_prefix,
- libdir, libsubdir and tooldir.
-
-1999-08-01 Mark Mitchell <mark@codesourcery.com>
-
- * splay-tree.c (splay_tree_insert): Return the new node.
-
-1999-07-14 Richard Henderson <rth@cygnus.com>
-
- * argv.c: Include stdlib.h and string.h instead of
- prototyping directly.
- * choose-temp.c: Conditionally include string.h.
-
-1999-07-12 Jason Merrill <jason@yorick.cygnus.com>
-
- * Makefile.in (NEEDED): Add bcmp, bcopy, bzero.
-
-1999-07-11 Ian Lance Taylor <ian@zembu.com>
-
- * splay-tree.c (splay_tree_insert): Add initialization to avoid
- warning.
-
-1999-07-07 Jason Merrill <jason@yorick.cygnus.com>
-
- * Makefile.in (needed-list): Only include stuff we actually need
- for libstdc++.
-
-1999-06-21 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
-
- * configure.in (checkfuncs): Add gettimeofday.
- * config.in, configure: Regenerated.
-
-Mon Jun 21 05:56:01 1999 Mumit Khan <khan@xraylith.wisc.edu>
-
- * configure.in (*-*-uwin*): UWIN has sys_{errlist,nerr} even if
- the test fails.
- * configure: Regenerate.
-
-1999-06-10 Mike Stump <mrs@wrs.com>
-
- * Makefile.in (setenv.o): Add config.h dep for setenv.o to fix
- parallel builds.
-
-1999-05-28 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * putenv.c: Include ansidecl.h to define `const'.
- * setenv.c: Likewise.
-
-Wed May 26 03:58:20 1999 "Melissa O'Neill" <oneill@cs.sfu.ca>
-
- * Makefile.in (CFILES): Add putenv.c and setenv.c.
- * configure.in (funcs): Add putenv and setenv.
- (AC_CHECK_FUNCS): Check for putenv and setenv.
- * configure: Rebuilt.
- * putenv.c setenv.c: New files.
-
- * getcwd.c (getcwd): If pathname is NULL, then obtain SIZE
- bytes of space using malloc.
-
-Mon May 17 01:42:34 1999 Stu Grossman <grossman@babylon-5.cygnus.com>
-
- * cplus-dem.c (demangle_fund_type (near 'I' case)): Don't advance
- the *mangled pointer beyond the end of the string. Clean up code to
- match prevailing coding style.
-
-1999-05-13 Michael Hayes <m.hayes@elec.canterbury.ac.nz>
-
- * tmpnam.c (L_tmpnam): Fix typo.
-
-Thu May 13 01:14:46 1999 Marc Espie <espie@cvs.openbsd.org>
-
- * cplus-dem.c (standard_symbol_characters): Renamed from
- standard_symbol_alphabet. No longer modify TABLE.
- (hp_symbol_characters): Renamed from hp_symbol_alphabet. No longer
- modify TABLE.
- (main): Corresponding changes. Use strchr to determine if a
- character is valid.
-
-1999-05-11 Jim Blandy <jimb@zwingli.cygnus.com>
-
- * cplus-dem.c (main): Use table lookup to distinguish identifier
- characters from non-identifier characters.
- (standard_symbol_alphabet, hp_symbol_alphabet): New functions.
-
-Thu May 6 20:34:42 1999 Fred Fish <fnf@be.com>
-
- * configure.in (sys/resource.h): Add to AC_CHECK_HEADERS list.
- * getruntime.c: Only attempt to include sys/resource.h and
- use getrusage if both HAVE_GETRUSAGE and HAVE_SYS_RESOURCE_H
- are defined.
-
-Mon Apr 26 01:36:06 1999 Donn Terry (donn@interix.com)
-
- * configure.in (alloca detection): Handle alloca directly for interix.
- * configure: Rebuilt.
-
-Sun Apr 25 01:18:21 1999 Mumit Khan <khan@xraylith.wisc.edu>
-
- * choose-temp.c (DIR_SEPARATOR): Use '\\' only for native windows32.
-
-1999-04-20 Jim Blandy <jimb@zwingli.cygnus.com>
-
- Fix from Dale Hawkins:
- * cplus-dem.c (mop_up): Set typevec_size to zero, so it'll be
- reallocated properly if we use it again.
-
- * cplus-dem.c (demangle_fund_type): Check for buffer overrun. Be
- stricter about syntax. Always null-terminate string.
-
-Thu Apr 15 23:00:55 1999 Mumit Khan <khan@xraylith.wisc.edu>
-
- * configure.in (checkfuncs): Check for sbrk.
- * config.in: Rebuilt.
- * configure: Likewise.
- * xmalloc.c: Use HAVE_SBRK instead of the host specific definitions.
-
-1999-04-12 Jim Blandy <jimb@zwingli.cygnus.com>
-
- Fix from Marcus Daniels:
- * cplus-dem.c (demangle_fund_type): Don't run off the end of the
- identifier looking for another underscore.
-
-Sun Apr 11 23:20:59 1999 Mumit Khan <khan@xraylith.wisc.edu>
-
- * pexecute.c: Change all references to __UWIN__ to _UWIN.
- * xmalloc.c: Likewise.
- (xcalloc): UWIN has sbrk.
- (xrealloc): Fix guard macro.
-
-1999-04-11 Richard Henderson <rth@cygnus.com>
-
- * alloca-conf.h (alloca) [C_ALLOCA]: Don't use Gcc builtin
- or <alloca.h>.
- * clock.c (GNU_HZ): New definition.
- (clock): Use it.
- * getruntime.c: Likewise.
-
- * config.table: Use mh-beos.
- * config/mh-beos: New file.
-
-1999-04-11 Mark Mitchell <mark@codesourcery.com>
-
- * cplus-dem.c (demangle_template_value_parm): Handle
- pointers-to-members.
- (do_type): Handle template parameters as qualifiers.
-
-1999-04-01 Jim Blandy <jimb@zwingli.cygnus.com>
-
- * cplus-dem.c: Attempt to handle overflows in counts with some
- semblance of grace.
- (consume_count): Detect overflows. Return -1 to indicate errors,
- instead of zero.
- (demangle_template_value_parm, demangle_template): Handle change
- to consume_count's return convention.
-
-1999-04-05 Tom Tromey <tromey@cygnus.com>
-
- * testsuite/regress-demangle: New file.
- * testsuite/demangle-expected: New file.
-
- * Makefile.in (all, check, installcheck, info, install-info,
- clean-info, dvi, install, etags, tags, mostlyclean, clean,
- distclean, maintainer-clean, realclean): Depend on corresponding
- `-subdir' target.
- (all-subdir check-subdir installcheck-subdir info-subdir
- install-info-subdir clean-info-subdir dvi-subdir
- install-info-subdir etags-subdir mostlyclean-subdir clean-subdir
- distclean-subdir maintainer-clean-subdir): New target.
- * testsuite/Makefile.in: New file.
- * configure: Rebuilt.
- * configure.in: Create testsuite/Makefile.
-
-1999-04-02 Mark Mitchell <mark@codesourcery.com>
-
- * splay-tree.h (splay_tree_compare_pointers): Define.
-
-1999-03-30 Mark Mitchell <mark@codesourcery.com>
-
- * splay-tree.c (splay_tree_compare_ints): Define.
-
-1999-03-30 Tom Tromey <tromey@cygnus.com>
-
- * cplus-dem.c (consume_count): If `count' wraps, return 0 and
- don't advance input pointer.
- (demangle_class_name): If consume_count didn't find a count, do
- nothing. Don't bother with `strlen' sanity check; consume_count
- does it for us.
-
-1999-03-16 Stan Shebs <shebs@andros.cygnus.com>
-
- From Art Haas <ahaas@neosoft.com>:
- * cplus-dem.c (demangle_prefix): Don't grab all the '__' strings
- when doing arm or hp style.
- (demangle_nested_args): Decr forgetting_types field when done.
-
-Thu Mar 11 01:22:58 1999 Mumit Khan <khan@xraylith.wisc.edu>
-
- * pexecute.c (__CYGWIN32__): Rename to
- (__CYGWIN__): this.
- * xmalloc.c: Likewise.
-
- Changes to support i386-pc-uwin.
- * configure.in (*-*-uwin*): Workaround for vfork bug.
- * configure: Regenerate.
- * pexecute.c (pexecute): Be like standard Unix.
- (pwait): Likewise.
- * xmalloc.c (first_break): Define.
- (xmalloc_set_program_name): Use.
- (xmalloc): Use.
-
-Thu Mar 11 01:07:55 1999 Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
-
- * config.table: Cleanup and add mh-*pic handling for alpha, arm, powerpc
-
-Sun Feb 28 22:30:44 1999 Geoffrey Noer <noer@cygnus.com>
-
- * config.table: Check cygwin*, not cygwin32*.
-
-Tue Feb 9 16:39:01 1999 Dave Brolley <brolley@cygnus.com>
-
- * Makefile.in: Change mkstemp -> mkstemps.
-
-Tue Feb 9 01:12:27 1999 Marc Espie <Marc.Espie@liafa.jussieu.fr>
-
- * Makefile.in (REQUIRED_OFILES): remove mkstemp.o
- * configure.in (funcs): Check for and conditionally add mkstemps to
- the list of functions libiberty will provide.
- * configure: Rebuilt.
-
-Wed Feb 3 00:01:15 1999 Mumit Khan <khan@xraylith.wisc.edu>
-
- * clock.c (HZ): Define in terms of (ISO C) CLOCKS_PER_SEC on
- platforms that don't have HZ.
- * getruntime.c (HZ): Likewise.
-
-Sat Jan 30 13:28:04 1999 Richard Henderson <rth@cygnus.com>
-
- * Makefile.in (xstrdup.o): Depend on config.h.
-
-Wed Jan 13 07:26:44 1999 H.J. Lu (hjl@gnu.org)
-
- * cplus-dem.c (mop_up): Set work->previous_argument to NULL after
- freeing it.
-
-Wed Jan 13 14:16:36 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * xstrdup.c (xstrdup): Switch from strcpy to memcpy for speed.
-
-Tue Jan 5 15:58:29 1999 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
-
- * Makefile.in (CFILES): fix typo, splay-tree.c instead of
- splay-tree.o.
-
-1999-01-04 Jason Molenda (jsm@bugshack.cygnus.com)
-
- * configure.in: Require autoconf 2.12.1 or higher.
-
-1998-12-30 Michael Meissner <meissner@cygnus.com>
-
- * random.c (NULL): Don't redefine NULL if it is already defined.
-
-Tue Dec 22 09:43:35 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * argv.c (buildargv): Cast the result of alloca in assignment.
-
- * choose-temp.c: Include stdlib.h.
-
- * cplus-dem.c (demangle_arm_pt): Remove unused prototype.
- (snarf_numeric_literal): Constify first parameter.
- (code_for_qualifier): Avoid a gcc extension, make the parameter an
- int, not a char.
- (demangle_qualifier): Likewise.
- (demangle_signature): Cast the argument of a ctype function to
- unsigned char.
- (arm_pt): Add parens around assignment used as truth value.
- (demangle_arm_hp_template): Constify variable `args'.
- (do_hpacc_template_const_value): Cast the argument of a ctype
- function to unsigned char.
- (do_hpacc_template_literal): Remove unused variable `i'.
- (snarf_numeric_literal): Constify parameter `args'.
- Cast the argument of a ctype function to unsigned char.
-
- * floatformat.c (floatformat_to_double): Add explicit braces to
- avoid ambiguous `else'.
-
- * fnmatch.c (fnmatch): Change type of variables `c', `c1',
- `cstart' and `cend' to unsigned char. Cast the argument of macro
- `FOLD', which uses ctype functions, to unsigned char.
-
- * objalloc.c (free): Add prototype.
-
-Sun Dec 20 16:03:46 1998 Hans-Peter Nilsson <hp@axis.se>
-
- * Makefile.in (CFILES): Fix typo: splay-tree.c, not splay-tree.o
-
-Fri Dec 18 17:50:18 1998 David Taylor <taylor@texas.cygnus.com>
-
- * cplus-dem.c (demangle_arm_pt): remove declaration -- function
- doesn't exist.
- (do_hpacc_template_literal): remove unused variable `i'.
-
-Fri Dec 18 16:11:43 EST 1998 Andrew MacLeod <amacleod@cygnus.com>
-
- * cplus-dem.c (demangle_fund_type): Process CV and u codes before
- bumping the pointer we read from. Also prepend these codes,
- as we do in other places.
-
-1998-12-18 Nick Clifton <nickc@cygnus.com>
-
- * cplus-dem.c (demangle_arm_hp_template): Make variable 'args' be
- 'const char *' in order to match its usage when calling siblings.
- (snarf_numeric_literal): Make first arg 'const char **' in order
- to match usage.
-
-Mon Dec 14 09:55:50 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * choose-temp.c: Don't check IN_GCC anymore.
-
- * floatformat.c (floatformat_from_double): Use `const', not `CONST'.
- * memchr.c (memchr): Likewise.
- * memcpy.c (memcpy): Likewise.
- * memmove.c (memmove): Likewise.
-
- * mkstemp.c: Don't check IN_GCC anymore.
- * pexecute.c: Likewise.
- * splay-tree.c: Likewise.
-
- * strchr.c (strchr): Use `const', not `CONST'.
- * strrchr.c (strrchr): Likewise.
- * strtol.c (strtol): Likewise.
- * strtoul.c (strtoul): Likewise.
-
-Fri Dec 4 13:51:04 1998 David Taylor <taylor@texas.cygnus.com>
- Elena Zannoni <ezannoni@cygnus.com>
- Stan Shebs <shebs@cygnus.com>
- Edith Epstein <eepstein@cygnus.com>
- Andres MacLeod <amacleod@cygnus.com>
- Satish Pai <pai@apollo.hp.com>
-
- * HP aCC demangling support.
- * cplus-dem.c
- (main): Remove default to HP style demangling, set to EDG
- demangling correctly when -edg specified; set the demangling style
- when user specifies 'edg'. Set strip_underscore to
- prepends_underscore, if not HPUXHPPA. Set
- current_demangling_style to hp_demangling if HPUXHPPA. Set
- current demangling style correctly if the switch is hp. Read
- label correctly also in the HP style case.
- (work_stuff): add temp_start field; add field for volatile member
- function.
- (arm_pt): handle ARM_DEMANGLING and EDG_DEMANGLING styles; HP
- style for this case is the same as ARM.
- (demangle_args): handle EDG_DEMANGLING style; support HP style.
- (demangle_arm_hp_template): new function. (It was
- demangle_arm_pt.); check and set value of temp_start field in
- multiple places. Also, when ceching for end of template args,
- check to see if at end of static member of template class.
- (demangle_class): new local variable : save_class_name_end Don't
- include template args in string defining class.
- (demangle_class_name): use demangel_arm_hp_template.
- (demangle_function_name): handle case where demangling style is
- HP_DEMANGLING and currently point at an 'X' in the mangled name.
- Handle EDG_DEMANGLING style. Handle constructor and destructor
- ops for HP style.
- (demangle_prefix): handle EDG_DEMANGLING and ARM_DEMANGLING
- styles. global destructor and constructor for HP style are same
- as for ARM style. Same for local variables.
- (demangle_qualified): handle EDG_DEMANGLING style.
- (demangle_signature): add case for volatile member function. For
- cases '1' - '9' : initialize the temp_start field to -1 and handle
- the EDG_DEMANGLING style. for case 'F' : handle EDG_DEMANGLING
- and AUTO_DEMANGLING styles. If expecting a function and managed
- to demangle the funct args, then handle the LUCID_DEMANGLING,
- ARM_DEMANGLING, and EDG_DEMANGLING styles. Add case for local
- class name after "Lnnn_ in HP style case. HP style too needs to
- forget types. _nnn is OK for HP style, so don't report failure.
- (do_hpacc_template_const_value): new function. Handle template's
- value param for HP/aCC.
- (do_hpacc_template_literal): new function. Handle a template's
- literal parameter for HP aCC.
- (recursively_demangle): new function
- (snarf_numeric_literal): new function.
- (usage): add 'edg' to the list of demangling styles; add hp switch
- to message.
-
-Sat Nov 28 17:25:22 1998 Christopher Faylor <cgf@cygnus.com>
-
- * pexecute.c: Remove obsolete ifdefed cygwin code.
-
-Fri Nov 27 13:26:06 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * choose-temp.c: Always include libiberty.h. Avoid redundancies.
- * cplus-dem.c: Likewise. Conform to libiberty.h.
- * pexecute.c: Likewise.
- * splay-tree.c: Likewise.
-
-1998-11-25 Mike Stump <mrs@wrs.com>
-
- * Makefile.in (splay-tree.o): Add config.h dependency.
-
-Mon Nov 23 16:59:49 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * configure.in: Use AC_PREREQ(2.12.1).
-
-1998-11-16 Benjamin Kosnik <bkoz@haight.constant.com>
-
- * cplus-dem.c (demangle_fund_type): Add demangling for C9x types.
-
-Thu Nov 19 22:15:50 1998 Jeffrey A Law (law@cygnus.com)
-
- * mpw.c (mpw_access): Add missing parens.
-
-Thu Nov 19 12:59:21 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * configure.in: Call AC_HEADER_SYS_WAIT.
-
- * pexecute.c: Include sys/wait.h when !IN_GCC.
-
-Thu Nov 19 14:38:20 1998 Geoffrey Noer <noer@cygnus.com>
-
- * pexecute.c: revert back to checking old Cygwin
- preprocessor symbol until some time has passed.
-
-Wed Nov 18 08:52:26 1998 Christopher Faylor <cgf@cygnus.com>
-
- * pexecute.c: Reorganize WIN32 case to accomodate Cygwin
- since it will now support similar constructs.
-
-Fri Nov 13 19:18:05 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * configure.in: Check for calloc.
-
- * calloc.c: New file.
-
- * xmalloc.c (xcalloc): New function.
-
-Fri Nov 13 08:51:46 EST 1998 Andrew MacLeod <amacleod@cygnus.com>
-
- *cplus-dem.c (demangle_prefix): Use the last "__"
- in the mangled name when looking for the signature. This allows
- template names to begin with "__".
-
-1998-11-08 Mark Mitchell <mark@markmitchell.com>
-
- * cplus-dem.c (type_kind_t): Add tk_reference.
- (demangle_template_value_parm): Handle it.
- (do_type): Use it for references, instead of tk_pointer.
-
- * cplus-dem.c (demangle_template_value_parm): Use cplus_demangle,
- not internal_cplus_demangle.
-
-Sat Nov 7 16:02:10 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * choose-temp.c: Don't include gansidecl.h.
- * mkstemp.c: Likewise.
- * pexecute.c: Likewise.
-
-Mon Nov 2 15:05:33 1998 Geoffrey Noer <noer@cygnus.com>
-
- * configure.in: detect cygwin* instead of cygwin32*
- * configure: regenerate
-
-Mon Nov 2 10:22:01 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * pexecute.c: Check HAVE_CONFIG_H, not IN_GCC, when determining
- whether to include config.h. Possibly include unistd.h in the
- !IN_GCC case. Define VFORK_STRING as a printable function call
- for error messages (either "vfork" or "fork".) If HAVE_VFORK_H is
- defined, include vfork.h. If VMS is defined, define vfork()
- appropriately. Remove vfork check on USG, we're using autoconf.
- (pexecute): Set `errmsg_fmt' to VFORK_STRING instead of checking
- locally what string to use.
-
-1998-10-26 Mark Mitchell <mark@markmitchell.com>
-
- * splay-tree.c: Tweak include directives to make sure declarations of
- xmalloc and free are available.
-
-1998-10-25 Mark Mitchell <mark@markmitchell.com>
-
- * cplus-dem.c (gnu_special): Fix handling of virtual tables in
- anonymous namespaces.
-
-1998-10-23 Mark Mitchell <mark@markmitchell.com>
-
- * cplus-dem.c (work_stuff): Replace const_type and volatile_type
- with type_quals.
- (TYPE_UNQUALIFIED): New macro.
- (TYPE_QUAL_CONST): Likewise.
- (TYPE_QUAL_VOLATILE): Likewise.
- (TYPE_QUAL_RESTRICT): Likewise.
- (code_for_qualifier): New function.
- (qualifier_string): Likewise.
- (demangle_qualifier): Likewise.
- (internal_cplus_demangle): Use them.
- (demangle_signature): Likewise.
- (demangle_template_value_parm): Likewise.
- (do_type): Likewise.
- (demangle_fund_type)): Likewise.
-
-Thu Oct 22 19:58:43 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * splay-tree.c (splay_tree_foreach_helper): Make definition static
- to match prototype.
-
-1998-10-21 Mark Mitchell <mark@markmitchell.com>
-
- * splay-tree.c: New file.
- * Makefile.in (CFILES): Add it.
- (REQUIRED_OFILES): Likewise.
- (splay-tree.o): Add dependencies.
-
-Tue Oct 20 12:29:02 1998 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
-
- * cplus-dem.c (demangle_qualified): Fix off-by-one when checking
- range of 'K' index.
-
-Thu Oct 15 18:51:12 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * choose-temp.c: Prototype mkstemps() when IN_GCC.
-
- * cplus-dem.c (consume_count): Cast argument of ctype macro to
- `unsigned char'.
- (cplus_demangle_opname): Cast the result of `strlen' to (int) when
- comparing against one.
- (cplus_mangle_opname): Likewise.
- (demangle_integral_value): Cast argument of ctype macro to
- `unsigned char'.
- (demangle_template_value_parm): Likewise.
- (demangle_template): Initialize variable `bindex'. Cast the
- result of `strlen' to (int) when comparing against one. Remove
- unused variable `start_of_value_parm'.
- (demangle_class_name): Cast the result of `strlen' to (int) when
- comparing against one.
- (demangle_prefix): Cast argument of ctype macro to `unsigned char'.
- (gnu_special): Likewise. Cast the result of `strlen' to (int)
- when comparing against one.
- (demangle_qualified): Cast argument of ctype macro to `unsigned char'.
- (get_count): Likewise.
- (do_type): Likewise. Cast the result of `strlen' to (int) when
- comparing against one.
- (demangle_fund_type): Cast argument of ctype macro to `unsigned char'.
- (demangle_function_name): Cast the result of `strlen' to (int)
- when comparing against one.
-
- * mkstemp.c (mkstemps): Cast variable `len' to (int) when
- comparing against one.
-
-Tue Oct 13 23:51:51 1998 Jeffrey A Law (law@cygnus.com)
-
- * mkstemp.c: Check HAVE_SYS_TIME_H before including sys/time.h
- * configure.in (AC_CHECK_HEADERS): Check for sys/time.h too.
- * config.in, configure: Rebuilt.
-
- * getopt.c: Check HAVE_STRINGS_H before including strings.h.
- * configure.in (AC_CHECK_HEADERS): Check for strings.h too.
- * config.in, configure: Rebuilt.
-
-Mon Oct 12 19:15:59 1998 Geoffrey Noer <noer@cygnus.com>
-
- * configure.in: in comment, call AC_EXEEXT instead of AM_EXEEXT
-
-Sun Oct 11 17:36:06 1998 Michael Tiemann <tiemann@holodeck.cygnus.com>
-
- * Makefile.in (cplus-dem.o, obstack.o): Depend upon config.h.
-
-Thu Oct 8 23:42:08 1998 Jeffrey A Law (law@cygnus.com)
-
- * Merge egcs & devo libiberty.
-
-1998-09-08 Martin von Löwis <loewis@informatik.hu-berlin.de>
-
- * cplus-dem.c (demangle_arm_pt): Demangle anonymous namespaces.
-
-Mon Sep 7 23:29:01 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * mkstemp.c: Include config.h even when not IN_GCC. Wrap header
- inclusions inside HAVE_*_H macros. Include ansidecl.h when not
- IN_GCC.
-
- * vasprintf.c: Include stdarg.h/varargs.h first.
-
- * vprintf.c: Likewise.
-
-Sat Sep 5 03:24:49 1998 Jeffrey A Law (law@cygnus.com)
-
- * pexecute.c: Updates from gcc. Copy in gcc has been removed. This
- is the canonical copy. Define ISSPACE if !IN_GCC.
- * alloca.c, vfprintf.c, choose-temp.c, mkstemp.c, getopt.c: Similarly.
- * getopt1.c, obstack.c: Similarly.
- * Makefile.in: Build mkstemp.o
-
-Tue Sep 1 23:12:47 1998 Christopher Faylor <cgf@cygnus.com>
-
- * configure.in: Include asprintf in list of functions known not
- to be in newlib.
- * configure: Rebuild.
-
-Wed Aug 19 14:05:01 1998 Mumit Khan <khan@xraylith.wisc.edu>
-
- * cplus-dem.c (work_stuff): Add dllimported.
- (demangled_prefix): Mark symbols imported from PE DLL.
- (internal_cplus_demangled): Handle.
-
-1998-08-17 Jason Merrill <jason@yorick.cygnus.com>
-
- * cplus-dem.c (do_type): Fix simple array handling. If we fail,
- stay failed.
-
-Mon Aug 17 10:40:34 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * cplus-dem.c: Include config.h if it exists. Also, only
- prototype malloc/realloc if we can't get stdlib.h.
-
-Sat Aug 15 16:15:01 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * configure.in: Switch back to checking --with-target-subdir when
- deciding whether to check for newlib, undoing part of July 15
- change.
- * configure: Rebuild.
-
-Thu Aug 13 16:47:38 1998 Mark Mitchell <mark@markmitchell.com>
-
- * cplus-dem.c (type_kind_t): New type.
- (demangle_template_value_parm): Add type_kind_t parameter. Rely
- on this paramter, rather than demangling the type again.
- (demangle_integral_value): Pass tk_integral.
- (demangle_template_: Pass the value returned from do_type.
- (do_type): Return a type_kind_t. Pass tk_integral to
- demangle_template_value_parm for array bounds.
- (demangle_fund_type): Likewise.
-
- Also incorporate from GCC version:
-
- Tue Jul 21 13:28:19 1998 Jason Merrill <jason@yorick.cygnus.com>
-
- * cplus-dem.c (do_type): Use demangle_template_value_parm for arrays.
-
-Thu Aug 13 16:47:38 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * cplus-dem.c (demangle_nested_args): Make function definition
- static to match the prototype.
-
-Tue Jul 28 11:33:09 1998 Mark Mitchell <mark@markmitchell.com>
-
- * cplus-dem.c (type_kind_t): New type.
- (demangle_template_value_parm): Add type_kind_t parameter. Rely
- on this paramter, rather than demangling the type again.
- (demangle_integral_value): Pass tk_integral.
- (demangle_template_: Pass the value returned from do_type.
- (do_type): Return a type_kind_t. Pass tk_integral to
- demangle_template_value_parm for array bounds.
- (demangle_fund_type): Likewise.
-
- Also incorporate from GCC version:
-
- Tue Jul 21 13:28:19 1998 Jason Merrill <jason@yorick.cygnus.com>
-
- * cplus-dem.c (do_type): Use demangle_template_value_parm for arrays.
-
-Mon Jul 27 12:16:08 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.in (ALLOCA): New variable.
- ($(TARGETLIB)): Add $(ALLOCA) to library.
- (needed-list): Add $(ALLOCA).
- ($(ALLOCA)): Depend upon stamp-picdir.
-
-Sun Jul 19 08:23:17 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * cplus-dem.c (demangle_nested_args): Make function definition
- static to match the prototype.
-
-Wed Jul 15 00:12:58 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * configure.in: Check --with-cross-host rather than
- --with-target-subdir when deciding whether build uses a cross
- compiler, and when deciding where to install the library.
- * configure: Rebuild.
-
-Sun Jul 12 01:27:05 1998 Jason Merrill <jason@yorick.cygnus.com>
-
- * cplus-dem.c (demangle_nested_args): Return a value.
-
-Sat Jul 11 16:19:48 1998 Mark Mitchell <mark@markmitchell.com>
-
- * cplus-dem.c (string): Move definition before work_stuff.
- (work_stuff): Add volatile_type, forgetting_types,
- previous_argument, and nrepeats fields.
- (SCOPE_STRING): New macro.
- (demangle_template): Add `remember' parameter. Add comment.
- Register the `B' code type here, if remembering. Tidy. Fix crash
- on NULL tmpl_argvec. Be consistent with use of tname/trawname.
- (demangle_nested_args): New function.
- (internal_cplus_demangle): Handle volatile-qualified member
- functions.
- (mop_up): Delete the previous_argument string if present.
- (demangle_signature): Tidy. Handle volatile-qualified member
- functions. Handle back-references using the `B' code. Use extra
- parameter to demangle_template and SCOPE_STRING where appropriate.
- (demangle_template_value_parm): Fix thinko; 'B' is not an integral
- code.
- (demangle_class): Use SCOPE_STRING.
- (gnu_special): Pass additional argument to demangle_template.
- Use SCOPE_STRING.
- (demangle_qualified): Save qualified types for later
- back-references. Handle constructors and destructors for template
- types correctly.
- (do_type): Tidy. Use SCOPE_STRING. Pass extra argument to
- demangle_template. Use demangled_nested_args. Don't remember
- qualified types here; that's now done in demangle_qualified.
- Similarly for templates.
- (do_arg): Improve commment. Handle 'n' repeat code.
- (remember_type): Check forgetting_types.
- (demangle_args): Deal with 'n' repeat codes. Tidy.
-
-Thu Jul 2 16:26:24 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * config.table: Only use mh-fbsd21 on *-*-freebsd2.2.[012], not on
- *-*-freebsd2.2.*. From Dmitrij Tejblum <tejblum@arc.hq.cti.ru>.
-
-Mon Jun 15 16:29:01 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * configure.in (setobjs): Correct quoting error in cygwin32 case.
- From Chris Faylor <cgf@cygnus.com>.
-
-Mon Jun 1 13:47:55 1998 Jason Molenda (crash@bugshack.cygnus.com)
-
- * obstack.c: Update to latest FSF version.
-
-Mon Jun 1 14:17:36 1998 Mike Stump <mrs@wrs.com>
-
- * Makefile.in: Add a dependency on stamp-picdir for the
- objects, so that we can do a parallel build.
-
-Sat May 30 22:17:13 1998 Mumit Khan <khan@xraylith.wisc.edu>
-
- * configure.in (checkfuncs): Add missing "'".
-
-Fri May 29 12:40:41 1998 Jason Molenda (crash@bugshack.cygnus.com)
-
- * obstack.c (_obstack_memory_used): Elide this function if we're
- on a system with GNU libc.
-
-Tue May 26 18:28:43 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.in (distclean): Remove config.log.
-
-Tue May 26 15:01:52 1998 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-
- * Makefile.in (distclean): Don't remove alloca-conf.h.
-
-Fri May 22 01:38:07 1998 Hans-Peter Nilsson <hp@axis.se>
-
- * cplus-dem.c (MBUF_SIZE): Bumped from 512 to 32767.
-
-1998-05-21 Mark Mitchell <mmitchell@usa.net>
-
- * cplus-dem.c (do_type): Handle volatile qualification.
-
-1998-05-21 Manfred Hollstein <manfred@s-direktnet.de>
-
- * configure.in: Check for unistd.h as well.
- * configure: Rebuild.
- * config.in: Rebuild.
- * getpagesize.c (GNU_OUR_PAGESIZE): Use sysconf only if _SC_PAGESIZE
- is defined in unistd.h. Reformat conditional block for easier reading.
-
- * config.table (shared): Default to no if ${enable_shared}
- is unset or empty; this logic is used by the toplevel
- configure scripts, too.
-
-Sat May 16 14:01:26 1998 Jeffrey A Law (law@cygnus.com)
-
- * config.table: Add line to set enable_shared in the Makefile
- as needed.
-
-Wed May 13 14:24:38 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * cplus-dem.c (squangle_mop_up): Change return type to void.
- (internal_cplus_demangle): Remove unused parameter `options'.
- All callers changed.
- (cplus_demangle_opname): Remove function wide variable `int i' and
- replace with `size_t i' at each location where it is used.
- (cplus_mangle_opname): change type of `i' from int to size_t.
-
-Wed May 13 13:39:38 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * alloca-conf.h: Include config.h. Check HAVE_ALLOCA_H rather
- than sparc or sun.
- * Makefile.in (argv.o): Depend upon config.h and alloca-conf.h.
-
-Fri May 8 00:23:51 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * configure.in: Set libiberty_topdir correctly when srcdir is
- "." and with_target_subdir is not set.
- * configure: Rebuild.
-
-Thu May 7 13:01:44 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * configure.in: Add *-*-mingw32* case.
- * configure: Rebuild.
-
-Wed May 6 11:33:51 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * config.table: Never use a PIC file for *-*-cygwin32*.
-
- * Makefile.in (config.status): Depend upon config.table.
-
- * configure.in: On a cygwin32 host, always compile random, and
- don't test for sys_siglist, strsignal, or psignal.
- * configure: Rebuild.
-
- * clock.c: Check HAVE_SYS_PARAM_H rather than NO_SYS_PARAM_H.
- * getcwd.c: Likewise.
- * getpagesize.c: Likewise.
- * getruntime.c: Likewise.
-
-Tue May 5 18:08:32 1998 Ian Lance Taylor <ian@cygnus.com>
-
- Use autoconf tests rather than the old dummy.c test:
- * configure.in: Add AC_ARG_WITH calls for --with-target-subdir and
- --with-newlib. Add AC_CONFIG_HEADER. Use AC_REPLACE_FUNCS for
- most functions. Add special cases to handle newlib and VxWorks.
- Remove target_makefile_frag. Create stamp-h in AC_OUTPUT if
- CONFIG_HEADERS is set. Only call config-ml.in in AC_OUTPUT if
- CONFIG_FILES is set; set ac_file before calling it.
- * config.table (arm-*-riscix*, *-*-cygwin32): Remove.
- (*-*-hpux*, *-*-hiux*, *-*-irix4*, *-*-solaris2*): Remove.
- (*-*-sysv4*, *-*-go32, *-*-vxworks5*, *-*-vxworks): Remove
- (i[3456]-*-mingw32*): Remove.
- * Makefile.in (ERRORS_CC, CONFIG_H, NEEDED_LIST): Remove.
- (LIBOBJS): New variable.
- (HOST_OFILES, DO_ALSO, STAGESTUFF): Remove.
- (all): Depend upon needed-list. Don't check RULE1.
- (@target_makefile_frag@): Remove.
- (COMPILE.c): Include @DEFS@.
- (HFILES): Add alloca-conf.h.
- (REQUIRED_OFILES): Remove basename.o.
- ($(TARGETLIB)): New target.
- (stamp-needed, lneeded-list, needed.awk, stamp-config): Remove.
- (lconfig.h, needed2.awk, dummy.o, errors): Remove.
- (needed-list, config.h): Rewrite.
- (RULE1, $(RULE1), RULE2, $(RULE2)): Remove.
- (.always.): Remove.
- (Makefile): Set CONFIG_FILES and CONFIG_HEADERS.
- (stamp-h): New target.
- (atexit.o, clock.o, getcwd.o, getpagesize.o): New targets.
- (basename.o): Don't depend upon config.h.
- (getruntime.o): Depend upon config.h.
- * atexit.c: Include config.h. Check HAVE_ON_EXIT rather than
- NEED_on_exit.
- * basename.c: Don't include config.h. Don't check NEED_basename.
- * clock.c: Include config.h.
- * getcwd.c: Likewise.
- * getpagesize.c: Likewise.
- * getruntime.c: Likewise. Fix checks which set HAVE_GETRUSAGE and
- HAVE_TIMES.
- * strerror.c: Change uses of NEED_sys_errlist to
- HAVE_SYS_ERRLIST. Likewise for NEED_strerror and HAVE_STRERROR.
- * strsignal.c: Likewise for NEED_sys_siglist and HAVE_SYS_SIGLIST,
- and for NEED_strsignal and HAVE_STRSIGNAL and for NEED_psignal and
- HAVE_PSIGNAL.
- * acconfig.h: New file.
- * dummy.c: Remove.
- * functions.def: Remove.
- * config/mh-cxux7 (HDEFINES): Remove -DHAVE_SYSCONF.
- * config/mh-windows (HDEFINES): Remove.
- * config/mh-cygwin32: Remove.
- * config/mh-go32: Remove.
- * config/mh-irix4: Remove.
- * config/mh-riscix: Remove.
- * config/mh-sysv4: Remove.
- * config/mt-mingw32: Remove.
- * config/mt-vxworks5: Remove.
- * config.in: New file, generated using autoheader.
- * configure: Rebuild.
-
-Mon May 4 13:00:28 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * configure.in: Rewrite to use autoconf.
- * configure: Generate using autoconf.
- * config/mh-a68bsd: Remove.
- * config/mh-apollo68: Remove.
- * config/mh-hpbsd: Remove.
- * config/mh-ncr3000: Remove.
- * config/mh-sysv: Remove.
- * config/mh-aix (RANLIB, INSTALL): Don't define.
- * config/mh-cxux7 (RANLIB, INSTALL): Don't define.
- * config/mh-irix4 (CC, RANLIB, INSTALL): Don't define.
- * config/mh-sysv4 (RANLIB, INSTALL): Don't define.
- * config.table: Change config_shell to CONFIG_SHELL, and use
- libiberty_topdir to find move-if-change.
- (m68k-apollo-bsd*, m68k-apollo-sysv*): Remove.
- (i[3456]86-ncr-sysv4*, *-*-dgux*, hppa*-hp-bsd*): Remove.
- (*-*-irix*, *-*-m88kbcs*, *-*-sysv*): Remove.
- * Makefile.in (srcdir): Set to @srcdir@.
- (VPATH): Likewise.
- (prefix, exec_prefix, bindir, libdir): Set to autoconf variables.
- (SHELL, INSTALL, INSTALL_PROGRAM, INSTALL_DATA): Likewise.
- (CC, CFLAGS, RANLIB)): Likewise.
- (datadir, man*dir, infodir, includedir, MAKEINFO): Remove.
- (target_makefile_frag, host_makefile_frag): Add substitutions.
- (INSTALL_DEST): Set to @INSTALL_DEST@.
- (Makefile): Depend upon config.status. Don't depend upon
- $(host_makefile_frag) or $(target_makefile_frag).
- (config.status): New target.
-
-Sun May 3 17:58:49 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * config/mt-sunos4: Remove. Should be handled by --with-headers
- and --with-libraries options at top level.
- * config.table: Never use mt-sunos4.
-
- * alloca-conf.h: New file, combining alloca-norm.h and
- alloca-botch.h.
- * alloca-norm.h: Remove.
- * alloca-botch.h: Remove.
- * configure.in: Set shell variables files and links to empty.
- * config.table: Don't set shell variable files.
- * configure.bat: Don't create alloca-conf.h.
- * makefile.vms: Likewise.
- * mpw-config.in: Likewise.
- * vmsbuild.com: Likewise.
-
-Fri May 1 11:41:42 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.in ($(HOST_OFILES) $(REQUIRED_OFILES)): Remove old
- target depending upon config.h.
- (alloca.o): Add target depending upon config.h
- (basename.o, choose-temp.o, fnmatch.o): Likewise.
- (getopt.o, getopt1.o, pexecute.o, strerror.o): Likewise.
- (strsignal.o, xstrerror.o): Likewise.
-
-Fri May 1 04:26:25 1998 Peter Schauer <pes@regent.e-technik.tu-muenchen.de>
-
- * cplus-dem.c (cplus_demangle_opname): Initialize work.
-
-Mon Apr 27 15:53:30 EDT 1998 Andrew MacLeod <amacleod@cygnus.com>
-
- * cplus-dem.c (demangle_qualified): Replace missing else.
-
-Sun Apr 26 15:38:50 1998 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-
- * cplus-dem.c (gnu_special): Fix off-by-one bug when checking the
- length in the name of a virtual table.
-
-Wed Apr 22 10:53:49 EDT 1998 Andrew MacLeod <amacleod@cygnus.com>
-
- * cplus-dem.c (struct work stuff): Add field for B and K mangle codes.
- (cplus_demangle_opname): Call mop_up_squangle.
- (cplus_demangle): Initialize squangle info, then call
- internal_cplus_demangle. (Most code moved there as well)
- (internal_cplus_demangle): New function, performs most of what use
- to be done in cplus_demangle, but is only called with this file.
- (squangle_mop_up): New function to clean up B and K code data.
- (mop_up): set pointers to NULL after freeing.
- (demangle_signature, demangle_template, demangle_class): Add
- switch elements to handle K and B codes.
- (demangle_prefix, gnu_special, demangle_qualified): Add
- code to handle K and B codes.
- (do_type, demangle_fund_type): Handle B and K codes.
- (remember_Ktype): New function to store K info.
- (register_Btype, remember_Btype): New functions for B codes.
- (forget_B_and_K_types): New function to destroy B and K info.
-
-Fri Apr 10 01:49:10 1998 Jeffrey A Law (law@cygnus.com)
-
- * COPYING.LIB, choose-temp.c, cplus-dem.c: Sync with egcs & gcc.
-
-Thu Mar 5 09:23:28 1998 Manfred Hollstein <manfred@s-direktnet.de>
-
- * config.table: Make locating frag files failsafe even for the
- special case if configuring and building in srcdir.
-
-Mon Feb 23 14:33:15 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * choose-temp.c: Fix handling of sys/file.h to work in libiberty.
-
-Sun Feb 22 18:03:23 1998 Jeffrey A Law (law@cygnus.com)
-
- * choose-temp.c: Sync with copy in gcc.
-
-Thu Feb 12 16:29:49 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * getopt.c: Update to latest FSF version.
- * getopt1.c: Likewise.
-
-Tue Feb 10 16:58:33 1998 Stan Shebs <shebs@andros.cygnus.com>
-
- * cplus-dem.c (gnu_special): Don't get confused by .<digits>
- strings that are not actually lengths.
-
-Fri Feb 6 01:35:17 1998 Manfred Hollstein <manfred@s-direktnet.de>
-
- * Makefile.in (FLAGS_TO_PASS): Don't pass PICFLAG.
- (.c.o): Check value of enable_shared, not PICFLAG.
- (stamp-picdir): Dito.
-
-Thu Feb 5 18:48:56 1998 Geoffrey Noer <noer@cygnus.com>
-
- * config/mh-cygwin32: remove vasprintf.o from EXTRA_OFILES
- since it gets built automatically
-
-Sun Feb 1 02:52:32 1998 Mike Stump <mrs@wrs.com>
-
- * config.table (vxworks configs): Default to VxWorks 5.x, as that is
- the currently shipping OS.
-
-Tue Jan 27 16:08:20 1998 Pat Rankin <rankin@eql.caltech.edu>
-
- * vmsbuild.com [REQUIRE_OFILES]: Synchronized with Makefile.in:
- Add fnmatch.o and objalloc.o; remove vasprintf.o.
- [config.h]: Define NEED_strsignal.
-
-Mon Jan 19 12:20:01 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * functions.def: Correct argument types for strerror and
- strsignal. Reported by Alex Gutman <agutman@emc.com>.
-
-Sun Jan 18 15:57:28 1998 Michael Snyder <msnyder@cleaver.cygnus.com>
-
- * vasprintf.c (int_vasprintf): Increase buffer size for float/double
- values.
-
-Sat Jan 17 22:28:38 1998 Mumit Khan <khan@xraylith.wisc.edu>
- J.J. VanderHeijden <J.J.vanderHeijden@student.utwente.nl>
-
- Add mingw32 support.
- * pexecute.c (pexecute): New function for mingw32. Supports pipes.
- (pwait): New function for mingw32.
-
- * config.table (i[3456]86-*-mingw32*): Support for i386-mingw32.
- * config/mt-mingw32: New file.
- * xmalloc.c (first_break): Not used for mingw32.
- (xmalloc_set_program_name): Don't use sbrk on mingw32.
- (xmalloc): Likewise.
- (xrealloc): Likewise.
-
-Sat Jan 17 22:28:05 1998 Jeffrey A Law (law@cygnus.com)
-
- * choose-temp.c: Sync with gcc version.
-
-Tue Jan 13 18:34:39 1998 Jim Wilson <wilson@cygnus.com>
-
- * Makefile.in (install_to_libdir, install_to_tooldir): Add MULTISUBDIR
- to all filenames in libdir and tooldir.
- (distclean): Do MULTICLEAN before deleting Makefile.
- (stamp-needed, stamp-config): Add MULTISRCTOP to
- pathname for move-if-change.
-
-Thu Dec 4 17:25:19 1997 Jeffrey A Law (law@cygnus.com)
-
- * strsignal.c (sys_nsig): Try NSIG and _NSIG.
-
-Wed Nov 19 13:37:06 1997 Michael Meissner <meissner@cygnus.com>
-
- * alloca-norm.h (alloca, GCC case): Don't redefine alloca if it
- was already defined previously.
-
-Mon Nov 10 12:48:03 1997 Philippe De Muyter <phdm@macqel.be>
-
- * Makefile.in (INSTALL): Use ../install-sh, not install.
-
-Tue Oct 28 23:41:15 1997 Judy Goldberg <jodyg@idt.net>
-
- * Makefile.in (CFILES): Add pexecute.c.
-
-Wed Oct 15 19:13:48 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * asprintf.c: Consistently use either stdarg or varargs.
-
-Tue Oct 14 12:01:00 1997 Mark Mitchell <mmitchell@usa.net>
-
- * cplus-dem.c (demangle_signature): Don't look for return types on
- constructors. Handle member template constructors.
-
-Fri Oct 3 17:53:30 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * README: Fix configuration instructions.
-
-Mon Sep 29 12:28:41 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * pexecute.c: Update to current version from /gd/gnu/lib:
-
- Mon Sep 29 12:27:59 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * pexecute.c: Use spawn if __CYGWIN32__.
-
- 1997-08-08 Paul Eggert <eggert@twinsun.com>
-
- * pexecute.c: Include "config.h" first, as per autoconf manual.
-
- Fri Jun 27 15:20:29 1997 Scott Christley <scottc@net-community.com>
-
- * pexecute.c (fix_argv): New function.
- (pexecute): Win32 but not Cygwin32 needs its arguments fixed.
- Add underscore to cwait function call.
-
-Sun Sep 28 12:00:52 1997 Mark Mitchell <mmitchell@usa.net>
-
- * cplus-dem.c (demangle_template): Add new parameter. Handle new
- template-function mangling.
- (consume_count_with_underscores): New function.
- (demangle_signature): Handle new name-mangling scheme.
-
-Wed Sep 24 00:31:59 1997 Felix Lee <flee@yin.cygnus.com>
-
- * asprintf.c: stdarg.h when ALMOST_STDC
- * config/mh-windows (EXTRA_OFILES): add asprintf.o and
- strncasecmp.o.
-
-Thu Aug 28 14:27:15 1997 Andrew Cagney <cagney@b1.cygnus.com>
-
- * vasprintf.c (vasprintf): Allow for _BSD_VA_LIST_.
-
- * config.table: Add case for FreeBSD 2.1 and 2.2, needs mh-fbsd21.
-
- * config/mh-fbsd21 (EXTRA_OFILES): Force vasprintf.o
-
-Wed Sep 10 12:43:10 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * cplus-dem.c (demangle_fund_type): Change "complex" to "__complex".
-
-Fri Sep 5 16:34:42 1997 Andrew Cagney <cagney@b1.cygnus.com>
-
- * asprintf.c (asprintf): New file.
- * Makefile.in (CFILES): Add asprintf.c
- * functions.def: Ditto.
-
-Thu Aug 28 18:53:34 1997 Andrew Cagney <cagney@b1.cygnus.com>
-
- * argv.c (dupargv): New function, duplicate an argument vector.
-
-Tue Aug 19 20:28:45 1997 Geoffrey Noer <noer@cygnus.com>
-
- * config/mh-cygwin32: also build random.o
-
-Tue Aug 19 17:10:56 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * cplus-dem.c: Add 'extern' to prepends_underscore.
-
-Wed Jul 30 11:42:19 1997 Per Bothner <bothner@cygnus.com>
-
- * cplus-dem.c: Various changes to produce Java output when passed
- DMGL_JAVA. Thus "::" becomes "." and "JArray<Foo>" becomes "Foo[]".
- (main): Support --java and -j flags to set DMGL_JAVA.
-
-Tue Jul 22 19:05:23 1997 Robert Hoehne <robert.hoehne@Mathematik.TU-Chemnitz.DE>
-
- * config/mh-go32 (CC, AR, RANLIB): Don't define.
-
-Tue Jul 22 17:49:54 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.in (REQUIRED_OFILES): Add pexecute.o.
- (pexecute.o): New target.
-
- * Makefile.in (stamp-needed): New target, replacing needed-list.
- (needed-list): Just depend upon stamp-needed.
- (stamp-config): New target, replacing config.h.
- (config.h): Just depend upon stamp-config.
- (mostlyclean): Remove stamp-*.
-
-Thu Jun 12 11:00:18 1997 Angela Marie Thomas (angela@cygnus.com)
-
- * Makefile.in (FLAGS_TO_PASS): pass INSTALL, INSTALL_PROGRAM and
- INSTALL_DATA for multilibbed installs
-
-Tue Jun 3 13:21:05 1997 Doug Evans <dje@canuck.cygnus.com>
-
- Tue Dec 10 09:44:57 1996 Paul Eggert <eggert@twinsun.com>
-
- * choose-temp.c (choose_temp_base): Don't dump core if TMPDIR is empty.
-
- * choose-temp.c (try): Insist that temp dir be searchable.
-
- Wed Oct 23 17:36:39 1996 Doug Rupp (rupp@gnat.com)
-
- * choose-temp.c (choose_temp_base): On VMS, use proper syntax
- for current directory.
-
- Sat Feb 15 19:03:48 1997 Geoffrey Noer (noer@cygnus.com)
-
- * pexecute.c: Remove special cases for cygwin32.
- (pwait): Remove local definition of `pid'.
-
- Tue Nov 12 18:26:15 1996 Doug Rupp (rupp@gnat.com)
-
- * pexecute.c (vfork): Supply new definition for VMS.
- (pwait): Use waitpid instead of wait for VMS.
-
-Tue May 20 14:02:20 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * cplus-dem.c (do_type): Handle `J'.
- (demangle_fund_type): Print "complex" for it.
-
-Wed Apr 30 12:15:45 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * configure.in: Don't turn on multilib here.
-
-Mon Apr 28 19:04:31 1997 Michael Snyder <msnyder@cleaver.cygnus.com>
-
- * obstack.c: move _obstack_memory_used outside of ifdef. Cannot be
- elided; needed by gdb and not present in libc.
-
-Thu Apr 24 19:33:47 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.in (clean): Remove tmpmulti.out.
-
-Tue Apr 22 10:25:15 1997 Fred Fish <fnf@cygnus.com>
-
- * floatformat.c (floatformat_ieee_double_littlebyte_bigword):
- Add new floatformat, mainly for ARM doubles.
-
-Mon Apr 14 12:11:16 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * config.table: Use ${config_shell} with ${moveifchange}. From
- Thomas Graichen <graichen@rzpd.de>.
-
-Fri Apr 4 03:09:24 1997 Ulrich Drepper <drepper@cygnus.com>
-
- * configure.in: Enable multilibing by default.
- Update multilib template to read config-ml.in.
-
-Tue Apr 1 16:26:39 1997 Klaus Kaempf <kkaempf@progis.de>
-
- * makefile.vms: Add objalloc.
-
-Mon Mar 31 23:57:51 1997 H.J. Lu <hjl@gnu.ai.mit.edu>
-
- * cplus-dem.c (demangle_it): Add prototype declaration.
- (usage, fatal): Likewise.
-
- * xexit.c (_xexit_cleanup): Add prototype.
-
- * strerror.c (init_error_tables): Declare.
-
-Fri Mar 28 11:43:20 1997 H.J. Lu <hjl@lucon.org>
-
- * functions.def: Add DEF of vasprintf, and DEFFUNC of strsignal.
- * strsignal.c: Only define strsignal if NEED_strsignal.
- * Makefile.in (REQUIRED_OFILES): Remove vasprintf.o.
- * configure.in: Add NEED_strsignal to xconfig.h. Add vasprintf.o
- to xneeded-list.
- * config/mh-cygwin32 (HDEFINES): Add -DNEED_strsignal.
- (EXTRA_OFILES): Define to vasprintf.o.
- * config/mh-windows (HDEFINES): Add -DNEED_strsignal.
- (EXTRA_OFILES): Add vasprintf.o.
- * config/mt-vxworks5 (vxconfig.h): Define NEED_strsignal.
- (vxneeded-list): Add vasprintf.o.
-
-Thu Mar 20 17:02:09 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * objalloc.c: Include <stdio.h>.
-
-Mon Mar 17 19:23:11 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * objalloc.c: New file.
- * Makefile.in (CFILES): Add objalloc.c
- (REQUIRED_OFILES): Add objalloc.o.
- (objalloc.o): New target.
-
-Sat Mar 15 18:49:41 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * obstack.c: Update to current FSF version.
-
-Fri Mar 14 14:18:47 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * cplus-dem.c: Add prototypes for all static functions.
- (mystrstr): Make static. Make arguments and result const.
- (cplus_match): Remove; not used.
-
-Tue Mar 11 14:20:31 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * cplus-dem.c (gnu_special): Call demangled_fund_type for other
- __t* symbols.
-
-Tue Mar 11 15:41:21 1997 H.J. Lu <hjl@lucon.org>
-
- * spaces.c: Declare malloc and free properly.
- * strsignal.c (init_signal_tables): Add prototype.
- * xatexit.c (_xexit_cleanup): Add parameter declarations.
-
-Wed Feb 19 15:43:24 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * Makefile.in (lneeded-list): If alloca.o is needed, xexit.o is
- also required because of xmalloc.o.
-
-Fri Feb 14 13:43:38 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * strsignal.c: Unconditionally redefine sys_siglist around the
- inclusion of the system header files.
-
-Thu Feb 13 22:01:04 1997 Klaus Kaempf <kkaempf@progis.de>
-
- * makefile.vms: Remove 8 bit characters. Update to latest
- gcc release.
-
-Tue Feb 4 11:52:19 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * strsignal.c: Use NEED_sys_siglist instead of
- LOSING_SYS_SIGLIST.
- * config.table: Don't use mh-lynxos.
- * config/mh-lynxos: Remove.
-
-Thu Jan 16 14:51:03 1997 Bob Manson <manson@charmed.cygnus.com>
-
- * cplus-dem.c: Fix indenting; make identical to the copy
- in GCC.
- (do_type, case 'M'): Check for a template as well as a class.
-
-Thu Dec 19 13:51:33 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * config/mt-vxworks5 (vxneeded-list): Remove sigsetmask.o, since
- vxworks 5.[0-3] all have sigsetmask in them; the one provided by
- libiberty is incorrect, as well.
-
-Mon Dec 2 15:03:42 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * alloca.c (alloca): When compiled with an ANSI/ISO compiler,
- alloca takes a size_t argument, not just unsigned.
-
-Mon Nov 18 15:42:08 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cplus-dem.c: Note that this file also lives in GCC.
-
-Mon Nov 18 15:19:00 1996 Dawn Perchik <dawn@critters.cygnus.com>
-
- * alloca.c: Remove include of libiberty.h for hpux.
- * argv.c: Replace defs from libiberty.h.
- * spaces.c: Put back externs from removed from libiberty.h.
- * vasprintf.c: Remove include of libiberty.h for hpux.
-
-Mon Nov 18 14:08:00 1996 Dawn Perchik <dawn@critters.cygnus.com>
-
- * cplus-dem.c: Checking in again; last checkin filed due to sticky tag.
-
-Wed Nov 13 08:22:00 1996 Dawn Perchik <dawn@critters.cygnus.com>
-
- * cplus-dem.c: Revert last two commits due to conflicts with
- hpux system headers.
-
-Wed Nov 13 08:22:00 1996 Dawn Perchik <dawn@critters.cygnus.com>
-
- * alloca.c, argv.c, spaces.c, strcasecmp.c, vasprintf.c, vprintf.c:
- Revert last commit due to conflicts with hpux system headers.
-
-Wed Nov 13 10:36:50 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * cplus-dem.c (x{m,re}alloc): Make declarations compatibile with
- libiberty.h when compiled with a standard compiler.
-
-Tue Nov 12 16:31:00 1996 Dawn Perchik <dawn@critters.cygnus.com>
-
- * alloca.c: Include libiberty.h for definition of xmalloc.
- Don't redefine NULL.
- * argv.c: Move prototypes to libiberty.h.
- * cplus-dem.c: Include libiberty.h for definition of xmalloc.
- Don't redefine NULL.
- Use casts to eliminate compiler warnings.
- * spaces.c: Remove prototypes for malloc and free which are
- already in libibrty.h.
- * strcasecmp.c: Use casts to eliminate compiler warnings.
- * vasprintf.c: Include libiberty.h for definition of malloc.
- Don't redefine NULL.
- * vprintf.c: Include stdarg.h if __STDC__.
-
-Fri Oct 11 15:42:12 1996 Stu Grossman (grossman@critters.cygnus.com)
-
- * config/mh-windows: Add strcasecmp.o to EXTRA_OFILES.
-
-Fri Oct 11 11:16:31 1996 Stan Shebs <shebs@andros.cygnus.com>
-
- * mpw.c (mpwify_filename): Rewrite to simplify, and to handle
- upward components correctly.
-
-Tue Oct 8 08:55:34 1996 Stu Grossman (grossman@critters.cygnus.com)
-
- * config.table, config/mh-windows: Add support for building under
- MSVC (the Microsoft build environment).
-
-Mon Oct 7 10:50:27 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * fnmatch.c: Undef const if not __STDC__.
-
-Thu Oct 3 13:46:39 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * fnmatch.c: New file.
- * Makefile.in (CFILES): Add fnmatch.c.
- (REQUIRED_OFILES): Add fnmatch.o.
- (fnmatch.o): New target.
-
-Wed Sep 18 14:49:13 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cplus-dem.c (demangle_template): Fix handling of address args.
- (gnu_special): Handle type_info stuff.
-
-Fri Sep 13 17:52:55 1996 Stan Shebs <shebs@andros.cygnus.com>
-
- * mpw.c (DebugPI): Make settable from the env var DEBUG_PATHNAMES.
- (mpwify_filename): Handle "::/" case.
-
-Thu Sep 12 13:30:40 1996 Geoffrey Noer <noer@cygnus.com>
-
- * config/mh-cygwin32: new file (need -DNEED_basename and
- -DNEED_sys_siglist for native NT rebuilding)
- * config.table (*-*-cygwin32): new entry
- * choose-temp.c: bring in sync with gcc (revert Aug 17 change)
-
-Thu Aug 29 16:48:45 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * config.table (i[345]86-*-*): Recognize i686 for pentium pro.
-
-Tue Aug 27 13:47:58 1996 Stan Shebs <shebs@andros.cygnus.com>
-
- * pexecute.c (pexecute) [MPW]: Remove old bogus code that
- messed with arguments that included a '/', add escape chars
- to double quotes, remove const decl from arg that Mac
- compilers don't seem to like.
-
-Sat Aug 17 04:44:27 1996 Geoffrey Noer <noer@cygnus.com>
-
- * pexecute.c: Update test for win32 (&& ! cygwin32).
- * choose-temp.c: fix WIN32 preprocessor defines
-
-Thu Aug 15 12:26:48 1996 Stan Shebs <shebs@andros.cygnus.com>
-
- * mpw-make.sed: Add @DASH_C_FLAG@ and @SEGMENT_FLAG({Default})@
- to editing of default makefile rule.
-
-Sun Aug 11 21:03:27 1996 Stu Grossman (grossman@critters.cygnus.com)
-
- * alloca-norm.h: Include <malloc.h> if _WIN32.
- * argv.c: Include non-prototyped decls for malloc and string
- functions if ! _WIN32 or if __GNUC__.
-
-Thu Aug 8 12:42:40 1996 Klaus Kaempf <kkaempf@progis.de>
-
- * config.h-vms: New file.
- * makefile.vms: Use it.
-
-Wed Aug 7 17:16:12 1996 Stu Grossman (grossman@critters.cygnus.com)
-
- * getopt.c (_getopt_internal): If argc is 0, just return (before
- we reference *argv and segfault).
-
-Mon Aug 5 01:29:08 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * Makefile.in (distclean): Add multilib.out.
-
-Thu Jul 18 17:40:55 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * alloca-norm.h: Change #ifdef sparc to #if defined (sparc) &&
- defined (sun). From Andrew Gierth <ANDREWG@microlise.co.uk>.
-
-Mon Jul 1 13:40:44 1996 Ken Raeburn <raeburn@cygnus.com>
-
- Tue May 28 15:29:03 1996 Pat Rankin <rankin@eql.caltech.edu>
-
- * vmsbuild.com (REQUIRD_OFILES): Add choose-temp.o and xstrdup.o.
-
- Thu Jan 25 18:20:04 1996 Pat Rankin <rankin@eql.caltech.edu>
-
- * vmsbuild.com: Changes to handle DEFFUNC(on_exit).
- (do_ofiles): Allow nonexistent source file in pass 3.
- (chk_deffunc): New routine.
-
-Tue Jun 25 19:24:43 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * pexecute.c (PEXECUTE_VERBOSE): Define.
- (MPW pexecute): Check flags & PEXECUTE_VERBOSE instead of verbose_flag.
-
-Tue Jun 25 23:11:48 1996 Jason Molenda (crash@godzilla.cygnus.co.jp)
-
- * Makefile.in (docdir): Removed.
-
-Tue Jun 25 23:01:07 1996 Jason Molenda (crash@godzilla.cygnus.co.jp)
-
- * Makefile.in (oldincludedir): Removed.
-
-Tue Jun 25 22:50:07 1996 Jason Molenda (crash@godzilla.cygnus.co.jp)
-
- * Makefile.in (datadir): Set to $(prefix)/share.
-
-Thu Jun 20 21:17:52 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * cplus-dem.c (demangle_arm_pt): Reindent. Avoid endless loop by
- checking for errors from do_type.
-
-Tue Jun 18 14:36:19 1996 Klaus Kaempf <kkaempf@progis.de>
-
- * makefile.vms: New file.
- * xmalloc.c: If VMS, include <stdlib.h> and <unixlib.h> rather
- than declaring malloc, realloc, and sbrk.
-
-Mon Jun 10 13:17:17 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * pexecute.c: New file.
-
-Wed Jun 5 16:57:45 1996 Richard Henderson <rth@tamu.edu>
-
- * xmalloc.c: Declare sbrk.
-
-Sat May 4 05:08:45 1996 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
-
- * alloca-norm.h: Add SPARCworks cc compatible __builtin_alloca
- declaration.
-
-Mon Apr 22 18:41:49 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * xstrerror.c: Include <stdio.h>.
-
-Sun Apr 21 11:55:12 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * Makefile.in (CFILES): Add atexit.c.
-
-Sun Apr 21 09:50:09 1996 Stephen L Moshier (moshier@world.std.com)
-
- * choose-temp.c: Include sys/types.h before sys/file.h for sco3.2v5.
-
-Wed Apr 17 11:17:55 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * choose-temp.c: Don't #include sys/file.h ifdef NO_SYS_FILE_H.
- #include <stdio.h>
- * config/mt-vxworks5 (HDEFINES): Define NO_SYS_FILE_H.
-
-Tue Apr 16 11:27:16 1996 Jeffrey A Law (law@cygnus.com)
-
- * Makefile.in (lneeded-list): If alloca.o is needed, so is xmalloc.o.
- Reverts Feb 8, 1995 change.
-
-Mon Apr 15 12:53:26 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * choose-temp.c: New file.
- * Makefile.in (CFILES): Add choose-temp.c.
- (REQUIRED_OFILES): Add choose-temp.o.
-
-Sat Apr 13 14:19:30 1996 Stu Grossman (grossman@critters.cygnus.com)
-
- * floatformat.c (floatformat_to_double): Don't bias exponent when
- handling zero's, denorms or NaNs.
-
-Thu Apr 11 13:36:56 1996 Stu Grossman (grossman@critters.cygnus.com)
-
- * floatformat.c (floatformat_to_double): Fix bugs with handling
- numbers with fractions < 32 bits.
-
-Mon Apr 8 14:48:34 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * config.table: Permit --enable-shared to specify a list of
- directories.
-
-Tue Mar 19 22:02:07 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cplus-dem.c (demangle_template): Fix for non-mangled pointer
- arguments.
-
-Fri Mar 8 17:24:18 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * configure.in: If srcdir is `.' and with_target_subdir is not
- `.', then set MULTISRCTOP before calling config-ml.in.
-
-Thu Mar 7 13:37:10 1996 Stan Shebs <shebs@andros.cygnus.com>
-
- * mpw.c (mpw_open): Add debugging output option.
-
-Wed Mar 6 17:36:03 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cplus-dem.c (demangle_template): Fix for address-of-extern arguments.
-
-Tue Feb 27 12:00:50 1996 Raymond Jou <rjou@mexican.cygnus.com>
-
- * mpw.c (mpwify_filename): Change 6 to 5 in
- strncmp (unixname, "/tmp/", 5).
-
-Tue Feb 20 10:55:53 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * cplus-dem.c (demangle_template): Initialize is_bool. Correctly
- handle 0 as a pointer value parameter.
-
-Mon Feb 5 16:41:44 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.in (all): Depend upon required-list.
- (required-list): New target.
- (clean): Remove required-list.
-
-Wed Jan 31 10:19:41 1996 Steve Chamberlain <sac@slash.cygnus.com>
-
- * win32.c: Deleted.
- * config.table (i386-*-win32): Deleted.
- * config/mh-i386win32: Deleted.
-
-Thu Jan 18 11:34:17 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * cplus-dem.c (cplus_demangle_opname): Change opname parameter to
- const char *.
- (cplus_mangle_opname): Change return type and opname parameter to
- const char *. Don't cast return value.
-
-Tue Jan 16 12:13:11 1996 Stan Shebs <shebs@andros.cygnus.com>
-
- * mpw.c: Include Timer.h, in order to get m68k Microseconds trap
- definition.
-
-Wed Jan 3 13:15:04 1996 Fred Fish <fnf@cygnus.com>
-
- * obstack.c: Update copyright to 1996.
- (_obstack_memory_used): Define new function. Called via
- obstack_memory_used macro.
-
-Thu Dec 28 11:39:40 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * xstrdup.c: New file.
- * Makefile.in (CFILES): Add xstrdup.c.
- (REQUIRED_OFILES): Add xstrdup.o.
- (xstrdup.o): New target.
-
-Mon Dec 11 18:18:52 1995 Mike Stump <mrs@cygnus.com>
-
- * atexit.c: New stub to provide atexit on systems that have
- on_exit, like SunOS 4.1.x systems.
- * functions.def (on_exit, atexit): Ditto.
-
-Mon Dec 11 15:42:14 1995 Stan Shebs <shebs@andros.cygnus.com>
-
- * mpw.c (mpw_abort): Remove decl.
- (mpw_access): Move debugging printf.
-
-Sat Dec 2 01:25:23 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * config.table: Consistently use ${host} rather than ${xhost} or
- ${target}.
- * configure.in: Don't bother to set ${xhost} before calling
- config.table.
-
-Tue Nov 28 14:16:57 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * Makefile.in (.c.o): Use test instead of the left bracket, to
- avoid problems with some versions of make.
-
-Tue Nov 28 11:45:17 1995 Stan Shebs <shebs@andros.cygnus.com>
-
- * mpw-make.sed: Fix INCDIR edit to work with Nov 14 change.
-
-Tue Nov 21 11:26:34 1995 Fred Fish <fnf@rtl.cygnus.com>
-
- * config/mh-hpux: Remove. It was only used to define EXTRA_OFILES,
- which was set to just alloca.o, which is now automatically marked
- as needed by the autoconfiguration process.
-
-Tue Nov 21 14:15:06 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * config.table: Check ${with_cross_host} rather than comparing
- ${host} and ${target}.
-
-Thu Nov 16 14:34:42 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * configure.in: If with_target_subdir is empty, set xhost to
- ${host} rather than ${target} before calling config.table.
-
-Tue Nov 14 01:38:30 1995 Doug Evans <dje@canuck.cygnus.com>
-
- * Makefile.in (MULTITOP): Deleted.
- (MULTISRCTOP, MULTIBUILDTOP): New.
- (FLAGS_TO_PASS): Delete INCDIR.
- (INCDIR): Add $(MULTISRCTOP).
- (install_to_libdir): Add $(MULTISUBDIR). Call $(MULTIDO).
- * configure.in: Delete call to cfg-ml-com.in. Call config-ml.in
- instead of cfg-ml-pos.in.
- (cross-compile check): Change to test for with_target_subdir.
- (EXTRA_LINKS): Delete.
-
-Sun Nov 12 12:13:04 1995 Stan Shebs <shebs@andros.cygnus.com>
-
- * mpw-make.sed: Add getpagesize.c.o to needed-list.
- * mpw.c [USE_MW_HEADERS]: Conditionalize compiling of
- functions that are supplied by Metrowerks libraries.
- (fstat): Clean up descriptor->pointer conversion code.
- (InstallConsole, etc): Empty definitions, for when linking
- with SIOUX.
-
-Sun Nov 5 19:25:27 1995 Per Bothner <bothner@kalessin.cygnus.com>
-
- * Makefile.in (FLAGS_TO_PASS): Also pass PICFLAGS.
- (.c.o): Stylistic change.
-
-Thu Nov 2 12:06:29 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * strtol.c, strtoul.c: Don't include <stdlib.h>. From
- phdm@info.ucl.ac.be (Philippe De Muyter).
-
-Wed Nov 1 11:59:36 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * configure.in: Correct sed call.
-
-Mon Oct 30 13:03:45 1995 Per Bothner <bothner@kalessin.cygnus.com>
-
- * configure.in: Clean up / simplify for native.
-
- * configure.in: Merge in stuff from ../xiberty/configure.in.
- * Makefile.in (CC): Add definition (so it can be overrridden
- by ../configure).
-
-Tue Oct 24 17:57:27 1995 Stan Shebs <shebs@andros.cygnus.com>
-
- * mpw-make.sed: Leave strerror.c.o in standard list of functions.
- * mpw.c (R_OK, ENOENT, EACCESS, ENOSYS): Remove.
- (link): Remove useless definition with error return.
- (last_microseconds, warn_if_spin_delay, record_for_spin_delay):
- Use UnsignedWide type for microsecond counts.
-
-Thu Oct 19 10:52:07 1995 Michael Meissner <meissner@wogglebug.tiac.net>
-
- * memcmp.c (memcmp): Argument types are const void *, not void
- *const.
-
- * strncasecmp.c (strncasecmp): Include ansidecl.h/stdarg.h, not
- sys/types.h.
- * strcasecmp.c (strcasecmp): Ditto.
-
-Tue Oct 10 11:03:24 1995 Fred Fish <fnf@cygnus.com>
-
- * Makefile.in (BISON): Remove macro.
-
-Tue Sep 26 15:06:46 1995 Stan Shebs <shebs@andros.cygnus.com>
-
- * Makefile.in (HFILES): Add default empty definition.
- * mpw-config.in (config.h): Only update if changed.
- * mpw-make.in: Remove.
- * mpw-make.sed: New file, edits Makefile.in into MPW makefile.
- * mpw.c: Remove semi-clone of strerror code.
- (sys_nerr, sys_errlist): Define here.
- (Microseconds): Only define as A-line trap if m68k Mac.
-
-Wed Sep 20 12:53:32 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.in (maintainer-clean): New synonym for distclean.
-
-Mon Aug 28 19:47:52 1995 Per Bothner <bothner@kalessin.cygnus.com>
-
- * config.table: For host, generalize rs6000-ibm-aix*
- to *-ibm-aix* so we also include powerpc.
-
-Tue Aug 22 03:18:05 1995 Ken Raeburn <raeburn@kr-laptop.cygnus.com>
-
- Fri Jun 16 18:35:40 1995 Pat Rankin (rankin@eql.caltech.edu)
-
- * xstrerror.c: New file.
- * Makefile.in, vmsbuild.com: Compile it.
-
-Mon Jul 31 12:16:32 1995 steve chamberlain <sac@slash.cygnus.com>
-
- * config.table (i386-*-win32): New.
-
-Fri Jul 21 11:35:52 1995 Doug Evans <dje@canuck.cygnus.com>
-
- * Makefile.in (MULTITOP): New variable.
- (MULTIDIRS, MULTISUBDIR, MULTIDO, MULTICLEAN): Likewise.
- (all): Add multilib support.
- (install_to_tooldir, *clean): Likewise.
-
-Mon Jul 10 11:47:27 1995 Ken Raeburn <raeburn@cygnus.com>
-
- * makefile.dos (OBJS): Add hex.o. From DJ Delorie.
-
-Fri Jun 30 17:28:59 1995 Pat Rankin (rankin@eql.caltech.edu)
-
- * vmsbuild.com: create "new-lib.olb", build libiberty under that
- name, and then make it become "liberty.olb" when done, so that an
- incomplete build attempt never leaves behind something which looks
- like a complete library.
-
-Thu Jun 29 00:22:02 1995 Steve Chamberlain <sac@slash.cygnus.com>
-
- * config/mh-i386pe: New file for PE hosts.
- * config.table: Understand PE hosts.
-
-Wed Jun 28 19:13:23 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * cplus-dem.c: Update from gcc.
-
- * argv.c, dummy.c: If __STDC__, #include "alloca-conf.h" after
- <stddef.h>.
- * alloca-norm.h: If __STDC__, declare alloca with its parameter.
-
-Thu Jun 22 18:57:47 1995 Stan Shebs <shebs@andros.cygnus.com>
-
- * mpw-make.in (ALL_CFLAGS): Define NEED_basename.
- * mpw.c: Only test DebugPI once whenever printing debug info.
- (mpwify_filename): If filename is /tmp/foo, change it into :_foo,
- also fix to not write on input filename buffer.
- (mpw_access): Use stat() instead of open(), works for directories
- as well as files.
-
-Mon Jun 19 00:33:22 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * Makefile.in: Massage broken shells that require 'else true'.
-
-Sat Jun 17 23:21:58 1995 Fred Fish <fnf@cygnus.com>
-
- * alloca-norm.h: Declare alloca as type "PTR" to match functions.def.
- Declare __builtin_alloca in the sparc case, as argv.c did.
- * argv.c: Replace inline version of alloca-norm.h at start of file with
- a #include of alloca-conf.h. Precede it with an include of ansidecl.h
- because alloca-norm.h needs to declare alloca as "PTR".
-
-Mon Jun 12 14:24:26 1995 Steve Chamberlain <sac@slash.cygnus.com>
-
- * win32.c: New file.
-
-Fri Jun 9 15:16:14 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * dummy.c: #include "alloca-conf.h".
-
-Wed Jun 7 11:46:23 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * Makefile.in (mostlyclean): Remove stamp-picdir.
- (clean): Don't.
-
-Mon Jun 5 18:46:06 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * config.table (frags): Use toplevel pic frags.
-
- * Makefile.in (PICFLAG): New macro.
- (all): Depend on stamp-picdir.
- (needed-list): Ditto.
- (.c.o): Also build pic object.
- (stamp-picdir): New rule.
- (mostlyclean): Remove pic.
- (clean): Remove stamp-picdir.
-
-Fri Mar 24 16:55:48 1995 Pat Rankin (rankin@eql.caltech.edu)
-
- * vmsbuild.com (config.h): Add `#define NEED_basename'.
-
-Tue May 23 10:12:46 1995 Per Bothner <bothner@kalessin.cygnus.com>
-
- * clock.c, getopt.c, strtod.c, vsprintf.c: Change from using LGPL
- to libio-style copyright.
- * getpagesize.c: Remove FSF copyright.
-
-Sat May 20 12:30:23 1995 Ken Raeburn <raeburn@kr-laptop.cygnus.com>
-
- Added improved VMS support from Pat Rankin:
-
- Fri Mar 17 18:40:36 1995 Pat Rankin (rankin@eql.caltech.edu)
-
- * vmsbuild.com: new file.
-
- * getpagesize.c (getpagesize): implement for VMS;
- * strerror.c (strerror, strerrno, strtoerrno): add rudimentary
- support for EVMSERR.
-
-Thu May 18 17:01:42 1995 Ken Raeburn <raeburn@kr-laptop.cygnus.com>
-
- Wed May 10 14:28:16 1995 Richard Earnshaw (rearnsha@armltd.co.uk)
-
- * floatformat.c (floatformat_arm_ext): Define.
-
-Tue May 16 13:30:59 1995 Per Bothner <bothner@kalessin.cygnus.com>
-
- * basename.c, bcmp.c, getcwd.c, insque.c, rename.c, sigsetmask.c,
- strerror.c, strsignal.c: Remove FSF copyright.
- * sigsetmask.c: #include <sys/types.h> - seems to be needed by ISC.
-
-Mon May 15 19:53:17 1995 Per Bothner <bothner@kalessin.cygnus.com>
-
- * bcopy.c, bzero.c, memcmp.c, memcpy.c, memset.c, strchr.c,
- strrchr.c, strstr.c, vfork.c: Remove FSF Copyright, because this
- might contaminate libstdc++ with the LGPL. (OK'd by RMS 11 Oct 94.)
- * strchr.c, strrchr.c: Add cast to suppress const warning.
-
-Thu May 4 14:36:42 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * cplus-dem.c: Use const instead of CONST. Don't include
- ansidecl.h directly.
-
-Wed Apr 19 01:30:27 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * cplus-dem.c: Don't include libiberty.h. Do declare xmalloc and
- xrealloc.
- (-DMAIN): Don't rely on an externally-defined version number;
- instead, require the version number to be defined as a
- preprocessor macro. Handle the RS/6000 leading dot. Define
- xmalloc, xrealloc and fatal. Don't strip a leading underscore
- if we couldn't demangle the word.
-
-Tue Apr 4 13:03:51 1995 Stan Shebs <shebs@andros.cygnus.com>
-
- (Old mpw.c change descriptions retained for informational value.)
- * mpw.c (warning_threshold): Default to .4 sec.
- (overflow_count, current_progress): New globals.
- (warn_if_spin_delay): Include current progress type,
- such as program name, in message.
- (mpw_start_progress): Set current_progress variable from arg.
- (mpw_end_progress): Report spin delays by power-of-two-size
- buckets instead of constant-size buckets.
-
- * mpw.c: Clean up formatting, types, returns, etc.
- (ENOSYS): Define.
- (mpw_fread, mpw_fwrite): Define.
- (sleep): Define correctly.
-
- * mpw.c: New code to implement cursor spinning support.
- (umask): New function.
- (mpw_fopen, mpw_fseek, stat, fstat): Call PROGRESS.
-
- * mpw.c (mpw_basename, mpw_mixed_basename): New functions, find
- basenames for MPW and MPW/Unix filenames.
- (mpw_special_init): New function, calls Macsbug if desired.
-
- * mpw.c: Add GPL notice.
- (mpwify_filename): Add more transformations.
- (mpw_fopen): Call mpwify_filename on file names.
- (rename): Remove.
- (chdir, getcwd): Add simple definitions.
-
- * mpw.c: Random cleanups, remove unused code bits.
- Added copy of strerror.c for gcc's use.
- (stat, fstat, _stat): New versions based on Guido van Rossum code.
-
- * mpw.c (mpw_fseek): Make it work correctly when doing SEEK_CUR.
-
- * mpw.c (stat): Remove hack definition, get from sys/stat.h.
- (fork, vfork, etc): Print error messages if called.
- (getrusage, sbrk, environ, isatty, link, utime, mkdir, rmdir,
- rename, chown): Define.
-
- * mpw-config.in: New file, MPW version of configure.in.
- * mpw-make.in: New file, MPW version of Makefile.in.
- * mpw.c: New file, MPW compatibility routines.
-
-Fri Mar 24 14:10:30 1995 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * basename.c: Include config.h before checking for NEED_basename.
-
-Thu Mar 23 19:09:54 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * functions.def: Add DEFFUNC for basename.
-
- * basename.c: Only define basename if NEED_basename.
-
-Thu Mar 16 13:36:05 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * config.table: Fix --enable-shared logic for native builds.
-
-Mon Mar 13 11:05:11 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * cplus-dem.c (demangle_template): Demangle bool literals properly.
-
-Mon Mar 6 23:57:28 1995 Stu Grossman (grossman@cygnus.com)
-
- * strtol.c strtoul.c: Replace these with less buggy versions from
- NetBSD. (strtoul in particular couldn't handle base 16.)
-
-Wed Mar 1 15:59:01 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * config/mt-vxworks5 (HDEFINES): Define NO_SYS_PARAM_H.
-
- * clock.c: If NO_SYS_PARAM_H is defined, don't include
- <sys/param.h>.
- * getcwd.c, getpagesize.c, getruntime.c: Likewise.
-
-Fri Feb 17 15:40:55 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * getruntime.c (get_run_time): Don't assume that CLOCKS_PER_SEC is
- a number; ANSI appears to permit any expression, including a
- function call.
-
- * config.table (*-*-vxworks5*): Use mt-vxworks5 when configuring
- xiberty.
- * config/mt-vxworks5: New file.
-
-Thu Feb 9 14:19:45 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * basename.c (basename): Change argument to be const.
-
-Wed Feb 8 18:06:52 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * Makefile.in (lneeded-list): Don't worry about xmalloc.
-
-Sun Jan 15 00:40:36 1995 Jeff Law (law@snake.cs.utah.edu)
-
- * Makefile.in (distclean): Delete xhost-mkfrag.
-
-Thu Jan 12 16:54:18 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * Makefile.in (lneeded-list): If alloca.o is needed, so is xmalloc.o.
-
-Wed Jan 11 22:39:56 1995 Ken Raeburn <raeburn@cujo.cygnus.com>
-
- * hex.c: New file.
- * Makefile.in (REQUIRED_OFILES, CFILES): List it.
- (hex.o): Add dependencies.
-
- * cplus-dem.c (demangle_prefix): For GNU style constructor and
- destructor names, try demangling the remainder of the string.
-
-Wed Dec 28 00:49:15 1994 Ian Lance Taylor <ian@tweedledumb.cygnus.com>
-
- * vasprintf.c (int_vasprintf): New static function.
- (vasprintf): Use int_vasprintf. Removes assumption that va_list
- is assignment compatible.
-
-Sat Nov 5 19:29:12 1994 Jason Merrill (jason@phydeaux.cygnus.com)
-
- * Makefile.in (LIBCFLAGS): New variable.
- (FLAGS_TO_PASS): Pass it.
- (.c.o): Use it.
-
-Thu Nov 3 19:09:47 1994 Ken Raeburn <raeburn@cujo.cygnus.com>
-
- * getopt.c, getopt1.c: Do compile these functions under Linux,
- since many native versions are based on glibc but are buggy.
-
-Mon Oct 24 15:16:46 1994 Per Bothner <bothner@kalessin.cygnus.com>
-
- * vasprintf.c: Make 'format' arg be const, to avoid a mismatch
- with prototype in GNU libc. Support stdarg.h as well as varargs.h.
-
-Tue Oct 11 17:48:27 1994 Jason Merrill (jason@phydeaux.cygnus.com)
-
- * Makefile.in (REQUIRED_OFILES): Add vasprintf.o.
- * functions.def: Remove vasprintf.
-
-Wed Sep 14 17:04:55 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
-
- * xmalloc.c (first_break): New static variable.
- (xmalloc_set_program_name): Record sbrk (0) in first_break.
- (xmalloc): If memory allocation fails, try to report how much
- memory was allocated by the program up to this point.
- (xrealloc): Likewise.
-
-Sun Sep 04 17:58:10 1994 Richard Earnshaw (rwe@pegasus.esprit.ec.org)
-
- * Makefile.in (ERRORS_CC): New variable, defaulted to $(CC). Use it
- when linking dummy.
- * config.table: Add host RISCiX Makefile frag.
- * config/mh-riscix: New file.
-
-Thu Aug 25 17:29:44 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
-
- * Makefile.in (FLAGS_TO_PASS): Define.
- ($(RULE1)): Use $(FLAGS_TO_PASS).
-
-Wed Aug 24 17:08:47 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
-
- * vasprintf.c: Include <string.h>.
- (vasprintf): Add casts to void for va_arg to avoid gcc warnings.
- * xatexit.c: Declare malloc.
-
-Fri Aug 19 15:29:12 1994 Kung Hsu (kung@mexican.cygnus.com)
-
- * cplus-dem.c (demangle_args): Fix a bug in previous patch (the
- one below).
-
-Thu Aug 18 14:37:14 1994 Kung Hsu (kung@mexican.cygnus.com)
-
- * cplus-dem.c (demangle args): Handle ARM repeat encoding where
- the type index is greater than 9.
-
-Wed Aug 17 16:13:49 1994 Kung Hsu (kung@mexican.cygnus.com)
-
- * cplus-dem.c (demangle_qualified): accept optional '_' between
- qualified name. This is baecause the template name may end with
- numeric and can mixed up with the length of next qualified name.
-
-Wed Aug 3 05:52:14 1994 D. V. Henkel-Wallace (gumby@cygnus.com)
-
- * config/mt-sunos4: Use our standard location for cross-includes
- and cross-libs when the target is also a "host" environment (ie no
- newlib; includes and such don't belong to us). This is specific
- to the Cygnus Support environment.
-
-Tue Aug 2 15:25:12 1994 Kung Hsu (kung@mexican.cygnus.com)
-
- * cplus-dem.c (demangle_template): demangle as xxx<'Q'> not
- xxx<ch=81>.
-
-Mon Aug 1 17:02:48 1994 Kung Hsu (kung@mexican.cygnus.com)
-
- * cplus-dem.c (main): flush stdout to make pipe work.
-
-Sat Jul 16 12:56:32 1994 Stan Shebs (shebs@andros.cygnus.com)
-
- * config.table (*-*-cxux7*): Recognize.
- * floatformat.c (floatformat_m88110_ext) [HARRIS_FLOAT_FORMAT]:
- Harris-specific float format.
- * config/mh-cxux7: New file.
-
-Wed Jun 29 00:26:17 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
-
- * cplus-dem.c (demangle_template): Make sure that the result of
- consume_count doesn't index beyond the end of the string.
-
-Mon Jun 20 23:54:37 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
-
- * cplus-dem.c (gnu_special): Handle vtable mangling of gcc-2.4.5 and
- earlier. Improve test for new vtable mangling. Change output back
- to `virtual table'.
-
-Mon Jun 20 11:37:30 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
-
- * obstack.c: Always compile this code, even if using the GNU
- library. Avoids problems with relatively recent binary
- incompatibility.
-
-Thu Jun 16 17:54:01 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * cplus-dem.c: Include libiberty.h.
- (xmalloc, xrealloc, free): Don't declare.
- (strstr): Don't declare parameters.
- (xmalloc, xrealloc): Don't define.
- (long_options): Add no-strip-underscores.
- (main): Call xmalloc_set_program_name. Pass n in short options to
- getopt_long. Handle option 'n' to not strip underscores.
- (usage): Mention -n and --no-strip-underscores.
-
-Sun Jun 12 01:37:09 1994 Jason Merrill (jason@deneb.cygnus.com)
-
- * cplus-dem.c (demangle_template): Separate consecutive >'s with a
- space.
- (gnu_special): Demangle template and qualified names in a vtable name.
-
-Fri May 27 12:27:52 1994 Ken Raeburn (raeburn@cujo.cygnus.com)
-
- From gas-2.3 and binutils-2.4 net releases:
-
- Wed May 11 22:32:00 1994 DJ Delorie (dj@ctron.com)
-
- * makefile.dos: [new] Makefile for dos/go32
- * configure.bat: update for latest files
- * msdos.c: remove some functions now in libc.a
-
-Fri May 20 18:53:32 1994 Per Bothner (bothner@kalessin.cygnus.com)
-
- * cplus-dem.c (gnu_special): Recognize thunks, as well as
- the new naming style for vtables (when -fvtable-thunks).
-
-Wed May 18 13:34:06 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * Makefile.in (XTRAFLAGS): Don't define.
- (.c.o, dummy.o): Don't use XTRAFLAGS.
- ($(RULE1)): Don't pass XTRAFLAGS down in recursive call.
-
-Fri May 13 16:02:12 1994 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * vasprintf.c: New file.
- * Makefile.in, functions.def: Add it.
-
-Fri May 13 16:20:28 1994 Jason Merrill (jason@deneb.cygnus.com)
-
- * cplus-dem.c (demangle_fund_type): Grok bool.
-
-Fri May 6 14:44:21 1994 Steve Chamberlain (sac@cygnus.com)
-
- * config.table: Add go32
- * config/mh-go32: New template.
-
-Fri May 6 11:01:59 1994 D. V. Henkel-Wallace (gumby@rtl.cygnus.com)
-
- * config.table, config/mt-sunos4: config for when sun4 is cross target.
-
-Mon Apr 11 00:54:33 1994 Richard Stallman (rms@mole.gnu.ai.mit.edu)
-
- * getopt.c [not __GNU_LIBRARY__] [__GCC__] [not __STDC__]:
- Declare strlen to return int. Don't include stddef.h.
-
-Fri Apr 1 00:38:17 1994 Jim Wilson (wilson@mole.gnu.ai.mit.edu)
-
- * getopt.c: Delete use of IN_GCC to control whether
- stddef.h or gstddef.h is included.
-
-Thu Apr 14 14:00:56 1994 Kung Hsu (kung@mexican.cygnus.com)
-
- * cplus-dem.c (demangle_signature): Fix a bug in template function
- type numbering.
-
-Wed Apr 13 17:23:03 1994 Kung Hsu (kung@mexican.cygnus.com)
-
- * cplus-dem.c (demangle_signature): Fix template function with arm
- style argument type number, Tn.
-
-Wed Apr 13 17:11:15 1994 Jason Merrill (jason@deneb.cygnus.com)
-
- * cplus-dem.c (optable): Add new[] and delete[].
-
-Fri Apr 8 11:21:42 1994 Jim Kingdon (kingdon@deneb.cygnus.com)
-
- * argv.c (buildargv): Don't produce empty argument just because
- there is trailing whitespace.
-
-Wed Apr 6 11:42:14 1994 Kung Hsu (kung@mexican.cygnus.com)
-
- * cplus-dem.c (demangle_template): fix 'Q' qualified name bug.
- Handle 'p' same as 'P'.
- * cplus-dem.c (do_type): Handle 'p' same as 'P'.
-
-Sat Mar 26 12:00:13 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
-
- * floatformat.c (get_field, put_field): Fix off by one error in
- little endian case.
-
-Thu Mar 24 10:40:19 1994 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * floatformat.c (floatformat_from_double): Pass unsigned char *,
- not char *, to put_field.
-
-Fri Mar 18 12:34:33 1994 Per Bothner (bothner@kalessin.cygnus.com)
-
- * memmove.c: Re-wrote; placed in public domain.
-
-Wed Mar 16 10:33:07 1994 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * cplus-dem.c (demangle_prefix): If ARM demangling, don't treat
- __Q* as a constructor.
-
-Mon Mar 14 12:26:02 1994 Ian Lance Taylor (ian@cygnus.com)
-
- * ieee-float.c: Removed; no longer used.
- * Makefile.in: Changed accordingly.
-
-Mon Mar 7 12:28:17 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * floatformat.c (get_field): Removed unused local variable i.
- (put_field): Removed unused local variable i.
-
-Sun Feb 27 21:50:11 1994 Jim Kingdon (kingdon@deneb.cygnus.com)
-
- * floatformat.c: New file, intended to replace ieee-float.c.
- * Makefile.in: Change accordingly.
-
-Thu Feb 24 11:51:12 1994 David J. Mackenzie (djm@rtl.cygnus.com)
-
- * getopt.c: Remove #ifdef GETOPT_COMPAT and #if 0 code.
- (_getopt_initialize): New function, broken out of _getopt_internal.
- (_getopt_internal):
- If long_only and the ARGV-element has the form "-f", where f is
- a valid short option, don't consider it an abbreviated form of
- a long option that starts with f. Otherwise there would be no
- way to give the -f short option.
-
-Thu Feb 10 14:44:16 1994 Richard Stallman (rms@mole.gnu.ai.mit.edu)
-
- * getopt.c [not __GNU_LIBRARY__] [__GNUC__] [not IN_GCC]:
- Test just __STDC__, not emacs.
-
-Wed Feb 9 00:14:00 1994 Richard Stallman (rms@mole.gnu.ai.mit.edu)
-
- * getopt.c [not __GNU_LIBRARY__] [__GNUC__] [not IN_GCC]
- [emacs] [not __STDC__]: Don't include stddef.h. Don't declare strlen.
-
-Fri Dec 24 19:43:00 1993 Noah Friedman (friedman@nutrimat.gnu.ai.mit.edu)
-
- * getopt.c (_NO_PROTO): Define before config.h is included.
-
-Mon Sep 20 15:59:03 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu)
-
- * getopt.c, getopt1.c [emacs || CONFIG_BROKETS]: Include
- <config.h> only under these, else "config.h".
-
-Thu Aug 12 18:16:49 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu)
-
- * getopt.c, getopt1.c [HAVE_CONFIG_H]: Include
- <config.h> instead of "config.h".
-
-Sun Feb 20 17:17:01 1994 Ian Lance Taylor (ian@lisa.cygnus.com)
-
- * concat.c: Check ANSI_PROTOTYPES rather than __STDC__ to decide
- whether to use prototypes or not.
- * strerror.c (const): Never undefine; let ansidecl.h handle it.
- * strsignal.c (const): Likewise.
-
-Thu Feb 17 13:27:35 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * xatexit.c (_xexit_cleanup): Declare as extern; don't initialize.
- Merging common and initialized variables need not be supported by
- ANSI C compilers.
- (xatexit): Initialize _xexit_cleanup if not already set.
- * xexit.c: Comment fix.
-
-Wed Feb 16 01:15:36 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * xmalloc.c: Don't declare xexit; it's declared in libiberty.h.
- (xrealloc): If oldmem is NULL, allocate with malloc, rather than
- assuming that realloc works correctly.
-
-Tue Feb 15 09:26:16 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
-
- * concat.c, ieee-float.c: Replace inclusion of <string.h>
- with explicit function declarations, as recommended by Ian Taylor.
-
-Sat Feb 12 10:31:11 1994 David J. Mackenzie (djm@rtl.cygnus.com)
-
- * xmalloc.c (xmalloc, xrealloc): Use PTR and size_t throughout.
- (malloc, realloc): Declare.
-
-Thu Feb 10 17:08:19 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * argv.c, basename.c: Include ansidecl.h and libiberty.h.
- * concat.c, fdmatch.c, getruntime.c, spaces.c: Likewise.
- * strerror.c, strsignal.c, xatexit.c, xexit.c: Likewise.
- * xmalloc.c: Likewise.
- * concat.c: Don't declare xmalloc. If __STDC__, use <stdarg.h>
- macros, not <varargs.h> macros.
- * spaces.c (spaces): Make return type const. Don't crash if
- malloc returns NULL.
- * strerror.c (struct error_info): Make name and msg fields const.
- (error_names): Make const.
- (strerrno): Make const.
- (strtoerrno): Make argument const.
- * strsignal.c (struct signal_info): Make name and msg fields
- const.
- (signal_names, sys_siglist): Make const.
- (strsignal, strsigno): Make const.
- (strtosigno): Make argument const.
- * xatexit.c: Declare parameter types.
- * xmalloc.c (name): Make const.
- (xmalloc_set_program_name): Make argument const.
- * Makefile.in (INCDIR): Define.
- (.c.o): Use $(INCDIR).
- (dummy.o): Likewise.
- (argv.o, basename.o): New targets; depend on libiberty.h.
- (concat.o, fdmatch.o, getruntime.o, spaces.o): Likewise.
- (strerror.o, strsignal.o, xatexit.o, xexit.o): Likewise.
- (xmalloc.o): Likewise.
- (cplus-dem.o): New target; depend on demangle.h.
- (getopt.o, getopt1.o): New targets; depend on getopt.h.
- (ieee-float.o): New target; depend on ieee-float.h.
- (obstack.o): New target; depend on obstack.h.
-
-Tue Feb 8 05:29:08 1994 David J. Mackenzie (djm@thepub.cygnus.com)
-
- Handle obstack_chunk_alloc returning NULL. This allows
- obstacks to be used by libraries, without forcing them
- to call exit or longjmp.
- * obstack.c (_obstack_begin, _obstack_begin_1, _obstack_newchunk):
- If CALL_CHUNKFUN returns NULL, set alloc_failed, else clear it.
- (_obstack_begin, _obstack_begin_1): Return 1 if successful, 0 if not.
-
-Tue Feb 8 00:32:28 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
-
- * concat.c, ieee-float.c: Include <string.h>.
-
-Sun Feb 6 21:28:46 1994 David J. Mackenzie (djm@thepub.cygnus.com)
-
- * xmalloc.c (xmalloc_set_program_name): New function.
- (xmalloc, xrealloc): Include the name in the error message, if set.
-
- * Replace atexit.c with xatexit.c.
- * Makefile.in (CFILES), functions.def: Change references.
-
-Sat Feb 5 14:02:32 1994 Stan Shebs (shebs@andros.cygnus.com)
-
- * getruntime.c (get_run_time): Use getrusage or times if
- HAVE_GETRUSAGE or HAVE_TIMES are defined.
-
-Fri Feb 4 15:49:38 1994 David J. Mackenzie (djm@thepub.cygnus.com)
-
- * atexit.c: New file.
- * Makefile.in (CFILES), functions.def: Add it.
- * xexit.c: New file.
- * Makefile.in (CFILES, REQUIRED_OFILES): Add it.
- * xmalloc.c (xmalloc, xrealloc): Call xexit instead of exit.
- Change request for 0 bytes into request for 1 byte.
-
-Wed Feb 2 11:36:49 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * xmalloc.c (xmalloc, xrealloc): Print size using %lu, and cast to
- unsigned long, to avoid warnings.
-
-Fri Jan 28 17:49:06 1994 Ken Raeburn (raeburn@cujo.cygnus.com)
-
- * dummy.c: Don't include time.h ever; always define clock_t as
- "unsigned long". Until gcc/fixincludes ensures that clock_t
- exists, __STDC__ isn't a sufficient test. And if clock() doesn't
- exist, clock_t probably doesn't either.
-
-Mon Jan 24 11:52:31 1994 Stan Shebs (shebs@andros.cygnus.com)
-
- * clock.c, getruntime.c: New files.
- * Makefile.in: Add to file lists.
- * functions.def (clock): Add to list.
- * dummy.c (time.h): Add if __STDC__.
- (clock_t): #define as "unsigned long" if not __STDC__.
-
-Tue Jan 11 11:27:44 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * strtod.c: Declare atof. From edler@jan.ultra.nyu.edu (Jan
- Edler).
-
-Tue Dec 28 14:17:30 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * Makefile.in (errors): Use CFLAGS as well as LDFLAGS when
- linking.
-
-Fri Dec 17 12:26:07 1993 Kung Hsu (kung@cirdan.cygnus.com)
-
- * cplus-dem.c (demangle_arm_pt): New function. Common code
- for ARM template demangling.
- * cplus-dem.c (demangle_class_name): Use demangle_arm_pt.
- * cplus-dem.c (demangle_prefix): Likewise.
-
-Tue Nov 30 15:47:48 1993 Jason Merrill (jason@deneb.cygnus.com)
-
- * cplus-dem.c (cplus_demangle_opname): Add CONST to please gcc.
-
-Sat Nov 27 11:05:50 1993 Fred Fish (fnf@cygnus.com)
-
- Merge changes from tom@basil.icce.rug.nl (Tom R.Hageman)
- * strerror.c, strsignal.c: As a small space optimization, don't
- include messages when they aren't actually used.
-
- Merge changes from takefive.co.at!joe (Josef Leherbauer)
- * cplus-dem.c (demangle_prefix, demangle_function_name,
- cplus_demangle_opname): Fixes for systems where cplus_marker
- is something other than '$'.
-
-Fri Nov 26 13:51:11 1993 Per Bothner (bothner@kalessin.cygnus.com)
-
- * waitpid.c: Simple-minded approcimation to waitpid
- using vanilla wait.
- * functions.def, Makefile.in: Update accordingly,
-
-Thu Nov 18 18:01:15 1993 Kung Hsu (kung@cirdan.cygnus.com)
-
- * cplus-dem.c(demangle_template): fix bug template instantiation
- with value of user defined type.
-
-Wed Nov 17 18:30:21 1993 Kung Hsu (kung@cirdan.cygnus.com)
-
- * cplus-dem.c(cplus_demangle_opname): add the subject new function
- to support unified search of operator in class.
-
-Wed Nov 10 09:47:22 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- gcc -Wall lint:
- * strtoul.c (strtoul): use "(digit = *s) != '\0'" not just
- "digit = *s" as condition in while loop.
-
-Tue Nov 9 15:52:22 1993 Mark Eichin (eichin@cygnus.com)
-
- * Makefile.in: pass SHELL to recursive make
-
-Thu Nov 4 12:09:26 1993 Per Bothner (bothner@kalessin.cygnus.com)
-
- * vfprintf.c, vprintf.c, vsprintf.c: Make format arg
- be (const char*), for ANSI (and gcc w/fixproto) consistency.
-
-Thu Nov 4 08:29:04 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * config.table: Make *-*-hiux* use mh-hpux.
-
-Fri Oct 22 07:53:15 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * config.table: Add * to end of all OS names.
-
-Tue Oct 19 17:12:01 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com)
-
- * Makefile.in (lneeded-list): ensure that object file names are
- not duplicated, as multiple instances of the same object file in
- a library causes problems on some machines
-
-Mon Oct 18 21:59:28 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * strcasecmp.c, strncasecmp.c: Change u_char to unsigned char.
-
-Fri Oct 15 22:17:11 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com)
-
- * strncasecmp.c: new file, implements strncasecmp
- * strcasecmp.c: new file, implement strcasecmp
-
- * Makefile.in (CFILES): list these two new source files
-
- * functions.def: add strcasecmp and strncasecmp entries
-
-Fri Oct 15 14:53:05 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * strtoul.c (strtoul), strtol.c (strtol): Handle overflow
- according to ANSI C.
-
-Thu Oct 14 16:34:19 1993 Kung Hsu (kung@cirdan.cygnus.com)
-
- * cplus-dem.c: add support of ARM global constructor/destructor,
- and 'G' for passing record or union in parameter.
-
-Wed Oct 13 13:36:19 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * Makefile.in: Fix comment to clarify that stuff in REQUIRED_OFILES
- should not be in functions.def.
-
-Wed Oct 13 13:13:38 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * functions.def: Removed xmalloc. Stuff in REQUIRED_OFILES should
- not be in functions.def.
-
-Mon Oct 4 18:26:39 1993 Kung Hsu (kung@cirdan.cygnus.com)
-
- * cplus-dem.c: change globl constructor/destructor to proper name
-
-Tue Sep 28 18:11:07 1993 Kung Hsu (kung@cirdan.cygnus.com)
-
- * cplus-dem.c: fix bug in constructor/destructor
-
-Tue Sep 28 16:20:49 1993 Kung Hsu (kung@cirdan.cygnus.com)
-
- * cplus-dem.c: support both old and new _vt$... vtbl mangled names
-
-Fri Sep 24 19:07:16 1993 Jason Merrill (jason@deneb.cygnus.com)
-
- * cplus-dem.c: Fix demangle_template prototype
-
-Fri Sep 24 17:32:55 1993 Kung Hsu (kung@cirdan.cygnus.com)
-
- * cplus-dem.c: fix template demangling
- * cplus-dem.c: fix const type demangling
- * cplus-dem.c: fix constructor/destructor, virtual table,
- qualifier, global constructor/destructor demangling
-
-Wed Sep 1 23:13:11 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * strsignal.c, strerror.c: Use fully-bracketed initializer to
- keep gcc -Wall happy.
-
-Fri Aug 27 10:30:09 1993 Jason Merrill (jason@deneb.cygnus.com)
-
- * cplus-dem.c (do_type): Add CONSTS to make gcc happy with last
- patch.
-
-Fri Aug 27 11:24:54 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- Patch from Paul Flinders:
- * cplus-dem.c (do_type): Deal with arrays.
-
-Tue Aug 24 14:23:50 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * cplus-dem.c (demangle_qualified: Deal with GNU format for more
- than 9 classes.
-
-Wed Aug 18 19:50:29 1993 Jason Merrill (jason@deneb.cygnus.com)
-
- * Makefile.in (dummy.o): Redirect to /dev/null to avoid "variable
- not initialized" warnings under HP/UX
-
-Sun Aug 15 20:42:40 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * strerror.c: Move include of stdio.h after sys_errlist #define.
- Also remove NULL definition (stdio.h always defines NULL, so it
- never did anything but clutter up the code).
-
-Sat Aug 14 14:21:49 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com)
-
- * Makefile.in, functions.def: handle xmalloc.c
-
- * xmalloc.c: provide xmalloc and xrealloc functions
-
-Thu Aug 12 17:38:57 1993 David J. Mackenzie (djm@thepub.cygnus.com)
-
- * cplus-dem.c: Fix a comment.
-
-Sat Aug 7 13:56:35 1993 David J. Mackenzie (djm@thepub.cygnus.com)
-
- * getopt1.c: Declare const the way getopt.c does.
-
-Fri Aug 6 17:03:13 1993 David J. Mackenzie (djm@thepub.cygnus.com)
-
- * obstack.c, alloca.c: Update from FSF.
- * getopt.c, getopt1.c: Update to current FSF version, which
- doesn't use alloca.
-
-Tue Jul 27 14:03:57 1993 Brendan Kehoe (brendan@lisa.cygnus.com)
-
- * Makefile.in (demangle): Add the target with a message saying
- where demangle went.
-
-Mon Jul 26 15:49:54 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * Makefile.in: Remove obsolete `demangle' target.
-
-Thu Jul 22 08:31:01 1993 Fred Fish (fnf@deneb.cygnus.com)
-
- * cplus-dem.c (arm_special): Apply patch from arg@lucid.com to
- avoid infinite loop on vtbl symbols with disambiguating "junk"
- tacked on the end.
-
-Mon Jul 19 14:10:37 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com)
-
- * strsignal.c: work around some systems losing definitions of
- sys_siglist
-
- * config/mh-lynxos: this system has a losing definition of
- sys_siglist
-
- * config.table: use mh-lynxos for *-*-lynxos
-
-Mon Jul 19 17:08:52 1993 Ken Raeburn (raeburn@rtl.cygnus.com)
-
- * config.table: Add support for HPPA BSD hosts.
-
- * config/mh-hpbsd: New file.
-
-Mon Jul 12 18:00:40 1993 K. Richard Pixley (rich@cygnus.com)
-
- * Makefile.in (TAGS): make work when srcdir != objdir.
-
-Sun Jun 27 15:35:31 1993 David J. Mackenzie (djm@thepub.cygnus.com)
-
- * cplus-dem.c (main): Add long options, including --help and
- --version.
- (usage): New function from code in main.
-
-Tue Jun 22 11:37:38 1993 Per Bothner (bothner@deneb.cygnus.com)
-
- * config.table: New shell scipt, sourced by both ./configure,in
- and ../xiberty/configure.in, to avoid maintainance lossages.
- * configure.in and ../xiberty/configure.in: Use config.table.
-
- * configure.in: Don't use mh-aix for AIX 3.2, only for 3.1.
- * configure.in: Map *-*-irix* (except irix4) to mh-sysv.
- * ../xiberty/configure.in: Update from ./configure.in.
-
-Tue Jun 15 17:05:31 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com)
-
- * Makefile.in: remove parentdir support
-
-Wed May 26 12:59:09 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
-
- * cplus-dem.c (xrealloc): Match definition with prototype.
-
-Tue May 25 14:27:51 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
-
- * cplus-dem.c (demangle_prefix): Demangle cfront
- local variables as an extension to ARM demangling.
-
-Fri May 21 09:53:57 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * ieee-float.c: Don't require pointers to double to be aligned.
-
-Tue May 18 17:12:10 1993 Fred Fish (fnf@cygnus.com)
-
- (merge changes from dlong@cse.ucsc.edu)
- * cplus-dem.c (consume_count): Simplify.
- * cplus-dem.c (arm_pt, demangle_class_name): New functions.
- * cplus-dem.c (various): Calls to arm_pt, demangle_class_name.
-
- * cplus-dem.c (xmalloc, xrealloc, strstr): Make extern decls into
- full prototypes.
- * cplus-dem.c (free): Add prototype.
- * cplus-dem.c (optable): Fully bracketize initializer.
-
-Fri May 14 17:13:05 1993 Per Bothner (bothner@cygnus.com)
-
- * cplus-dem.c: Whether initial underscores are stripped
- depends on the external variable prepends_underscore
- (which is generated by the binutils Makefile).
-
-Fri May 14 07:32:20 1993 Ken Raeburn (raeburn@deneb.cygnus.com)
-
- * cplus-dem.c (mop_up, arm_special): Remove some unused variables.
-
-Tue May 4 20:31:59 1993 Fred Fish (fnf@cygnus.com)
-
- * cplus-dem.c (consume_count): Return zero if arg does not
- start with digit, and don't consume any input.
-
-Tue May 4 08:10:28 1993 Jim Kingdon (kingdon@cygnus.com)
-
- * Makefile.in (demangle): Use ${srcdir} not $^.
-
- * strtod.c: New file, needed at least for BSD 4.3.
-
-Sun May 2 11:30:42 1993 Fred Fish (fnf@cygnus.com)
-
- * strsignal.c (sys_siglist): For ANSI compilations, type is
- "const char *const". Also remove conditionalization on __STDC__
- since const is defined away for non-ANSI.
-
-Wed Apr 28 19:29:55 1993 Ken Raeburn (raeburn@deneb.cygnus.com)
-
- * configure.in: Recognize *-*-hpux.
- * config/mh-hpux: New file.
-
-Tue Apr 27 15:22:19 1993 Per Bothner (bothner@cygnus.com)
-
- * tmpnam.c: Added ANSI tmpnam() function.
- * functions.def, Makefile.in: Update accordingly.
-
-Tue Apr 27 13:38:38 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
-
- * cplus-dem.c (demangle_function_name): Get the demangling of
- stop__1A right.
-
-Fri Apr 16 23:48:24 1993 Jim Kingdon (kingdon at calvin)
-
- * cplus-dem.c: Declare strstr return type.
-
-Fri Mar 26 12:01:26 1993 Jim Kingdon (kingdon@cygnus.com)
-
- * strsignal.c: Add some AIX signals.
-
-Thu Mar 25 15:17:23 1993 Ian Lance Taylor (ian@cygnus.com)
-
- * Makefile.in (MAKEOVERRIDES): Define to be empty.
-
-Wed Mar 24 01:59:25 1993 david d `zoo' zuhn (zoo at poseidon.cygnus.com)
-
- * Makefile.in: add installcheck & dvi targets
-
-Thu Mar 18 14:05:44 1993 Per Bothner (bothner@rtl.cygnus.com)
-
- * ieee-float.c: New file, moved from ../gdb (since it is
- needed by ../opcode/m68k-dis.c).
-
-Tue Mar 2 17:47:31 1993 Fred Fish (fnf@cygnus.com)
-
- * cplus-dem.c: Replace all references to cfront with ARM.
-
-Fri Feb 26 00:17:07 1993 Per Bothner (bothner@rtl.cygnus.com)
-
- * cplus-dem.c: Fix main program (when compiled with -DMAIN)
- to be more useful as a filter.
-
-Sat Feb 20 21:41:39 1993 Brendan Kehoe (brendan@lisa.cygnus.com)
-
- * Makefile.in (install_to_libdir, install_to_tooldir): Go into the
- destination directory before running $(RANLIB), in case that
- program tries to create a file in the current directory as part of
- its work.
-
-Thu Feb 18 23:00:19 1993 John Gilmore (gnu@cygnus.com)
-
- * strsignal.c (sys_siglist): Remove yet another *%^&%&$# "const"
- because BSD 4.4 lacks one. Isn't this fun?
-
-Thu Feb 18 11:24:25 1993 Fred Fish (fnf@cygnus.com)
-
- * cplus-dem.c (demangle_signature): Set func_done after
- demangling a template.
- * cplus-dem.c (demangle_template): Fix several small bugs
- in demangling GNU style templates.
- * cplus-dem.c (demangle_prefix): Fix for templates in GNU
- style constructors.
- * cplus-dem.c (gnu_special): Fix for templates in GNU style
- static data members.
-
-Tue Feb 16 17:28:35 1993 Fred Fish (fnf@cygnus.com)
-
- * cplus-dem.c (demangle_signature): Modify to include type
- modifiers like static and const in remembered types.
-
-Thu Feb 11 22:20:47 1993 Fred Fish (fnf@cygnus.com)
-
- * cplus-dem.c (demangled_qualified): Add new parameter that tells
- whether to prepend or append the qualifiers.
- * cplus-dem.c (string_prepends): Used now, remove #if 0.
- * cplus-dem.c (demangle_signature): Call demangle_qualified
- with prepending.
- * cplus-dem.c (gnu_special): Recognize static data members that
- use qualified names.
- * cplus-dem.c (demangle_qualified): Accumulate qualifiers in a
- temporary buffer and the prepend or append them to the result,
- as specified by the new "append" flag.
- * cplus-dem.c (do_type): Call demangled_qualified with
- appending.
-
-Mon Dec 28 10:47:19 1992 Ken Raeburn (raeburn@cygnus.com)
-
- * strsignal.c (signal_table): Now const.
- (init_signal_tables): Variable eip now points to const.
-
- * strerror.c (error_table): Now const.
- (init_error_tables): Variable eip now points to const.
-
-Tue Dec 15 15:36:50 1992 Per Bothner (bothner@cygnus.com)
-
- * memchr.c (memchr): New (ANSI standard) function.
- * Makefile.in, functions.def: Added memchr.
- * Makefile.in (AR_FLAGS): Use rc instad of non-standard cq.
-
-Wed Dec 2 22:49:10 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com)
-
- * getopt.c: remove use of USG around <alloca.h>, which never meant
- anything anyway
-
- * config/mh-{aix,apollo68,ncr3000,sysv,sysv4}: removed definitions
- of USG and USGr4
-
-Thu Nov 19 03:09:33 1992 Brendan Kehoe (brendan@lisa.cygnus.com)
-
- * cplus-dem.c (demangle_fund_type): Recognize `w', a wide character;
- it's now a type according to the ANSI X3J16 working paper; output
- "wchar_t" for it.
- (demangle_template): Accept `w' as an integral type.
- (xmalloc, xrealloc): Use `char *', not `PTR'. Cast calls to their
- counterparts malloc and realloc to `char *'.
- (main): Exit with a 0 status.
- * Makefile.in (demangle): Don't expect the user to define
- DEMANGLE, instead force to be cplus-dem.c. Look in $(srcdir)/../include
- for demangle.h. Pass it any HDEFINES or XTRAFLAGS.
-
-Wed Nov 18 18:56:20 1992 John Gilmore (gnu@cygnus.com)
-
- * Makefile.in (AR_FLAGS): Avoid verbosity.
- * config/mh-sysv4: Remove AR_FLAGS override, use INSTALL=cp,
- replace USGr4 with HAVE_SYSCONF.
- * config/mh-solaris: Remove; mh-sysv4 works now.
- * getpagesize.c: Replace USGr4 with HAVE_SYSCONF.
- * configure.in: Simplify host matching table, remove separate
- solaris config file.
-
-Sun Nov 15 09:35:16 1992 Fred Fish (fnf@cygnus.com)
-
- * configure.in (i[34]86-*-solaris2*): Add, use mh-sysv4.
-
-Tue Nov 3 21:27:03 1992 Brendan Kehoe (brendan@cygnus.com)
-
- * cplus-dem.c (xmalloc, xrealloc): Add decls.
- (remember_type): Don't cast xmalloc.
- (string_need): Likewise; don't cast xrealloc either.
-
-Fri Oct 23 08:52:01 1992 Ian Lance Taylor (ian@cygnus.com)
-
- * Makefile.in, functions.defs, rename.c: added simple
- implementation of rename, since some binutils programs use it.
-
-Thu Oct 15 15:18:22 1992 Per Bothner (bothner@cygnus.com)
-
- * strsignal.c: Add appropriate 'const' to sys_siglist
- extern declaration (if __STDC__). (Needed for Linux.)
- * strsignal.c (strsignal): Add cast to remove const-ness.
-
-Fri Oct 9 03:22:55 1992 John Gilmore (gnu@cygnus.com)
-
- * Makefile.in (needed.awk, needed2.awk): Remove erroneous \'s
- before "'s, diagnosed by BSD 4.4 awk.
-
-Thu Oct 8 15:25:12 1992 Ian Lance Taylor (ian@cygnus.com)
-
- * Makefile.in: create config.h and needed-list through $(CONFIG_H)
- and $(NEEDED_LIST), to give some hooks for xiberty.
-
-Thu Oct 1 23:31:42 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com)
-
- * configure.in: use cpu-vendor-triple instead of nested cases
-
-Wed Sep 30 11:26:59 1992 Per Bothner (bothner@rtl.cygnus.com)
-
- * Makefile.in, argv.c, basename.c, bcmp.c, bcopy.c, bzero.c,
- concat.c, cplus-dem.c, fdmatch.c, getcwd.c, getopt.c, getopt1.c,
- getpagesize.c, insque.c, memcmp.c, memcpy.c, memmove.c, memset.c,
- obstack.c, sigsetmask.c, spaces.c, strchr.c, strerror.c,
- strrchr.c, strsignal.c, strstr.c, vfork.c, vsprintf.c:
- Convert from using GPL to LGPL.
-
-Sat Sep 26 04:01:30 1992 John Gilmore (gnu@cygnus.com)
-
- * Makefile.in (errors): Leave dummy.o and dummy around so that
- we can see how the needed list was generated (it's sometimes wrong).
- (mostlyclean): Remove them.
-
-Mon Sep 21 14:50:42 1992 Ian Lance Taylor (ian@cygnus.com)
-
- * getcwd.c: supply a default if MAXPATHLEN is not defined.
-
- * config/mh-irix4: set EXTRA_OFILES to alloca.o, from WRS.
-
-Wed Sep 9 12:41:48 1992 Ian Lance Taylor (ian@cygnus.com)
-
- * Makefile.in: Use XTRAFLAGS when compiling, so that xiberty works
- when cross-compiling.
-
-Thu Sep 3 13:29:39 1992 K. Richard Pixley (rich@sendai.cygnus.com)
-
- * cplus-dem.c: (demangle_prefix): reduction in strength of strstr
- as a time optimization.
-
- * cplus-dem.c (cplus_demangle): remove strpbrk test. Appears to
- be more expensive than simply demangling.
-
- * cplus-dem.c (cplus_match): new function.
-
-Tue Sep 1 15:24:04 1992 Per Bothner (bothner@rtl.cygnus.com)
-
- * cplus-dem.c: #include <stdio.h>, to define NULL.
- Define current_demangling_style.
-
-Sun Aug 30 17:58:19 1992 Per Bothner (bothner@rtl.cygnus.com)
-
- * cplus-dem.c: New file, moved from ../gdb.
- * cplus-dem.c (set_cplus_marker_for_demangling): New exported
- function, to avoid compiling in target-dependency for CPLUS_MARKER.
- * cplus-dem.c (cplus_demangle): Allow demangling style option
- to be passed as a parameter, but using the global variable
- current_demangling_style as a default.
- * Makefile.in: Update for cplus-dem.c
-
-Sat Aug 29 10:44:09 1992 Fred Fish (fnf@cygnus.com)
-
- * obstack.c: Merge in comment changes from FSF version. Now
- matches the FSF version exactly.
-
-Fri Aug 28 18:39:08 1992 John Gilmore (gnu@cygnus.com)
-
- * obstack.c (CALL_FREEFUN): Can't use ?: with void values (at
- least on losing DECstations!); use if-then-else instead.
-
-Wed Aug 19 14:40:34 1992 Ian Lance Taylor (ian@cygnus.com)
-
- * Makefile.in: always create installation directories.
-
-Mon Aug 10 17:33:40 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com)
-
- * Makefile.in: clean up definition of CFILES, more comments
-
-Sat Aug 8 23:10:59 1992 Fred Fish (fnf@cygnus.com)
-
- * getopt.c (my_index): Make first arg const to match strchr,
- which it sometimes is remapped to.
-
-Sat Aug 1 13:48:50 1992 Fred Fish (fnf@cygnus.com)
-
- * obstack.c (DEFAULT_ALIGNMENT): Update to match FSF version.
- * obstack.c (_obstack_begin): Initialize use_extra_arg.
- * obstack.c (_obstack_begin_1): New, from FSF version.
-
-Mon Jul 20 21:07:58 1992 Fred Fish (fnf@cygnus.com)
-
- * obstack.c (CALL_CHECKFUN, CALL_FREEFUN): Use use_extra_arg and
- extra_arg.
- * obstack.c (_obstack_begin): Remove area_id and flags arguments
- (previously added for mmalloc support, interface has changed).
- Also convert flags usage to use use_extra_arg and maybe_empty_object.
-
-Fri Jul 10 00:41:53 1992 Fred Fish (fnf@cygnus.com)
-
- * argv.c: Move expandargv inline and eliminate static variables.
- Rewrite to always allocate in powers of two. Fix to return an
- argv with a single null string arg if passed a null string.
-
-Fri Jul 3 20:27:29 1992 Fred Fish (fnf@cygnus.com)
-
- * random.c, sigsetmask.c, strerror.c, strsignal.c: Remove
- "(void)" casts from function calls where the return value is
- ignored, in accordance with GNU coding standards.
-
-Mon Jun 29 10:54:19 1992 Fred Fish (fnf at cygnus.com)
-
- * bcopy.c, strerror.c, strsignal.c: Lint.
-
-Thu Jun 25 09:18:41 1992 K. Richard Pixley (rich@rtl.cygnus.com)
-
- * getopt.c: merge changes from make.
-
-Thu Jun 25 04:43:22 1992 John Gilmore (gnu at cygnus.com)
-
- * alloca.c: Incorporate fixes from gdb/alloca.c.
- FIXME: Eventually move gdb's alloca configuration files here,
- and remove gdb/alloca.c and its Makefile.in support.
-
-Tue Jun 23 21:56:30 1992 Fred Fish (fnf@cygnus.com)
-
- * dummy.c: Define NOTHING to /*nothing*/, change return type
- of main to int and return zero.
- * functions.def: Supply NOTHING as the fourth arg to macros
- that don't have an explicit arg, to satisfy picky preprocessors.
-
-Wed Jun 17 18:13:58 1992 Per Bothner (bothner@rtl.cygnus.com)
-
- * Makefile.in: Clean up *clean rules, as per standards.texi.
-
-Tue Jun 16 16:11:59 1992 K. Richard Pixley (rich@rtl.cygnus.com)
-
- * getopt.c, getopt1.c: merged largely gratuitous, mostly
- whitespace diffs from other prep distributions.
-
-Mon Jun 15 12:25:46 1992 Fred Fish (fnf@cygnus.com)
-
- * config/mh-ncr3000 (INSTALL): Don't use /usr/ucb/install,
- it is broken on ncr 3000's.
-
-Mon Jun 15 01:03:26 1992 John Gilmore (gnu at cygnus.com)
-
- * sigsetmask.c: Rewrite. Old one was very confused about its
- arguments and result. New one can't do much, but at least knows
- what it can't do, and it's good enough for GDB's use.
-
-Sun Jun 14 15:17:40 1992 Stu Grossman (grossman at cygnus.com)
-
- * functions.def: Use proper prototype for strtoul.
-
-Fri Jun 12 19:22:40 1992 John Gilmore (gnu at cygnus.com)
-
- * Makefile.in: Add random.c.
- * config/mh-*: Use "true" rather than "echo >/dev/null" for ranlib.
- * configure.in: update solaris2 config.
-
-Wed Jun 10 16:31:29 1992 Fred Fish (fnf@cygnus.com)
-
- * random.c: Add for random() and srandom().
- * functions.def: Add random
-
-Tue Jun 9 17:27:18 1992 Fred Fish (fnf@cygnus.com)
-
- * config/{mh-ncr3000, mh-sysv4}: Add definition for INSTALL
- using /usr/ucb/install.
-
-Mon Jun 1 13:20:17 1992 Per Bothner (bothner@rtl.cygnus.com)
-
- * strerror.c: Kludge to guard against a conflict with
- possible declaration of sys_errlist in errno.h.
-
-Sun May 31 15:07:47 1992 Mark Eichin (eichin at cygnus.com)
-
- * configure.in, config/mh-solaris: add solaris2 config support.
-
-Fri May 29 17:23:23 1992 Per Bothner (bothner@rtl.cygnus.com)
-
- * sigsetmask.c: #ifdef out sigsetmask if SIG_SETMASK
- is not defined (should be defined in signal.h, says Posix.).
-
-Mon May 18 17:35:04 1992 K. Richard Pixley (rich@cygnus.com)
-
- * getopt.c: merged changes from make-3.62.11.
-
-Fri May 8 14:53:07 1992 K. Richard Pixley (rich@cygnus.com)
-
- * getopt.c: merged changes from bison-1.18.
-
-Tue May 5 11:51:40 1992 Per Bothner (bothner@rtl.cygnus.com)
-
- * Makefile.in: Don't have $(EXTRA_OFILES) depend on config.h,
- since that introduces a circular dependency.
- ($(EXTRA_OFILES) are used to build config.h.)
-
- * strtoul.c: Fixes to handle non-decimal bases better.
-
-Wed Apr 22 09:27:51 1992 Fred Fish (fnf@cygnus.com)
-
- * config/mh-ncr3000: Replace MINUS_G with CFLAGS.
- * Makefile.dos: Finish MINUS_G eradication.
- * Makefile.in (CFILES): Add strsignal.c.
- * Makefile.in (REQUIRED_OFILES): Add strerror.o strsignal.o
- * Makefile.in (needed-list): Split creation of errors file to
- separate make target.
- * Makefile.in (config.h, needed2.awk, errors): New targets.
- * Makefile.in (clean): Split to multiple lines, add needed2.awk
- and config.h.
- * dummy.c (DEFFUNC, DEFVAR): Add defines and undefs.
- * functions.def (strerror): Remove from optional list.
- * functions.def (sys_nerr, sys_errlist, sys_siglist): DEFVAR's
- * functions.def (strerror, psignal): DEFFUNC's
- * strerror.c: Rewrite from scratch to use sys_errlist only if
- available, add errno_max(), add strerrno(), add strtoerrno(),
- add test driver.
- * strsignal.c: New file, signal equivalent to strerror.c.
- Uses sys_siglist if available, defines signo_max(), strsignal(),
- strsigno(), strtosigno(), psignal(), and test driver.
-
-Mon Apr 20 20:49:32 1992 K. Richard Pixley (rich@cygnus.com)
-
- * Makefile.in: do not print recursion line.
-
- * Makefile.in: allow CFLAGS to be passed in from command line.
- Removed MINUS_G. Default CFLAGS to -g.
-
-Mon Apr 20 12:57:46 1992 Per Bothner (bothner@rtl.cygnus.com)
-
- * config/mh-aix: New. EXTRA_OFILES lists copysign.o,
- so libg++ users don't have to be inconvenienced by a
- libc.a bug (libc.a needs copysign, but doesn't define it!).
- * configure.in: Use config/mh-aix.
- * strtoul.c: Handle '-' as required by ANSI.
- Clean up radix handling.
- * strstr.c: Fix buggy algorithm.
- * Makefile.in: Change so that ${EXTRA_OFILES} is
- appended to needed-list (which is used by libg++).
-
-Fri Apr 10 22:51:41 1992 Fred Fish (fnf@cygnus.com)
-
- * configure.in: Recognize new ncr3000 config.
- * config/mh-ncr3000: New config file.
-
-Wed Apr 1 23:31:43 1992 John Gilmore (gnu at cygnus.com)
-
- * argv.c, dummy.c: Lint.
-
-Tue Mar 31 18:46:44 1992 Fred Fish (fnf@cygnus.com)
-
- * config/mh-sysv4: New config file.
- * configure.in (host_makefile_frag): Set to config/mh-sysv4 for
- host_os == sysv4.
- * getpagesize.c: For SVR4, use sysconf(_SC_PAGESIZE) to get
- pagesize.
-
-Sun Mar 29 12:26:42 1992 John Gilmore (gnu at cygnus.com)
-
- * getopt.c: Lint.
-
-Fri Mar 27 08:32:55 1992 Fred Fish (fnf@cygnus.com)
-
- * functions.def (alloca): Fix return type and args to avoid
- type clash with gcc's builtin alloca.
-
-Tue Mar 24 23:33:42 1992 K. Richard Pixley (rich@cygnus.com)
-
- * configure.in, config/mh-irix4: irix4 support.
-
- * Makefile.in, functions.def, alloca.c: added alloca.
-
-Tue Mar 24 17:34:46 1992 Stu Grossman (grossman at cygnus.com)
-
- * obstack.c (CALL_FREEFUN): Make it compile on DECstations.
-
-Thu Mar 19 13:57:42 1992 Fred Fish (fnf@cygnus.com)
-
- * argv.c: Fix various external function definitions to be
- correct in an ANSI compilation environment.
-
-Sat Mar 14 17:28:17 1992 Fred Fish (fnf@cygnus.com)
-
- * obstack.c: Changes to support calling mmalloc functions,
- which take an additional argument over malloc functions.
-
-Fri Mar 6 22:01:10 1992 K. Richard Pixley (rich@cygnus.com)
-
- * added check target.
-
-Thu Feb 27 22:19:39 1992 Per Bothner (bothner@cygnus.com)
-
- * argv.c: #include alloca-conf.h (needed by AIX).
-
-Wed Feb 26 18:04:40 1992 K. Richard Pixley (rich@cygnus.com)
-
- * Makefile.in, configure.in: removed traces of namesubdir,
- -subdirs, $(subdir), $(unsubdir), some rcs triggers. Forced
- copyrights to '92, changed some from Cygnus to FSF.
-
-Sat Feb 22 01:09:21 1992 Stu Grossman (grossman at cygnus.com)
-
- * argv.c: Check in Fred's version which fixes problems with
- alloca().
-
-Fri Feb 7 21:46:08 1992 Stu Grossman (grossman at cygnus.com)
-
- * makefile.dos: Remove NUL to keep patch from failing.
-
-Thu Jan 30 22:48:41 1992 Stu Grossman (grossman at cygnus.com)
-
- * getopt.c (_getopt_internal): Fix usage of enum has_arg.
-
-Mon Jan 20 18:53:23 1992 Stu Grossman (grossman at cygnus.com)
-
- * getopt.c, getopt1.c, ../include/getopt.h: Get latest versions.
-
-Sat Jan 18 16:53:01 1992 Fred Fish (fnf at cygnus.com)
-
- * argv.c: New file to build and destroy standard argument
- vectors from a command string.
-
- * Makefile.in: Add argv.c and argv.o to appropriate macros.
-
-Fri Dec 20 12:12:57 1991 Fred Fish (fnf at cygnus.com)
-
- * configure.in: Change svr4 references to sysv4.
-
- * rindex.c: Declare return type of externally used function
- strrchr().
-
-Thu Dec 19 18:35:03 1991 John Gilmore (gnu at cygnus.com)
-
- * Makefile.in: Remove "***" in normal output, since Make produces
- this on errors, and it's convenient to search for.
-
-Tue Dec 17 23:21:30 1991 Per Bothner (bothner at cygnus.com)
-
- * memcmp.c, memcpy.c, memmove.c, memset.c, strchr.c, strrchr.c:
- New ANSI functions. The old non-ANSI functions (such as bcopy)
- should be avoided.
- * bcopy.c: Fix to correctly handle overlapping regions.
- * index.c, rindex.c: Re-write in terms of strchr() and strrchr().
- * functions.def: Add the new functions.
- * functions.def: Add 4th parameter to DEF macro,
- an ansidecl.h-style prototype.
- * dummy.c: Use expanded DEF macro to create a dummy function
- call, with correct parameter types. (This avoids some
- complaints from gcc about predefined builtins.)
-
- Move the functionality of config/mh-default into Makefile.in.
- This avoid duplication, and simplifies things slightly.
- * Makefile.in: Tweak so we don't need config/mh-default.
- * README: Update.
- * configure.in: No longer need config/mh-default.
- * config/mh-default: Deleted.
- * config/mh-sysv: Remove lines copied from old mh-default.
-
-Tue Dec 17 05:46:46 1991 John Gilmore (gnu at cygnus.com)
-
- * fdmatch.c (fdmatch): Don't compare st_rdev, which is for
- 'mknod' device numbers.
-
-Mon Dec 16 12:25:34 1991 Fred Fish (fnf at cygnus.com)
-
- * fdmatch.c, Makefile.in: Add new function that takes two
- open file descriptors and returns nonzero if they refer to
- the same file, zero otherwise. (used in gdb)
-
-Wed Dec 11 17:40:39 1991 Steve Chamberlain (sac at rtl.cygnus.com)
- From DJ:
- * msdos.c: stub functions for dos.
- * makefile.dos, configdj.bat: new.
- * getopt.c: Don't include alloca-conf.h in a GO32 world.
-
-
-Tue Dec 10 04:14:49 1991 K. Richard Pixley (rich at rtl.cygnus.com)
-
- * Makefile.in: infodir belongs in datadir.
-
-Fri Dec 6 23:26:45 1991 K. Richard Pixley (rich at rtl.cygnus.com)
-
- * Makefile.in: remove spaces following hyphens because bsd make
- can't cope. added standards.text support. install using
- INSTALL_DATA.
-
- * configure.in: remove commontargets as it is no longer a
- recognized hook.
-
-Thu Dec 5 22:46:46 1991 K. Richard Pixley (rich at rtl.cygnus.com)
-
- * Makefile.in: idestdir and ddestdir go away. Added copyrights
- and shift gpl to v2. Added ChangeLog if it didn't exist. docdir
- and mandir now keyed off datadir by default.
-
-Fri Nov 22 19:15:29 1991 John Gilmore (gnu at cygnus.com)
-
- * Makefile.in: find-needed.awk does not fit in 14 chars.
-
- * Makefile.in: Suppress error checking when compiling the test
- program, because Ultrix make/sh aborts there due to a bug.
-
-Fri Nov 22 12:23:17 1991 Per Bothner (bothner at cygnus.com)
-
- * Makefile.in: Re-did how EXTRA_OFILES is used to be more useful.
- * README: Explained how the auto-configuration works,
- and how to add new files and/or configurations.
-
-Fri Nov 22 09:45:23 1991 John Gilmore (gnu at cygnus.com)
-
- * strtoul.c: Avoid defining ULONG_MAX if already defined;
- cast a const char * to char * for pedants.
-
- * getopt.c: Only define "const" after local include files get to,
- and only if they haven't defined it.
-
-Thu Nov 21 16:58:53 1991 John Gilmore (gnu at cygnus.com)
-
- * getcwd.c (remove getwd.c): GNU code should call getcwd(). We
- emulate it with getwd() if available. This avoids callers having
- to find a MAXPATHLEN or PATH_MAX value from somewhere.
- * Makefile.in, functions.def: getwd->getcwd.
- * configure.in: Use generic case for every system.
- * config/mh-{delta88,mach,rs6000,svr4}: Remove.
- * config/mh-sysv: Use default handling, just add -DUSG.
-
-Thu Nov 14 10:58:05 1991 Per Bothner (bothner at cygnus.com)
-
- * Makefile.in, config/mh-default: Re-do make magic
- so that for the default ("automatic") mode we only
- compile the files we actually need. Do this using
- a recursive make: The top-level generates the list
- of needed files (loosely, the ones missing in libc),
- and then passes that list to the recursive make.
- * config/mh-mach: Remove obsolete STRERROR-{C,O} macros.
-
-Tue Nov 12 19:10:57 1991 John Gilmore (gnu at cygnus.com)
-
- RS/6000 host support (grumble).
-
- * configure.in: Build alloca-conf.h file from alloca-norm.h
- (everything else) or alloca-botch.h (rs/6000).
- * Makefile.in: Include . on the include path.
- * getopt.c: Use alloca-conf.h.
- * alloca-norm.h: How to declare alloca on reasonable machines.
- * alloca-botch.h: How to declare alloca on braindead machines.
-
-Tue Nov 12 09:21:48 1991 Fred Fish (fnf at cygnus.com)
-
- * concat.c : New file, like concat() in gdb but can take a
- variable number of arguments rather than fixed at 3 args. For
- now, client applications must supply an xmalloc(), which is a
- front end function to malloc() that deals with out-of-memory
- conditions.
-
- * Makefile.in: Add concat.c and concat.o to appropriate macros.
-
-Sat Nov 9 13:29:59 1991 Fred Fish (fnf at cygnus.com)
-
- * config/mh-svr4: Add sigsetmask to list of required functions.
-
-Sun Nov 3 11:57:56 1991 Per Bothner (bothner at cygnus.com)
-
- * vsprintf.c: New file.
- * functions.def, Makefile.in: Add vsprintf.
-
-Sun Oct 27 16:31:22 1991 John Gilmore (gnu at cygnus.com)
-
- * configure.in, config/mh-rs6000: Add rs/6000 host support.
- * Makefile.in: Compile with debug info.
-
-Fri Oct 25 17:01:12 1991 Per Bothner (bothner at cygnus.com)
-
- * Makefile.in, configure.in, and new files: dummy.c, functions.def,
- config/mf-default: Added a default configuration mode,
- which includes into libiberty.a functions that are "missing" in libc.
- * strdup.c, vprintf.c, vfprintf.c: New files.
-
-Thu Oct 24 02:29:26 1991 Fred Fish (fnf at cygnus.com)
-
- * config/hmake-svr4: New file.
-
- * config/hmake-sysv: Add HOST_CFILES and HOST_OFILES.
-
- * basename.c, bcmp.c, bcopy.c, bzero.c, getpagesize.c getwd.c,
- index.c, insque.c, rindex.c, spaces.c, strstr.c, vfork.c: New
- files containing either portable C versions or emulations using
- native library calls.
-
- * strerror.c: Add copyright, internal documentation, etc.
-
- * strtol.c: Replace hardwired hex constants with some more
- portable macros. Remove illegal (according to gcc) cast.
-
- * strtoul.c: Replace hardwired hex constant with more portable
- macro.
-
- * Makefile.in: Move TARGETLIB and CFLAGS where makefile fragments
- can override them. Add new source and object file names to CFILES
- and OFILES respectively.
-
- * configure.in: Add support for SVR4 makefile fragments.
-
-Tue Oct 22 19:00:23 1991 Steve Chamberlain (steve at cygnus.com)
-
- * Makefile.in: Move RANLIB, AR and AR_FLAGS to where they can be
- over-ridden by config/hmake-*
- * configure.in: added m88kcvs to sysv list
-
-Fri Oct 4 01:29:08 1991 John Gilmore (gnu at cygnus.com)
-
- * Makefile.in: Most hosts need strerror, but one or two don't,
- and they override these definitions in the host-dependent makefile
- fragment.
- * config/hmake-mach: The odd man out on strerror -- it's supplied.
- * strerror.c: New file.
-
- * strtol.c, strtoul.c: Add strtol to libiberty, since Mach lacks
- it and bfd uses it.
- * configure.in, Makefile.in, config/hmake-mach: Only configure
- strtol & strotoul in on Mach.
-
-Tue Sep 3 06:36:23 1991 John Gilmore (gnu at cygint.cygnus.com)
-
- * obstack.c: Merge with latest FSF version.
-
-
-Local Variables:
-version-control: never
-End:
diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in
deleted file mode 100644
index 5a25987..0000000
--- a/libiberty/Makefile.in
+++ /dev/null
@@ -1,483 +0,0 @@
-#
-# Makefile
-# Copyright (C) 1990, 91-99, 2000, 2001, 2002
-# Free Software Foundation
-#
-# This file is part of the libiberty library.
-# Libiberty is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Library General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# Libiberty is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Library General Public License for more details.
-#
-# You should have received a copy of the GNU Library General Public
-# License along with libiberty; see the file COPYING.LIB. If not,
-# write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-#
-
-# This file was written by K. Richard Pixley <rich@cygnus.com>.
-
-#
-# Makefile for libiberty directory
-#
-
-srcdir = @srcdir@
-VPATH = @srcdir@
-
-prefix = @prefix@
-
-exec_prefix = @exec_prefix@
-bindir = @bindir@
-libdir = @libdir@
-includedir = @includedir@
-target_header_dir = @target_header_dir@
-
-SHELL = @SHELL@
-
-# Multilib support variables.
-MULTISRCTOP =
-MULTIBUILDTOP =
-MULTIDIRS =
-MULTISUBDIR =
-MULTIDO = true
-MULTICLEAN = true
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-mkinstalldirs = $(SHELL) $(srcdir)/../mkinstalldirs
-
-# Some compilers can't handle cc -c blah.c -o foo/blah.o.
-OUTPUT_OPTION = @OUTPUT_OPTION@
-
-AR = @AR@
-AR_FLAGS = rc
-
-CC = @CC@
-CFLAGS = @CFLAGS@
-LIBCFLAGS = $(CFLAGS)
-RANLIB = @RANLIB@
-MAKEINFO = @MAKEINFO@
-PERL = @PERL@
-
-PICFLAG =
-
-MAKEOVERRIDES =
-
-TARGETLIB = libiberty.a
-TESTLIB = testlib.a
-
-LIBOBJS = @LIBOBJS@
-
-# A configuration can specify extra .o files that should be included,
-# even if they are in libc. (Perhaps the libc version is buggy.)
-EXTRA_OFILES =
-
-# Flags to pass to a recursive make.
-FLAGS_TO_PASS = \
- "AR=$(AR)" \
- "AR_FLAGS=$(AR_FLAGS)" \
- "CC=$(CC)" \
- "CFLAGS=$(CFLAGS)" \
- "LIBCFLAGS=$(LIBCFLAGS)" \
- "EXTRA_OFILES=$(EXTRA_OFILES)" \
- "HDEFINES=$(HDEFINES)" \
- "INSTALL=$(INSTALL)" \
- "INSTALL_DATA=$(INSTALL_DATA)" \
- "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
- "LDFLAGS=$(LDFLAGS)" \
- "LOADLIBES=$(LOADLIBES)" \
- "RANLIB=$(RANLIB)" \
- "SHELL=$(SHELL)" \
- "prefix=$(prefix)" \
- "exec_prefix=$(exec_prefix)" \
- "libdir=$(libdir)" \
- "libsubdir=$(libsubdir)" \
- "tooldir=$(tooldir)"
-
-# Subdirectories to recurse into. We need to override this during cleaning
-SUBDIRS = testsuite
-
-# FIXME: add @BUILD_INFO@ once we're sure it works for everyone.
-all: stamp-picdir $(TARGETLIB) needed-list required-list all-subdir
- @$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all
-
-.PHONY: check installcheck
-check: check-subdir
-installcheck: installcheck-subdir
-
-@host_makefile_frag@
-
-INCDIR=$(srcdir)/$(MULTISRCTOP)../include
-
-COMPILE.c = $(CC) -c @DEFS@ $(LIBCFLAGS) -I. -I$(INCDIR) $(HDEFINES) @ac_libiberty_warn_cflags@
-.c.o:
- if [ x"$(PICFLAG)" != x ]; then \
- $(COMPILE.c) $(PICFLAG) $< -o pic/$@; \
- else true; fi
- $(COMPILE.c) $< $(OUTPUT_OPTION)
-
-# NOTE: If you add new files to the library, add them to this list
-# (alphabetical), and add them to REQUIRED_OFILES, or
-# CONFIGURED_OFILES and funcs in configure.in.
-CFILES = alloca.c argv.c asprintf.c atexit.c \
- basename.c bcmp.c bcopy.c bsearch.c bzero.c \
- calloc.c choose-temp.c clock.c concat.c cp-demangle.c \
- cplus-dem.c \
- dyn-string.c \
- fdmatch.c ffs.c fibheap.c floatformat.c fnmatch.c \
- getcwd.c getopt.c getopt1.c getpagesize.c getpwd.c getruntime.c \
- hashtab.c hex.c \
- index.c insque.c \
- lbasename.c \
- make-temp-file.c md5.c memchr.c memcmp.c memcpy.c memmove.c \
- memset.c mkstemps.c \
- objalloc.c obstack.c \
- partition.c pexecute.c putenv.c \
- random.c regex.c rename.c rindex.c \
- safe-ctype.c setenv.c sigsetmask.c sort.c spaces.c \
- splay-tree.c strcasecmp.c strchr.c strdup.c strerror.c \
- strncasecmp.c strncmp.c strrchr.c strsignal.c strstr.c \
- strtod.c strtol.c strtoul.c \
- ternary.c tmpnam.c \
- vasprintf.c vfork.c vfprintf.c vprintf.c vsprintf.c \
- waitpid.c \
- xatexit.c xexit.c xmalloc.c xmemdup.c xstrdup.c xstrerror.c
-
-# These are always included in the library. The first four are listed
-# first and by compile time to optimize parallel builds.
-REQUIRED_OFILES = regex.o cplus-dem.o cp-demangle.o md5.o \
- alloca.o argv.o \
- choose-temp.o concat.o \
- dyn-string.o \
- fdmatch.o fibheap.o floatformat.o fnmatch.o \
- getopt.o getopt1.o getpwd.o getruntime.o \
- hashtab.o hex.o \
- lbasename.o \
- make-temp-file.o \
- objalloc.o obstack.o \
- partition.o pexecute.o \
- safe-ctype.o sort.o spaces.o splay-tree.o strerror.o \
- strsignal.o \
- ternary.o \
- xatexit.o xexit.o xmalloc.o xmemdup.o xstrdup.o xstrerror.o
-
-# These are all the objects that configure may add to the library via
-# $funcs or EXTRA_OFILES. This list exists here only for "make
-# maint-missing" and "make check".
-CONFIGURED_OFILES = asprintf.o atexit.o \
- basename.o bcmp.o bcopy.o bsearch.o bzero.o \
- calloc.o clock.o copysign.o \
- _doprnt.o \
- ffs.o \
- getcwd.o getpagesize.o \
- index.o insque.o \
- memchr.o memcmp.o memcpy.o memmove.o memset.o mkstemps.o \
- putenv.o \
- random.o rename.o rindex.o \
- setenv.o sigsetmask.o strcasecmp.o strchr.o strdup.o \
- strncasecmp.o strncmp.o strrchr.o strstr.o strtod.o strtol.o \
- strtoul.o \
- tmpnam.o \
- vasprintf.o vfork.o vfprintf.o vprintf.o vsprintf.o \
- waitpid.o
-
-# These files are installed if the library has been configured to do so.
-INSTALLED_HEADERS = \
- $(INCDIR)/ansidecl.h \
- $(INCDIR)/demangle.h \
- $(INCDIR)/dyn-string.h \
- $(INCDIR)/fibheap.h \
- $(INCDIR)/floatformat.h \
- $(INCDIR)/hashtab.h \
- $(INCDIR)/libiberty.h \
- $(INCDIR)/objalloc.h \
- $(INCDIR)/partition.h \
- $(INCDIR)/safe-ctype.h \
- $(INCDIR)/sort.h \
- $(INCDIR)/splay-tree.h \
- $(INCDIR)/ternary.h
-
-$(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS)
- -rm -f $(TARGETLIB) pic/$(TARGETLIB)
- $(AR) $(AR_FLAGS) $(TARGETLIB) \
- $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS)
- $(RANLIB) $(TARGETLIB)
- if [ x"$(PICFLAG)" != x ]; then \
- cd pic; \
- $(AR) $(AR_FLAGS) $(TARGETLIB) \
- $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \
- $(RANLIB) $(TARGETLIB); \
- cd ..; \
- else true; fi
-
-$(TESTLIB): $(REQUIRED_OFILES) $(CONFIGURED_OFILES)
- -rm -f $(TESTLIB)
- $(AR) $(AR_FLAGS) $(TESTLIB) \
- $(REQUIRED_OFILES) $(CONFIGURED_OFILES)
- $(RANLIB) $(TESTLIB)
-
-info: libiberty.info info-subdir
-install-info: install-info-subdir
-clean-info: clean-info-subdir
-dvi: libiberty.dvi dvi-subdir
-html: libiberty.html
-
-TEXISRC = \
- $(srcdir)/libiberty.texi \
- $(srcdir)/copying-lib.texi \
- $(srcdir)/obstacks.texi \
- $(srcdir)/functions.texi
-
-# Additional files that have texi snippets that need to be collected
-# and sorted. Some are here because the sources are imported from
-# elsewhere. Others represent headers in ../include.
-TEXIFILES = fnmatch.txh
-
-libiberty.info : $(srcdir)/libiberty.texi $(TEXISRC)
- $(MAKEINFO) -I$(srcdir) $(srcdir)/libiberty.texi
-
-libiberty.dvi : $(srcdir)/libiberty.texi $(TEXISRC)
- texi2dvi $(srcdir)/libiberty.texi
-
-libiberty.html : $(srcdir)/libiberty.texi $(TEXISRC)
- $(MAKEINFO) --html -I$(srcdir) $(srcdir)/libiberty.texi
-
-@MAINT@$(srcdir)/functions.texi : stamp-functions
-@MAINT@ @true
-
-@MAINT@stamp-functions : $(CFILES) $(TEXIFILES) $(srcdir)/gather-docs Makefile
-@MAINT@@HAVE_PERL@ $(PERL) $(srcdir)/gather-docs $(srcdir) $(srcdir)/functions.texi $(CFILES) $(TEXIFILES)
-@MAINT@ echo stamp > stamp-functions
-
-INSTALL_DEST = @INSTALL_DEST@
-install: install_to_$(INSTALL_DEST) install-subdir
-
-install_to_libdir: all
- $(INSTALL_DATA) $(TARGETLIB) $(DESTDIR)$(libdir)$(MULTISUBDIR)/$(TARGETLIB)n
- ( cd $(DESTDIR)$(libdir)$(MULTISUBDIR) ; $(RANLIB) $(TARGETLIB)n )
- mv -f $(DESTDIR)$(libdir)$(MULTISUBDIR)/$(TARGETLIB)n $(DESTDIR)$(libdir)$(MULTISUBDIR)/$(TARGETLIB)
- if test -n "${target_header_dir}"; then \
- case "${target_header_dir}" in \
- /*) thd=${target_header_dir};; \
- *) thd=${includedir}${MULTISUBDIR}/${target_header_dir};; \
- esac; \
- ${mkinstalldirs} $(DESTDIR)$${thd}; \
- for h in ${INSTALLED_HEADERS}; do \
- ${INSTALL_DATA} $$h $(DESTDIR)$${thd}; \
- done; \
- fi
- @$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install
-
-install_to_tooldir: all
- $(INSTALL_DATA) $(TARGETLIB) $(DESTDIR)$(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB)n
- ( cd $(DESTDIR)$(tooldir)/lib$(MULTISUBDIR) ; $(RANLIB) $(TARGETLIB)n )
- mv -f $(DESTDIR)$(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB)n $(DESTDIR)$(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB)
- @$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install
-
-# needed-list is used by libstdc++. NEEDED is the list of functions
-# to include there. Do not add anything LGPL to this list; libstdc++
-# can't use anything encumbering.
-NEEDED = atexit calloc memchr memcmp memcpy memmove memset rename strchr \
- strerror strncmp strrchr strstr strtol strtoul tmpnam vfprintf vprintf \
- vfork waitpid bcmp bcopy bzero
-needed-list: Makefile
- rm -f needed-list; touch needed-list; \
- for f in $(NEEDED); do \
- for g in $(LIBOBJS) $(EXTRA_OFILES); do \
- case "$$g" in \
- *$$f*) echo $$g >> needed-list ;; \
- esac; \
- done; \
- done
-
-# required-list was used when building a shared bfd/opcodes/libiberty
-# library. I don't know if it used by anything currently.
-required-list: Makefile
- echo $(REQUIRED_OFILES) > required-list
-
-stamp-picdir:
- if [ x"$(PICFLAG)" != x ] && [ ! -d pic ]; then \
- mkdir pic; \
- else true; fi
- touch stamp-picdir
-
-.PHONY: all etags tags ls clean stage1 stage2
-
-etags tags: TAGS etags-subdir
-
-TAGS: $(CFILES)
- etags `for i in $(CFILES); do echo $(srcdir)/$$i ; done`
-
-# The standalone demangler (c++filt) has been moved to binutils.
-demangle:
- @echo "The standalone demangler, now named c++filt, is now"
- @echo "a part of binutils."
- @false
-
-ls:
- @echo Makefile $(CFILES)
-
-# Various targets for maintainers.
-
-maint-missing :
- @$(PERL) $(srcdir)/maint-tool -s $(srcdir) missing $(CFILES) $(REQUIRED_OFILES) $(CONFIGURED_OFILES)
-
-maint-buildall : $(REQUIRED_OFILES) $(CONFIGURED_OFILES)
- @true
-
-maint-undoc : $(srcdir)/functions.texi
- @$(PERL) $(srcdir)/maint-tool -s $(srcdir) undoc
-
-maint-deps :
- @$(PERL) $(srcdir)/maint-tool -s $(srcdir) deps $(INCDIR)
-
-# Need to deal with profiled libraries, too.
-
-# Cleaning has to be done carefully to ensure that we don't clean our SUBDIRS
-# multiple times, hence our explicit recursion with an empty SUBDIRS.
-mostlyclean: mostlyclean-subdir
- -rm -rf *.o pic core errs \#* *.E a.out
- -rm -f needed.awk needed2.awk errors dummy needed-list config.h stamp-*
- -rm -f $(CONFIG_H) $(NEEDED_LIST) stamp-picdir
- -rm -f libiberty.aux libiberty.cp libiberty.cps libiberty.fn libiberty.ky
- -rm -f libiberty.log libiberty.tmp libiberty.tps libiberty.pg
- -rm -f libiberty.pgs libiberty.toc libiberty.tp libiberty.tpl libiberty.vr
- -rm -f libtexi.stamp
- @$(MULTICLEAN) multi-clean DO=mostlyclean
-clean: clean-subdir
- $(MAKE) SUBDIRS="" mostlyclean
- -rm -f *.a required-list tmpmulti.out
- -rm -f libiberty.dvi libiberty.info* libiberty.html
- @$(MULTICLEAN) multi-clean DO=clean
-distclean: distclean-subdir
- $(MAKE) SUBDIRS="" clean
- @$(MULTICLEAN) multi-clean DO=distclean
- -rm -f *~ Makefile config.status xhost-mkfrag TAGS multilib.out
- -rm -f config.log
- -rmdir testsuite 2>/dev/null
-maintainer-clean realclean: maintainer-clean-subdir
- $(MAKE) SUBDIRS="" distclean
-
-force:
-
-Makefile: $(srcdir)/Makefile.in config.status
- CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status
-
-# Depending on Makefile makes sure that config.status has been re-run
-# if needed. This prevents problems with parallel builds.
-config.h: stamp-h ; @true
-stamp-h: config.in config.status Makefile
- CONFIG_FILES= CONFIG_HEADERS=config.h:config.in $(SHELL) ./config.status
-
-config.status: $(srcdir)/configure $(srcdir)/config.table
- $(SHELL) ./config.status --recheck
-
-# Depending on config.h makes sure that config.status has been re-run
-# if needed. This prevents problems with parallel builds, in case
-# subdirectories need to run config.status also.
-all-subdir check-subdir installcheck-subdir info-subdir \
-install-info-subdir clean-info-subdir dvi-subdir install-subdir \
-etags-subdir mostlyclean-subdir clean-subdir distclean-subdir \
-maintainer-clean-subdir: config.h
- @subdirs='$(SUBDIRS)'; \
- target=`echo $@ | sed -e 's/-subdir//'`; \
- for dir in $$subdirs ; do \
- cd $$dir && $(MAKE) $$target; \
- done
-
-$(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS): stamp-picdir
-$(CONFIGURED_OFILES): stamp-picdir
-
-# The dependencies in the remainder of this file are automatically
-# generated by "make maint-deps". Manual edits will be lost.
-
-_doprnt.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h
-alloca.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
-argv.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
-asprintf.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
-atexit.o: config.h
-basename.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
- $(INCDIR)/safe-ctype.h
-bsearch.o: config.h $(INCDIR)/ansidecl.h
-calloc.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
-choose-temp.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
-clock.o: config.h
-concat.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
-copysign.o: $(INCDIR)/ansidecl.h
-cp-demangle.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/demangle.h \
- $(INCDIR)/dyn-string.h $(INCDIR)/getopt.h $(INCDIR)/libiberty.h
-cplus-dem.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/demangle.h \
- $(INCDIR)/getopt.h $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h
-dyn-string.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/dyn-string.h \
- $(INCDIR)/libiberty.h
-fdmatch.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
-fibheap.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/fibheap.h \
- $(INCDIR)/libiberty.h
-floatformat.o: $(INCDIR)/ansidecl.h $(INCDIR)/floatformat.h
-fnmatch.o: config.h $(INCDIR)/fnmatch.h $(INCDIR)/safe-ctype.h
-getcwd.o: config.h
-getopt.o: config.h $(INCDIR)/getopt.h
-getopt1.o: config.h $(INCDIR)/getopt.h
-getpagesize.o: config.h
-getpwd.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
-getruntime.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
-hashtab.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/hashtab.h \
- $(INCDIR)/libiberty.h
-hex.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
-lbasename.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
- $(INCDIR)/safe-ctype.h
-make-temp-file.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
-md5.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/md5.h
-memchr.o: $(INCDIR)/ansidecl.h
-memcmp.o: $(INCDIR)/ansidecl.h
-memcpy.o: $(INCDIR)/ansidecl.h
-memmove.o: $(INCDIR)/ansidecl.h
-memset.o: $(INCDIR)/ansidecl.h
-mkstemps.o: config.h $(INCDIR)/ansidecl.h
-objalloc.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/objalloc.h
-obstack.o: config.h $(INCDIR)/obstack.h
-partition.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
- $(INCDIR)/partition.h
-pexecute.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
- $(INCDIR)/safe-ctype.h
-putenv.o: config.h $(INCDIR)/ansidecl.h
-random.o: $(INCDIR)/ansidecl.h
-regex.o: config.h $(INCDIR)/xregex.h $(INCDIR)/xregex2.h
-rename.o: config.h
-safe-ctype.o: $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h
-setenv.o: config.h $(INCDIR)/ansidecl.h
-sigsetmask.o: $(INCDIR)/ansidecl.h
-sort.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
- $(INCDIR)/sort.h
-spaces.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
-splay-tree.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
- $(INCDIR)/splay-tree.h
-strcasecmp.o: $(INCDIR)/ansidecl.h
-strchr.o: $(INCDIR)/ansidecl.h
-strerror.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
-strncasecmp.o: $(INCDIR)/ansidecl.h
-strncmp.o: $(INCDIR)/ansidecl.h
-strrchr.o: $(INCDIR)/ansidecl.h
-strsignal.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
-strtod.o: $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h
-strtol.o: config.h $(INCDIR)/safe-ctype.h
-strtoul.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h
-ternary.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
- $(INCDIR)/ternary.h
-vasprintf.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
-vfork.o: $(INCDIR)/ansidecl.h
-vprintf.o: $(INCDIR)/ansidecl.h
-vsprintf.o: $(INCDIR)/ansidecl.h
-waitpid.o: config.h
-xatexit.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
-xexit.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
-xmalloc.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
-xmemdup.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
-xstrdup.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
-xstrerror.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
diff --git a/libiberty/README b/libiberty/README
deleted file mode 100644
index e8e9b33..0000000
--- a/libiberty/README
+++ /dev/null
@@ -1,66 +0,0 @@
-This directory contains the -liberty library of free software.
-It is a collection of subroutines used by various GNU programs.
-Current members include:
-
- getopt -- get options from command line
- obstack -- stacks of arbitrarily-sized objects
- strerror -- error message strings corresponding to errno
- strtol -- string-to-long conversion
- strtoul -- string-to-unsigned-long conversion
-
-We expect many of the GNU subroutines that are floating around to
-eventually arrive here.
-
-The library must be configured from the top source directory. Don't
-try to run configure in this directory. Follow the configuration
-instructions in ../README.
-
-Please report bugs to "gcc-bugs@gcc.gnu.org" and send fixes to
-"gcc-patches@gcc.gnu.org". Thank you.
-
-ADDING A NEW FILE
-=================
-
-There are two sets of files: Those that are "required" will be
-included in the library for all configurations, while those
-that are "optional" will be included in the library only if "needed."
-
-To add a new required file, edit Makefile to add the source file
-name to CFILES and the object file to REQUIRED_OFILES.
-
-To add a new optional file, it must provide a single function, and the
-name of the function must be the same as the name of the file.
-
- * Add the source file name to CFILES.
-
- * Add the function to name to the funcs shell variable in
- configure.in.
-
- * Add the function to the AC_CHECK_FUNCS lists just after the
- setting of the funcs shell variable. These AC_CHECK_FUNCS calls
- are never executed; they are there to make autoheader work
- better.
-
- * Consider the special cases of building libiberty; as of this
- writing, the special cases are newlib and VxWorks. If a
- particular special case provides the function, you do not need
- to do anything. If it does not provide the function, add the
- object file to LIBOBJS, and add the function name to the case
- controlling whether to define HAVE_func.
-
-The optional file you've added (e.g. getcwd.c) should compile and work
-on all hosts where it is needed. It does not have to work or even
-compile on hosts where it is not needed.
-
-ADDING A NEW CONFIGURATION
-==========================
-
-On most hosts you should be able to use the scheme for automatically
-figuring out which files are needed. In that case, you probably
-don't need a special Makefile stub for that configuration.
-
-If the fully automatic scheme doesn't work, you may be able to get
-by with defining EXTRA_OFILES in your Makefile stub. This is
-a list of object file names that should be treated as required
-for this configuration - they will be included in libiberty.a,
-regardless of whatever might be in the C library.
diff --git a/libiberty/_doprnt.c b/libiberty/_doprnt.c
deleted file mode 100644
index 8ce1415..0000000
--- a/libiberty/_doprnt.c
+++ /dev/null
@@ -1,303 +0,0 @@
-/* Provide a version of _doprnt in terms of fprintf.
- Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
- Contributed by Kaveh Ghazi (ghazi@caip.rutgers.edu) 3/29/98
-
-This program is free software; you can redistribute 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "config.h"
-#include "ansidecl.h"
-#include "safe-ctype.h"
-
-#include <stdio.h>
-#ifdef ANSI_PROTOTYPES
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-
-#undef _doprnt
-
-#ifdef HAVE__DOPRNT
-#define TEST
-#endif
-
-#ifdef TEST /* Make sure to use the internal one. */
-#define _doprnt my_doprnt
-#endif
-
-#define COPY_VA_INT \
- do { \
- const int value = abs (va_arg (ap, int)); \
- char buf[32]; \
- ptr++; /* Go past the asterisk. */ \
- *sptr = '\0'; /* NULL terminate sptr. */ \
- sprintf(buf, "%d", value); \
- strcat(sptr, buf); \
- while (*sptr) sptr++; \
- } while (0)
-
-#define PRINT_CHAR(CHAR) \
- do { \
- putc(CHAR, stream); \
- ptr++; \
- total_printed++; \
- continue; \
- } while (0)
-
-#define PRINT_TYPE(TYPE) \
- do { \
- int result; \
- TYPE value = va_arg (ap, TYPE); \
- *sptr++ = *ptr++; /* Copy the type specifier. */ \
- *sptr = '\0'; /* NULL terminate sptr. */ \
- result = fprintf(stream, specifier, value); \
- if (result == -1) \
- return -1; \
- else \
- { \
- total_printed += result; \
- continue; \
- } \
- } while (0)
-
-int
-_doprnt (format, ap, stream)
- const char * format;
- va_list ap;
- FILE * stream;
-{
- const char * ptr = format;
- char specifier[128];
- int total_printed = 0;
-
- while (*ptr != '\0')
- {
- if (*ptr != '%') /* While we have regular characters, print them. */
- PRINT_CHAR(*ptr);
- else /* We got a format specifier! */
- {
- char * sptr = specifier;
- int wide_width = 0, short_width = 0;
-
- *sptr++ = *ptr++; /* Copy the % and move forward. */
-
- while (strchr ("-+ #0", *ptr)) /* Move past flags. */
- *sptr++ = *ptr++;
-
- if (*ptr == '*')
- COPY_VA_INT;
- else
- while (ISDIGIT(*ptr)) /* Handle explicit numeric value. */
- *sptr++ = *ptr++;
-
- if (*ptr == '.')
- {
- *sptr++ = *ptr++; /* Copy and go past the period. */
- if (*ptr == '*')
- COPY_VA_INT;
- else
- while (ISDIGIT(*ptr)) /* Handle explicit numeric value. */
- *sptr++ = *ptr++;
- }
- while (strchr ("hlL", *ptr))
- {
- switch (*ptr)
- {
- case 'h':
- short_width = 1;
- break;
- case 'l':
- wide_width++;
- break;
- case 'L':
- wide_width = 2;
- break;
- default:
- abort();
- }
- *sptr++ = *ptr++;
- }
-
- switch (*ptr)
- {
- case 'd':
- case 'i':
- case 'o':
- case 'u':
- case 'x':
- case 'X':
- case 'c':
- {
- /* Short values are promoted to int, so just copy it
- as an int and trust the C library printf to cast it
- to the right width. */
- if (short_width)
- PRINT_TYPE(int);
- else
- {
- switch (wide_width)
- {
- case 0:
- PRINT_TYPE(int);
- break;
- case 1:
- PRINT_TYPE(long);
- break;
- case 2:
- default:
-#if defined(__GNUC__) || defined(HAVE_LONG_LONG)
- PRINT_TYPE(long long);
-#else
- PRINT_TYPE(long); /* Fake it and hope for the best. */
-#endif
- break;
- } /* End of switch (wide_width) */
- } /* End of else statement */
- } /* End of integer case */
- break;
- case 'f':
- case 'e':
- case 'E':
- case 'g':
- case 'G':
- {
- if (wide_width == 0)
- PRINT_TYPE(double);
- else
- {
-#if defined(__GNUC__) || defined(HAVE_LONG_DOUBLE)
- PRINT_TYPE(long double);
-#else
- PRINT_TYPE(double); /* Fake it and hope for the best. */
-#endif
- }
- }
- break;
- case 's':
- PRINT_TYPE(char *);
- break;
- case 'p':
- PRINT_TYPE(void *);
- break;
- case '%':
- PRINT_CHAR('%');
- break;
- default:
- abort();
- } /* End of switch (*ptr) */
- } /* End of else statement */
- }
-
- return total_printed;
-}
-
-#ifdef TEST
-
-#include <math.h>
-#ifndef M_PI
-#define M_PI (3.1415926535897932385)
-#endif
-
-#define RESULT(x) do \
-{ \
- int i = (x); \
- printf ("printed %d characters\n", i); \
- fflush(stdin); \
-} while (0)
-
-static int checkit PARAMS ((const char * format, ...)) ATTRIBUTE_PRINTF_1;
-
-static int
-checkit VPARAMS ((const char* format, ...))
-{
- int result;
- VA_OPEN (args, format);
- VA_FIXEDARG (args, char *, format);
-
- result = _doprnt (format, args, stdout);
- VA_CLOSE (args);
-
- return result;
-}
-
-int
-main ()
-{
- RESULT(checkit ("<%d>\n", 0x12345678));
- RESULT(printf ("<%d>\n", 0x12345678));
-
- RESULT(checkit ("<%200d>\n", 5));
- RESULT(printf ("<%200d>\n", 5));
-
- RESULT(checkit ("<%.300d>\n", 6));
- RESULT(printf ("<%.300d>\n", 6));
-
- RESULT(checkit ("<%100.150d>\n", 7));
- RESULT(printf ("<%100.150d>\n", 7));
-
- RESULT(checkit ("<%s>\n",
- "jjjjjjjjjiiiiiiiiiiiiiiioooooooooooooooooppppppppppppaa\n\
-777777777777777777333333333333366666666666622222222222777777777777733333"));
- RESULT(printf ("<%s>\n",
- "jjjjjjjjjiiiiiiiiiiiiiiioooooooooooooooooppppppppppppaa\n\
-777777777777777777333333333333366666666666622222222222777777777777733333"));
-
- RESULT(checkit ("<%f><%0+#f>%s%d%s>\n",
- 1.0, 1.0, "foo", 77, "asdjffffffffffffffiiiiiiiiiiixxxxx"));
- RESULT(printf ("<%f><%0+#f>%s%d%s>\n",
- 1.0, 1.0, "foo", 77, "asdjffffffffffffffiiiiiiiiiiixxxxx"));
-
- RESULT(checkit ("<%4f><%.4f><%%><%4.4f>\n", M_PI, M_PI, M_PI));
- RESULT(printf ("<%4f><%.4f><%%><%4.4f>\n", M_PI, M_PI, M_PI));
-
- RESULT(checkit ("<%*f><%.*f><%%><%*.*f>\n", 3, M_PI, 3, M_PI, 3, 3, M_PI));
- RESULT(printf ("<%*f><%.*f><%%><%*.*f>\n", 3, M_PI, 3, M_PI, 3, 3, M_PI));
-
- RESULT(checkit ("<%d><%i><%o><%u><%x><%X><%c>\n",
- 75, 75, 75, 75, 75, 75, 75));
- RESULT(printf ("<%d><%i><%o><%u><%x><%X><%c>\n",
- 75, 75, 75, 75, 75, 75, 75));
-
- RESULT(checkit ("<%d><%i><%o><%u><%x><%X><%c>\n",
- 75, 75, 75, 75, 75, 75, 75));
- RESULT(printf ("<%d><%i><%o><%u><%x><%X><%c>\n",
- 75, 75, 75, 75, 75, 75, 75));
-
- RESULT(checkit ("Testing (hd) short: <%d><%ld><%hd><%hd><%d>\n", 123, (long)234, 345, 123456789, 456));
- RESULT(printf ("Testing (hd) short: <%d><%ld><%hd><%hd><%d>\n", 123, (long)234, 345, 123456789, 456));
-
-#if defined(__GNUC__) || defined (HAVE_LONG_LONG)
- RESULT(checkit ("Testing (lld) long long: <%d><%lld><%d>\n", 123, 234234234234234234LL, 345));
- RESULT(printf ("Testing (lld) long long: <%d><%lld><%d>\n", 123, 234234234234234234LL, 345));
- RESULT(checkit ("Testing (Ld) long long: <%d><%Ld><%d>\n", 123, 234234234234234234LL, 345));
- RESULT(printf ("Testing (Ld) long long: <%d><%Ld><%d>\n", 123, 234234234234234234LL, 345));
-#endif
-
-#if defined(__GNUC__) || defined (HAVE_LONG_DOUBLE)
- RESULT(checkit ("Testing (Lf) long double: <%.20f><%.20Lf><%0+#.20f>\n",
- 1.23456, 1.234567890123456789L, 1.23456));
- RESULT(printf ("Testing (Lf) long double: <%.20f><%.20Lf><%0+#.20f>\n",
- 1.23456, 1.234567890123456789L, 1.23456));
-#endif
-
- return 0;
-}
-#endif /* TEST */
diff --git a/libiberty/aclocal.m4 b/libiberty/aclocal.m4
deleted file mode 100644
index 103e246..0000000
--- a/libiberty/aclocal.m4
+++ /dev/null
@@ -1,191 +0,0 @@
-dnl See whether strncmp reads past the end of its string parameters.
-dnl On some versions of SunOS4 at least, strncmp reads a word at a time
-dnl but erroneously reads past the end of strings. This can cause
-dnl a SEGV in some cases.
-AC_DEFUN(libiberty_AC_FUNC_STRNCMP,
-[AC_REQUIRE([AC_FUNC_MMAP])
-AC_CACHE_CHECK([for working strncmp], ac_cv_func_strncmp_works,
-[AC_TRY_RUN([
-/* Test by Jim Wilson and Kaveh Ghazi.
- Check whether strncmp reads past the end of its string parameters. */
-#include <sys/types.h>
-
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
-
-#ifdef HAVE_SYS_MMAN_H
-#include <sys/mman.h>
-#endif
-
-#ifndef MAP_ANON
-#ifdef MAP_ANONYMOUS
-#define MAP_ANON MAP_ANONYMOUS
-#else
-#define MAP_ANON MAP_FILE
-#endif
-#endif
-
-#ifndef MAP_FILE
-#define MAP_FILE 0
-#endif
-#ifndef O_RDONLY
-#define O_RDONLY 0
-#endif
-
-#define MAP_LEN 0x10000
-
-main ()
-{
-#if defined(HAVE_MMAP) || defined(HAVE_MMAP_ANYWHERE)
- char *p;
- int dev_zero;
-
- dev_zero = open ("/dev/zero", O_RDONLY);
- if (dev_zero < 0)
- exit (1);
-
- p = (char *) mmap (0, MAP_LEN, PROT_READ|PROT_WRITE,
- MAP_ANON|MAP_PRIVATE, dev_zero, 0);
- if (p == (char *)-1)
- p = (char *) mmap (0, MAP_LEN, PROT_READ|PROT_WRITE,
- MAP_ANON|MAP_PRIVATE, -1, 0);
- if (p == (char *)-1)
- exit (2);
- else
- {
- char *string = "__si_type_info";
- char *q = (char *) p + MAP_LEN - strlen (string) - 2;
- char *r = (char *) p + 0xe;
-
- strcpy (q, string);
- strcpy (r, string);
- strncmp (r, q, 14);
- }
-#endif /* HAVE_MMAP || HAVE_MMAP_ANYWHERE */
- exit (0);
-}
-], ac_cv_func_strncmp_works=yes, ac_cv_func_strncmp_works=no,
- ac_cv_func_strncmp_works=no)
-rm -f core core.* *.core])
-if test $ac_cv_func_strncmp_works = no ; then
- LIBOBJS="$LIBOBJS strncmp.o"
-fi
-])
-
-dnl See if errno must be declared even when <errno.h> is included.
-AC_DEFUN(libiberty_AC_DECLARE_ERRNO,
-[AC_CACHE_CHECK(whether errno must be declared, libiberty_cv_declare_errno,
-[AC_TRY_COMPILE(
-[#include <errno.h>],
-[int x = errno;],
-libiberty_cv_declare_errno=no,
-libiberty_cv_declare_errno=yes)])
-if test $libiberty_cv_declare_errno = yes
-then AC_DEFINE(NEED_DECLARATION_ERRNO, 1,
- [Define if errno must be declared even when <errno.h> is included.])
-fi
-])
-
-# FIXME: We temporarily define our own version of AC_PROG_CC. This is
-# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
-# are probably using a cross compiler, which will not be able to fully
-# link an executable. This should really be fixed in autoconf
-# itself.
-
-AC_DEFUN(LIB_AC_PROG_CC,
-[AC_BEFORE([$0], [AC_PROG_CPP])dnl
-AC_PROVIDE([AC_PROG_CC])
-AC_CHECK_PROG(CC, gcc, gcc)
-if test -z "$CC"; then
- AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
- test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
-fi
-
-AC_PROG_CC_GNU
-
-if test $ac_cv_prog_gcc = yes; then
- GCC=yes
- ac_libiberty_warn_cflags='-W -Wall -Wtraditional -pedantic'
-dnl Check whether -g works, even if CFLAGS is set, in case the package
-dnl plays around with CFLAGS (such as to build both debugging and
-dnl normal versions of a library), tasteless as that idea is.
- ac_test_CFLAGS="${CFLAGS+set}"
- ac_save_CFLAGS="$CFLAGS"
- CFLAGS=
- AC_PROG_CC_G
- if test "$ac_test_CFLAGS" = set; then
- CFLAGS="$ac_save_CFLAGS"
- elif test $ac_cv_prog_cc_g = yes; then
- CFLAGS="-g -O2"
- else
- CFLAGS="-O2"
- fi
-else
- GCC=
- ac_libiberty_warn_cflags=
- test "${CFLAGS+set}" = set || CFLAGS="-g"
-fi
-AC_SUBST(ac_libiberty_warn_cflags)
-])
-
-# Work around a bug in autoheader. This can go away when we switch to
-# autoconf >2.50. The use of define instead of AC_DEFUN is
-# deliberate.
-define(AC_DEFINE_NOAUTOHEADER,
-[cat >> confdefs.h <<\EOF
-[#define] $1 ifelse($#, 2, [$2], $#, 3, [$2], 1)
-EOF
-])
-
-# We always want a C version of alloca() compiled into libiberty,
-# because native-compiler support for the real alloca is so !@#$%
-# unreliable that GCC has decided to use it only when being compiled
-# by GCC. This is the part of AC_FUNC_ALLOCA that calculates the
-# information alloca.c needs.
-AC_DEFUN(libiberty_AC_FUNC_C_ALLOCA,
-[AC_CACHE_CHECK(whether alloca needs Cray hooks, ac_cv_os_cray,
-[AC_EGREP_CPP(webecray,
-[#if defined(CRAY) && ! defined(CRAY2)
-webecray
-#else
-wenotbecray
-#endif
-], ac_cv_os_cray=yes, ac_cv_os_cray=no)])
-if test $ac_cv_os_cray = yes; then
- for ac_func in _getb67 GETB67 getb67; do
- AC_CHECK_FUNC($ac_func,
- [AC_DEFINE_UNQUOTED(CRAY_STACKSEG_END, $ac_func,
- [Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP
- systems. This function is required for alloca.c support on those
- systems.]) break])
- done
-fi
-
-AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction,
-[AC_TRY_RUN([find_stack_direction ()
-{
- static char *addr = 0;
- auto char dummy;
- if (addr == 0)
- {
- addr = &dummy;
- return find_stack_direction ();
- }
- else
- return (&dummy > addr) ? 1 : -1;
-}
-main ()
-{
- exit (find_stack_direction() < 0);
-}],
- ac_cv_c_stack_direction=1,
- ac_cv_c_stack_direction=-1,
- ac_cv_c_stack_direction=0)])
-AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction,
- [Define if you know the direction of stack growth for your system;
- otherwise it will be automatically deduced at run-time.
- STACK_DIRECTION > 0 => grows toward higher addresses
- STACK_DIRECTION < 0 => grows toward lower addresses
- STACK_DIRECTION = 0 => direction of growth unknown])
-])
diff --git a/libiberty/alloca.c b/libiberty/alloca.c
deleted file mode 100644
index 918235d..0000000
--- a/libiberty/alloca.c
+++ /dev/null
@@ -1,478 +0,0 @@
-/* alloca.c -- allocate automatically reclaimed memory
- (Mostly) portable public-domain implementation -- D A Gwyn
-
- This implementation of the PWB library alloca function,
- which is used to allocate space off the run-time stack so
- that it is automatically reclaimed upon procedure exit,
- was inspired by discussions with J. Q. Johnson of Cornell.
- J.Otto Tennant <jot@cray.com> contributed the Cray support.
-
- There are some preprocessor constants that can
- be defined when compiling for your specific system, for
- improved efficiency; however, the defaults should be okay.
-
- The general concept of this implementation is to keep
- track of all alloca-allocated blocks, and reclaim any
- that are found to be deeper in the stack than the current
- invocation. This heuristic does not reclaim storage as
- soon as it becomes invalid, but it will do so eventually.
-
- As a special case, alloca(0) reclaims storage without
- allocating any. It is a good idea to use alloca(0) in
- your main control loop, etc. to force garbage collection. */
-
-/*
-
-@deftypefn Replacement void* alloca (size_t @var{size})
-
-This function allocates memory which will be automatically reclaimed
-after the procedure exits. The @libib{} implementation does not free
-the memory immediately but will do so eventually during subsequent
-calls to this function. Memory is allocated using @code{xmalloc} under
-normal circumstances.
-
-The header file @file{alloca-conf.h} can be used in conjunction with the
-GNU Autoconf test @code{AC_FUNC_ALLOCA} to test for and properly make
-available this function. The @code{AC_FUNC_ALLOCA} test requires that
-client code use a block of preprocessor code to be safe (see the Autoconf
-manual for more); this header incorporates that logic and more, including
-the possibility of a GCC built-in function.
-
-@end deftypefn
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <libiberty.h>
-
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-
-/* These variables are used by the ASTRDUP implementation that relies
- on C_alloca. */
-const char *libiberty_optr;
-char *libiberty_nptr;
-unsigned long libiberty_len;
-
-/* If your stack is a linked list of frames, you have to
- provide an "address metric" ADDRESS_FUNCTION macro. */
-
-#if defined (CRAY) && defined (CRAY_STACKSEG_END)
-static long i00afunc ();
-#define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg))
-#else
-#define ADDRESS_FUNCTION(arg) &(arg)
-#endif
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-/* Define STACK_DIRECTION if you know the direction of stack
- growth for your system; otherwise it will be automatically
- deduced at run-time.
-
- STACK_DIRECTION > 0 => grows toward higher addresses
- STACK_DIRECTION < 0 => grows toward lower addresses
- STACK_DIRECTION = 0 => direction of growth unknown */
-
-#ifndef STACK_DIRECTION
-#define STACK_DIRECTION 0 /* Direction unknown. */
-#endif
-
-#if STACK_DIRECTION != 0
-
-#define STACK_DIR STACK_DIRECTION /* Known at compile-time. */
-
-#else /* STACK_DIRECTION == 0; need run-time code. */
-
-static int stack_dir; /* 1 or -1 once known. */
-#define STACK_DIR stack_dir
-
-static void
-find_stack_direction ()
-{
- static char *addr = NULL; /* Address of first `dummy', once known. */
- auto char dummy; /* To get stack address. */
-
- if (addr == NULL)
- { /* Initial entry. */
- addr = ADDRESS_FUNCTION (dummy);
-
- find_stack_direction (); /* Recurse once. */
- }
- else
- {
- /* Second entry. */
- if (ADDRESS_FUNCTION (dummy) > addr)
- stack_dir = 1; /* Stack grew upward. */
- else
- stack_dir = -1; /* Stack grew downward. */
- }
-}
-
-#endif /* STACK_DIRECTION == 0 */
-
-/* An "alloca header" is used to:
- (a) chain together all alloca'ed blocks;
- (b) keep track of stack depth.
-
- It is very important that sizeof(header) agree with malloc
- alignment chunk size. The following default should work okay. */
-
-#ifndef ALIGN_SIZE
-#define ALIGN_SIZE sizeof(double)
-#endif
-
-typedef union hdr
-{
- char align[ALIGN_SIZE]; /* To force sizeof(header). */
- struct
- {
- union hdr *next; /* For chaining headers. */
- char *deep; /* For stack depth measure. */
- } h;
-} header;
-
-static header *last_alloca_header = NULL; /* -> last alloca header. */
-
-/* Return a pointer to at least SIZE bytes of storage,
- which will be automatically reclaimed upon exit from
- the procedure that called alloca. Originally, this space
- was supposed to be taken from the current stack frame of the
- caller, but that method cannot be made to work for some
- implementations of C, for example under Gould's UTX/32. */
-
-/* @undocumented C_alloca */
-
-PTR
-C_alloca (size)
- size_t size;
-{
- auto char probe; /* Probes stack depth: */
- register char *depth = ADDRESS_FUNCTION (probe);
-
-#if STACK_DIRECTION == 0
- if (STACK_DIR == 0) /* Unknown growth direction. */
- find_stack_direction ();
-#endif
-
- /* Reclaim garbage, defined as all alloca'd storage that
- was allocated from deeper in the stack than currently. */
-
- {
- register header *hp; /* Traverses linked list. */
-
- for (hp = last_alloca_header; hp != NULL;)
- if ((STACK_DIR > 0 && hp->h.deep > depth)
- || (STACK_DIR < 0 && hp->h.deep < depth))
- {
- register header *np = hp->h.next;
-
- free ((PTR) hp); /* Collect garbage. */
-
- hp = np; /* -> next header. */
- }
- else
- break; /* Rest are not deeper. */
-
- last_alloca_header = hp; /* -> last valid storage. */
- }
-
- if (size == 0)
- return NULL; /* No allocation required. */
-
- /* Allocate combined header + user data storage. */
-
- {
- register PTR new = xmalloc (sizeof (header) + size);
- /* Address of header. */
-
- if (new == 0)
- abort();
-
- ((header *) new)->h.next = last_alloca_header;
- ((header *) new)->h.deep = depth;
-
- last_alloca_header = (header *) new;
-
- /* User storage begins just after header. */
-
- return (PTR) ((char *) new + sizeof (header));
- }
-}
-
-#if defined (CRAY) && defined (CRAY_STACKSEG_END)
-
-#ifdef DEBUG_I00AFUNC
-#include <stdio.h>
-#endif
-
-#ifndef CRAY_STACK
-#define CRAY_STACK
-#ifndef CRAY2
-/* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */
-struct stack_control_header
- {
- long shgrow:32; /* Number of times stack has grown. */
- long shaseg:32; /* Size of increments to stack. */
- long shhwm:32; /* High water mark of stack. */
- long shsize:32; /* Current size of stack (all segments). */
- };
-
-/* The stack segment linkage control information occurs at
- the high-address end of a stack segment. (The stack
- grows from low addresses to high addresses.) The initial
- part of the stack segment linkage control information is
- 0200 (octal) words. This provides for register storage
- for the routine which overflows the stack. */
-
-struct stack_segment_linkage
- {
- long ss[0200]; /* 0200 overflow words. */
- long sssize:32; /* Number of words in this segment. */
- long ssbase:32; /* Offset to stack base. */
- long:32;
- long sspseg:32; /* Offset to linkage control of previous
- segment of stack. */
- long:32;
- long sstcpt:32; /* Pointer to task common address block. */
- long sscsnm; /* Private control structure number for
- microtasking. */
- long ssusr1; /* Reserved for user. */
- long ssusr2; /* Reserved for user. */
- long sstpid; /* Process ID for pid based multi-tasking. */
- long ssgvup; /* Pointer to multitasking thread giveup. */
- long sscray[7]; /* Reserved for Cray Research. */
- long ssa0;
- long ssa1;
- long ssa2;
- long ssa3;
- long ssa4;
- long ssa5;
- long ssa6;
- long ssa7;
- long sss0;
- long sss1;
- long sss2;
- long sss3;
- long sss4;
- long sss5;
- long sss6;
- long sss7;
- };
-
-#else /* CRAY2 */
-/* The following structure defines the vector of words
- returned by the STKSTAT library routine. */
-struct stk_stat
- {
- long now; /* Current total stack size. */
- long maxc; /* Amount of contiguous space which would
- be required to satisfy the maximum
- stack demand to date. */
- long high_water; /* Stack high-water mark. */
- long overflows; /* Number of stack overflow ($STKOFEN) calls. */
- long hits; /* Number of internal buffer hits. */
- long extends; /* Number of block extensions. */
- long stko_mallocs; /* Block allocations by $STKOFEN. */
- long underflows; /* Number of stack underflow calls ($STKRETN). */
- long stko_free; /* Number of deallocations by $STKRETN. */
- long stkm_free; /* Number of deallocations by $STKMRET. */
- long segments; /* Current number of stack segments. */
- long maxs; /* Maximum number of stack segments so far. */
- long pad_size; /* Stack pad size. */
- long current_address; /* Current stack segment address. */
- long current_size; /* Current stack segment size. This
- number is actually corrupted by STKSTAT to
- include the fifteen word trailer area. */
- long initial_address; /* Address of initial segment. */
- long initial_size; /* Size of initial segment. */
- };
-
-/* The following structure describes the data structure which trails
- any stack segment. I think that the description in 'asdef' is
- out of date. I only describe the parts that I am sure about. */
-
-struct stk_trailer
- {
- long this_address; /* Address of this block. */
- long this_size; /* Size of this block (does not include
- this trailer). */
- long unknown2;
- long unknown3;
- long link; /* Address of trailer block of previous
- segment. */
- long unknown5;
- long unknown6;
- long unknown7;
- long unknown8;
- long unknown9;
- long unknown10;
- long unknown11;
- long unknown12;
- long unknown13;
- long unknown14;
- };
-
-#endif /* CRAY2 */
-#endif /* not CRAY_STACK */
-
-#ifdef CRAY2
-/* Determine a "stack measure" for an arbitrary ADDRESS.
- I doubt that "lint" will like this much. */
-
-static long
-i00afunc (long *address)
-{
- struct stk_stat status;
- struct stk_trailer *trailer;
- long *block, size;
- long result = 0;
-
- /* We want to iterate through all of the segments. The first
- step is to get the stack status structure. We could do this
- more quickly and more directly, perhaps, by referencing the
- $LM00 common block, but I know that this works. */
-
- STKSTAT (&status);
-
- /* Set up the iteration. */
-
- trailer = (struct stk_trailer *) (status.current_address
- + status.current_size
- - 15);
-
- /* There must be at least one stack segment. Therefore it is
- a fatal error if "trailer" is null. */
-
- if (trailer == 0)
- abort ();
-
- /* Discard segments that do not contain our argument address. */
-
- while (trailer != 0)
- {
- block = (long *) trailer->this_address;
- size = trailer->this_size;
- if (block == 0 || size == 0)
- abort ();
- trailer = (struct stk_trailer *) trailer->link;
- if ((block <= address) && (address < (block + size)))
- break;
- }
-
- /* Set the result to the offset in this segment and add the sizes
- of all predecessor segments. */
-
- result = address - block;
-
- if (trailer == 0)
- {
- return result;
- }
-
- do
- {
- if (trailer->this_size <= 0)
- abort ();
- result += trailer->this_size;
- trailer = (struct stk_trailer *) trailer->link;
- }
- while (trailer != 0);
-
- /* We are done. Note that if you present a bogus address (one
- not in any segment), you will get a different number back, formed
- from subtracting the address of the first block. This is probably
- not what you want. */
-
- return (result);
-}
-
-#else /* not CRAY2 */
-/* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP.
- Determine the number of the cell within the stack,
- given the address of the cell. The purpose of this
- routine is to linearize, in some sense, stack addresses
- for alloca. */
-
-static long
-i00afunc (long address)
-{
- long stkl = 0;
-
- long size, pseg, this_segment, stack;
- long result = 0;
-
- struct stack_segment_linkage *ssptr;
-
- /* Register B67 contains the address of the end of the
- current stack segment. If you (as a subprogram) store
- your registers on the stack and find that you are past
- the contents of B67, you have overflowed the segment.
-
- B67 also points to the stack segment linkage control
- area, which is what we are really interested in. */
-
- stkl = CRAY_STACKSEG_END ();
- ssptr = (struct stack_segment_linkage *) stkl;
-
- /* If one subtracts 'size' from the end of the segment,
- one has the address of the first word of the segment.
-
- If this is not the first segment, 'pseg' will be
- nonzero. */
-
- pseg = ssptr->sspseg;
- size = ssptr->sssize;
-
- this_segment = stkl - size;
-
- /* It is possible that calling this routine itself caused
- a stack overflow. Discard stack segments which do not
- contain the target address. */
-
- while (!(this_segment <= address && address <= stkl))
- {
-#ifdef DEBUG_I00AFUNC
- fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl);
-#endif
- if (pseg == 0)
- break;
- stkl = stkl - pseg;
- ssptr = (struct stack_segment_linkage *) stkl;
- size = ssptr->sssize;
- pseg = ssptr->sspseg;
- this_segment = stkl - size;
- }
-
- result = address - this_segment;
-
- /* If you subtract pseg from the current end of the stack,
- you get the address of the previous stack segment's end.
- This seems a little convoluted to me, but I'll bet you save
- a cycle somewhere. */
-
- while (pseg != 0)
- {
-#ifdef DEBUG_I00AFUNC
- fprintf (stderr, "%011o %011o\n", pseg, size);
-#endif
- stkl = stkl - pseg;
- ssptr = (struct stack_segment_linkage *) stkl;
- size = ssptr->sssize;
- pseg = ssptr->sspseg;
- result += size;
- }
- return (result);
-}
-
-#endif /* not CRAY2 */
-#endif /* CRAY */
diff --git a/libiberty/argv.c b/libiberty/argv.c
deleted file mode 100644
index 4205579..0000000
--- a/libiberty/argv.c
+++ /dev/null
@@ -1,355 +0,0 @@
-/* Create and destroy argument vectors (argv's)
- Copyright (C) 1992, 2001 Free Software Foundation, Inc.
- Written by Fred Fish @ Cygnus Support
-
-This file is part of the libiberty library.
-Libiberty is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public
-License as published by the Free Software Foundation; either
-version 2 of the License, or (at your option) any later version.
-
-Libiberty is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with libiberty; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-
-/* Create and destroy argument vectors. An argument vector is simply an
- array of string pointers, terminated by a NULL pointer. */
-
-#include "ansidecl.h"
-#include "libiberty.h"
-
-#define ISBLANK(ch) ((ch) == ' ' || (ch) == '\t')
-
-/* Routines imported from standard C runtime libraries. */
-
-#ifdef __STDC__
-
-#include <stddef.h>
-#include <string.h>
-#include <stdlib.h>
-
-#else /* !__STDC__ */
-
-#if !defined _WIN32 || defined __GNUC__
-extern char *memcpy (); /* Copy memory region */
-extern int strlen (); /* Count length of string */
-extern char *malloc (); /* Standard memory allocater */
-extern char *realloc (); /* Standard memory reallocator */
-extern void free (); /* Free malloc'd memory */
-extern char *strdup (); /* Duplicate a string */
-#endif
-
-#endif /* __STDC__ */
-
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-#ifndef EOS
-#define EOS '\0'
-#endif
-
-#define INITIAL_MAXARGC 8 /* Number of args + NULL in initial argv */
-
-
-/*
-
-@deftypefn Extension char** dupargv (char **@var{vector})
-
-Duplicate an argument vector. Simply scans through @var{vector},
-duplicating each argument until the terminating @code{NULL} is found.
-Returns a pointer to the argument vector if successful. Returns
-@code{NULL} if there is insufficient memory to complete building the
-argument vector.
-
-@end deftypefn
-
-*/
-
-char **
-dupargv (argv)
- char **argv;
-{
- int argc;
- char **copy;
-
- if (argv == NULL)
- return NULL;
-
- /* the vector */
- for (argc = 0; argv[argc] != NULL; argc++);
- copy = (char **) malloc ((argc + 1) * sizeof (char *));
- if (copy == NULL)
- return NULL;
-
- /* the strings */
- for (argc = 0; argv[argc] != NULL; argc++)
- {
- int len = strlen (argv[argc]);
- copy[argc] = malloc (sizeof (char *) * (len + 1));
- if (copy[argc] == NULL)
- {
- freeargv (copy);
- return NULL;
- }
- strcpy (copy[argc], argv[argc]);
- }
- copy[argc] = NULL;
- return copy;
-}
-
-/*
-
-@deftypefn Extension void freeargv (char **@var{vector})
-
-Free an argument vector that was built using @code{buildargv}. Simply
-scans through @var{vector}, freeing the memory for each argument until
-the terminating @code{NULL} is found, and then frees @var{vector}
-itself.
-
-@end deftypefn
-
-*/
-
-void freeargv (vector)
-char **vector;
-{
- register char **scan;
-
- if (vector != NULL)
- {
- for (scan = vector; *scan != NULL; scan++)
- {
- free (*scan);
- }
- free (vector);
- }
-}
-
-/*
-
-@deftypefn Extension char** buildargv (char *@var{sp})
-
-Given a pointer to a string, parse the string extracting fields
-separated by whitespace and optionally enclosed within either single
-or double quotes (which are stripped off), and build a vector of
-pointers to copies of the string for each field. The input string
-remains unchanged. The last element of the vector is followed by a
-@code{NULL} element.
-
-All of the memory for the pointer array and copies of the string
-is obtained from @code{malloc}. All of the memory can be returned to the
-system with the single function call @code{freeargv}, which takes the
-returned result of @code{buildargv}, as it's argument.
-
-Returns a pointer to the argument vector if successful. Returns
-@code{NULL} if @var{sp} is @code{NULL} or if there is insufficient
-memory to complete building the argument vector.
-
-If the input is a null string (as opposed to a @code{NULL} pointer),
-then buildarg returns an argument vector that has one arg, a null
-string.
-
-@end deftypefn
-
-The memory for the argv array is dynamically expanded as necessary.
-
-In order to provide a working buffer for extracting arguments into,
-with appropriate stripping of quotes and translation of backslash
-sequences, we allocate a working buffer at least as long as the input
-string. This ensures that we always have enough space in which to
-work, since the extracted arg is never larger than the input string.
-
-The argument vector is always kept terminated with a @code{NULL} arg
-pointer, so it can be passed to @code{freeargv} at any time, or
-returned, as appropriate.
-
-*/
-
-char **buildargv (input)
- const char *input;
-{
- char *arg;
- char *copybuf;
- int squote = 0;
- int dquote = 0;
- int bsquote = 0;
- int argc = 0;
- int maxargc = 0;
- char **argv = NULL;
- char **nargv;
-
- if (input != NULL)
- {
- copybuf = (char *) alloca (strlen (input) + 1);
- /* Is a do{}while to always execute the loop once. Always return an
- argv, even for null strings. See NOTES above, test case below. */
- do
- {
- /* Pick off argv[argc] */
- while (ISBLANK (*input))
- {
- input++;
- }
- if ((maxargc == 0) || (argc >= (maxargc - 1)))
- {
- /* argv needs initialization, or expansion */
- if (argv == NULL)
- {
- maxargc = INITIAL_MAXARGC;
- nargv = (char **) malloc (maxargc * sizeof (char *));
- }
- else
- {
- maxargc *= 2;
- nargv = (char **) realloc (argv, maxargc * sizeof (char *));
- }
- if (nargv == NULL)
- {
- if (argv != NULL)
- {
- freeargv (argv);
- argv = NULL;
- }
- break;
- }
- argv = nargv;
- argv[argc] = NULL;
- }
- /* Begin scanning arg */
- arg = copybuf;
- while (*input != EOS)
- {
- if (ISBLANK (*input) && !squote && !dquote && !bsquote)
- {
- break;
- }
- else
- {
- if (bsquote)
- {
- bsquote = 0;
- *arg++ = *input;
- }
- else if (*input == '\\')
- {
- bsquote = 1;
- }
- else if (squote)
- {
- if (*input == '\'')
- {
- squote = 0;
- }
- else
- {
- *arg++ = *input;
- }
- }
- else if (dquote)
- {
- if (*input == '"')
- {
- dquote = 0;
- }
- else
- {
- *arg++ = *input;
- }
- }
- else
- {
- if (*input == '\'')
- {
- squote = 1;
- }
- else if (*input == '"')
- {
- dquote = 1;
- }
- else
- {
- *arg++ = *input;
- }
- }
- input++;
- }
- }
- *arg = EOS;
- argv[argc] = strdup (copybuf);
- if (argv[argc] == NULL)
- {
- freeargv (argv);
- argv = NULL;
- break;
- }
- argc++;
- argv[argc] = NULL;
-
- while (ISBLANK (*input))
- {
- input++;
- }
- }
- while (*input != EOS);
- }
- return (argv);
-}
-
-#ifdef MAIN
-
-/* Simple little test driver. */
-
-static const char *const tests[] =
-{
- "a simple command line",
- "arg 'foo' is single quoted",
- "arg \"bar\" is double quoted",
- "arg \"foo bar\" has embedded whitespace",
- "arg 'Jack said \\'hi\\'' has single quotes",
- "arg 'Jack said \\\"hi\\\"' has double quotes",
- "a b c d e f g h i j k l m n o p q r s t u v w x y z 1 2 3 4 5 6 7 8 9",
-
- /* This should be expanded into only one argument. */
- "trailing-whitespace ",
-
- "",
- NULL
-};
-
-int main ()
-{
- char **argv;
- const char *const *test;
- char **targs;
-
- for (test = tests; *test != NULL; test++)
- {
- printf ("buildargv(\"%s\")\n", *test);
- if ((argv = buildargv (*test)) == NULL)
- {
- printf ("failed!\n\n");
- }
- else
- {
- for (targs = argv; *targs != NULL; targs++)
- {
- printf ("\t\"%s\"\n", *targs);
- }
- printf ("\n");
- }
- freeargv (argv);
- }
-
- return 0;
-}
-
-#endif /* MAIN */
diff --git a/libiberty/asprintf.c b/libiberty/asprintf.c
deleted file mode 100644
index 5de7756..0000000
--- a/libiberty/asprintf.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/* Like sprintf but provides a pointer to malloc'd storage, which must
- be freed by the caller.
- Copyright (C) 1997 Free Software Foundation, Inc.
- Contributed by Cygnus Solutions.
-
-This file is part of the libiberty library.
-Libiberty is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public
-License as published by the Free Software Foundation; either
-version 2 of the License, or (at your option) any later version.
-
-Libiberty is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with libiberty; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-#include "ansidecl.h"
-#include "libiberty.h"
-
-#ifdef ANSI_PROTOTYPES
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
-/*
-
-@deftypefn Extension int asprintf (char **@var{resptr}, const char *@var{format}, ...)
-
-Like @code{sprintf}, but instead of passing a pointer to a buffer, you
-pass a pointer to a pointer. This function will compute the size of
-the buffer needed, allocate memory with @code{malloc}, and store a
-pointer to the allocated memory in @code{*@var{resptr}}. The value
-returned is the same as @code{sprintf} would return. If memory could
-not be allocated, zero is returned and @code{NULL} is stored in
-@code{*@var{resptr}}.
-
-@end deftypefn
-
-*/
-
-int
-asprintf VPARAMS ((char **buf, const char *fmt, ...))
-{
- int status;
- VA_OPEN (ap, fmt);
- VA_FIXEDARG (ap, char **, buf);
- VA_FIXEDARG (ap, const char *, fmt);
- status = vasprintf (buf, fmt, ap);
- VA_CLOSE (ap);
- return status;
-}
diff --git a/libiberty/atexit.c b/libiberty/atexit.c
deleted file mode 100644
index e14de29..0000000
--- a/libiberty/atexit.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Wrapper to implement ANSI C's atexit using SunOS's on_exit. */
-/* This function is in the public domain. --Mike Stump. */
-
-/*
-
-@deftypefn Supplemental int atexit (void (*@var{f})())
-
-Causes function @var{f} to be called at exit. Returns 0.
-
-@end deftypefn
-
-*/
-
-#include "config.h"
-
-#ifdef HAVE_ON_EXIT
-
-int
-atexit(f)
- void (*f)();
-{
- /* If the system doesn't provide a definition for atexit, use on_exit
- if the system provides that. */
- on_exit (f, 0);
- return 0;
-}
-
-#endif
diff --git a/libiberty/basename.c b/libiberty/basename.c
deleted file mode 100644
index 69a982d..0000000
--- a/libiberty/basename.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/* Return the basename of a pathname.
- This file is in the public domain. */
-
-/*
-
-@deftypefn Supplemental char* basename (const char *@var{name})
-
-Returns a pointer to the last component of pathname @var{name}.
-Behavior is undefined if the pathname ends in a directory separator.
-
-@end deftypefn
-
-*/
-
-#include "ansidecl.h"
-#include "libiberty.h"
-#include "safe-ctype.h"
-
-#ifndef DIR_SEPARATOR
-#define DIR_SEPARATOR '/'
-#endif
-
-#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
- defined (__OS2__)
-#define HAVE_DOS_BASED_FILE_SYSTEM
-#ifndef DIR_SEPARATOR_2
-#define DIR_SEPARATOR_2 '\\'
-#endif
-#endif
-
-/* Define IS_DIR_SEPARATOR. */
-#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 */
-
-char *
-basename (name)
- const char *name;
-{
- const char *base;
-
-#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
- /* Skip over the disk name in MSDOS pathnames. */
- if (ISALPHA (name[0]) && name[1] == ':')
- name += 2;
-#endif
-
- for (base = name; *name; name++)
- {
- if (IS_DIR_SEPARATOR (*name))
- {
- base = name + 1;
- }
- }
- return (char *) base;
-}
-
diff --git a/libiberty/bcmp.c b/libiberty/bcmp.c
deleted file mode 100644
index 1895773..0000000
--- a/libiberty/bcmp.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* bcmp
- This function is in the public domain. */
-
-/*
-
-@deftypefn Supplemental int bcmp (char *@var{x}, char *@var{y}, int @var{count})
-
-Compares the first @var{count} bytes of two areas of memory. Returns
-zero if they are the same, nonzero otherwise. Returns zero if
-@var{count} is zero. A nonzero result only indicates a difference,
-it does not indicate any sorting order (say, by having a positive
-result mean @var{x} sorts before @var{y}).
-
-@end deftypefn
-
-*/
-
-
-int
-bcmp (from, to, count)
- char *from, *to;
- int count;
-{
- int rtnval = 0;
-
- while (count-- > 0)
- {
- if (*from++ != *to++)
- {
- rtnval = 1;
- break;
- }
- }
- return (rtnval);
-}
-
diff --git a/libiberty/bcopy.c b/libiberty/bcopy.c
deleted file mode 100644
index 70fa7e3..0000000
--- a/libiberty/bcopy.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* bcopy -- copy memory regions of arbitary length
-
-@deftypefn Supplemental void bcopy (char *@var{in}, char *@var{out}, int @var{length})
-
-Copies @var{length} bytes from memory region @var{in} to region
-@var{out}. The use of @code{bcopy} is deprecated in new programs.
-
-@end deftypefn
-
-*/
-
-void
-bcopy (src, dest, len)
- register char *src, *dest;
- int len;
-{
- if (dest < src)
- while (len--)
- *dest++ = *src++;
- else
- {
- char *lasts = src + (len-1);
- char *lastd = dest + (len-1);
- while (len--)
- *(char *)lastd-- = *(char *)lasts--;
- }
-}
diff --git a/libiberty/bsearch.c b/libiberty/bsearch.c
deleted file mode 100644
index b3283f9..0000000
--- a/libiberty/bsearch.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 1990 Regents of the University of California.
- * All rights reserved.
- *
- * 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.
- * 3. [rescinded 22 July 1999]
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * 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 REGENTS 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.
- */
-
-/*
-
-@deftypefn Supplemental void* bsearch (const void *@var{key}, const void *@var{base}, size_t @var{nmemb}, size_t @var{size}, int (*@var{compar})(const void *, const void *))
-
-Performs a search over an array of @var{nmemb} elements pointed to by
-@var{base} for a member that matches the object pointed to by @var{key}.
-The size of each member is specified by @var{size}. The array contents
-should be sorted in ascending order according to the @var{compar}
-comparison function. This routine should take two arguments pointing to
-the @var{key} and to an array member, in that order, and should return an
-integer less than, equal to, or greater than zero if the @var{key} object
-is respectively less than, matching, or greater than the array member.
-
-@end deftypefn
-
-*/
-
-#include "config.h"
-#include "ansidecl.h"
-#include <sys/types.h> /* size_t */
-#include <stdio.h>
-
-/*
- * Perform a binary search.
- *
- * The code below is a bit sneaky. After a comparison fails, we
- * divide the work in half by moving either left or right. If lim
- * is odd, moving left simply involves halving lim: e.g., when lim
- * is 5 we look at item 2, so we change lim to 2 so that we will
- * look at items 0 & 1. If lim is even, the same applies. If lim
- * is odd, moving right again involes halving lim, this time moving
- * the base up one item past p: e.g., when lim is 5 we change base
- * to item 3 and make lim 2 so that we will look at items 3 and 4.
- * If lim is even, however, we have to shrink it by one before
- * halving: e.g., when lim is 4, we still looked at item 2, so we
- * have to make lim 3, then halve, obtaining 1, so that we will only
- * look at item 3.
- */
-void *
-bsearch(key, base0, nmemb, size, compar)
- register void *key;
- void *base0;
- size_t nmemb;
- register size_t size;
- register int (*compar)();
-{
- register char *base = base0;
- register int lim, cmp;
- register void *p;
-
- for (lim = nmemb; lim != 0; lim >>= 1) {
- p = base + (lim >> 1) * size;
- cmp = (*compar)(key, p);
- if (cmp == 0)
- return (p);
- if (cmp > 0) { /* key > p: move right */
- base = (char *)p + size;
- lim--;
- } /* else move left */
- }
- return (NULL);
-}
diff --git a/libiberty/bzero.c b/libiberty/bzero.c
deleted file mode 100644
index 8874118..0000000
--- a/libiberty/bzero.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Portable version of bzero for systems without it.
- This function is in the public domain. */
-
-/*
-
-@deftypefn Supplemental void bzero (char *@var{mem}, int @var{count})
-
-Zeros @var{count} bytes starting at @var{mem}. Use of this function
-is deprecated in favor of @code{memset}.
-
-@end deftypefn
-
-*/
-
-
-void
-bzero (to, count)
- char *to;
- int count;
-{
- while (count-- > 0)
- {
- *to++ = 0;
- }
-}
diff --git a/libiberty/calloc.c b/libiberty/calloc.c
deleted file mode 100644
index b342f6c..0000000
--- a/libiberty/calloc.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* calloc -- allocate memory which has been initialized to zero.
- This function is in the public domain. */
-
-/*
-
-@deftypefn Supplemental void* calloc (size_t @var{nelem}, size_t @var{elsize})
-
-Uses @code{malloc} to allocate storage for @var{nelem} objects of
-@var{elsize} bytes each, then zeros the memory.
-
-@end deftypefn
-
-*/
-
-#include "ansidecl.h"
-#include "libiberty.h"
-
-#ifdef ANSI_PROTOTYPES
-#include <stddef.h>
-#else
-#define size_t unsigned long
-#endif
-
-/* For systems with larger pointers than ints, this must be declared. */
-PTR malloc PARAMS ((size_t));
-
-PTR
-calloc (nelem, elsize)
- size_t nelem, elsize;
-{
- register PTR ptr;
-
- if (nelem == 0 || elsize == 0)
- nelem = elsize = 1;
-
- ptr = malloc (nelem * elsize);
- if (ptr) bzero (ptr, nelem * elsize);
-
- return ptr;
-}
diff --git a/libiberty/choose-temp.c b/libiberty/choose-temp.c
deleted file mode 100644
index 5c2c614..0000000
--- a/libiberty/choose-temp.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/* Utility to pick a temporary filename prefix.
- Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
-
-This file is part of the libiberty library.
-Libiberty is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public
-License as published by the Free Software Foundation; either
-version 2 of the License, or (at your option) any later version.
-
-Libiberty is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with libiberty; see the file COPYING.LIB. If not,
-write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdio.h> /* May get P_tmpdir. */
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-
-#include "libiberty.h"
-extern char *choose_tmpdir PARAMS ((void));
-
-/* Name of temporary file.
- mktemp requires 6 trailing X's. */
-#define TEMP_FILE "ccXXXXXX"
-#define TEMP_FILE_LEN (sizeof(TEMP_FILE) - 1)
-
-/*
-
-@deftypefn Extension char* choose_temp_base (void)
-
-Return a prefix for temporary file names or @code{NULL} if unable to
-find one. The current directory is chosen if all else fails so the
-program is exited if a temporary directory can't be found (@code{mktemp}
-fails). The buffer for the result is obtained with @code{xmalloc}.
-
-This function is provided for backwards compatability only. Its use is
-not recommended.
-
-@end deftypefn
-
-*/
-
-char *
-choose_temp_base ()
-{
- const char *base = choose_tmpdir ();
- char *temp_filename;
- int len;
-
- len = strlen (base);
- temp_filename = xmalloc (len + TEMP_FILE_LEN + 1);
- strcpy (temp_filename, base);
- strcpy (temp_filename + len, TEMP_FILE);
-
- mktemp (temp_filename);
- if (strlen (temp_filename) == 0)
- abort ();
- return temp_filename;
-}
diff --git a/libiberty/clock.c b/libiberty/clock.c
deleted file mode 100644
index 3ea70c3..0000000
--- a/libiberty/clock.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/* ANSI-compatible clock function.
- Copyright (C) 1994, 1995, 1999 Free Software Foundation, Inc.
-
-This file is part of the libiberty 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.
-
-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.
-
-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.
-
-As a special exception, if you link this library with files
-compiled with a GNU compiler to produce an executable, this does not 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. */
-
-/*
-
-@deftypefn Supplemental long clock (void)
-
-Returns an approximation of the CPU time used by the process as a
-@code{clock_t}; divide this number by @samp{CLOCKS_PER_SEC} to get the
-number of seconds used.
-
-@end deftypefn
-
-*/
-
-#include "config.h"
-
-#ifdef HAVE_GETRUSAGE
-#include <sys/time.h>
-#include <sys/resource.h>
-#endif
-
-#ifdef HAVE_TIMES
-#ifdef HAVE_SYS_PARAM_H
-#include <sys/param.h>
-#endif
-#include <sys/times.h>
-#endif
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#ifdef _SC_CLK_TCK
-#define GNU_HZ sysconf(_SC_CLK_TCK)
-#else
-#ifdef HZ
-#define GNU_HZ HZ
-#else
-#ifdef CLOCKS_PER_SEC
-#define GNU_HZ CLOCKS_PER_SEC
-#endif
-#endif
-#endif
-
-/* FIXME: should be able to declare as clock_t. */
-
-long
-clock ()
-{
-#ifdef HAVE_GETRUSAGE
- struct rusage rusage;
-
- getrusage (0, &rusage);
- return (rusage.ru_utime.tv_sec * 1000000 + rusage.ru_utime.tv_usec
- + rusage.ru_stime.tv_sec * 1000000 + rusage.ru_stime.tv_usec);
-#else
-#ifdef HAVE_TIMES
- struct tms tms;
-
- times (&tms);
- return (tms.tms_utime + tms.tms_stime) * (1000000 / GNU_HZ);
-#else
-#ifdef VMS
- struct
- {
- int proc_user_time;
- int proc_system_time;
- int child_user_time;
- int child_system_time;
- } vms_times;
-
- times (&vms_times);
- return (vms_times.proc_user_time + vms_times.proc_system_time) * 10000;
-#else
- /* A fallback, if nothing else available. */
- return 0;
-#endif /* VMS */
-#endif /* HAVE_TIMES */
-#endif /* HAVE_GETRUSAGE */
-}
-
diff --git a/libiberty/concat.c b/libiberty/concat.c
deleted file mode 100644
index 98b20e1..0000000
--- a/libiberty/concat.c
+++ /dev/null
@@ -1,236 +0,0 @@
-/* Concatenate variable number of strings.
- Copyright (C) 1991, 1994, 2001 Free Software Foundation, Inc.
- Written by Fred Fish @ Cygnus Support
-
-This file is part of the libiberty library.
-Libiberty is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public
-License as published by the Free Software Foundation; either
-version 2 of the License, or (at your option) any later version.
-
-Libiberty is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with libiberty; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-
-/*
-
-@deftypefn Extension char* concat (const char *@var{s1}, const char *@var{s2}, @dots{}, @code{NULL})
-
-Concatenate zero or more of strings and return the result in freshly
-@code{xmalloc}ed memory. Returns @code{NULL} if insufficient memory is
-available. The argument list is terminated by the first @code{NULL}
-pointer encountered. Pointers to empty strings are ignored.
-
-@end deftypefn
-
-NOTES
-
- This function uses xmalloc() which is expected to be a front end
- function to malloc() that deals with low memory situations. In
- typical use, if malloc() returns NULL then xmalloc() diverts to an
- error handler routine which never returns, and thus xmalloc will
- never return a NULL pointer. If the client application wishes to
- deal with low memory situations itself, it should supply an xmalloc
- that just directly invokes malloc and blindly returns whatever
- malloc returns.
-
-*/
-
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include "ansidecl.h"
-#include "libiberty.h"
-#include <sys/types.h> /* size_t */
-
-#ifdef ANSI_PROTOTYPES
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
-# if HAVE_STRING_H
-# include <string.h>
-# else
-# if HAVE_STRINGS_H
-# include <strings.h>
-# endif
-# endif
-
-#if HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-
-static inline unsigned long vconcat_length PARAMS ((const char *, va_list));
-static inline unsigned long
-vconcat_length (first, args)
- const char *first;
- va_list args;
-{
- unsigned long length = 0;
- const char *arg;
-
- for (arg = first; arg ; arg = va_arg (args, const char *))
- length += strlen (arg);
-
- return length;
-}
-
-static inline char *vconcat_copy PARAMS ((char *, const char *, va_list));
-static inline char *
-vconcat_copy (dst, first, args)
- char *dst;
- const char *first;
- va_list args;
-{
- char *end = dst;
- const char *arg;
-
- for (arg = first; arg ; arg = va_arg (args, const char *))
- {
- unsigned long length = strlen (arg);
- memcpy (end, arg, length);
- end += length;
- }
- *end = '\000';
-
- return dst;
-}
-
-/* @undocumented concat_length */
-
-unsigned long
-concat_length VPARAMS ((const char *first, ...))
-{
- unsigned long length;
-
- VA_OPEN (args, first);
- VA_FIXEDARG (args, const char *, first);
- length = vconcat_length (first, args);
- VA_CLOSE (args);
-
- return length;
-}
-
-/* @undocumented concat_copy */
-
-char *
-concat_copy VPARAMS ((char *dst, const char *first, ...))
-{
- char *save_dst;
-
- VA_OPEN (args, first);
- VA_FIXEDARG (args, char *, dst);
- VA_FIXEDARG (args, const char *, first);
- vconcat_copy (dst, first, args);
- save_dst = dst; /* With K&R C, dst goes out of scope here. */
- VA_CLOSE (args);
-
- return save_dst;
-}
-
-char *libiberty_concat_ptr;
-
-/* @undocumented concat_copy2 */
-
-char *
-concat_copy2 VPARAMS ((const char *first, ...))
-{
- VA_OPEN (args, first);
- VA_FIXEDARG (args, const char *, first);
- vconcat_copy (libiberty_concat_ptr, first, args);
- VA_CLOSE (args);
-
- return libiberty_concat_ptr;
-}
-
-char *
-concat VPARAMS ((const char *first, ...))
-{
- char *newstr;
-
- /* First compute the size of the result and get sufficient memory. */
- VA_OPEN (args, first);
- VA_FIXEDARG (args, const char *, first);
- newstr = (char *) xmalloc (vconcat_length (first, args) + 1);
- VA_CLOSE (args);
-
- /* Now copy the individual pieces to the result string. */
- VA_OPEN (args, first);
- VA_FIXEDARG (args, const char *, first);
- vconcat_copy (newstr, first, args);
- VA_CLOSE (args);
-
- return newstr;
-}
-
-/*
-
-@deftypefn Extension char* reconcat (char *@var{optr}, const char *@var{s1}, @dots{}, @code{NULL})
-
-Same as @code{concat}, except that if @var{optr} is not @code{NULL} it
-is freed after the string is created. This is intended to be useful
-when you're extending an existing string or building up a string in a
-loop:
-
-@example
- str = reconcat (str, "pre-", str, NULL);
-@end example
-
-@end deftypefn
-
-*/
-
-char *
-reconcat VPARAMS ((char *optr, const char *first, ...))
-{
- char *newstr;
-
- /* First compute the size of the result and get sufficient memory. */
- VA_OPEN (args, first);
- VA_FIXEDARG (args, char *, optr);
- VA_FIXEDARG (args, const char *, first);
- newstr = (char *) xmalloc (vconcat_length (first, args) + 1);
- VA_CLOSE (args);
-
- /* Now copy the individual pieces to the result string. */
- VA_OPEN (args, first);
- VA_FIXEDARG (args, char *, optr);
- VA_FIXEDARG (args, const char *, first);
- vconcat_copy (newstr, first, args);
- if (optr) /* Done before VA_CLOSE so optr stays in scope for K&R C. */
- free (optr);
- VA_CLOSE (args);
-
- return newstr;
-}
-
-#ifdef MAIN
-#define NULLP (char *)0
-
-/* Simple little test driver. */
-
-#include <stdio.h>
-
-int
-main ()
-{
- printf ("\"\" = \"%s\"\n", concat (NULLP));
- printf ("\"a\" = \"%s\"\n", concat ("a", NULLP));
- printf ("\"ab\" = \"%s\"\n", concat ("a", "b", NULLP));
- printf ("\"abc\" = \"%s\"\n", concat ("a", "b", "c", NULLP));
- printf ("\"abcd\" = \"%s\"\n", concat ("ab", "cd", NULLP));
- printf ("\"abcde\" = \"%s\"\n", concat ("ab", "c", "de", NULLP));
- printf ("\"abcdef\" = \"%s\"\n", concat ("", "a", "", "bcd", "ef", NULLP));
- return 0;
-}
-
-#endif
diff --git a/libiberty/config.h-vms b/libiberty/config.h-vms
deleted file mode 100644
index ccac6a2..0000000
--- a/libiberty/config.h-vms
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifndef NEED_strerror
-#define NEED_strerror
-#endif
-#ifndef NEED_basename
-#define NEED_basename
-#endif
-#ifndef NEED_psignal
-#define NEED_psignal
-#endif
-#ifndef NEED_on_exit
-#define NEED_on_exit
-#endif
-
diff --git a/libiberty/config.in b/libiberty/config.in
deleted file mode 100644
index e06bbce..0000000
--- a/libiberty/config.in
+++ /dev/null
@@ -1,254 +0,0 @@
-/* config.in. Generated automatically from configure.in by autoheader 2.13. */
-
-/* Define to empty if the keyword does not work. */
-#undef const
-
-/* Define if you have a working `mmap' system call. */
-#undef HAVE_MMAP
-
-/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
-#undef HAVE_SYS_WAIT_H
-
-/* Define if you have <vfork.h>. */
-#undef HAVE_VFORK_H
-
-/* Define as __inline if that's what the C compiler calls it. */
-#undef inline
-
-/* Define to `int' if <sys/types.h> doesn't define. */
-#undef pid_t
-
-/* Define if you need to in order for stat and other things to work. */
-#undef _POSIX_SOURCE
-
-/* Define if you have the ANSI C header files. */
-#undef STDC_HEADERS
-
-/* Define if you can safely include both <sys/time.h> and <time.h>. */
-#undef TIME_WITH_SYS_TIME
-
-/* Define vfork as fork if vfork does not work. */
-#undef vfork
-
-/* Define if you have the _doprnt function. */
-#undef HAVE__DOPRNT
-
-/* Define if you have the asprintf function. */
-#undef HAVE_ASPRINTF
-
-/* Define if you have the atexit function. */
-#undef HAVE_ATEXIT
-
-/* Define if you have the basename function. */
-#undef HAVE_BASENAME
-
-/* Define if you have the bcmp function. */
-#undef HAVE_BCMP
-
-/* Define if you have the bcopy function. */
-#undef HAVE_BCOPY
-
-/* Define if you have the bsearch function. */
-#undef HAVE_BSEARCH
-
-/* Define if you have the bzero function. */
-#undef HAVE_BZERO
-
-/* Define if you have the calloc function. */
-#undef HAVE_CALLOC
-
-/* Define if you have the clock function. */
-#undef HAVE_CLOCK
-
-/* Define if you have the ffs function. */
-#undef HAVE_FFS
-
-/* Define if you have the getcwd function. */
-#undef HAVE_GETCWD
-
-/* Define if you have the getpagesize function. */
-#undef HAVE_GETPAGESIZE
-
-/* Define if you have the getrusage function. */
-#undef HAVE_GETRUSAGE
-
-/* Define if you have the gettimeofday function. */
-#undef HAVE_GETTIMEOFDAY
-
-/* Define if you have the index function. */
-#undef HAVE_INDEX
-
-/* Define if you have the insque function. */
-#undef HAVE_INSQUE
-
-/* Define if you have the memchr function. */
-#undef HAVE_MEMCHR
-
-/* Define if you have the memcmp function. */
-#undef HAVE_MEMCMP
-
-/* Define if you have the memcpy function. */
-#undef HAVE_MEMCPY
-
-/* Define if you have the memmove function. */
-#undef HAVE_MEMMOVE
-
-/* Define if you have the memset function. */
-#undef HAVE_MEMSET
-
-/* Define if you have the mkstemps function. */
-#undef HAVE_MKSTEMPS
-
-/* Define if you have the on_exit function. */
-#undef HAVE_ON_EXIT
-
-/* Define if you have the psignal function. */
-#undef HAVE_PSIGNAL
-
-/* Define if you have the putenv function. */
-#undef HAVE_PUTENV
-
-/* Define if you have the random function. */
-#undef HAVE_RANDOM
-
-/* Define if you have the rename function. */
-#undef HAVE_RENAME
-
-/* Define if you have the rindex function. */
-#undef HAVE_RINDEX
-
-/* Define if you have the sbrk function. */
-#undef HAVE_SBRK
-
-/* Define if you have the setenv function. */
-#undef HAVE_SETENV
-
-/* Define if you have the sigsetmask function. */
-#undef HAVE_SIGSETMASK
-
-/* Define if you have the strcasecmp function. */
-#undef HAVE_STRCASECMP
-
-/* Define if you have the strchr function. */
-#undef HAVE_STRCHR
-
-/* Define if you have the strdup function. */
-#undef HAVE_STRDUP
-
-/* Define if you have the strerror function. */
-#undef HAVE_STRERROR
-
-/* Define if you have the strncasecmp function. */
-#undef HAVE_STRNCASECMP
-
-/* Define if you have the strrchr function. */
-#undef HAVE_STRRCHR
-
-/* Define if you have the strsignal function. */
-#undef HAVE_STRSIGNAL
-
-/* Define if you have the strstr function. */
-#undef HAVE_STRSTR
-
-/* Define if you have the strtod function. */
-#undef HAVE_STRTOD
-
-/* Define if you have the strtol function. */
-#undef HAVE_STRTOL
-
-/* Define if you have the strtoul function. */
-#undef HAVE_STRTOUL
-
-/* Define if you have the sysconf function. */
-#undef HAVE_SYSCONF
-
-/* Define if you have the times function. */
-#undef HAVE_TIMES
-
-/* Define if you have the tmpnam function. */
-#undef HAVE_TMPNAM
-
-/* Define if you have the vasprintf function. */
-#undef HAVE_VASPRINTF
-
-/* Define if you have the vfprintf function. */
-#undef HAVE_VFPRINTF
-
-/* Define if you have the vprintf function. */
-#undef HAVE_VPRINTF
-
-/* Define if you have the vsprintf function. */
-#undef HAVE_VSPRINTF
-
-/* Define if you have the waitpid function. */
-#undef HAVE_WAITPID
-
-/* Define if you have the <alloca.h> header file. */
-#undef HAVE_ALLOCA_H
-
-/* Define if you have the <fcntl.h> header file. */
-#undef HAVE_FCNTL_H
-
-/* Define if you have the <limits.h> header file. */
-#undef HAVE_LIMITS_H
-
-/* Define if you have the <stdlib.h> header file. */
-#undef HAVE_STDLIB_H
-
-/* Define if you have the <string.h> header file. */
-#undef HAVE_STRING_H
-
-/* Define if you have the <strings.h> header file. */
-#undef HAVE_STRINGS_H
-
-/* Define if you have the <sys/file.h> header file. */
-#undef HAVE_SYS_FILE_H
-
-/* Define if you have the <sys/mman.h> header file. */
-#undef HAVE_SYS_MMAN_H
-
-/* Define if you have the <sys/param.h> header file. */
-#undef HAVE_SYS_PARAM_H
-
-/* Define if you have the <sys/resource.h> header file. */
-#undef HAVE_SYS_RESOURCE_H
-
-/* Define if you have the <sys/stat.h> header file. */
-#undef HAVE_SYS_STAT_H
-
-/* Define if you have the <sys/time.h> header file. */
-#undef HAVE_SYS_TIME_H
-
-/* Define if you have the <time.h> header file. */
-#undef HAVE_TIME_H
-
-/* Define if you have the <unistd.h> header file. */
-#undef HAVE_UNISTD_H
-
-/* Define if errno must be declared even when <errno.h> is included. */
-#undef NEED_DECLARATION_ERRNO
-
-/* Define if you have the `uintptr_t' type. */
-#undef HAVE_UINTPTR_T
-
-/* Define if you have the sys_errlist variable. */
-#undef HAVE_SYS_ERRLIST
-
-/* Define if you have the sys_nerr variable. */
-#undef HAVE_SYS_NERR
-
-/* Define if you have the sys_siglist variable. */
-#undef HAVE_SYS_SIGLIST
-
-/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP
- systems. This function is required for alloca.c support on those
- systems. */
-#undef CRAY_STACKSEG_END
-
-/* Define if you know the direction of stack growth for your system;
- otherwise it will be automatically deduced at run-time.
- STACK_DIRECTION > 0 => grows toward higher addresses
- STACK_DIRECTION < 0 => grows toward lower addresses
- STACK_DIRECTION = 0 => direction of growth unknown */
-#undef STACK_DIRECTION
-
diff --git a/libiberty/config.table b/libiberty/config.table
deleted file mode 100644
index b9a2479..0000000
--- a/libiberty/config.table
+++ /dev/null
@@ -1,67 +0,0 @@
-# Don't build the shared library for build.
-if [ -n "${with_build_subdir}" ]; then
- enable_shared=no
-fi
-
-frag=
-case "${host}" in
- rs6000-ibm-aix3.1 | rs6000-ibm-aix)
- frag=mh-aix ;;
- *-*-cxux7*) frag=mh-cxux7 ;;
- *-*-freebsd2.1.*) frag=mh-fbsd21 ;;
- *-*-freebsd2.2.[012]) frag=mh-fbsd21 ;;
- i370-*-opened*) frag=mh-openedition ;;
- i[345]86-*-windows*) frag=mh-windows ;;
-esac
-
-if [ -n "${frag}" ]; then
- frags=${libiberty_topdir}/libiberty/config/$frag
-else
- frags=
-fi
-
-# If they didn't specify --enable-shared, don't generate shared libs.
-case "${enable_shared}" in
- yes) shared=yes ;;
- no) shared=no ;;
- "") shared=no ;;
- *) shared=yes ;;
-esac
-if [ "${shared}" = "yes" ]; then
- frag=
- case "${host}" in
- *-*-cygwin*) ;;
- alpha*-*-linux*) frag=mh-elfalphapic ;;
- arm*-*-*) frag=mh-armpic ;;
- hppa*-*-*) frag=mh-papic ;;
- i[3456]86-*-* | x86_64-*-*)
- frag=mh-x86pic ;;
- powerpc*-*-aix*) ;;
- powerpc*-*-*) frag=mh-ppcpic ;;
- sparc*-*-*) frag=mh-sparcpic ;;
- *) frag=mh-${host_cpu}pic ;;
- esac
- if [ -n "${frag}" ]; then
- frags="${frags} ${libiberty_topdir}/config/${frag}"
- fi
-fi
-
-echo "# Warning: this fragment is automatically generated" > temp-frag
-
-for frag in ${frags}; do
- if [ -f ${frag} ]; then
- echo "Appending ${frag} to xhost-mkfrag"
- echo "# Following fragment copied from ${frag}" >> temp-frag
- cat ${frag} >> temp-frag
- fi
-done
-
-# record if we want to build shared libs.
-if [ "${shared}" = "yes" ]; then
- echo enable_shared = yes >> temp-frag
-else
- echo enable_shared = no >> temp-frag
-fi
-
-frag=xhost-mkfrag
-${CONFIG_SHELL-/bin/sh} ${libiberty_topdir}/move-if-change temp-frag xhost-mkfrag
diff --git a/libiberty/config/mh-aix b/libiberty/config/mh-aix
deleted file mode 100644
index 6b64505..0000000
--- a/libiberty/config/mh-aix
+++ /dev/null
@@ -1,9 +0,0 @@
-# This file is only needed by AIX 3.1.
-HDEFINES = -D__IEEE_BIG_ENDIAN
-
-# Most releases of AIX 3.1 include an incorrect internal version of copysign
-# in libc.a for use by some libc public functions including modf. The public
-# version of copysign in libm.a is usable. For the sake of libg++ (which
-# uses modf), we add copysign here. Supposedly, this problem is fixed in AIX
-# 3.1.8 and above, including all releases of AIX 3.2.
-EXTRA_OFILES = copysign.o
diff --git a/libiberty/config/mh-cxux7 b/libiberty/config/mh-cxux7
deleted file mode 100644
index a924b08..0000000
--- a/libiberty/config/mh-cxux7
+++ /dev/null
@@ -1 +0,0 @@
-HDEFINES = -DHARRIS_FLOAT_FORMAT
diff --git a/libiberty/config/mh-fbsd21 b/libiberty/config/mh-fbsd21
deleted file mode 100644
index 1375a78..0000000
--- a/libiberty/config/mh-fbsd21
+++ /dev/null
@@ -1 +0,0 @@
-EXTRA_OFILES=vasprintf.o
diff --git a/libiberty/config/mh-openedition b/libiberty/config/mh-openedition
deleted file mode 100644
index 8de8ed1..0000000
--- a/libiberty/config/mh-openedition
+++ /dev/null
@@ -1,3 +0,0 @@
-HDEFINES = -D_ALL_SOURCE -DLE370
-CC=c89
-
diff --git a/libiberty/config/mh-windows b/libiberty/config/mh-windows
deleted file mode 100644
index 3ff5f79..0000000
--- a/libiberty/config/mh-windows
+++ /dev/null
@@ -1 +0,0 @@
-EXTRA_OFILES=asprintf.o strcasecmp.o strncasecmp.o vasprintf.o
diff --git a/libiberty/configure b/libiberty/configure
deleted file mode 100755
index cac9f56..0000000
--- a/libiberty/configure
+++ /dev/null
@@ -1,3780 +0,0 @@
-#! /bin/sh
-
-# Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.13
-# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
-#
-# This configure script is free software; the Free Software Foundation
-# gives unlimited permission to copy, distribute and modify it.
-
-# Defaults:
-ac_help=
-ac_default_prefix=/usr/local
-# Any additions from configure.in:
-ac_help="$ac_help
- --with-target-subdir=SUBDIR Configuring in a subdirectory for target"
-ac_help="$ac_help
- --with-build-subdir=SUBDIR Configuring in a subdirectory for build"
-ac_help="$ac_help
- --with-cross-host=HOST Configuring with a cross compiler"
-ac_help="$ac_help
- --with-newlib Configuring with newlib"
-ac_help="$ac_help
- --enable-maintainer-mode
- enable make rules and dependencies not useful
- (and sometimes confusing) to the casual installer"
-ac_help="$ac_help
- --enable-install-libiberty Install headers for end users"
-
-# Initialize some variables set by options.
-# The variables have the same names as the options, with
-# dashes changed to underlines.
-build=NONE
-cache_file=./config.cache
-exec_prefix=NONE
-host=NONE
-no_create=
-nonopt=NONE
-no_recursion=
-prefix=NONE
-program_prefix=NONE
-program_suffix=NONE
-program_transform_name=s,x,x,
-silent=
-site=
-srcdir=
-target=NONE
-verbose=
-x_includes=NONE
-x_libraries=NONE
-bindir='${exec_prefix}/bin'
-sbindir='${exec_prefix}/sbin'
-libexecdir='${exec_prefix}/libexec'
-datadir='${prefix}/share'
-sysconfdir='${prefix}/etc'
-sharedstatedir='${prefix}/com'
-localstatedir='${prefix}/var'
-libdir='${exec_prefix}/lib'
-includedir='${prefix}/include'
-oldincludedir='/usr/include'
-infodir='${prefix}/info'
-mandir='${prefix}/man'
-
-# Initialize some other variables.
-subdirs=
-MFLAGS= MAKEFLAGS=
-SHELL=${CONFIG_SHELL-/bin/sh}
-# Maximum number of lines to put in a shell here document.
-ac_max_here_lines=12
-
-ac_prev=
-for ac_option
-do
-
- # If the previous option needs an argument, assign it.
- if test -n "$ac_prev"; then
- eval "$ac_prev=\$ac_option"
- ac_prev=
- continue
- fi
-
- case "$ac_option" in
- -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
- *) ac_optarg= ;;
- esac
-
- # Accept the important Cygnus configure options, so we can diagnose typos.
-
- case "$ac_option" in
-
- -bindir | --bindir | --bindi | --bind | --bin | --bi)
- ac_prev=bindir ;;
- -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
- bindir="$ac_optarg" ;;
-
- -build | --build | --buil | --bui | --bu)
- ac_prev=build ;;
- -build=* | --build=* | --buil=* | --bui=* | --bu=*)
- build="$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" ;;
-
- -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
- ac_prev=datadir ;;
- -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
- | --da=*)
- datadir="$ac_optarg" ;;
-
- -disable-* | --disable-*)
- ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
- fi
- ac_feature=`echo $ac_feature| sed 's/-/_/g'`
- eval "enable_${ac_feature}=no" ;;
-
- -enable-* | --enable-*)
- ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
- fi
- ac_feature=`echo $ac_feature| sed 's/-/_/g'`
- case "$ac_option" in
- *=*) ;;
- *) ac_optarg=yes ;;
- esac
- eval "enable_${ac_feature}='$ac_optarg'" ;;
-
- -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
- | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
- | --exec | --exe | --ex)
- ac_prev=exec_prefix ;;
- -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
- | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
- | --exec=* | --exe=* | --ex=*)
- exec_prefix="$ac_optarg" ;;
-
- -gas | --gas | --ga | --g)
- # Obsolete; use --with-gas.
- with_gas=yes ;;
-
- -help | --help | --hel | --he)
- # 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 << EOF
-Usage: configure [options] [host]
-Options: [defaults in brackets after descriptions]
-Configuration:
- --cache-file=FILE cache test results in FILE
- --help print this message
- --no-create do not create output files
- --quiet, --silent do not print \`checking...' messages
- --version print the version of autoconf that created configure
-Directory and file names:
- --prefix=PREFIX install architecture-independent files in PREFIX
- [$ac_default_prefix]
- --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
- [same as prefix]
- --bindir=DIR user executables in DIR [EPREFIX/bin]
- --sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
- --libexecdir=DIR program executables in DIR [EPREFIX/libexec]
- --datadir=DIR read-only architecture-independent data in DIR
- [PREFIX/share]
- --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
- --sharedstatedir=DIR modifiable architecture-independent data in DIR
- [PREFIX/com]
- --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
- --libdir=DIR object code libraries in DIR [EPREFIX/lib]
- --includedir=DIR C header files in DIR [PREFIX/include]
- --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
- --infodir=DIR info documentation in DIR [PREFIX/info]
- --mandir=DIR man documentation in DIR [PREFIX/man]
- --srcdir=DIR find the sources in DIR [configure dir or ..]
- --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
-EOF
- cat << EOF
-Host type:
- --build=BUILD configure for building on BUILD [BUILD=HOST]
- --host=HOST configure for HOST [guessed]
- --target=TARGET configure for TARGET [TARGET=HOST]
-Features and packages:
- --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
- --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
- --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
- --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
- --x-includes=DIR X include files are in DIR
- --x-libraries=DIR X library files are in DIR
-EOF
- if test -n "$ac_help"; then
- echo "--enable and --with options recognized:$ac_help"
- fi
- exit 0 ;;
-
- -host | --host | --hos | --ho)
- ac_prev=host ;;
- -host=* | --host=* | --hos=* | --ho=*)
- host="$ac_optarg" ;;
-
- -includedir | --includedir | --includedi | --included | --include \
- | --includ | --inclu | --incl | --inc)
- ac_prev=includedir ;;
- -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
- | --includ=* | --inclu=* | --incl=* | --inc=*)
- includedir="$ac_optarg" ;;
-
- -infodir | --infodir | --infodi | --infod | --info | --inf)
- ac_prev=infodir ;;
- -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
- infodir="$ac_optarg" ;;
-
- -libdir | --libdir | --libdi | --libd)
- ac_prev=libdir ;;
- -libdir=* | --libdir=* | --libdi=* | --libd=*)
- libdir="$ac_optarg" ;;
-
- -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
- | --libexe | --libex | --libe)
- ac_prev=libexecdir ;;
- -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
- | --libexe=* | --libex=* | --libe=*)
- libexecdir="$ac_optarg" ;;
-
- -localstatedir | --localstatedir | --localstatedi | --localstated \
- | --localstate | --localstat | --localsta | --localst \
- | --locals | --local | --loca | --loc | --lo)
- ac_prev=localstatedir ;;
- -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
- | --localstate=* | --localstat=* | --localsta=* | --localst=* \
- | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
- localstatedir="$ac_optarg" ;;
-
- -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
- ac_prev=mandir ;;
- -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
- mandir="$ac_optarg" ;;
-
- -nfp | --nfp | --nf)
- # Obsolete; use --without-fp.
- with_fp=no ;;
-
- -no-create | --no-create | --no-creat | --no-crea | --no-cre \
- | --no-cr | --no-c)
- no_create=yes ;;
-
- -no-recursion | --no-recursion | --no-recursio | --no-recursi \
- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
- no_recursion=yes ;;
-
- -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
- | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
- | --oldin | --oldi | --old | --ol | --o)
- ac_prev=oldincludedir ;;
- -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
- | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
- | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
- oldincludedir="$ac_optarg" ;;
-
- -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
- ac_prev=prefix ;;
- -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
- prefix="$ac_optarg" ;;
-
- -program-prefix | --program-prefix | --program-prefi | --program-pref \
- | --program-pre | --program-pr | --program-p)
- ac_prev=program_prefix ;;
- -program-prefix=* | --program-prefix=* | --program-prefi=* \
- | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
- program_prefix="$ac_optarg" ;;
-
- -program-suffix | --program-suffix | --program-suffi | --program-suff \
- | --program-suf | --program-su | --program-s)
- ac_prev=program_suffix ;;
- -program-suffix=* | --program-suffix=* | --program-suffi=* \
- | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
- program_suffix="$ac_optarg" ;;
-
- -program-transform-name | --program-transform-name \
- | --program-transform-nam | --program-transform-na \
- | --program-transform-n | --program-transform- \
- | --program-transform | --program-transfor \
- | --program-transfo | --program-transf \
- | --program-trans | --program-tran \
- | --progr-tra | --program-tr | --program-t)
- ac_prev=program_transform_name ;;
- -program-transform-name=* | --program-transform-name=* \
- | --program-transform-nam=* | --program-transform-na=* \
- | --program-transform-n=* | --program-transform-=* \
- | --program-transform=* | --program-transfor=* \
- | --program-transfo=* | --program-transf=* \
- | --program-trans=* | --program-tran=* \
- | --progr-tra=* | --program-tr=* | --program-t=*)
- program_transform_name="$ac_optarg" ;;
-
- -q | -quiet | --quiet | --quie | --qui | --qu | --q \
- | -silent | --silent | --silen | --sile | --sil)
- silent=yes ;;
-
- -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
- ac_prev=sbindir ;;
- -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
- | --sbi=* | --sb=*)
- sbindir="$ac_optarg" ;;
-
- -sharedstatedir | --sharedstatedir | --sharedstatedi \
- | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
- | --sharedst | --shareds | --shared | --share | --shar \
- | --sha | --sh)
- ac_prev=sharedstatedir ;;
- -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
- | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
- | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
- | --sha=* | --sh=*)
- sharedstatedir="$ac_optarg" ;;
-
- -site | --site | --sit)
- ac_prev=site ;;
- -site=* | --site=* | --sit=*)
- site="$ac_optarg" ;;
-
- -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
- ac_prev=srcdir ;;
- -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
- srcdir="$ac_optarg" ;;
-
- -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
- | --syscon | --sysco | --sysc | --sys | --sy)
- ac_prev=sysconfdir ;;
- -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
- | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
- sysconfdir="$ac_optarg" ;;
-
- -target | --target | --targe | --targ | --tar | --ta | --t)
- ac_prev=target ;;
- -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
- target="$ac_optarg" ;;
-
- -v | -verbose | --verbose | --verbos | --verbo | --verb)
- verbose=yes ;;
-
- -version | --version | --versio | --versi | --vers)
- echo "configure generated by autoconf version 2.13"
- exit 0 ;;
-
- -with-* | --with-*)
- ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
- fi
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- case "$ac_option" in
- *=*) ;;
- *) ac_optarg=yes ;;
- esac
- eval "with_${ac_package}='$ac_optarg'" ;;
-
- -without-* | --without-*)
- ac_package=`echo $ac_option|sed -e 's/-*without-//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
- fi
- 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 "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
- ;;
-
- *)
- if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
- echo "configure: warning: $ac_option: invalid host type" 1>&2
- fi
- if test "x$nonopt" != xNONE; then
- { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
- fi
- nonopt="$ac_option"
- ;;
-
- esac
-done
-
-if test -n "$ac_prev"; then
- { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
-fi
-
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-# File descriptor usage:
-# 0 standard input
-# 1 file creation
-# 2 errors and warnings
-# 3 some systems may open it to /dev/tty
-# 4 used on the Kubota Titan
-# 6 checking for... messages and results
-# 5 compiler messages saved in config.log
-if test "$silent" = yes; then
- exec 6>/dev/null
-else
- exec 6>&1
-fi
-exec 5>./config.log
-
-echo "\
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-" 1>&5
-
-# Strip out --no-create and --no-recursion so they do not pile up.
-# Also quote any args containing shell metacharacters.
-ac_configure_args=
-for ac_arg
-do
- case "$ac_arg" in
- -no-create | --no-create | --no-creat | --no-crea | --no-cre \
- | --no-cr | --no-c) ;;
- -no-recursion | --no-recursion | --no-recursio | --no-recursi \
- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
- ac_configure_args="$ac_configure_args '$ac_arg'" ;;
- *) ac_configure_args="$ac_configure_args $ac_arg" ;;
- esac
-done
-
-# NLS nuisances.
-# Only set these to C if already set. These must not be set unconditionally
-# because not all systems understand e.g. LANG=C (notably SCO).
-# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
-# Non-C LC_CTYPE values break the ctype check.
-if test "${LANG+set}" = set; then LANG=C; export LANG; fi
-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
-if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
-if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
-
-# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -rf conftest* confdefs.h
-# AIX cpp loses on an empty file, so make sure it contains at least a newline.
-echo > confdefs.h
-
-# A filename unique to this package, relative to the directory that
-# configure is in, which we can look for to find out if srcdir is correct.
-ac_unique_file=pexecute.c
-
-# Find the source files, if location was not specified.
-if test -z "$srcdir"; then
- ac_srcdir_defaulted=yes
- # Try the directory containing this script, then its parent.
- ac_prog=$0
- ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
- test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
- srcdir=$ac_confdir
- if test ! -r $srcdir/$ac_unique_file; then
- srcdir=..
- fi
-else
- ac_srcdir_defaulted=no
-fi
-if test ! -r $srcdir/$ac_unique_file; then
- if test "$ac_srcdir_defaulted" = yes; then
- { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
- else
- { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
- fi
-fi
-srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
-
-# Prefer explicitly selected file to automatically selected ones.
-if test -z "$CONFIG_SITE"; then
- if test "x$prefix" != xNONE; then
- CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
- else
- CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
- fi
-fi
-for ac_site_file in $CONFIG_SITE; do
- if test -r "$ac_site_file"; then
- echo "loading site script $ac_site_file"
- . "$ac_site_file"
- fi
-done
-
-if test -r "$cache_file"; then
- echo "loading cache $cache_file"
- . $cache_file
-else
- echo "creating cache $cache_file"
- > $cache_file
-fi
-
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-ac_exeext=
-ac_objext=o
-if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
- # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
- if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
- ac_n= ac_c='
-' ac_t=' '
- else
- ac_n=-n ac_c= ac_t=
- fi
-else
- ac_n= ac_c='\c' ac_t=
-fi
-
-
-
-# This works around the fact that libtool configuration may change LD
-# for this particular configuration, but some shells, instead of
-# keeping the changes in LD private, export them just because LD is
-# exported. We don't use libtool yet, but some day we might, so...
-ORIGINAL_LD_FOR_MULTILIBS=$LD
-
-# Check whether --with-target-subdir or --without-target-subdir was given.
-if test "${with_target_subdir+set}" = set; then
- withval="$with_target_subdir"
- :
-fi
-
-# Check whether --with-build-subdir or --without-build-subdir was given.
-if test "${with_build_subdir+set}" = set; then
- withval="$with_build_subdir"
- :
-fi
-
-# Check whether --with-cross-host or --without-cross-host was given.
-if test "${with_cross_host+set}" = set; then
- withval="$with_cross_host"
- :
-fi
-
-# Check whether --with-newlib or --without-newlib was given.
-if test "${with_newlib+set}" = set; then
- withval="$with_newlib"
- :
-fi
-
-
-if test "${srcdir}" = "."; then
- if test -n "${with_build_subdir}"; then
- libiberty_topdir="${srcdir}/../.."
- with_target_subdir=
- elif test -z "${with_target_subdir}"; then
- libiberty_topdir="${srcdir}/.."
- else
- if test "${with_target_subdir}" != "."; then
- libiberty_topdir="${srcdir}/${with_multisrctop}../.."
- else
- libiberty_topdir="${srcdir}/${with_multisrctop}.."
- fi
- fi
-else
- libiberty_topdir="${srcdir}/.."
-fi
-ac_aux_dir=
-for ac_dir in $libiberty_topdir $srcdir/$libiberty_topdir; 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
- fi
-done
-if test -z "$ac_aux_dir"; then
- { echo "configure: error: can not find install-sh or install.sh in $libiberty_topdir $srcdir/$libiberty_topdir" 1>&2; exit 1; }
-fi
-ac_config_guess=$ac_aux_dir/config.guess
-ac_config_sub=$ac_aux_dir/config.sub
-ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
-
-
-
-echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
-echo "configure:609: checking whether to enable maintainer-specific portions of Makefiles" >&5
- # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
-if test "${enable_maintainer_mode+set}" = set; then
- enableval="$enable_maintainer_mode"
- maintainer_mode=$enableval
-else
- maintainer_mode=no
-fi
-
-
-echo "$ac_t""$maintainer_mode" 1>&6
-
-if test "$maintainer_mode" = "yes"; then
- MAINT=''
- NOTMAINT='#'
-else
- MAINT='#'
- NOTMAINT=''
-fi
-
-# Do we have a single-tree copy of texinfo? Even if we do, we can't
-# rely on it - libiberty is built before texinfo.
-# Extract the first word of "makeinfo", so it can be a program name with args.
-set dummy makeinfo; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:634: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_MAKEINFO'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$MAKEINFO"; then
- ac_cv_prog_MAKEINFO="$MAKEINFO" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_MAKEINFO="makeinfo"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-MAKEINFO="$ac_cv_prog_MAKEINFO"
-if test -n "$MAKEINFO"; then
- echo "$ac_t""$MAKEINFO" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-if test "x$MAKEINFO" = "x"; then
- MAKEINFO="@echo makeinfo missing; true"
- BUILD_INFO=
-else
- BUILD_INFO=info
- case x"`$MAKEINFO --version | grep 'GNU texinfo'`" in
- x*\ [1-3].* )
- MAKEINFO="@echo $MAKEINFO is too old, 4.0 or newer required; true"
- BUILD_INFO=
- echo "configure: warning:
-*** Makeinfo is too old. Info documentation will not be built." 1>&2
- ;;
- esac
-fi
-
-
-
-# Extract the first word of "perl", so it can be a program name with args.
-set dummy perl; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:680: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_PERL'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$PERL"; then
- ac_cv_prog_PERL="$PERL" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_PERL="perl"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-PERL="$ac_cv_prog_PERL"
-if test -n "$PERL"; then
- echo "$ac_t""$PERL" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-if test x"$PERL" = x""; then
- HAVE_PERL='#'
-else
- HAVE_PERL=''
-fi
-
-
-
-# Make sure we can run config.sub.
-if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
-else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
-fi
-
-echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:720: checking host system type" >&5
-
-host_alias=$host
-case "$host_alias" in
-NONE)
- case $nonopt in
- NONE)
- if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
- else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
- fi ;;
- *) host_alias=$nonopt ;;
- esac ;;
-esac
-
-host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
-host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$host" 1>&6
-
-
-
-echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:743: checking build system type" >&5
-
-build_alias=$build
-case "$build_alias" in
-NONE)
- case $nonopt in
- NONE) build_alias=$host_alias ;;
- *) build_alias=$nonopt ;;
- esac ;;
-esac
-
-build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`
-build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$build" 1>&6
-
-if test $host != $build; then
- ac_tool_prefix=${host_alias}-
-else
- ac_tool_prefix=
-fi
-
-# 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 $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:769: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$AR"; then
- ac_cv_prog_AR="$AR" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_AR="${ac_tool_prefix}ar"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_prog_AR" && ac_cv_prog_AR="ar"
-fi
-fi
-AR="$ac_cv_prog_AR"
-if test -n "$AR"; then
- echo "$ac_t""$AR" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-
-
-# 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 $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:801: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$RANLIB"; then
- ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-RANLIB="$ac_cv_prog_RANLIB"
-if test -n "$RANLIB"; then
- echo "$ac_t""$RANLIB" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-
-if test -z "$ac_cv_prog_RANLIB"; then
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "ranlib", so it can be a program name with args.
-set dummy ranlib; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:833: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$RANLIB"; then
- ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_RANLIB="ranlib"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
-fi
-fi
-RANLIB="$ac_cv_prog_RANLIB"
-if test -n "$RANLIB"; then
- echo "$ac_t""$RANLIB" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-else
- RANLIB=":"
-fi
-fi
-
-
-
-# Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:870: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CC="gcc"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-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 $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:900: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_prog_rejected=no
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
- ac_prog_rejected=yes
- continue
- fi
- ac_cv_prog_CC="cc"
- break
- fi
- done
- IFS="$ac_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 $# -gt 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
- set dummy "$ac_dir/$ac_word" "$@"
- shift
- ac_cv_prog_CC="$@"
- fi
-fi
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
- test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
-fi
-
-echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:949: checking whether we are using GNU C" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.c <<EOF
-#ifdef __GNUC__
- yes;
-#endif
-EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:958: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
- ac_cv_prog_gcc=yes
-else
- ac_cv_prog_gcc=no
-fi
-fi
-
-echo "$ac_t""$ac_cv_prog_gcc" 1>&6
-
-if test $ac_cv_prog_gcc = yes; then
- GCC=yes
- ac_libiberty_warn_cflags='-W -Wall -Wtraditional -pedantic'
- ac_test_CFLAGS="${CFLAGS+set}"
- ac_save_CFLAGS="$CFLAGS"
- CFLAGS=
- echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:974: checking whether ${CC-cc} accepts -g" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- echo 'void f(){}' > conftest.c
-if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
- ac_cv_prog_cc_g=yes
-else
- ac_cv_prog_cc_g=no
-fi
-rm -f conftest*
-
-fi
-
-echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
- if test "$ac_test_CFLAGS" = set; then
- CFLAGS="$ac_save_CFLAGS"
- elif test $ac_cv_prog_cc_g = yes; then
- CFLAGS="-g -O2"
- else
- CFLAGS="-O2"
- fi
-else
- GCC=
- ac_libiberty_warn_cflags=
- test "${CFLAGS+set}" = set || CFLAGS="-g"
-fi
-
-
-
-if test "x$CC" != xcc; then
- echo $ac_n "checking whether $CC and cc understand -c and -o together""... $ac_c" 1>&6
-echo "configure:1006: checking whether $CC and cc understand -c and -o together" >&5
-else
- echo $ac_n "checking whether cc understands -c and -o together""... $ac_c" 1>&6
-echo "configure:1009: checking whether cc understands -c and -o together" >&5
-fi
-set dummy $CC; ac_cc="`echo $2 |
- sed -e 's/[^a-zA-Z0-9_]/_/g' -e 's/^[0-9]/_/'`"
-if eval "test \"`echo '$''{'ac_cv_prog_cc_${ac_cc}_c_o'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- echo 'foo(){}' > conftest.c
-# 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-cc} -c conftest.c -o conftest.o 1>&5'
-if { (eval echo configure:1021: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } &&
- test -f conftest.o && { (eval echo configure:1022: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; };
-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.c 1>&5'; { (eval echo configure:1027: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
- ac_try='cc -c conftest.c -o conftest.o 1>&5'
- if { (eval echo configure:1029: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } &&
- test -f conftest.o && { (eval echo configure:1030: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; };
- 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 conftest*
-
-fi
-if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = yes"; then
- echo "$ac_t""yes" 1>&6
-else
- echo "$ac_t""no" 1>&6
- cat >> confdefs.h <<\EOF
-#define NO_MINUS_C_MINUS_O 1
-EOF
-
-fi
-
-# autoconf is lame and doesn't give us any substitution variable for this.
-if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then
- NO_MINUS_C_MINUS_O=yes
-else
- OUTPUT_OPTION='-o $@'
-fi
-
-
-
-echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6
-echo "configure:1066: checking for POSIXized ISC" >&5
-if test -d /etc/conf/kconfig.d &&
- grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
-then
- echo "$ac_t""yes" 1>&6
- ISC=yes # If later tests want to check for ISC.
- cat >> confdefs.h <<\EOF
-#define _POSIX_SOURCE 1
-EOF
-
- if test "$GCC" = yes; then
- CC="$CC -posix"
- else
- CC="$CC -Xp"
- fi
-else
- echo "$ac_t""no" 1>&6
- ISC=
-fi
-
-echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:1087: checking for working const" >&5
-if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1092 "configure"
-#include "confdefs.h"
-
-int main() {
-
-/* Ultrix mips cc rejects this. */
-typedef int charset[2]; const charset x;
-/* SunOS 4.1.1 cc rejects this. */
-char const *const *ccp;
-char **p;
-/* NEC SVR4.0.2 mips cc rejects this. */
-struct point {int x, y;};
-static struct point const zero = {0,0};
-/* AIX XL C 1.02.0.0 rejects this.
- It does not let you subtract one const X* pointer from another in an arm
- of an if-expression whose if-part is not a constant expression */
-const char *g = "string";
-ccp = &g + (g ? g-g : 0);
-/* HPUX 7.0 cc rejects these. */
-++ccp;
-p = (char**) ccp;
-ccp = (char const *const *) p;
-{ /* SCO 3.2v4 cc rejects this. */
- char *t;
- char const *s = 0 ? (char *) 0 : (char const *) 0;
-
- *t++ = 0;
-}
-{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
- int x[] = {25, 17};
- const int *foo = &x[0];
- ++foo;
-}
-{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
- typedef const int *iptr;
- iptr p = 0;
- ++p;
-}
-{ /* AIX XL C 1.02.0.0 rejects this saying
- "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
- struct s { int j; const int *ap[3]; };
- struct s *b; b->j = 5;
-}
-{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
- const int foo = 10;
-}
-
-; return 0; }
-EOF
-if { (eval echo configure:1141: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- ac_cv_c_const=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_c_const=no
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_c_const" 1>&6
-if test $ac_cv_c_const = no; then
- cat >> confdefs.h <<\EOF
-#define const
-EOF
-
-fi
-
-echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:1162: checking for inline" >&5
-if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- ac_cv_c_inline=no
-for ac_kw in inline __inline__ __inline; do
- cat > conftest.$ac_ext <<EOF
-#line 1169 "configure"
-#include "confdefs.h"
-
-int main() {
-} $ac_kw foo() {
-; return 0; }
-EOF
-if { (eval echo configure:1176: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- ac_cv_c_inline=$ac_kw; break
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
-fi
-rm -f conftest*
-done
-
-fi
-
-echo "$ac_t""$ac_cv_c_inline" 1>&6
-case "$ac_cv_c_inline" in
- inline | yes) ;;
- no) cat >> confdefs.h <<\EOF
-#define inline
-EOF
- ;;
- *) cat >> confdefs.h <<EOF
-#define inline $ac_cv_c_inline
-EOF
- ;;
-esac
-
-
-
-
-
-
-
-# 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
-# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
-# AFS /usr/afsws/bin/install, which mishandles nonexistent args
-# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
-# ./install, which can be erroneously created by make from ./install.sh.
-echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:1219: checking for a BSD compatible install" >&5
-if test -z "$INSTALL"; then
-if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
- for ac_dir in $PATH; do
- # Account for people who put trailing slashes in PATH elements.
- case "$ac_dir/" in
- /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
- *)
- # OSF1 and SCO ODT 3.0 have their own names for install.
- # Don't use installbsd from OSF since it installs stuff as root
- # by default.
- for ac_prog in ginstall scoinst install; do
- if test -f $ac_dir/$ac_prog; then
- if test $ac_prog = install &&
- grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
- # AIX install. It has an incompatible calling convention.
- :
- else
- ac_cv_path_install="$ac_dir/$ac_prog -c"
- break 2
- fi
- fi
- done
- ;;
- esac
- done
- IFS="$ac_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. We don't cache a
- # path for INSTALL within a source directory, because that will
- # break other packages using the cache if that directory is
- # removed, or if the path is relative.
- INSTALL="$ac_install_sh"
- fi
-fi
-echo "$ac_t""$INSTALL" 1>&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_PROGRAM}'
-
-test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-
-
-. ${srcdir}/config.table
-host_makefile_frag=${frag}
-
-
-# It's OK to check for header files. Although the compiler may not be
-# able to link anything, it had better be able to at least compile
-# something.
-echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1280: checking how to run the C preprocessor" >&5
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
- CPP=
-fi
-if test -z "$CPP"; then
-if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- # This must be in double quotes, not single quotes, because CPP may get
- # substituted into the Makefile and "${CC-cc}" will confuse make.
- CPP="${CC-cc} -E"
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp.
- cat > conftest.$ac_ext <<EOF
-#line 1295 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1301: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- :
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- CPP="${CC-cc} -E -traditional-cpp"
- cat > conftest.$ac_ext <<EOF
-#line 1312 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1318: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- :
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- CPP="${CC-cc} -nologo -E"
- cat > conftest.$ac_ext <<EOF
-#line 1329 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1335: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- :
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- CPP=/lib/cpp
-fi
-rm -f conftest*
-fi
-rm -f conftest*
-fi
-rm -f conftest*
- ac_cv_prog_CPP="$CPP"
-fi
- CPP="$ac_cv_prog_CPP"
-else
- ac_cv_prog_CPP="$CPP"
-fi
-echo "$ac_t""$CPP" 1>&6
-
-for ac_hdr in sys/file.h sys/param.h limits.h stdlib.h string.h unistd.h strings.h sys/time.h time.h sys/resource.h sys/stat.h sys/mman.h fcntl.h alloca.h
-do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1363: checking for $ac_hdr" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1368 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1373: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=yes"
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=no"
-fi
-rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_hdr 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
-echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
-echo "configure:1400: checking for sys/wait.h that is POSIX.1 compatible" >&5
-if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1405 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#include <sys/wait.h>
-#ifndef WEXITSTATUS
-#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
-#endif
-#ifndef WIFEXITED
-#define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
-#endif
-int main() {
-int s;
-wait (&s);
-s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
-; return 0; }
-EOF
-if { (eval echo configure:1421: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- ac_cv_header_sys_wait_h=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_header_sys_wait_h=no
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_header_sys_wait_h" 1>&6
-if test $ac_cv_header_sys_wait_h = yes; then
- cat >> confdefs.h <<\EOF
-#define HAVE_SYS_WAIT_H 1
-EOF
-
-fi
-
-echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:1442: checking whether time.h and sys/time.h may both be included" >&5
-if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1447 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#include <sys/time.h>
-#include <time.h>
-int main() {
-struct tm *tp;
-; return 0; }
-EOF
-if { (eval echo configure:1456: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- ac_cv_header_time=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_header_time=no
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_header_time" 1>&6
-if test $ac_cv_header_time = yes; then
- cat >> confdefs.h <<\EOF
-#define TIME_WITH_SYS_TIME 1
-EOF
-
-fi
-
-
-echo $ac_n "checking whether errno must be declared""... $ac_c" 1>&6
-echo "configure:1478: checking whether errno must be declared" >&5
-if eval "test \"`echo '$''{'libiberty_cv_declare_errno'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1483 "configure"
-#include "confdefs.h"
-#include <errno.h>
-int main() {
-int x = errno;
-; return 0; }
-EOF
-if { (eval echo configure:1490: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- libiberty_cv_declare_errno=no
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- libiberty_cv_declare_errno=yes
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$libiberty_cv_declare_errno" 1>&6
-if test $libiberty_cv_declare_errno = yes
-then cat >> confdefs.h <<\EOF
-#define NEED_DECLARATION_ERRNO 1
-EOF
-
-fi
-
-
-echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:1512: checking for ANSI C header files" >&5
-if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1517 "configure"
-#include "confdefs.h"
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1525: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- rm -rf conftest*
- ac_cv_header_stdc=yes
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-if test $ac_cv_header_stdc = yes; then
- # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
-cat > conftest.$ac_ext <<EOF
-#line 1542 "configure"
-#include "confdefs.h"
-#include <string.h>
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "memchr" >/dev/null 2>&1; then
- :
-else
- rm -rf conftest*
- 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 <<EOF
-#line 1560 "configure"
-#include "confdefs.h"
-#include <stdlib.h>
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "free" >/dev/null 2>&1; then
- :
-else
- rm -rf conftest*
- 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 <<EOF
-#line 1581 "configure"
-#include "confdefs.h"
-#include <ctype.h>
-#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int main () { int i; for (i = 0; i < 256; i++)
-if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
-exit (0); }
-
-EOF
-if { (eval echo configure:1592: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
- :
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- ac_cv_header_stdc=no
-fi
-rm -fr conftest*
-fi
-
-fi
-fi
-
-echo "$ac_t""$ac_cv_header_stdc" 1>&6
-if test $ac_cv_header_stdc = yes; then
- cat >> confdefs.h <<\EOF
-#define STDC_HEADERS 1
-EOF
-
-fi
-
-echo $ac_n "checking for uintptr_t""... $ac_c" 1>&6
-echo "configure:1616: checking for uintptr_t" >&5
-if eval "test \"`echo '$''{'ac_cv_type_uintptr_t'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1621 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#endif
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "(^|[^a-zA-Z_0-9])uintptr_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
- rm -rf conftest*
- ac_cv_type_uintptr_t=yes
-else
- rm -rf conftest*
- ac_cv_type_uintptr_t=no
-fi
-rm -f conftest*
-
-fi
-echo "$ac_t""$ac_cv_type_uintptr_t" 1>&6
-if test $ac_cv_type_uintptr_t = no; then
- cat >> confdefs.h <<\EOF
-#define uintptr_t unsigned long
-EOF
-
-fi
-
-
-if test $ac_cv_type_uintptr_t = yes
-then
- cat >> confdefs.h <<\EOF
-#define HAVE_UINTPTR_T 1
-EOF
-
-fi
-
-echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:1658: checking for pid_t" >&5
-if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1663 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#endif
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "(^|[^a-zA-Z_0-9])pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
- rm -rf conftest*
- ac_cv_type_pid_t=yes
-else
- rm -rf conftest*
- ac_cv_type_pid_t=no
-fi
-rm -f conftest*
-
-fi
-echo "$ac_t""$ac_cv_type_pid_t" 1>&6
-if test $ac_cv_type_pid_t = no; then
- cat >> confdefs.h <<\EOF
-#define pid_t int
-EOF
-
-fi
-
-
-# This is the list of functions which libiberty will provide if they
-# are not available on the host.
-
-funcs="asprintf"
-funcs="$funcs atexit"
-funcs="$funcs basename"
-funcs="$funcs bcmp"
-funcs="$funcs bcopy"
-funcs="$funcs bsearch"
-funcs="$funcs bzero"
-funcs="$funcs calloc"
-funcs="$funcs clock"
-funcs="$funcs ffs"
-funcs="$funcs getcwd"
-funcs="$funcs getpagesize"
-funcs="$funcs index"
-funcs="$funcs insque"
-funcs="$funcs memchr"
-funcs="$funcs memcmp"
-funcs="$funcs memcpy"
-funcs="$funcs memmove"
-funcs="$funcs memset"
-funcs="$funcs mkstemps"
-funcs="$funcs putenv"
-funcs="$funcs random"
-funcs="$funcs rename"
-funcs="$funcs rindex"
-funcs="$funcs setenv"
-funcs="$funcs sigsetmask"
-funcs="$funcs strcasecmp"
-funcs="$funcs strchr"
-funcs="$funcs strdup"
-funcs="$funcs strncasecmp"
-funcs="$funcs strrchr"
-funcs="$funcs strstr"
-funcs="$funcs strtod"
-funcs="$funcs strtol"
-funcs="$funcs strtoul"
-funcs="$funcs tmpnam"
-funcs="$funcs vasprintf"
-funcs="$funcs vfprintf"
-funcs="$funcs vprintf"
-funcs="$funcs vsprintf"
-funcs="$funcs waitpid"
-
-# Also in the old function.def file: alloca, vfork, getopt.
-
-vars="sys_errlist sys_nerr sys_siglist"
-
-checkfuncs="getrusage on_exit psignal strerror strsignal sysconf times sbrk gettimeofday"
-
-# These are neither executed nor required, but they help keep
-# autoheader happy without adding a bunch of text to acconfig.h.
-if test "x" = "y"; then
- for ac_func in asprintf atexit basename bcmp bcopy bsearch bzero calloc clock
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1748: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1753 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:1776: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
- for ac_func in getcwd getpagesize index insque mkstemps memchr memcmp memcpy
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1803: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1808 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:1831: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
- for ac_func in memmove memset putenv random rename rindex sigsetmask
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1858: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1863 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:1886: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
- for ac_func in strcasecmp setenv strchr strdup strncasecmp strrchr strstr
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1913: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1918 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:1941: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
- for ac_func in strtod strtol strtoul tmpnam vasprintf vfprintf vprintf
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1968: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1973 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:1996: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
- for ac_func in vsprintf waitpid getrusage on_exit psignal strerror strsignal
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2023: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2028 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:2051: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
- for ac_func in sysconf times sbrk gettimeofday ffs
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2078: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2083 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:2106: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
- cat >> confdefs.h <<\EOF
-#define HAVE_SYS_ERRLIST 1
-EOF
-
- cat >> confdefs.h <<\EOF
-#define HAVE_SYS_NERR 1
-EOF
-
- cat >> confdefs.h <<\EOF
-#define HAVE_SYS_SIGLIST 1
-EOF
-
-fi
-
-# For each of these functions, if the host does not provide the
-# function we want to put FN.o in LIBOBJS, and if the host does
-# provide the function, we want to define HAVE_FN in config.h.
-
-setobjs=
-CHECK=
-target_header_dir=
-if test -n "${with_target_subdir}"; then
-
- # We are being configured as a target library. AC_REPLACE_FUNCS
- # may not work correctly, because the compiler may not be able to
- # link executables. Note that we may still be being configured
- # native.
-
- # If we are being configured for newlib, we know which functions
- # newlib provide and which ones we will be expected to provide.
-
- if test "x${with_newlib}" = "xyes"; then
- LIBOBJS="asprintf.o basename.o insque.o random.o strdup.o vasprintf.o"
-
- for f in $funcs; do
- case "$f" in
- asprintf | basename | insque | random | strdup | vasprintf)
- ;;
- *)
- n=HAVE_`echo $f | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $n 1
-EOF
-
- ;;
- esac
- done
-
- # newlib doesnt provide any of the variables in $vars, so we
- # dont have to check them here.
-
- # Of the functions in $checkfuncs, newlib only has strerror.
- cat >> confdefs.h <<\EOF
-#define HAVE_STRERROR 1
-EOF
-
-
- setobjs=yes
-
- fi
-
- # We may wish to install the target headers somewhere.
- # Check whether --enable-install-libiberty or --disable-install-libiberty was given.
-if test "${enable_install_libiberty+set}" = set; then
- enableval="$enable_install_libiberty"
- enable_install_libiberty=$enableval
-else
- enable_install_libiberty=no
-fi
-
- # Option parsed, now set things appropriately.
- case x"$enable_install_libiberty" in
- xyes|x)
- target_header_dir=libiberty
- ;;
- xno)
- target_header_dir=
- ;;
- *)
- # This could be sanity-checked in various ways...
- target_header_dir="${enable_install_libiberty}"
- ;;
- esac
-
-
-else
-
- # Not a target library, so we set things up to run the test suite.
- CHECK=check-cplus-dem
-
-fi
-
-
-
-
-case "${host}" in
- *-*-cygwin* | *-*-mingw*)
- cat >> confdefs.h <<\EOF
-#define HAVE_SYS_ERRLIST 1
-EOF
-
- cat >> confdefs.h <<\EOF
-#define HAVE_SYS_NERR 1
-EOF
-
- ;;
-esac
-
-if test -z "${setobjs}"; then
- case "${host}" in
-
- *-*-vxworks*)
- # Handle VxWorks configuration specially, since on VxWorks the
- # libraries are actually on the target board, not in the file
- # system.
- LIBOBJS="basename.o getpagesize.o insque.o random.o strcasecmp.o"
- LIBOBJS="$LIBOBJS strncasecmp.o strdup.o vfork.o waitpid.o vasprintf.o"
- for f in $funcs; do
- case "$f" in
- basename | getpagesize | insque | random | strcasecmp)
- ;;
- strncasecmp | strdup | vfork | waitpid | vasprintf)
- ;;
- *)
- n=HAVE_`echo $f | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $n 1
-EOF
-
- ;;
- esac
- done
-
- # VxWorks doesn't provide any of the variables in $vars, so we
- # don't have to check them here.
-
- # Of the functions in $checkfuncs, VxWorks only has strerror.
- cat >> confdefs.h <<\EOF
-#define HAVE_STRERROR 1
-EOF
-
-
- setobjs=yes
- ;;
-
- esac
-fi
-
-if test -z "${setobjs}"; then
-
- case "${host}" in
-
- *-*-cygwin*)
- # The Cygwin library actually uses a couple of files from
- # libiberty when it is built. If we are building a native
- # Cygwin, and we run the tests, we will appear to have these
- # files. However, when we go on to build winsup, we will wind up
- # with a library which does not have the files, since they should
- # have come from libiberty.
-
- # We handle this by removing the functions the winsup library
- # provides from our shell variables, so that they appear to be
- # missing.
-
- # DJ - only if we're *building* cygwin, not just building *with* cygwin
-
- if test -n "${with_target_subdir}"
- then
- funcs="`echo $funcs | sed -e 's/random//'`"
- LIBOBJS="$LIBOBJS random.o"
- vars="`echo $vars | sed -e 's/sys_siglist//'`"
- checkfuncs="`echo $checkfuncs | sed -e 's/strsignal//' -e 's/psignal//'`"
- fi
- ;;
-
- *-*-mingw32*)
- # Under mingw32, sys_nerr and sys_errlist exist, but they are
- # macros, so the test below won't find them.
- libiberty_cv_var_sys_nerr=yes
- libiberty_cv_var_sys_errlist=yes
- ;;
-
- *-*-uwin*)
- # Under some versions of uwin, vfork is notoriously buggy and the test
- # can hang configure; on other versions, vfork exists just as a stub.
- # FIXME: This should be removed once vfork in uwin's runtime is fixed.
- ac_cv_func_vfork_works=no
- # Under uwin 2.0+, sys_nerr and sys_errlist exist, but they are
- # macros (actually, these are imported from a DLL, but the end effect
- # is the same), so the test below won't find them.
- libiberty_cv_var_sys_nerr=yes
- libiberty_cv_var_sys_errlist=yes
- ;;
-
- *-*-*vms*)
- # Under VMS, vfork works very different than on Unix. The standard test
- # won't work, and it isn't easily adaptable. It makes more sense to
- # just force it.
- ac_cv_func_vfork_works=yes
- ;;
-
- esac
-
- # We haven't set the list of objects yet. Use the standard autoconf
- # tests. This will only work if the compiler works.
- echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:2336: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
-
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-cat > conftest.$ac_ext << EOF
-
-#line 2347 "configure"
-#include "confdefs.h"
-
-main(){return(0);}
-EOF
-if { (eval echo configure:2352: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- ac_cv_prog_cc_works=yes
- # If we can't run a trivial program, we are probably using a cross compiler.
- if (./conftest; exit) 2>/dev/null; then
- ac_cv_prog_cc_cross=no
- else
- ac_cv_prog_cc_cross=yes
- fi
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- ac_cv_prog_cc_works=no
-fi
-rm -fr conftest*
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
-if test $ac_cv_prog_cc_works = no; then
- { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
-fi
-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:2378: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
-echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
-cross_compiling=$ac_cv_prog_cc_cross
-
- for ac_func in $funcs
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2385: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2390 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:2413: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-LIBOBJS="$LIBOBJS ${ac_func}.${ac_objext}"
-fi
-done
-
-
- echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:2440: checking whether alloca needs Cray hooks" >&5
-if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2445 "configure"
-#include "confdefs.h"
-#if defined(CRAY) && ! defined(CRAY2)
-webecray
-#else
-wenotbecray
-#endif
-
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "webecray" >/dev/null 2>&1; then
- rm -rf conftest*
- ac_cv_os_cray=yes
-else
- rm -rf conftest*
- ac_cv_os_cray=no
-fi
-rm -f conftest*
-
-fi
-
-echo "$ac_t""$ac_cv_os_cray" 1>&6
-if test $ac_cv_os_cray = yes; then
- for ac_func in _getb67 GETB67 getb67; do
- echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2470: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2475 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:2498: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- cat >> confdefs.h <<EOF
-#define CRAY_STACKSEG_END $ac_func
-EOF
- break
-else
- echo "$ac_t""no" 1>&6
-fi
-
- done
-fi
-
-echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:2524: checking stack direction for C alloca" >&5
-if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test "$cross_compiling" = yes; then
- ac_cv_c_stack_direction=0
-else
- cat > conftest.$ac_ext <<EOF
-#line 2532 "configure"
-#include "confdefs.h"
-find_stack_direction ()
-{
- static char *addr = 0;
- auto char dummy;
- if (addr == 0)
- {
- addr = &dummy;
- return find_stack_direction ();
- }
- else
- return (&dummy > addr) ? 1 : -1;
-}
-main ()
-{
- exit (find_stack_direction() < 0);
-}
-EOF
-if { (eval echo configure:2551: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
- ac_cv_c_stack_direction=1
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- ac_cv_c_stack_direction=-1
-fi
-rm -fr conftest*
-fi
-
-fi
-
-echo "$ac_t""$ac_cv_c_stack_direction" 1>&6
-cat >> confdefs.h <<EOF
-#define STACK_DIRECTION $ac_cv_c_stack_direction
-EOF
-
-
- ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for vfork.h""... $ac_c" 1>&6
-echo "configure:2573: checking for vfork.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2578 "configure"
-#include "confdefs.h"
-#include <vfork.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2583: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=yes"
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=no"
-fi
-rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- cat >> confdefs.h <<\EOF
-#define HAVE_VFORK_H 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-
-echo $ac_n "checking for working vfork""... $ac_c" 1>&6
-echo "configure:2608: checking for working vfork" >&5
-if eval "test \"`echo '$''{'ac_cv_func_vfork_works'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test "$cross_compiling" = yes; then
- echo $ac_n "checking for vfork""... $ac_c" 1>&6
-echo "configure:2614: checking for vfork" >&5
-if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2619 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char vfork(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char vfork();
-
-int main() {
-
-/* 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_vfork) || defined (__stub___vfork)
-choke me
-#else
-vfork();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:2642: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_vfork=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_vfork=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'vfork`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- :
-else
- echo "$ac_t""no" 1>&6
-fi
-
-ac_cv_func_vfork_works=$ac_cv_func_vfork
-else
- cat > conftest.$ac_ext <<EOF
-#line 2664 "configure"
-#include "confdefs.h"
-/* Thanks to Paul Eggert for this test. */
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_VFORK_H
-#include <vfork.h>
-#endif
-/* On some sparc systems, changes by the child to local and incoming
- argument registers are propagated back to the parent.
- The compiler is told about this with #include <vfork.h>,
- but some compilers (e.g. gcc -O) don't grok <vfork.h>.
- Test for this by using a static variable whose address
- is put into a register that is clobbered by the vfork. */
-static
-#ifdef __cplusplus
-sparc_address_test (int arg)
-#else
-sparc_address_test (arg) int arg;
-#endif
-{
- static pid_t child;
- if (!child) {
- child = vfork ();
- if (child < 0) {
- perror ("vfork");
- _exit(2);
- }
- if (!child) {
- arg = getpid();
- write(-1, "", 0);
- _exit (arg);
- }
- }
-}
-main() {
- pid_t parent = getpid ();
- pid_t child;
-
- sparc_address_test ();
-
- child = vfork ();
-
- if (child == 0) {
- /* Here is another test for sparc vfork register problems.
- This test uses lots of local variables, at least
- as many local variables as main has allocated so far
- including compiler temporaries. 4 locals are enough for
- gcc 1.40.3 on a Solaris 4.1.3 sparc, but we use 8 to be safe.
- A buggy compiler should reuse the register of parent
- for one of the local variables, since it will think that
- parent can't possibly be used any more in this routine.
- Assigning to the local variable will thus munge parent
- in the parent process. */
- pid_t
- p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(),
- p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid();
- /* Convince the compiler that p..p7 are live; otherwise, it might
- use the same hardware register for all 8 local variables. */
- if (p != p1 || p != p2 || p != p3 || p != p4
- || p != p5 || p != p6 || p != p7)
- _exit(1);
-
- /* On some systems (e.g. IRIX 3.3),
- vfork doesn't separate parent from child file descriptors.
- If the child closes a descriptor before it execs or exits,
- this munges the parent's descriptor as well.
- Test for this by closing stdout in the child. */
- _exit(close(fileno(stdout)) != 0);
- } else {
- int status;
- struct stat st;
-
- while (wait(&status) != child)
- ;
- exit(
- /* Was there some problem with vforking? */
- child < 0
-
- /* Did the child fail? (This shouldn't happen.) */
- || status
-
- /* Did the vfork/compiler bug occur? */
- || parent != getpid()
-
- /* Did the file descriptor bug occur? */
- || fstat(fileno(stdout), &st) != 0
- );
- }
-}
-EOF
-if { (eval echo configure:2759: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
- ac_cv_func_vfork_works=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- ac_cv_func_vfork_works=no
-fi
-rm -fr conftest*
-fi
-
-fi
-
-echo "$ac_t""$ac_cv_func_vfork_works" 1>&6
-if test $ac_cv_func_vfork_works = no; then
- cat >> confdefs.h <<\EOF
-#define vfork fork
-EOF
-
-fi
-
- if test $ac_cv_func_vfork_works = no; then
- LIBOBJS="$LIBOBJS vfork.o"
- fi
- # We only need _doprnt if we might use it to implement v*printf.
- if test $ac_cv_func_vprintf != yes \
- || test $ac_cv_func_vfprintf != yes \
- || test $ac_cv_func_vsprintf != yes; then
- for ac_func in _doprnt
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2791: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2796 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:2819: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-LIBOBJS="$LIBOBJS ${ac_func}.${ac_objext}"
-fi
-done
-
-
- else
- for ac_func in _doprnt
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2849: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2854 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:2877: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
- fi
-
- for v in $vars; do
- echo $ac_n "checking for $v""... $ac_c" 1>&6
-echo "configure:2905: checking for $v" >&5
- if eval "test \"`echo '$''{'libiberty_cv_var_$v'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2910 "configure"
-#include "confdefs.h"
-int *p;
-int main() {
-extern int $v []; p = $v;
-; return 0; }
-EOF
-if { (eval echo configure:2917: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "libiberty_cv_var_$v=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "libiberty_cv_var_$v=no"
-fi
-rm -f conftest*
-fi
-
- if eval "test \"`echo '$libiberty_cv_var_'$v`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- n=HAVE_`echo $v | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $n 1
-EOF
-
- else
- echo "$ac_t""no" 1>&6
- fi
- done
- for ac_func in $checkfuncs
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2943: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2948 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:2971: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
-fi
-
-for ac_hdr in stdlib.h unistd.h sys/stat.h sys/types.h
-do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3001: checking for $ac_hdr" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 3006 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3011: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=yes"
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=no"
-fi
-rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_hdr 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
-for ac_func in getpagesize
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3040: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 3045 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:3068: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
-echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:3093: checking for working mmap" >&5
-if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test "$cross_compiling" = yes; then
- ac_cv_func_mmap_fixed_mapped=no
-else
- cat > conftest.$ac_ext <<EOF
-#line 3101 "configure"
-#include "confdefs.h"
-
-/* 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 filesystem buffer cache
- like early versions of FreeBSD and possibly contemporary NetBSD.)
- For shared mappings, we should conversely verify that changes get
- propogated 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 <sys/types.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_STDLIB_H
-# include <stdlib.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#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 <sys/param.h>
-# 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 */
-
-#ifdef __cplusplus
-extern "C" { void *malloc(unsigned); }
-#else
-char *malloc();
-#endif
-
-int
-main()
-{
- char *data, *data2, *data3;
- int i, pagesize;
- int fd;
-
- pagesize = getpagesize();
-
- /*
- * First, make a file with some known garbage in it.
- */
- data = malloc(pagesize);
- if (!data)
- exit(1);
- for (i = 0; i < pagesize; ++i)
- *(data + i) = rand();
- umask(0);
- fd = creat("conftestmmap", 0600);
- if (fd < 0)
- exit(1);
- if (write(fd, data, pagesize) != pagesize)
- exit(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("conftestmmap", O_RDWR);
- if (fd < 0)
- exit(1);
- data2 = malloc(2 * pagesize);
- if (!data2)
- exit(1);
- data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1);
- if (data2 != mmap(data2, pagesize, PROT_READ | PROT_WRITE,
- MAP_PRIVATE | MAP_FIXED, fd, 0L))
- exit(1);
- for (i = 0; i < pagesize; ++i)
- if (*(data + i) != *(data2 + i))
- exit(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 = malloc(pagesize);
- if (!data3)
- exit(1);
- if (read(fd, data3, pagesize) != pagesize)
- exit(1);
- for (i = 0; i < pagesize; ++i)
- if (*(data + i) != *(data3 + i))
- exit(1);
- close(fd);
- unlink("conftestmmap");
- exit(0);
-}
-
-EOF
-if { (eval echo configure:3254: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
- ac_cv_func_mmap_fixed_mapped=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- ac_cv_func_mmap_fixed_mapped=no
-fi
-rm -fr conftest*
-fi
-
-fi
-
-echo "$ac_t""$ac_cv_func_mmap_fixed_mapped" 1>&6
-if test $ac_cv_func_mmap_fixed_mapped = yes; then
- cat >> confdefs.h <<\EOF
-#define HAVE_MMAP 1
-EOF
-
-fi
-
-
-echo $ac_n "checking for working strncmp""... $ac_c" 1>&6
-echo "configure:3278: checking for working strncmp" >&5
-if eval "test \"`echo '$''{'ac_cv_func_strncmp_works'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test "$cross_compiling" = yes; then
- ac_cv_func_strncmp_works=no
-else
- cat > conftest.$ac_ext <<EOF
-#line 3286 "configure"
-#include "confdefs.h"
-
-/* Test by Jim Wilson and Kaveh Ghazi.
- Check whether strncmp reads past the end of its string parameters. */
-#include <sys/types.h>
-
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
-
-#ifdef HAVE_SYS_MMAN_H
-#include <sys/mman.h>
-#endif
-
-#ifndef MAP_ANON
-#ifdef MAP_ANONYMOUS
-#define MAP_ANON MAP_ANONYMOUS
-#else
-#define MAP_ANON MAP_FILE
-#endif
-#endif
-
-#ifndef MAP_FILE
-#define MAP_FILE 0
-#endif
-#ifndef O_RDONLY
-#define O_RDONLY 0
-#endif
-
-#define MAP_LEN 0x10000
-
-main ()
-{
-#if defined(HAVE_MMAP) || defined(HAVE_MMAP_ANYWHERE)
- char *p;
- int dev_zero;
-
- dev_zero = open ("/dev/zero", O_RDONLY);
- if (dev_zero < 0)
- exit (1);
-
- p = (char *) mmap (0, MAP_LEN, PROT_READ|PROT_WRITE,
- MAP_ANON|MAP_PRIVATE, dev_zero, 0);
- if (p == (char *)-1)
- p = (char *) mmap (0, MAP_LEN, PROT_READ|PROT_WRITE,
- MAP_ANON|MAP_PRIVATE, -1, 0);
- if (p == (char *)-1)
- exit (2);
- else
- {
- char *string = "__si_type_info";
- char *q = (char *) p + MAP_LEN - strlen (string) - 2;
- char *r = (char *) p + 0xe;
-
- strcpy (q, string);
- strcpy (r, string);
- strncmp (r, q, 14);
- }
-#endif /* HAVE_MMAP || HAVE_MMAP_ANYWHERE */
- exit (0);
-}
-
-EOF
-if { (eval echo configure:3350: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
- ac_cv_func_strncmp_works=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- ac_cv_func_strncmp_works=no
-fi
-rm -fr conftest*
-fi
-
-rm -f core core.* *.core
-fi
-
-echo "$ac_t""$ac_cv_func_strncmp_works" 1>&6
-if test $ac_cv_func_strncmp_works = no ; then
- LIBOBJS="$LIBOBJS strncmp.o"
-fi
-
-
-# Install a library built with a cross compiler in $(tooldir) rather
-# than $(libdir).
-if test -z "${with_cross_host}"; then
- INSTALL_DEST=libdir
-else
- INSTALL_DEST=tooldir
-fi
-
-
-# We need multilib support, but only if configuring for the target.
-trap '' 1 2 15
-cat > confcache <<\EOF
-# 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. It is not useful on other systems.
-# If it contains results you don't want to keep, you may remove or edit it.
-#
-# By default, configure uses ./config.cache as the cache file,
-# creating it if it does not exist already. You can give configure
-# the --cache-file=FILE option to use a different cache file; that is
-# what configure does when it calls configure scripts in
-# subdirectories, so they share the cache.
-# Giving --cache-file=/dev/null disables caching, for debugging configure.
-# config.status only pays attention to the cache file if you give it the
-# --recheck option to rerun configure.
-#
-EOF
-# The following way of writing the cache mishandles newlines in values,
-# but we know of no workaround that is simple, portable, and efficient.
-# So, don't put newlines in cache variables' values.
-# Ultrix sh set writes to stderr and can't be redirected directly,
-# and sets the high bit in the cache file unless we assign to the vars.
-(set) 2>&1 |
- case `(ac_space=' '; set | grep ac_space) 2>&1` in
- *ac_space=\ *)
- # `set' does not quote correctly, so add quotes (double-quote substitution
- # turns \\\\ into \\, and sed turns \\ into \).
- sed -n \
- -e "s/'/'\\\\''/g" \
- -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
- ;;
- *)
- # `set' quotes correctly as required by POSIX, so do not add quotes.
- sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
- ;;
- esac >> confcache
-if cmp -s $cache_file confcache; then
- :
-else
- if test -w $cache_file; then
- echo "updating cache $cache_file"
- cat confcache > $cache_file
- else
- echo "not updating unwritable cache $cache_file"
- fi
-fi
-rm -f confcache
-
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-test "x$prefix" = xNONE && prefix=$ac_default_prefix
-# Let make expand exec_prefix.
-test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-
-# Any assignment to VPATH causes Sun make to only execute
-# the first set of double-colon rules, so remove it if not needed.
-# If there is a colon in the path, we need to keep it.
-if test "x$srcdir" = x.; then
- ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
-fi
-
-trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
-
-DEFS=-DHAVE_CONFIG_H
-
-# Without the "./", some shells look in PATH for config.status.
-: ${CONFIG_STATUS=./config.status}
-
-echo creating $CONFIG_STATUS
-rm -f $CONFIG_STATUS
-cat > $CONFIG_STATUS <<EOF
-#! /bin/sh
-# Generated automatically by configure.
-# Run this file to recreate the current configuration.
-# This directory was configured as follows,
-# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
-#
-# $0 $ac_configure_args
-#
-# Compiler output produced by configure, useful for debugging
-# configure, is in ./config.log if it exists.
-
-ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
-for ac_option
-do
- case "\$ac_option" in
- -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
- echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
- exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
- -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
- echo "$CONFIG_STATUS generated by autoconf version 2.13"
- exit 0 ;;
- -help | --help | --hel | --he | --h)
- echo "\$ac_cs_usage"; exit 0 ;;
- *) echo "\$ac_cs_usage"; exit 1 ;;
- esac
-done
-
-ac_given_srcdir=$srcdir
-ac_given_INSTALL="$INSTALL"
-
-trap 'rm -fr `echo "Makefile testsuite/Makefile config.h:config.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
-EOF
-cat >> $CONFIG_STATUS <<EOF
-
-# Protect against being on the right side of a sed subst in config.status.
-sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
- s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
-$ac_vpsub
-$extrasub
-s%@SHELL@%$SHELL%g
-s%@CFLAGS@%$CFLAGS%g
-s%@CPPFLAGS@%$CPPFLAGS%g
-s%@CXXFLAGS@%$CXXFLAGS%g
-s%@FFLAGS@%$FFLAGS%g
-s%@DEFS@%$DEFS%g
-s%@LDFLAGS@%$LDFLAGS%g
-s%@LIBS@%$LIBS%g
-s%@exec_prefix@%$exec_prefix%g
-s%@prefix@%$prefix%g
-s%@program_transform_name@%$program_transform_name%g
-s%@bindir@%$bindir%g
-s%@sbindir@%$sbindir%g
-s%@libexecdir@%$libexecdir%g
-s%@datadir@%$datadir%g
-s%@sysconfdir@%$sysconfdir%g
-s%@sharedstatedir@%$sharedstatedir%g
-s%@localstatedir@%$localstatedir%g
-s%@libdir@%$libdir%g
-s%@includedir@%$includedir%g
-s%@oldincludedir@%$oldincludedir%g
-s%@infodir@%$infodir%g
-s%@mandir@%$mandir%g
-s%@MAINT@%$MAINT%g
-s%@NOTMAINT@%$NOTMAINT%g
-s%@MAKEINFO@%$MAKEINFO%g
-s%@BUILD_INFO@%$BUILD_INFO%g
-s%@PERL@%$PERL%g
-s%@HAVE_PERL@%$HAVE_PERL%g
-s%@host@%$host%g
-s%@host_alias@%$host_alias%g
-s%@host_cpu@%$host_cpu%g
-s%@host_vendor@%$host_vendor%g
-s%@host_os@%$host_os%g
-s%@build@%$build%g
-s%@build_alias@%$build_alias%g
-s%@build_cpu@%$build_cpu%g
-s%@build_vendor@%$build_vendor%g
-s%@build_os@%$build_os%g
-s%@AR@%$AR%g
-s%@RANLIB@%$RANLIB%g
-s%@CC@%$CC%g
-s%@ac_libiberty_warn_cflags@%$ac_libiberty_warn_cflags%g
-s%@NO_MINUS_C_MINUS_O@%$NO_MINUS_C_MINUS_O%g
-s%@OUTPUT_OPTION@%$OUTPUT_OPTION%g
-s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
-s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
-s%@INSTALL_DATA@%$INSTALL_DATA%g
-/@host_makefile_frag@/r $host_makefile_frag
-s%@host_makefile_frag@%%g
-s%@CPP@%$CPP%g
-s%@CHECK@%$CHECK%g
-s%@target_header_dir@%$target_header_dir%g
-s%@LIBOBJS@%$LIBOBJS%g
-s%@INSTALL_DEST@%$INSTALL_DEST%g
-
-CEOF
-EOF
-
-cat >> $CONFIG_STATUS <<\EOF
-
-# Split the substitutions into bite-sized pieces for seds with
-# small command number limits, like on Digital OSF/1 and HP-UX.
-ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
-ac_file=1 # Number of current file.
-ac_beg=1 # First line for current file.
-ac_end=$ac_max_sed_cmds # Line after last line for current file.
-ac_more_lines=:
-ac_sed_cmds=""
-while $ac_more_lines; do
- if test $ac_beg -gt 1; then
- sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
- else
- sed "${ac_end}q" conftest.subs > conftest.s$ac_file
- fi
- if test ! -s conftest.s$ac_file; then
- ac_more_lines=false
- rm -f conftest.s$ac_file
- else
- if test -z "$ac_sed_cmds"; then
- ac_sed_cmds="sed -f conftest.s$ac_file"
- else
- ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
- fi
- ac_file=`expr $ac_file + 1`
- ac_beg=$ac_end
- ac_end=`expr $ac_end + $ac_max_sed_cmds`
- fi
-done
-if test -z "$ac_sed_cmds"; then
- ac_sed_cmds=cat
-fi
-EOF
-
-cat >> $CONFIG_STATUS <<EOF
-
-CONFIG_FILES=\${CONFIG_FILES-"Makefile testsuite/Makefile"}
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
- # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
- case "$ac_file" in
- *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
- ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
- *) ac_file_in="${ac_file}.in" ;;
- esac
-
- # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
-
- # Remove last slash and all that follows it. Not all systems have dirname.
- ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
- if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
- # The file is in a subdirectory.
- test ! -d "$ac_dir" && mkdir "$ac_dir"
- ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
- # A "../" for each directory in $ac_dir_suffix.
- ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
- else
- ac_dir_suffix= ac_dots=
- fi
-
- case "$ac_given_srcdir" in
- .) srcdir=.
- if test -z "$ac_dots"; then top_srcdir=.
- else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
- /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
- *) # Relative path.
- srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
- top_srcdir="$ac_dots$ac_given_srcdir" ;;
- esac
-
- case "$ac_given_INSTALL" in
- [/$]*) INSTALL="$ac_given_INSTALL" ;;
- *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
- esac
-
- echo creating "$ac_file"
- rm -f "$ac_file"
- configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
- case "$ac_file" in
- *Makefile*) ac_comsub="1i\\
-# $configure_input" ;;
- *) ac_comsub= ;;
- esac
-
- ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
- sed -e "$ac_comsub
-s%@configure_input@%$configure_input%g
-s%@srcdir@%$srcdir%g
-s%@top_srcdir@%$top_srcdir%g
-s%@INSTALL@%$INSTALL%g
-" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
-fi; done
-rm -f conftest.s*
-
-# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
-# NAME is the cpp macro being defined and VALUE is the value it is being given.
-#
-# ac_d sets the value in "#define NAME VALUE" lines.
-ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)'
-ac_dB='\([ ][ ]*\)[^ ]*%\1#\2'
-ac_dC='\3'
-ac_dD='%g'
-# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
-ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
-ac_uB='\([ ]\)%\1#\2define\3'
-ac_uC=' '
-ac_uD='\4%g'
-# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
-ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
-ac_eB='$%\1#\2define\3'
-ac_eC=' '
-ac_eD='%g'
-
-if test "${CONFIG_HEADERS+set}" != set; then
-EOF
-cat >> $CONFIG_STATUS <<EOF
- CONFIG_HEADERS="config.h:config.in"
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-fi
-for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
- # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
- case "$ac_file" in
- *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
- ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
- *) ac_file_in="${ac_file}.in" ;;
- esac
-
- echo creating $ac_file
-
- rm -f conftest.frag conftest.in conftest.out
- ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
- cat $ac_file_inputs > conftest.in
-
-EOF
-
-# Transform confdefs.h into a sed script conftest.vals that substitutes
-# the proper values into config.h.in to produce config.h. And first:
-# Protect against being on the right side of a sed subst in config.status.
-# Protect against being in an unquoted here document in config.status.
-rm -f conftest.vals
-cat > conftest.hdr <<\EOF
-s/[\\&%]/\\&/g
-s%[\\$`]%\\&%g
-s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
-s%ac_d%ac_u%gp
-s%ac_u%ac_e%gp
-EOF
-sed -n -f conftest.hdr confdefs.h > conftest.vals
-rm -f conftest.hdr
-
-# This sed command replaces #undef with comments. This is necessary, for
-# example, in the case of _POSIX_SOURCE, which is predefined and required
-# on some systems where configure will not decide to define it.
-cat >> conftest.vals <<\EOF
-s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
-EOF
-
-# Break up conftest.vals because some shells have a limit on
-# the size of here documents, and old seds have small limits too.
-
-rm -f conftest.tail
-while :
-do
- ac_lines=`grep -c . conftest.vals`
- # grep -c gives empty output for an empty file on some AIX systems.
- if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
- # Write a limited-size here document to conftest.frag.
- echo ' cat > conftest.frag <<CEOF' >> $CONFIG_STATUS
- sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
- echo 'CEOF
- sed -f conftest.frag conftest.in > conftest.out
- rm -f conftest.in
- mv conftest.out conftest.in
-' >> $CONFIG_STATUS
- sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
- rm -f conftest.vals
- mv conftest.tail conftest.vals
-done
-rm -f conftest.vals
-
-cat >> $CONFIG_STATUS <<\EOF
- rm -f conftest.frag conftest.h
- echo "/* $ac_file. Generated automatically by configure. */" > conftest.h
- cat conftest.in >> conftest.h
- rm -f conftest.in
- if cmp -s $ac_file conftest.h 2>/dev/null; then
- echo "$ac_file is unchanged"
- rm -f conftest.h
- else
- # Remove last slash and all that follows it. Not all systems have dirname.
- ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
- if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
- # The file is in a subdirectory.
- test ! -d "$ac_dir" && mkdir "$ac_dir"
- fi
- rm -f $ac_file
- mv conftest.h $ac_file
- fi
-fi; done
-
-EOF
-cat >> $CONFIG_STATUS <<EOF
-srcdir=${srcdir}
-host=${host}
-target=${target}
-with_target_subdir=${with_target_subdir}
-with_build_subdir=${with_build_subdir}
-with_multisubdir=${with_multisubdir}
-ac_configure_args="--enable-multilib ${ac_configure_args}"
-CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
-libiberty_topdir=${libiberty_topdir}
-
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
-if test -n "$CONFIG_FILES"; then
- if test -n "${with_build_subdir}" || test -n "${with_target_subdir}"; then
- # FIXME: We shouldn't need to set ac_file
- ac_file=Makefile
- LD="${ORIGINAL_LD_FOR_MULTILIBS}"
- . ${libiberty_topdir}/config-ml.in
- fi
-fi
-exit 0
-EOF
-chmod +x $CONFIG_STATUS
-rm -fr confdefs* $ac_clean_files
-test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
-
diff --git a/libiberty/configure.in b/libiberty/configure.in
deleted file mode 100644
index a8dc66f..0000000
--- a/libiberty/configure.in
+++ /dev/null
@@ -1,459 +0,0 @@
-dnl Process this file with autoconf to produce a configure script
-
-AC_PREREQ(2.13)
-AC_INIT(pexecute.c)
-
-# This works around the fact that libtool configuration may change LD
-# for this particular configuration, but some shells, instead of
-# keeping the changes in LD private, export them just because LD is
-# exported. We don't use libtool yet, but some day we might, so...
-ORIGINAL_LD_FOR_MULTILIBS=$LD
-
-dnl We use these options to decide which functions to include.
-AC_ARG_WITH(target-subdir,
-[ --with-target-subdir=SUBDIR Configuring in a subdirectory for target])
-AC_ARG_WITH(build-subdir,
-[ --with-build-subdir=SUBDIR Configuring in a subdirectory for build])
-AC_ARG_WITH(cross-host,
-[ --with-cross-host=HOST Configuring with a cross compiler])
-AC_ARG_WITH(newlib,
-[ --with-newlib Configuring with newlib])
-
-if test "${srcdir}" = "."; then
- if test -n "${with_build_subdir}"; then
- libiberty_topdir="${srcdir}/../.."
- with_target_subdir=
- elif test -z "${with_target_subdir}"; then
- libiberty_topdir="${srcdir}/.."
- else
- if test "${with_target_subdir}" != "."; then
- libiberty_topdir="${srcdir}/${with_multisrctop}../.."
- else
- libiberty_topdir="${srcdir}/${with_multisrctop}.."
- fi
- fi
-else
- libiberty_topdir="${srcdir}/.."
-fi
-AC_CONFIG_AUX_DIR($libiberty_topdir)
-
-dnl Very limited version of automake's enable-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],
- maintainer_mode=$enableval,
- maintainer_mode=no)
-
-AC_MSG_RESULT($maintainer_mode)
-
-if test "$maintainer_mode" = "yes"; then
- MAINT=''
- NOTMAINT='#'
-else
- MAINT='#'
- NOTMAINT=''
-fi
-AC_SUBST(MAINT)dnl
-AC_SUBST(NOTMAINT)dnl
-
-# Do we have a single-tree copy of texinfo? Even if we do, we can't
-# rely on it - libiberty is built before texinfo.
-AC_CHECK_PROG(MAKEINFO, makeinfo, makeinfo, )
-if test "x$MAKEINFO" = "x"; then
- MAKEINFO="@echo makeinfo missing; true"
- BUILD_INFO=
-else
- BUILD_INFO=info
- case x"`$MAKEINFO --version | grep 'GNU texinfo'`" in
- x*\ [[1-3]].* )
- MAKEINFO="@echo $MAKEINFO is too old, 4.0 or newer required; true"
- BUILD_INFO=
- AC_MSG_WARN([
-*** Makeinfo is too old. Info documentation will not be built.])
- ;;
- esac
-fi
-AC_SUBST(MAKEINFO)
-AC_SUBST(BUILD_INFO)
-
-AC_CHECK_PROG(PERL, perl, perl, )
-if test x"$PERL" = x""; then
- HAVE_PERL='#'
-else
- HAVE_PERL=''
-fi
-AC_SUBST(HAVE_PERL)
-
-AC_CANONICAL_HOST
-
-dnl When we start using automake:
-dnl AM_INIT_AUTOMAKE(libiberty, 1.0)
-
-dnl These must be called before AM_PROG_LIBTOOL, because it may want
-dnl to call AC_CHECK_PROG.
-AC_CHECK_TOOL(AR, ar)
-AC_CHECK_TOOL(RANLIB, ranlib, :)
-
-LIB_AC_PROG_CC
-
-AC_PROG_CC_C_O
-# autoconf is lame and doesn't give us any substitution variable for this.
-if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then
- NO_MINUS_C_MINUS_O=yes
-else
- OUTPUT_OPTION='-o $@'
-fi
-AC_SUBST(NO_MINUS_C_MINUS_O)
-AC_SUBST(OUTPUT_OPTION)
-
-AC_ISC_POSIX
-AC_C_CONST
-AC_C_INLINE
-
-dnl When we start using libtool:
-dnl Default to a non shared library. This may be overridden by the
-dnl configure option --enable-shared.
-dnl AM_DISABLE_SHARED
-
-dnl When we start using libtool:
-dnl AM_PROG_LIBTOOL
-
-dnl When we start using automake:
-dnl AM_CONFIG_HEADER(config.h:config.in)
-AC_CONFIG_HEADER(config.h:config.in)
-
-dnl When we start using automake:
-dnl AM_MAINTAINER_MODE
-dnl AC_EXEEXT
-
-dnl When we start using automake:
-dnl AM_PROG_INSTALL
-AC_PROG_INSTALL
-
-. ${srcdir}/config.table
-host_makefile_frag=${frag}
-AC_SUBST_FILE(host_makefile_frag)
-
-# It's OK to check for header files. Although the compiler may not be
-# able to link anything, it had better be able to at least compile
-# something.
-AC_CHECK_HEADERS(sys/file.h sys/param.h limits.h stdlib.h string.h unistd.h strings.h sys/time.h time.h sys/resource.h sys/stat.h sys/mman.h fcntl.h alloca.h)
-AC_HEADER_SYS_WAIT
-AC_HEADER_TIME
-
-libiberty_AC_DECLARE_ERRNO
-
-AC_CHECK_TYPE(uintptr_t, unsigned long)
-
-if test $ac_cv_type_uintptr_t = yes
-then
- AC_DEFINE(HAVE_UINTPTR_T, 1, [Define if you have the \`uintptr_t' type.])
-fi
-
-AC_TYPE_PID_T
-
-# This is the list of functions which libiberty will provide if they
-# are not available on the host.
-
-funcs="asprintf"
-funcs="$funcs atexit"
-funcs="$funcs basename"
-funcs="$funcs bcmp"
-funcs="$funcs bcopy"
-funcs="$funcs bsearch"
-funcs="$funcs bzero"
-funcs="$funcs calloc"
-funcs="$funcs clock"
-funcs="$funcs ffs"
-funcs="$funcs getcwd"
-funcs="$funcs getpagesize"
-funcs="$funcs index"
-funcs="$funcs insque"
-funcs="$funcs memchr"
-funcs="$funcs memcmp"
-funcs="$funcs memcpy"
-funcs="$funcs memmove"
-funcs="$funcs memset"
-funcs="$funcs mkstemps"
-funcs="$funcs putenv"
-funcs="$funcs random"
-funcs="$funcs rename"
-funcs="$funcs rindex"
-funcs="$funcs setenv"
-funcs="$funcs sigsetmask"
-funcs="$funcs strcasecmp"
-funcs="$funcs strchr"
-funcs="$funcs strdup"
-funcs="$funcs strncasecmp"
-funcs="$funcs strrchr"
-funcs="$funcs strstr"
-funcs="$funcs strtod"
-funcs="$funcs strtol"
-funcs="$funcs strtoul"
-funcs="$funcs tmpnam"
-funcs="$funcs vasprintf"
-funcs="$funcs vfprintf"
-funcs="$funcs vprintf"
-funcs="$funcs vsprintf"
-funcs="$funcs waitpid"
-
-# Also in the old function.def file: alloca, vfork, getopt.
-
-vars="sys_errlist sys_nerr sys_siglist"
-
-checkfuncs="getrusage on_exit psignal strerror strsignal sysconf times sbrk gettimeofday"
-
-# These are neither executed nor required, but they help keep
-# autoheader happy without adding a bunch of text to acconfig.h.
-if test "x" = "y"; then
- AC_CHECK_FUNCS(asprintf atexit basename bcmp bcopy bsearch bzero calloc clock)
- AC_CHECK_FUNCS(getcwd getpagesize index insque mkstemps memchr memcmp memcpy)
- AC_CHECK_FUNCS(memmove memset putenv random rename rindex sigsetmask)
- AC_CHECK_FUNCS(strcasecmp setenv strchr strdup strncasecmp strrchr strstr)
- AC_CHECK_FUNCS(strtod strtol strtoul tmpnam vasprintf vfprintf vprintf)
- AC_CHECK_FUNCS(vsprintf waitpid getrusage on_exit psignal strerror strsignal)
- AC_CHECK_FUNCS(sysconf times sbrk gettimeofday ffs)
- AC_DEFINE(HAVE_SYS_ERRLIST, 1, [Define if you have the sys_errlist variable.])
- AC_DEFINE(HAVE_SYS_NERR, 1, [Define if you have the sys_nerr variable.])
- AC_DEFINE(HAVE_SYS_SIGLIST, 1, [Define if you have the sys_siglist variable.])
-fi
-
-# For each of these functions, if the host does not provide the
-# function we want to put FN.o in LIBOBJS, and if the host does
-# provide the function, we want to define HAVE_FN in config.h.
-
-setobjs=
-CHECK=
-target_header_dir=
-if test -n "${with_target_subdir}"; then
-
- # We are being configured as a target library. AC_REPLACE_FUNCS
- # may not work correctly, because the compiler may not be able to
- # link executables. Note that we may still be being configured
- # native.
-
- # If we are being configured for newlib, we know which functions
- # newlib provide and which ones we will be expected to provide.
-
- if test "x${with_newlib}" = "xyes"; then
- LIBOBJS="asprintf.o basename.o insque.o random.o strdup.o vasprintf.o"
-
- for f in $funcs; do
- case "$f" in
- asprintf | basename | insque | random | strdup | vasprintf)
- ;;
- *)
- n=HAVE_`echo $f | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- AC_DEFINE_UNQUOTED($n)
- ;;
- esac
- done
-
- # newlib doesnt provide any of the variables in $vars, so we
- # dont have to check them here.
-
- # Of the functions in $checkfuncs, newlib only has strerror.
- AC_DEFINE_NOAUTOHEADER(HAVE_STRERROR)
-
- setobjs=yes
-
- fi
-
- # We may wish to install the target headers somewhere.
- AC_ARG_ENABLE(install-libiberty,
- [ --enable-install-libiberty Install headers for end users],
- enable_install_libiberty=$enableval,
- enable_install_libiberty=no)dnl
-
- # Option parsed, now set things appropriately.
- case x"$enable_install_libiberty" in
- xyes|x)
- target_header_dir=libiberty
- ;;
- xno)
- target_header_dir=
- ;;
- *)
- # This could be sanity-checked in various ways...
- target_header_dir="${enable_install_libiberty}"
- ;;
- esac
-
-
-else
-
- # Not a target library, so we set things up to run the test suite.
- CHECK=check-cplus-dem
-
-fi
-
-AC_SUBST(CHECK)
-AC_SUBST(target_header_dir)
-
-case "${host}" in
- *-*-cygwin* | *-*-mingw*)
- AC_DEFINE_NOAUTOHEADER(HAVE_SYS_ERRLIST)
- AC_DEFINE_NOAUTOHEADER(HAVE_SYS_NERR)
- ;;
-esac
-
-if test -z "${setobjs}"; then
- case "${host}" in
-
- *-*-vxworks*)
- # Handle VxWorks configuration specially, since on VxWorks the
- # libraries are actually on the target board, not in the file
- # system.
- LIBOBJS="basename.o getpagesize.o insque.o random.o strcasecmp.o"
- LIBOBJS="$LIBOBJS strncasecmp.o strdup.o vfork.o waitpid.o vasprintf.o"
- for f in $funcs; do
- case "$f" in
- basename | getpagesize | insque | random | strcasecmp)
- ;;
- strncasecmp | strdup | vfork | waitpid | vasprintf)
- ;;
- *)
- n=HAVE_`echo $f | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- AC_DEFINE_UNQUOTED($n)
- ;;
- esac
- done
-
- # VxWorks doesn't provide any of the variables in $vars, so we
- # don't have to check them here.
-
- # Of the functions in $checkfuncs, VxWorks only has strerror.
- AC_DEFINE_NOAUTOHEADER(HAVE_STRERROR)
-
- setobjs=yes
- ;;
-
- esac
-fi
-
-if test -z "${setobjs}"; then
-
- case "${host}" in
-
- *-*-cygwin*)
- # The Cygwin library actually uses a couple of files from
- # libiberty when it is built. If we are building a native
- # Cygwin, and we run the tests, we will appear to have these
- # files. However, when we go on to build winsup, we will wind up
- # with a library which does not have the files, since they should
- # have come from libiberty.
-
- # We handle this by removing the functions the winsup library
- # provides from our shell variables, so that they appear to be
- # missing.
-
- # DJ - only if we're *building* cygwin, not just building *with* cygwin
-
- if test -n "${with_target_subdir}"
- then
- funcs="`echo $funcs | sed -e 's/random//'`"
- LIBOBJS="$LIBOBJS random.o"
- vars="`echo $vars | sed -e 's/sys_siglist//'`"
- checkfuncs="`echo $checkfuncs | sed -e 's/strsignal//' -e 's/psignal//'`"
- fi
- ;;
-
- *-*-mingw32*)
- # Under mingw32, sys_nerr and sys_errlist exist, but they are
- # macros, so the test below won't find them.
- libiberty_cv_var_sys_nerr=yes
- libiberty_cv_var_sys_errlist=yes
- ;;
-
- *-*-uwin*)
- # Under some versions of uwin, vfork is notoriously buggy and the test
- # can hang configure; on other versions, vfork exists just as a stub.
- # FIXME: This should be removed once vfork in uwin's runtime is fixed.
- ac_cv_func_vfork_works=no
- # Under uwin 2.0+, sys_nerr and sys_errlist exist, but they are
- # macros (actually, these are imported from a DLL, but the end effect
- # is the same), so the test below won't find them.
- libiberty_cv_var_sys_nerr=yes
- libiberty_cv_var_sys_errlist=yes
- ;;
-
- *-*-*vms*)
- # Under VMS, vfork works very different than on Unix. The standard test
- # won't work, and it isn't easily adaptable. It makes more sense to
- # just force it.
- ac_cv_func_vfork_works=yes
- ;;
-
- esac
-
- # We haven't set the list of objects yet. Use the standard autoconf
- # tests. This will only work if the compiler works.
- AC_PROG_CC_WORKS
- AC_REPLACE_FUNCS($funcs)
- libiberty_AC_FUNC_C_ALLOCA
- AC_FUNC_VFORK
- if test $ac_cv_func_vfork_works = no; then
- LIBOBJS="$LIBOBJS vfork.o"
- fi
- # We only need _doprnt if we might use it to implement v*printf.
- if test $ac_cv_func_vprintf != yes \
- || test $ac_cv_func_vfprintf != yes \
- || test $ac_cv_func_vsprintf != yes; then
- AC_REPLACE_FUNCS(_doprnt)
- else
- AC_CHECK_FUNCS(_doprnt)
- fi
-
- for v in $vars; do
- AC_MSG_CHECKING([for $v])
- AC_CACHE_VAL(libiberty_cv_var_$v,
- [AC_TRY_LINK([int *p;], [extern int $v []; p = $v;],
- [eval "libiberty_cv_var_$v=yes"],
- [eval "libiberty_cv_var_$v=no"])])
- if eval "test \"`echo '$libiberty_cv_var_'$v`\" = yes"; then
- AC_MSG_RESULT(yes)
- n=HAVE_`echo $v | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- AC_DEFINE_UNQUOTED($n)
- else
- AC_MSG_RESULT(no)
- fi
- done
- AC_CHECK_FUNCS($checkfuncs)
-fi
-
-libiberty_AC_FUNC_STRNCMP
-
-# Install a library built with a cross compiler in $(tooldir) rather
-# than $(libdir).
-if test -z "${with_cross_host}"; then
- INSTALL_DEST=libdir
-else
- INSTALL_DEST=tooldir
-fi
-AC_SUBST(INSTALL_DEST)
-
-# We need multilib support, but only if configuring for the target.
-AC_OUTPUT(Makefile testsuite/Makefile,
-[test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
-if test -n "$CONFIG_FILES"; then
- if test -n "${with_build_subdir}" || test -n "${with_target_subdir}"; then
- # FIXME: We shouldn't need to set ac_file
- ac_file=Makefile
- LD="${ORIGINAL_LD_FOR_MULTILIBS}"
- . ${libiberty_topdir}/config-ml.in
- fi
-fi],
-srcdir=${srcdir}
-host=${host}
-target=${target}
-with_target_subdir=${with_target_subdir}
-with_build_subdir=${with_build_subdir}
-with_multisubdir=${with_multisubdir}
-ac_configure_args="--enable-multilib ${ac_configure_args}"
-CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
-libiberty_topdir=${libiberty_topdir}
-)
diff --git a/libiberty/copying-lib.texi b/libiberty/copying-lib.texi
deleted file mode 100644
index 940f70e..0000000
--- a/libiberty/copying-lib.texi
+++ /dev/null
@@ -1,565 +0,0 @@
-@node Library Copying
-@appendixsec GNU LESSER GENERAL PUBLIC LICENSE
-
-@cindex LGPL, Lesser General Public License
-@center Version 2.1, February 1999
-
-@display
-Copyright @copyright{} 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.]
-@end display
-
-@appendixsubsec 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---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 @dfn{Lesser} General Public License because it
-does @emph{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.
-
-@iftex
-@appendixsubsec TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-@end iftex
-@ifinfo
-@center GNU LESSER GENERAL PUBLIC LICENSE
-@center TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-@end ifinfo
-
-@enumerate 0
-@item
-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.
-
-@item
-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.
-
-@item
-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:
-
-@enumerate a
-@item
-The modified work must itself be a software library.
-
-@item
-You must cause the files modified to carry prominent notices
-stating that you changed the files and the date of any change.
-
-@item
-You must cause the whole of the work to be licensed at no
-charge to all third parties under the terms of this License.
-
-@item
-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.)
-@end enumerate
-
-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.
-
-@item
-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.
-
-@item
-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.
-
-@item
-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.
-
-@item
-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:
-
-@enumerate a
-@item
-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.)
-
-@item
-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.
-
-@item
-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.
-
-@item
-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.
-
-@item
-Verify that the user has already received a copy of these
-materials or that you have already sent this user a copy.
-@end enumerate
-
- 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.
-
-@item
-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:
-
-@enumerate a
-@item
-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.
-
-@item
-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.
-@end enumerate
-
-@item
-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.
-
-@item
-You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the 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.
-
-@item
-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.
-
-@item
-If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the 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.
-
-@item
-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.
-
-@item
-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.
-
-@item
-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.
-
-@iftex
-@heading NO WARRANTY
-@end iftex
-@ifinfo
-@center NO WARRANTY
-@end ifinfo
-
-@item
-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.
-
-@item
-IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE 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 enumerate
-
-@iftex
-@heading END OF TERMS AND CONDITIONS
-@end iftex
-@ifinfo
-@center END OF TERMS AND CONDITIONS
-@end ifinfo
-
-@page
-@appendixsubsec 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.
-
-@smallexample
-@var{one line to give the library's name and an idea of what it does.}
-Copyright (C) @var{year} @var{name of author}
-
-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.
-@end smallexample
-
-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:
-
-@smallexample
-Yoyodyne, Inc., hereby disclaims all copyright interest in the library
-`Frob' (a library for tweaking knobs) written by James Random Hacker.
-
-@var{signature of Ty Coon}, 1 April 1990
-Ty Coon, President of Vice
-@end smallexample
-
-That's all there is to it!
diff --git a/libiberty/copysign.c b/libiberty/copysign.c
deleted file mode 100644
index 5c48a54..0000000
--- a/libiberty/copysign.c
+++ /dev/null
@@ -1,152 +0,0 @@
-#include <ansidecl.h>
-
-#ifdef __IEEE_BIG_ENDIAN
-
-typedef union
-{
- double value;
- struct
- {
- unsigned int sign : 1;
- unsigned int exponent: 11;
- unsigned int fraction0:4;
- unsigned int fraction1:16;
- unsigned int fraction2:16;
- unsigned int fraction3:16;
-
- } number;
- struct
- {
- unsigned int sign : 1;
- unsigned int exponent: 11;
- unsigned int quiet:1;
- unsigned int function0:3;
- unsigned int function1:16;
- unsigned int function2:16;
- unsigned int function3:16;
- } nan;
- struct
- {
- unsigned long msw;
- unsigned long lsw;
- } parts;
- long aslong[2];
-} __ieee_double_shape_type;
-
-#endif
-
-#ifdef __IEEE_LITTLE_ENDIAN
-
-typedef union
-{
- double value;
- struct
- {
-#ifdef __SMALL_BITFIELDS
- unsigned int fraction3:16;
- unsigned int fraction2:16;
- unsigned int fraction1:16;
- unsigned int fraction0: 4;
-#else
- unsigned int fraction1:32;
- unsigned int fraction0:20;
-#endif
- unsigned int exponent :11;
- unsigned int sign : 1;
- } number;
- struct
- {
-#ifdef __SMALL_BITFIELDS
- unsigned int function3:16;
- unsigned int function2:16;
- unsigned int function1:16;
- unsigned int function0:3;
-#else
- unsigned int function1:32;
- unsigned int function0:19;
-#endif
- unsigned int quiet:1;
- unsigned int exponent: 11;
- unsigned int sign : 1;
- } nan;
- struct
- {
- unsigned long lsw;
- unsigned long msw;
- } parts;
-
- long aslong[2];
-
-} __ieee_double_shape_type;
-
-#endif
-
-#ifdef __IEEE_BIG_ENDIAN
-typedef union
-{
- float value;
- struct
- {
- unsigned int sign : 1;
- unsigned int exponent: 8;
- unsigned int fraction0: 7;
- unsigned int fraction1: 16;
- } number;
- struct
- {
- unsigned int sign:1;
- unsigned int exponent:8;
- unsigned int quiet:1;
- unsigned int function0:6;
- unsigned int function1:16;
- } nan;
- long p1;
-
-} __ieee_float_shape_type;
-#endif
-
-#ifdef __IEEE_LITTLE_ENDIAN
-typedef union
-{
- float value;
- struct
- {
- unsigned int fraction0: 7;
- unsigned int fraction1: 16;
- unsigned int exponent: 8;
- unsigned int sign : 1;
- } number;
- struct
- {
- unsigned int function1:16;
- unsigned int function0:6;
- unsigned int quiet:1;
- unsigned int exponent:8;
- unsigned int sign:1;
- } nan;
- long p1;
-
-} __ieee_float_shape_type;
-#endif
-
-#if defined(__IEEE_BIG_ENDIAN) || defined(__IEEE_LITTLE_ENDIAN)
-
-double DEFUN(copysign, (x, y), double x AND double y)
-{
- __ieee_double_shape_type a,b;
- b.value = y;
- a.value = x;
- a.number.sign =b.number.sign;
- return a.value;
-}
-
-#else
-
-double DEFUN(copysign, (x, y), double x AND double y)
-{
- if ((x < 0 && y > 0) || (x > 0 && y < 0))
- return -x;
- return x;
-}
-
-#endif
diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c
deleted file mode 100644
index 9adf5fd..0000000
--- a/libiberty/cp-demangle.c
+++ /dev/null
@@ -1,4199 +0,0 @@
-/* Demangler for IA64 / g++ V3 ABI.
- Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
- Written by Alex Samuel <samuel@codesourcery.com>.
-
- This file is part of GNU CC.
-
- This program is free software; you can redistribute 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.
-
- In addition to the permissions in the GNU General Public License, the
- Free Software Foundation gives you unlimited permission to link the
- compiled version of this file into combinations with other programs,
- and to distribute those combinations without any restriction coming
- from the use of this file. (The General Public License restrictions
- do apply in other respects; for example, they cover modification of
- the file, and distribution when not linked into a combined
- executable.)
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU 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.
-*/
-
-/* This file implements demangling of C++ names mangled according to
- the IA64 / g++ V3 ABI. Use the cp_demangle function to
- demangle a mangled name, or compile with the preprocessor macro
- STANDALONE_DEMANGLER defined to create a demangling filter
- executable (functionally similar to c++filt, but includes this
- demangler only). */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <sys/types.h>
-
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-
-#include <stdio.h>
-
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-
-#include <ctype.h>
-
-#include "ansidecl.h"
-#include "libiberty.h"
-#include "dyn-string.h"
-#include "demangle.h"
-
-/* If CP_DEMANGLE_DEBUG is defined, a trace of the grammar evaluation,
- and other debugging output, will be generated. */
-#ifdef CP_DEMANGLE_DEBUG
-#define DEMANGLE_TRACE(PRODUCTION, DM) \
- fprintf (stderr, " -> %-24s at position %3d\n", \
- (PRODUCTION), current_position (DM));
-#else
-#define DEMANGLE_TRACE(PRODUCTION, DM)
-#endif
-
-/* Don't include <ctype.h>, to prevent additional unresolved symbols
- from being dragged into the C++ runtime library. */
-#define IS_DIGIT(CHAR) ((CHAR) >= '0' && (CHAR) <= '9')
-#define IS_ALPHA(CHAR) \
- (((CHAR) >= 'a' && (CHAR) <= 'z') \
- || ((CHAR) >= 'A' && (CHAR) <= 'Z'))
-
-/* The prefix prepended by GCC to an identifier represnting the
- anonymous namespace. */
-#define ANONYMOUS_NAMESPACE_PREFIX "_GLOBAL_"
-
-/* Character(s) to use for namespace separation in demangled output */
-#define NAMESPACE_SEPARATOR (dm->style == DMGL_JAVA ? "." : "::")
-
-/* If flag_verbose is zero, some simplifications will be made to the
- output to make it easier to read and supress details that are
- generally not of interest to the average C++ programmer.
- Otherwise, the demangled representation will attempt to convey as
- much information as the mangled form. */
-static int flag_verbose;
-
-/* If flag_strict is non-zero, demangle strictly according to the
- specification -- don't demangle special g++ manglings. */
-static int flag_strict;
-
-/* String_list_t is an extended form of dyn_string_t which provides a
- link field and a caret position for additions to the string. A
- string_list_t may safely be cast to and used as a dyn_string_t. */
-
-struct string_list_def
-{
- /* The dyn_string; must be first. */
- struct dyn_string string;
-
- /* The position at which additional text is added to this string
- (using the result_add* macros). This value is an offset from the
- end of the string, not the beginning (and should be
- non-positive). */
- int caret_position;
-
- /* The next string in the list. */
- struct string_list_def *next;
-};
-
-typedef struct string_list_def *string_list_t;
-
-/* Data structure representing a potential substitution. */
-
-struct substitution_def
-{
- /* The demangled text of the substitution. */
- dyn_string_t text;
-
- /* Whether this substitution represents a template item. */
- int template_p : 1;
-};
-
-/* Data structure representing a template argument list. */
-
-struct template_arg_list_def
-{
- /* The next (lower) template argument list in the stack of currently
- active template arguments. */
- struct template_arg_list_def *next;
-
- /* The first element in the list of template arguments in
- left-to-right order. */
- string_list_t first_argument;
-
- /* The last element in the arguments lists. */
- string_list_t last_argument;
-};
-
-typedef struct template_arg_list_def *template_arg_list_t;
-
-/* Data structure to maintain the state of the current demangling. */
-
-struct demangling_def
-{
- /* The full mangled name being mangled. */
- const char *name;
-
- /* Pointer into name at the current position. */
- const char *next;
-
- /* Stack for strings containing demangled result generated so far.
- Text is emitted to the topmost (first) string. */
- string_list_t result;
-
- /* The number of presently available substitutions. */
- int num_substitutions;
-
- /* The allocated size of the substitutions array. */
- int substitutions_allocated;
-
- /* An array of available substitutions. The number of elements in
- the array is given by num_substitions, and the allocated array
- size in substitutions_size.
-
- The most recent substition is at the end, so
-
- - `S_' corresponds to substititutions[num_substitutions - 1]
- - `S0_' corresponds to substititutions[num_substitutions - 2]
-
- etc. */
- struct substitution_def *substitutions;
-
- /* The stack of template argument lists. */
- template_arg_list_t template_arg_lists;
-
- /* The most recently demangled source-name. */
- dyn_string_t last_source_name;
-
- /* Language style to use for demangled output. */
- int style;
-
- /* Set to non-zero iff this name is a constructor. The actual value
- indicates what sort of constructor this is; see demangle.h. */
- enum gnu_v3_ctor_kinds is_constructor;
-
- /* Set to non-zero iff this name is a destructor. The actual value
- indicates what sort of destructor this is; see demangle.h. */
- enum gnu_v3_dtor_kinds is_destructor;
-
-};
-
-typedef struct demangling_def *demangling_t;
-
-/* This type is the standard return code from most functions. Values
- other than STATUS_OK contain descriptive messages. */
-typedef const char *status_t;
-
-/* Special values that can be used as a status_t. */
-#define STATUS_OK NULL
-#define STATUS_ERROR "Error."
-#define STATUS_UNIMPLEMENTED "Unimplemented."
-#define STATUS_INTERNAL_ERROR "Internal error."
-
-/* This status code indicates a failure in malloc or realloc. */
-static const char *const status_allocation_failed = "Allocation failed.";
-#define STATUS_ALLOCATION_FAILED status_allocation_failed
-
-/* Non-zero if STATUS indicates that no error has occurred. */
-#define STATUS_NO_ERROR(STATUS) ((STATUS) == STATUS_OK)
-
-/* Evaluate EXPR, which must produce a status_t. If the status code
- indicates an error, return from the current function with that
- status code. */
-#define RETURN_IF_ERROR(EXPR) \
- do \
- { \
- status_t s = EXPR; \
- if (!STATUS_NO_ERROR (s)) \
- return s; \
- } \
- while (0)
-
-static status_t int_to_dyn_string
- PARAMS ((int, dyn_string_t));
-static string_list_t string_list_new
- PARAMS ((int));
-static void string_list_delete
- PARAMS ((string_list_t));
-static status_t result_add_separated_char
- PARAMS ((demangling_t, int));
-static status_t result_push
- PARAMS ((demangling_t));
-static string_list_t result_pop
- PARAMS ((demangling_t));
-static int substitution_start
- PARAMS ((demangling_t));
-static status_t substitution_add
- PARAMS ((demangling_t, int, int));
-static dyn_string_t substitution_get
- PARAMS ((demangling_t, int, int *));
-#ifdef CP_DEMANGLE_DEBUG
-static void substitutions_print
- PARAMS ((demangling_t, FILE *));
-#endif
-static template_arg_list_t template_arg_list_new
- PARAMS ((void));
-static void template_arg_list_delete
- PARAMS ((template_arg_list_t));
-static void template_arg_list_add_arg
- PARAMS ((template_arg_list_t, string_list_t));
-static string_list_t template_arg_list_get_arg
- PARAMS ((template_arg_list_t, int));
-static void push_template_arg_list
- PARAMS ((demangling_t, template_arg_list_t));
-static void pop_to_template_arg_list
- PARAMS ((demangling_t, template_arg_list_t));
-#ifdef CP_DEMANGLE_DEBUG
-static void template_arg_list_print
- PARAMS ((template_arg_list_t, FILE *));
-#endif
-static template_arg_list_t current_template_arg_list
- PARAMS ((demangling_t));
-static demangling_t demangling_new
- PARAMS ((const char *, int));
-static void demangling_delete
- PARAMS ((demangling_t));
-
-/* The last character of DS. Warning: DS is evaluated twice. */
-#define dyn_string_last_char(DS) \
- (dyn_string_buf (DS)[dyn_string_length (DS) - 1])
-
-/* Append a space character (` ') to DS if it does not already end
- with one. Evaluates to 1 on success, or 0 on allocation failure. */
-#define dyn_string_append_space(DS) \
- ((dyn_string_length (DS) > 0 \
- && dyn_string_last_char (DS) != ' ') \
- ? dyn_string_append_char ((DS), ' ') \
- : 1)
-
-/* Returns the index of the current position in the mangled name. */
-#define current_position(DM) ((DM)->next - (DM)->name)
-
-/* Returns the character at the current position of the mangled name. */
-#define peek_char(DM) (*((DM)->next))
-
-/* Returns the character one past the current position of the mangled
- name. */
-#define peek_char_next(DM) \
- (peek_char (DM) == '\0' ? '\0' : (*((DM)->next + 1)))
-
-/* Returns the character at the current position, and advances the
- current position to the next character. */
-#define next_char(DM) (*((DM)->next)++)
-
-/* Returns non-zero if the current position is the end of the mangled
- name, i.e. one past the last character. */
-#define end_of_name_p(DM) (peek_char (DM) == '\0')
-
-/* Advances the current position by one character. */
-#define advance_char(DM) (++(DM)->next)
-
-/* Returns the string containing the current demangled result. */
-#define result_string(DM) (&(DM)->result->string)
-
-/* Returns the position at which new text is inserted into the
- demangled result. */
-#define result_caret_pos(DM) \
- (result_length (DM) + \
- ((string_list_t) result_string (DM))->caret_position)
-
-/* Adds a dyn_string_t to the demangled result. */
-#define result_add_string(DM, STRING) \
- (dyn_string_insert (&(DM)->result->string, \
- result_caret_pos (DM), (STRING)) \
- ? STATUS_OK : STATUS_ALLOCATION_FAILED)
-
-/* Adds NUL-terminated string CSTR to the demangled result. */
-#define result_add(DM, CSTR) \
- (dyn_string_insert_cstr (&(DM)->result->string, \
- result_caret_pos (DM), (CSTR)) \
- ? STATUS_OK : STATUS_ALLOCATION_FAILED)
-
-/* Adds character CHAR to the demangled result. */
-#define result_add_char(DM, CHAR) \
- (dyn_string_insert_char (&(DM)->result->string, \
- result_caret_pos (DM), (CHAR)) \
- ? STATUS_OK : STATUS_ALLOCATION_FAILED)
-
-/* Inserts a dyn_string_t to the demangled result at position POS. */
-#define result_insert_string(DM, POS, STRING) \
- (dyn_string_insert (&(DM)->result->string, (POS), (STRING)) \
- ? STATUS_OK : STATUS_ALLOCATION_FAILED)
-
-/* Inserts NUL-terminated string CSTR to the demangled result at
- position POS. */
-#define result_insert(DM, POS, CSTR) \
- (dyn_string_insert_cstr (&(DM)->result->string, (POS), (CSTR)) \
- ? STATUS_OK : STATUS_ALLOCATION_FAILED)
-
-/* Inserts character CHAR to the demangled result at position POS. */
-#define result_insert_char(DM, POS, CHAR) \
- (dyn_string_insert_char (&(DM)->result->string, (POS), (CHAR)) \
- ? STATUS_OK : STATUS_ALLOCATION_FAILED)
-
-/* The length of the current demangled result. */
-#define result_length(DM) \
- dyn_string_length (&(DM)->result->string)
-
-/* Appends a (less-than, greater-than) character to the result in DM
- to (open, close) a template argument or parameter list. Appends a
- space first if necessary to prevent spurious elision of angle
- brackets with the previous character. */
-#define result_open_template_list(DM) result_add_separated_char(DM, '<')
-#define result_close_template_list(DM) result_add_separated_char(DM, '>')
-
-/* Appends a base 10 representation of VALUE to DS. STATUS_OK on
- success. On failure, deletes DS and returns an error code. */
-
-static status_t
-int_to_dyn_string (value, ds)
- int value;
- dyn_string_t ds;
-{
- int i;
- int mask = 1;
-
- /* Handle zero up front. */
- if (value == 0)
- {
- if (!dyn_string_append_char (ds, '0'))
- return STATUS_ALLOCATION_FAILED;
- return STATUS_OK;
- }
-
- /* For negative numbers, emit a minus sign. */
- if (value < 0)
- {
- if (!dyn_string_append_char (ds, '-'))
- return STATUS_ALLOCATION_FAILED;
- value = -value;
- }
-
- /* Find the power of 10 of the first digit. */
- i = value;
- while (i > 9)
- {
- mask *= 10;
- i /= 10;
- }
-
- /* Write the digits. */
- while (mask > 0)
- {
- int digit = value / mask;
-
- if (!dyn_string_append_char (ds, '0' + digit))
- return STATUS_ALLOCATION_FAILED;
-
- value -= digit * mask;
- mask /= 10;
- }
-
- return STATUS_OK;
-}
-
-/* Creates a new string list node. The contents of the string are
- empty, but the initial buffer allocation is LENGTH. The string
- list node should be deleted with string_list_delete. Returns NULL
- if allocation fails. */
-
-static string_list_t
-string_list_new (length)
- int length;
-{
- string_list_t s = (string_list_t) malloc (sizeof (struct string_list_def));
- s->caret_position = 0;
- if (s == NULL)
- return NULL;
- if (!dyn_string_init ((dyn_string_t) s, length))
- return NULL;
- return s;
-}
-
-/* Deletes the entire string list starting at NODE. */
-
-static void
-string_list_delete (node)
- string_list_t node;
-{
- while (node != NULL)
- {
- string_list_t next = node->next;
- dyn_string_delete ((dyn_string_t) node);
- node = next;
- }
-}
-
-/* Appends CHARACTER to the demangled result. If the current trailing
- character of the result is CHARACTER, a space is inserted first. */
-
-static status_t
-result_add_separated_char (dm, character)
- demangling_t dm;
- int character;
-{
- char *result = dyn_string_buf (result_string (dm));
- int caret_pos = result_caret_pos (dm);
-
- /* Add a space if the last character is already the character we
- want to add. */
- if (caret_pos > 0 && result[caret_pos - 1] == character)
- RETURN_IF_ERROR (result_add_char (dm, ' '));
- /* Add the character. */
- RETURN_IF_ERROR (result_add_char (dm, character));
-
- return STATUS_OK;
-}
-
-/* Allocates and pushes a new string onto the demangled results stack
- for DM. Subsequent demangling with DM will emit to the new string.
- Returns STATUS_OK on success, STATUS_ALLOCATION_FAILED on
- allocation failure. */
-
-static status_t
-result_push (dm)
- demangling_t dm;
-{
- string_list_t new_string = string_list_new (0);
- if (new_string == NULL)
- /* Allocation failed. */
- return STATUS_ALLOCATION_FAILED;
-
- /* Link the new string to the front of the list of result strings. */
- new_string->next = (string_list_t) dm->result;
- dm->result = new_string;
- return STATUS_OK;
-}
-
-/* Removes and returns the topmost element on the demangled results
- stack for DM. The caller assumes ownership for the returned
- string. */
-
-static string_list_t
-result_pop (dm)
- demangling_t dm;
-{
- string_list_t top = dm->result;
- dm->result = top->next;
- return top;
-}
-
-/* Returns the current value of the caret for the result string. The
- value is an offet from the end of the result string. */
-
-static int
-result_get_caret (dm)
- demangling_t dm;
-{
- return ((string_list_t) result_string (dm))->caret_position;
-}
-
-/* Sets the value of the caret for the result string, counted as an
- offet from the end of the result string. */
-
-static void
-result_set_caret (dm, position)
- demangling_t dm;
- int position;
-{
- ((string_list_t) result_string (dm))->caret_position = position;
-}
-
-/* Shifts the position of the next addition to the result by
- POSITION_OFFSET. A negative value shifts the caret to the left. */
-
-static void
-result_shift_caret (dm, position_offset)
- demangling_t dm;
- int position_offset;
-{
- ((string_list_t) result_string (dm))->caret_position += position_offset;
-}
-
-/* Returns non-zero if the character that comes right before the place
- where text will be added to the result is a space. In this case,
- the caller should supress adding another space. */
-
-static int
-result_previous_char_is_space (dm)
- demangling_t dm;
-{
- char *result = dyn_string_buf (result_string (dm));
- int pos = result_caret_pos (dm);
- return pos > 0 && result[pos - 1] == ' ';
-}
-
-/* Returns the start position of a fragment of the demangled result
- that will be a substitution candidate. Should be called at the
- start of productions that can add substitutions. */
-
-static int
-substitution_start (dm)
- demangling_t dm;
-{
- return result_caret_pos (dm);
-}
-
-/* Adds the suffix of the current demangled result of DM starting at
- START_POSITION as a potential substitution. If TEMPLATE_P is
- non-zero, this potential substitution is a template-id. */
-
-static status_t
-substitution_add (dm, start_position, template_p)
- demangling_t dm;
- int start_position;
- int template_p;
-{
- dyn_string_t result = result_string (dm);
- dyn_string_t substitution = dyn_string_new (0);
- int i;
-
- if (substitution == NULL)
- return STATUS_ALLOCATION_FAILED;
-
- /* Extract the substring of the current demangling result that
- represents the subsitution candidate. */
- if (!dyn_string_substring (substitution,
- result, start_position, result_caret_pos (dm)))
- {
- dyn_string_delete (substitution);
- return STATUS_ALLOCATION_FAILED;
- }
-
- /* If there's no room for the new entry, grow the array. */
- if (dm->substitutions_allocated == dm->num_substitutions)
- {
- size_t new_array_size;
- if (dm->substitutions_allocated > 0)
- dm->substitutions_allocated *= 2;
- else
- dm->substitutions_allocated = 2;
- new_array_size =
- sizeof (struct substitution_def) * dm->substitutions_allocated;
-
- dm->substitutions = (struct substitution_def *)
- realloc (dm->substitutions, new_array_size);
- if (dm->substitutions == NULL)
- /* Realloc failed. */
- {
- dyn_string_delete (substitution);
- return STATUS_ALLOCATION_FAILED;
- }
- }
-
- /* Add the substitution to the array. */
- i = dm->num_substitutions++;
- dm->substitutions[i].text = substitution;
- dm->substitutions[i].template_p = template_p;
-
-#ifdef CP_DEMANGLE_DEBUG
- substitutions_print (dm, stderr);
-#endif
-
- return STATUS_OK;
-}
-
-/* Returns the Nth-most-recent substitution. Sets *TEMPLATE_P to
- non-zero if the substitution is a template-id, zero otherwise.
- N is numbered from zero. DM retains ownership of the returned
- string. If N is negative, or equal to or greater than the current
- number of substitution candidates, returns NULL. */
-
-static dyn_string_t
-substitution_get (dm, n, template_p)
- demangling_t dm;
- int n;
- int *template_p;
-{
- struct substitution_def *sub;
-
- /* Make sure N is in the valid range. */
- if (n < 0 || n >= dm->num_substitutions)
- return NULL;
-
- sub = &(dm->substitutions[n]);
- *template_p = sub->template_p;
- return sub->text;
-}
-
-#ifdef CP_DEMANGLE_DEBUG
-/* Debugging routine to print the current substitutions to FP. */
-
-static void
-substitutions_print (dm, fp)
- demangling_t dm;
- FILE *fp;
-{
- int seq_id;
- int num = dm->num_substitutions;
-
- fprintf (fp, "SUBSTITUTIONS:\n");
- for (seq_id = -1; seq_id < num - 1; ++seq_id)
- {
- int template_p;
- dyn_string_t text = substitution_get (dm, seq_id + 1, &template_p);
-
- if (seq_id == -1)
- fprintf (fp, " S_ ");
- else
- fprintf (fp, " S%d_", seq_id);
- fprintf (fp, " %c: %s\n", template_p ? '*' : ' ', dyn_string_buf (text));
- }
-}
-
-#endif /* CP_DEMANGLE_DEBUG */
-
-/* Creates a new template argument list. Returns NULL if allocation
- fails. */
-
-static template_arg_list_t
-template_arg_list_new ()
-{
- template_arg_list_t new_list =
- (template_arg_list_t) malloc (sizeof (struct template_arg_list_def));
- if (new_list == NULL)
- return NULL;
- /* Initialize the new list to have no arguments. */
- new_list->first_argument = NULL;
- new_list->last_argument = NULL;
- /* Return the new list. */
- return new_list;
-}
-
-/* Deletes a template argument list and the template arguments it
- contains. */
-
-static void
-template_arg_list_delete (list)
- template_arg_list_t list;
-{
- /* If there are any arguments on LIST, delete them. */
- if (list->first_argument != NULL)
- string_list_delete (list->first_argument);
- /* Delete LIST. */
- free (list);
-}
-
-/* Adds ARG to the template argument list ARG_LIST. */
-
-static void
-template_arg_list_add_arg (arg_list, arg)
- template_arg_list_t arg_list;
- string_list_t arg;
-{
- if (arg_list->first_argument == NULL)
- /* If there were no arguments before, ARG is the first one. */
- arg_list->first_argument = arg;
- else
- /* Make ARG the last argument on the list. */
- arg_list->last_argument->next = arg;
- /* Make ARG the last on the list. */
- arg_list->last_argument = arg;
- arg->next = NULL;
-}
-
-/* Returns the template arugment at position INDEX in template
- argument list ARG_LIST. */
-
-static string_list_t
-template_arg_list_get_arg (arg_list, index)
- template_arg_list_t arg_list;
- int index;
-{
- string_list_t arg = arg_list->first_argument;
- /* Scan down the list of arguments to find the one at position
- INDEX. */
- while (index--)
- {
- arg = arg->next;
- if (arg == NULL)
- /* Ran out of arguments before INDEX hit zero. That's an
- error. */
- return NULL;
- }
- /* Return the argument at position INDEX. */
- return arg;
-}
-
-/* Pushes ARG_LIST onto the top of the template argument list stack. */
-
-static void
-push_template_arg_list (dm, arg_list)
- demangling_t dm;
- template_arg_list_t arg_list;
-{
- arg_list->next = dm->template_arg_lists;
- dm->template_arg_lists = arg_list;
-#ifdef CP_DEMANGLE_DEBUG
- fprintf (stderr, " ** pushing template arg list\n");
- template_arg_list_print (arg_list, stderr);
-#endif
-}
-
-/* Pops and deletes elements on the template argument list stack until
- arg_list is the topmost element. If arg_list is NULL, all elements
- are popped and deleted. */
-
-static void
-pop_to_template_arg_list (dm, arg_list)
- demangling_t dm;
- template_arg_list_t arg_list;
-{
- while (dm->template_arg_lists != arg_list)
- {
- template_arg_list_t top = dm->template_arg_lists;
- /* Disconnect the topmost element from the list. */
- dm->template_arg_lists = top->next;
- /* Delete the popped element. */
- template_arg_list_delete (top);
-#ifdef CP_DEMANGLE_DEBUG
- fprintf (stderr, " ** removing template arg list\n");
-#endif
- }
-}
-
-#ifdef CP_DEMANGLE_DEBUG
-
-/* Prints the contents of ARG_LIST to FP. */
-
-static void
-template_arg_list_print (arg_list, fp)
- template_arg_list_t arg_list;
- FILE *fp;
-{
- string_list_t arg;
- int index = -1;
-
- fprintf (fp, "TEMPLATE ARGUMENT LIST:\n");
- for (arg = arg_list->first_argument; arg != NULL; arg = arg->next)
- {
- if (index == -1)
- fprintf (fp, " T_ : ");
- else
- fprintf (fp, " T%d_ : ", index);
- ++index;
- fprintf (fp, "%s\n", dyn_string_buf ((dyn_string_t) arg));
- }
-}
-
-#endif /* CP_DEMANGLE_DEBUG */
-
-/* Returns the topmost element on the stack of template argument
- lists. If there is no list of template arguments, returns NULL. */
-
-static template_arg_list_t
-current_template_arg_list (dm)
- demangling_t dm;
-{
- return dm->template_arg_lists;
-}
-
-/* Allocates a demangling_t object for demangling mangled NAME. A new
- result must be pushed before the returned object can be used.
- Returns NULL if allocation fails. */
-
-static demangling_t
-demangling_new (name, style)
- const char *name;
- int style;
-{
- demangling_t dm;
- dm = (demangling_t) malloc (sizeof (struct demangling_def));
- if (dm == NULL)
- return NULL;
-
- dm->name = name;
- dm->next = name;
- dm->result = NULL;
- dm->num_substitutions = 0;
- dm->substitutions_allocated = 10;
- dm->template_arg_lists = NULL;
- dm->last_source_name = dyn_string_new (0);
- if (dm->last_source_name == NULL)
- return NULL;
- dm->substitutions = (struct substitution_def *)
- malloc (dm->substitutions_allocated * sizeof (struct substitution_def));
- if (dm->substitutions == NULL)
- {
- dyn_string_delete (dm->last_source_name);
- return NULL;
- }
- dm->style = style;
- dm->is_constructor = (enum gnu_v3_ctor_kinds) 0;
- dm->is_destructor = (enum gnu_v3_dtor_kinds) 0;
-
- return dm;
-}
-
-/* Deallocates a demangling_t object and all memory associated with
- it. */
-
-static void
-demangling_delete (dm)
- demangling_t dm;
-{
- int i;
- template_arg_list_t arg_list = dm->template_arg_lists;
-
- /* Delete the stack of template argument lists. */
- while (arg_list != NULL)
- {
- template_arg_list_t next = arg_list->next;
- template_arg_list_delete (arg_list);
- arg_list = next;
- }
- /* Delete the list of substitutions. */
- for (i = dm->num_substitutions; --i >= 0; )
- dyn_string_delete (dm->substitutions[i].text);
- free (dm->substitutions);
- /* Delete the demangled result. */
- string_list_delete (dm->result);
- /* Delete the stored identifier name. */
- dyn_string_delete (dm->last_source_name);
- /* Delete the context object itself. */
- free (dm);
-}
-
-/* These functions demangle an alternative of the corresponding
- production in the mangling spec. The first argument of each is a
- demangling context structure for the current demangling
- operation. Most emit demangled text directly to the topmost result
- string on the result string stack in the demangling context
- structure. */
-
-static status_t demangle_char
- PARAMS ((demangling_t, int));
-static status_t demangle_mangled_name
- PARAMS ((demangling_t));
-static status_t demangle_encoding
- PARAMS ((demangling_t));
-static status_t demangle_name
- PARAMS ((demangling_t, int *));
-static status_t demangle_nested_name
- PARAMS ((demangling_t, int *));
-static status_t demangle_prefix
- PARAMS ((demangling_t, int *));
-static status_t demangle_unqualified_name
- PARAMS ((demangling_t, int *));
-static status_t demangle_source_name
- PARAMS ((demangling_t));
-static status_t demangle_number
- PARAMS ((demangling_t, int *, int, int));
-static status_t demangle_number_literally
- PARAMS ((demangling_t, dyn_string_t, int, int));
-static status_t demangle_identifier
- PARAMS ((demangling_t, int, dyn_string_t));
-static status_t demangle_operator_name
- PARAMS ((demangling_t, int, int *, int *));
-static status_t demangle_nv_offset
- PARAMS ((demangling_t));
-static status_t demangle_v_offset
- PARAMS ((demangling_t));
-static status_t demangle_call_offset
- PARAMS ((demangling_t));
-static status_t demangle_special_name
- PARAMS ((demangling_t));
-static status_t demangle_ctor_dtor_name
- PARAMS ((demangling_t));
-static status_t demangle_type_ptr
- PARAMS ((demangling_t, int *, int));
-static status_t demangle_type
- PARAMS ((demangling_t));
-static status_t demangle_CV_qualifiers
- PARAMS ((demangling_t, dyn_string_t));
-static status_t demangle_builtin_type
- PARAMS ((demangling_t));
-static status_t demangle_function_type
- PARAMS ((demangling_t, int *));
-static status_t demangle_bare_function_type
- PARAMS ((demangling_t, int *));
-static status_t demangle_class_enum_type
- PARAMS ((demangling_t, int *));
-static status_t demangle_array_type
- PARAMS ((demangling_t, int *));
-static status_t demangle_template_param
- PARAMS ((demangling_t));
-static status_t demangle_template_args
- PARAMS ((demangling_t));
-static status_t demangle_literal
- PARAMS ((demangling_t));
-static status_t demangle_template_arg
- PARAMS ((demangling_t));
-static status_t demangle_expression
- PARAMS ((demangling_t));
-static status_t demangle_scope_expression
- PARAMS ((demangling_t));
-static status_t demangle_expr_primary
- PARAMS ((demangling_t));
-static status_t demangle_substitution
- PARAMS ((demangling_t, int *));
-static status_t demangle_local_name
- PARAMS ((demangling_t));
-static status_t demangle_discriminator
- PARAMS ((demangling_t, int));
-static status_t cp_demangle
- PARAMS ((const char *, dyn_string_t, int));
-static status_t cp_demangle_type
- PARAMS ((const char*, dyn_string_t));
-
-/* When passed to demangle_bare_function_type, indicates that the
- function's return type is not encoded before its parameter types. */
-#define BFT_NO_RETURN_TYPE NULL
-
-/* Check that the next character is C. If so, consume it. If not,
- return an error. */
-
-static status_t
-demangle_char (dm, c)
- demangling_t dm;
- int c;
-{
- static char *error_message = NULL;
-
- if (peek_char (dm) == c)
- {
- advance_char (dm);
- return STATUS_OK;
- }
- else
- {
- if (error_message == NULL)
- error_message = (char *) strdup ("Expected ?");
- error_message[9] = c;
- return error_message;
- }
-}
-
-/* Demangles and emits a <mangled-name>.
-
- <mangled-name> ::= _Z <encoding> */
-
-static status_t
-demangle_mangled_name (dm)
- demangling_t dm;
-{
- DEMANGLE_TRACE ("mangled-name", dm);
- RETURN_IF_ERROR (demangle_char (dm, '_'));
- RETURN_IF_ERROR (demangle_char (dm, 'Z'));
- RETURN_IF_ERROR (demangle_encoding (dm));
- return STATUS_OK;
-}
-
-/* Demangles and emits an <encoding>.
-
- <encoding> ::= <function name> <bare-function-type>
- ::= <data name>
- ::= <special-name> */
-
-static status_t
-demangle_encoding (dm)
- demangling_t dm;
-{
- int encode_return_type;
- int start_position;
- template_arg_list_t old_arg_list = current_template_arg_list (dm);
- char peek = peek_char (dm);
-
- DEMANGLE_TRACE ("encoding", dm);
-
- /* Remember where the name starts. If it turns out to be a template
- function, we'll have to insert the return type here. */
- start_position = result_caret_pos (dm);
-
- if (peek == 'G' || peek == 'T')
- RETURN_IF_ERROR (demangle_special_name (dm));
- else
- {
- /* Now demangle the name. */
- RETURN_IF_ERROR (demangle_name (dm, &encode_return_type));
-
- /* If there's anything left, the name was a function name, with
- maybe its return type, and its parameter types, following. */
- if (!end_of_name_p (dm)
- && peek_char (dm) != 'E')
- {
- if (encode_return_type)
- /* Template functions have their return type encoded. The
- return type should be inserted at start_position. */
- RETURN_IF_ERROR
- (demangle_bare_function_type (dm, &start_position));
- else
- /* Non-template functions don't have their return type
- encoded. */
- RETURN_IF_ERROR
- (demangle_bare_function_type (dm, BFT_NO_RETURN_TYPE));
- }
- }
-
- /* Pop off template argument lists that were built during the
- mangling of this name, to restore the old template context. */
- pop_to_template_arg_list (dm, old_arg_list);
-
- return STATUS_OK;
-}
-
-/* Demangles and emits a <name>.
-
- <name> ::= <unscoped-name>
- ::= <unscoped-template-name> <template-args>
- ::= <nested-name>
- ::= <local-name>
-
- <unscoped-name> ::= <unqualified-name>
- ::= St <unqualified-name> # ::std::
-
- <unscoped-template-name>
- ::= <unscoped-name>
- ::= <substitution> */
-
-static status_t
-demangle_name (dm, encode_return_type)
- demangling_t dm;
- int *encode_return_type;
-{
- int start = substitution_start (dm);
- char peek = peek_char (dm);
- int is_std_substitution = 0;
-
- /* Generally, the return type is encoded if the function is a
- template-id, and suppressed otherwise. There are a few cases,
- though, in which the return type is not encoded even for a
- templated function. In these cases, this flag is set. */
- int suppress_return_type = 0;
-
- DEMANGLE_TRACE ("name", dm);
-
- switch (peek)
- {
- case 'N':
- /* This is a <nested-name>. */
- RETURN_IF_ERROR (demangle_nested_name (dm, encode_return_type));
- break;
-
- case 'Z':
- RETURN_IF_ERROR (demangle_local_name (dm));
- *encode_return_type = 0;
- break;
-
- case 'S':
- /* The `St' substitution allows a name nested in std:: to appear
- without being enclosed in a nested name. */
- if (peek_char_next (dm) == 't')
- {
- (void) next_char (dm);
- (void) next_char (dm);
- RETURN_IF_ERROR (result_add (dm, "std::"));
- RETURN_IF_ERROR
- (demangle_unqualified_name (dm, &suppress_return_type));
- is_std_substitution = 1;
- }
- else
- RETURN_IF_ERROR (demangle_substitution (dm, encode_return_type));
- /* Check if a template argument list immediately follows.
- If so, then we just demangled an <unqualified-template-name>. */
- if (peek_char (dm) == 'I')
- {
- /* A template name of the form std::<unqualified-name> is a
- substitution candidate. */
- if (is_std_substitution)
- RETURN_IF_ERROR (substitution_add (dm, start, 0));
- /* Demangle the <template-args> here. */
- RETURN_IF_ERROR (demangle_template_args (dm));
- *encode_return_type = !suppress_return_type;
- }
- else
- *encode_return_type = 0;
-
- break;
-
- default:
- /* This is an <unscoped-name> or <unscoped-template-name>. */
- RETURN_IF_ERROR (demangle_unqualified_name (dm, &suppress_return_type));
-
- /* If the <unqualified-name> is followed by template args, this
- is an <unscoped-template-name>. */
- if (peek_char (dm) == 'I')
- {
- /* Add a substitution for the unqualified template name. */
- RETURN_IF_ERROR (substitution_add (dm, start, 0));
-
- RETURN_IF_ERROR (demangle_template_args (dm));
- *encode_return_type = !suppress_return_type;
- }
- else
- *encode_return_type = 0;
-
- break;
- }
-
- return STATUS_OK;
-}
-
-/* Demangles and emits a <nested-name>.
-
- <nested-name> ::= N [<CV-qualifiers>] <prefix> <unqulified-name> E */
-
-static status_t
-demangle_nested_name (dm, encode_return_type)
- demangling_t dm;
- int *encode_return_type;
-{
- char peek;
-
- DEMANGLE_TRACE ("nested-name", dm);
-
- RETURN_IF_ERROR (demangle_char (dm, 'N'));
-
- peek = peek_char (dm);
- if (peek == 'r' || peek == 'V' || peek == 'K')
- {
- dyn_string_t cv_qualifiers;
- status_t status;
-
- /* Snarf up CV qualifiers. */
- cv_qualifiers = dyn_string_new (24);
- if (cv_qualifiers == NULL)
- return STATUS_ALLOCATION_FAILED;
- demangle_CV_qualifiers (dm, cv_qualifiers);
-
- /* Emit them, preceded by a space. */
- status = result_add_char (dm, ' ');
- if (STATUS_NO_ERROR (status))
- status = result_add_string (dm, cv_qualifiers);
- /* The CV qualifiers that occur in a <nested-name> will be
- qualifiers for member functions. These are placed at the end
- of the function. Therefore, shift the caret to the left by
- the length of the qualifiers, so other text is inserted
- before them and they stay at the end. */
- result_shift_caret (dm, -dyn_string_length (cv_qualifiers) - 1);
- /* Clean up. */
- dyn_string_delete (cv_qualifiers);
- RETURN_IF_ERROR (status);
- }
-
- RETURN_IF_ERROR (demangle_prefix (dm, encode_return_type));
- /* No need to demangle the final <unqualified-name>; demangle_prefix
- will handle it. */
- RETURN_IF_ERROR (demangle_char (dm, 'E'));
-
- return STATUS_OK;
-}
-
-/* Demangles and emits a <prefix>.
-
- <prefix> ::= <prefix> <unqualified-name>
- ::= <template-prefix> <template-args>
- ::= # empty
- ::= <substitution>
-
- <template-prefix> ::= <prefix>
- ::= <substitution> */
-
-static status_t
-demangle_prefix (dm, encode_return_type)
- demangling_t dm;
- int *encode_return_type;
-{
- int start = substitution_start (dm);
- int nested = 0;
-
- /* ENCODE_RETURN_TYPE is updated as we decend the nesting chain.
- After <template-args>, it is set to non-zero; after everything
- else it is set to zero. */
-
- /* Generally, the return type is encoded if the function is a
- template-id, and suppressed otherwise. There are a few cases,
- though, in which the return type is not encoded even for a
- templated function. In these cases, this flag is set. */
- int suppress_return_type = 0;
-
- DEMANGLE_TRACE ("prefix", dm);
-
- while (1)
- {
- char peek;
-
- if (end_of_name_p (dm))
- return "Unexpected end of name in <compound-name>.";
-
- peek = peek_char (dm);
-
- /* We'll initialize suppress_return_type to false, and set it to true
- if we end up demangling a constructor name. However, make
- sure we're not actually about to demangle template arguments
- -- if so, this is the <template-args> following a
- <template-prefix>, so we'll want the previous flag value
- around. */
- if (peek != 'I')
- suppress_return_type = 0;
-
- if (IS_DIGIT ((unsigned char) peek)
- || (peek >= 'a' && peek <= 'z')
- || peek == 'C' || peek == 'D'
- || peek == 'S')
- {
- /* We have another level of scope qualification. */
- if (nested)
- RETURN_IF_ERROR (result_add (dm, NAMESPACE_SEPARATOR));
- else
- nested = 1;
-
- if (peek == 'S')
- /* The substitution determines whether this is a
- template-id. */
- RETURN_IF_ERROR (demangle_substitution (dm, encode_return_type));
- else
- {
- /* It's just a name. */
- RETURN_IF_ERROR
- (demangle_unqualified_name (dm, &suppress_return_type));
- *encode_return_type = 0;
- }
- }
- else if (peek == 'Z')
- RETURN_IF_ERROR (demangle_local_name (dm));
- else if (peek == 'I')
- {
- RETURN_IF_ERROR (demangle_template_args (dm));
-
- /* Now we want to indicate to the caller that we've
- demangled template arguments, thus the prefix was a
- <template-prefix>. That's so that the caller knows to
- demangle the function's return type, if this turns out to
- be a function name. But, if it's a member template
- constructor or a templated conversion operator, report it
- as untemplated. Those never get encoded return types. */
- *encode_return_type = !suppress_return_type;
- }
- else if (peek == 'E')
- /* All done. */
- return STATUS_OK;
- else
- return "Unexpected character in <compound-name>.";
-
- if (peek != 'S'
- && peek_char (dm) != 'E')
- /* Add a new substitution for the prefix thus far. */
- RETURN_IF_ERROR (substitution_add (dm, start, *encode_return_type));
- }
-}
-
-/* Demangles and emits an <unqualified-name>. If this
- <unqualified-name> is for a special function type that should never
- have its return type encoded (particularly, a constructor or
- conversion operator), *SUPPRESS_RETURN_TYPE is set to 1; otherwise,
- it is set to zero.
-
- <unqualified-name> ::= <operator-name>
- ::= <special-name>
- ::= <source-name> */
-
-static status_t
-demangle_unqualified_name (dm, suppress_return_type)
- demangling_t dm;
- int *suppress_return_type;
-{
- char peek = peek_char (dm);
-
- DEMANGLE_TRACE ("unqualified-name", dm);
-
- /* By default, don't force suppression of the return type (though
- non-template functions still don't get a return type encoded). */
- *suppress_return_type = 0;
-
- if (IS_DIGIT ((unsigned char) peek))
- RETURN_IF_ERROR (demangle_source_name (dm));
- else if (peek >= 'a' && peek <= 'z')
- {
- int num_args;
-
- /* Conversion operators never have a return type encoded. */
- if (peek == 'c' && peek_char_next (dm) == 'v')
- *suppress_return_type = 1;
-
- RETURN_IF_ERROR (demangle_operator_name (dm, 0, &num_args, NULL));
- }
- else if (peek == 'C' || peek == 'D')
- {
- /* Constructors never have a return type encoded. */
- if (peek == 'C')
- *suppress_return_type = 1;
-
- RETURN_IF_ERROR (demangle_ctor_dtor_name (dm));
- }
- else
- return "Unexpected character in <unqualified-name>.";
-
- return STATUS_OK;
-}
-
-/* Demangles and emits <source-name>.
-
- <source-name> ::= <length number> <identifier> */
-
-static status_t
-demangle_source_name (dm)
- demangling_t dm;
-{
- int length;
-
- DEMANGLE_TRACE ("source-name", dm);
-
- /* Decode the length of the identifier. */
- RETURN_IF_ERROR (demangle_number (dm, &length, 10, 0));
- if (length == 0)
- return "Zero length in <source-name>.";
-
- /* Now the identifier itself. It's placed into last_source_name,
- where it can be used to build a constructor or destructor name. */
- RETURN_IF_ERROR (demangle_identifier (dm, length,
- dm->last_source_name));
-
- /* Emit it. */
- RETURN_IF_ERROR (result_add_string (dm, dm->last_source_name));
-
- return STATUS_OK;
-}
-
-/* Demangles a number, either a <number> or a <positive-number> at the
- current position, consuming all consecutive digit characters. Sets
- *VALUE to the resulting numberand returns STATUS_OK. The number is
- interpreted as BASE, which must be either 10 or 36. If IS_SIGNED
- is non-zero, negative numbers -- prefixed with `n' -- are accepted.
-
- <number> ::= [n] <positive-number>
-
- <positive-number> ::= <decimal integer> */
-
-static status_t
-demangle_number (dm, value, base, is_signed)
- demangling_t dm;
- int *value;
- int base;
- int is_signed;
-{
- dyn_string_t number = dyn_string_new (10);
-
- DEMANGLE_TRACE ("number", dm);
-
- if (number == NULL)
- return STATUS_ALLOCATION_FAILED;
-
- demangle_number_literally (dm, number, base, is_signed);
- *value = strtol (dyn_string_buf (number), NULL, base);
- dyn_string_delete (number);
-
- return STATUS_OK;
-}
-
-/* Demangles a number at the current position. The digits (and minus
- sign, if present) that make up the number are appended to STR.
- Only base-BASE digits are accepted; BASE must be either 10 or 36.
- If IS_SIGNED, negative numbers -- prefixed with `n' -- are
- accepted. Does not consume a trailing underscore or other
- terminating character. */
-
-static status_t
-demangle_number_literally (dm, str, base, is_signed)
- demangling_t dm;
- dyn_string_t str;
- int base;
- int is_signed;
-{
- DEMANGLE_TRACE ("number*", dm);
-
- if (base != 10 && base != 36)
- return STATUS_INTERNAL_ERROR;
-
- /* An `n' denotes a negative number. */
- if (is_signed && peek_char (dm) == 'n')
- {
- /* Skip past the n. */
- advance_char (dm);
- /* The normal way to write a negative number is with a minus
- sign. */
- if (!dyn_string_append_char (str, '-'))
- return STATUS_ALLOCATION_FAILED;
- }
-
- /* Loop until we hit a non-digit. */
- while (1)
- {
- char peek = peek_char (dm);
- if (IS_DIGIT ((unsigned char) peek)
- || (base == 36 && peek >= 'A' && peek <= 'Z'))
- {
- /* Accumulate digits. */
- if (!dyn_string_append_char (str, next_char (dm)))
- return STATUS_ALLOCATION_FAILED;
- }
- else
- /* Not a digit? All done. */
- break;
- }
-
- return STATUS_OK;
-}
-
-/* Demangles an identifier at the current position of LENGTH
- characters and places it in IDENTIFIER. */
-
-static status_t
-demangle_identifier (dm, length, identifier)
- demangling_t dm;
- int length;
- dyn_string_t identifier;
-{
- DEMANGLE_TRACE ("identifier", dm);
-
- dyn_string_clear (identifier);
- if (!dyn_string_resize (identifier, length))
- return STATUS_ALLOCATION_FAILED;
-
- while (length-- > 0)
- {
- int ch;
- if (end_of_name_p (dm))
- return "Unexpected end of name in <identifier>.";
- ch = next_char (dm);
-
- /* Handle extended Unicode characters. We encode them as __U{hex}_,
- where {hex} omits leading 0's. For instance, '$' is encoded as
- "__U24_". */
- if (ch == '_'
- && peek_char (dm) == '_'
- && peek_char_next (dm) == 'U')
- {
- char buf[10];
- int pos = 0;
- advance_char (dm); advance_char (dm); length -= 2;
- while (length-- > 0)
- {
- ch = next_char (dm);
- if (!isxdigit (ch))
- break;
- buf[pos++] = ch;
- }
- if (ch != '_' || length < 0)
- return STATUS_ERROR;
- if (pos == 0)
- {
- /* __U_ just means __U. */
- if (!dyn_string_append_cstr (identifier, "__U"))
- return STATUS_ALLOCATION_FAILED;
- continue;
- }
- else
- {
- buf[pos] = '\0';
- ch = strtol (buf, 0, 16);
- }
- }
-
- if (!dyn_string_append_char (identifier, ch))
- return STATUS_ALLOCATION_FAILED;
- }
-
- /* GCC encodes anonymous namespaces using a `_GLOBAL_[_.$]N.'
- followed by the source file name and some random characters.
- Unless we're in strict mode, decipher these names appropriately. */
- if (!flag_strict)
- {
- char *name = dyn_string_buf (identifier);
- int prefix_length = strlen (ANONYMOUS_NAMESPACE_PREFIX);
-
- /* Compare the first, fixed part. */
- if (strncmp (name, ANONYMOUS_NAMESPACE_PREFIX, prefix_length) == 0)
- {
- name += prefix_length;
- /* The next character might be a period, an underscore, or
- dollar sign, depending on the target architecture's
- assembler's capabilities. After that comes an `N'. */
- if ((*name == '.' || *name == '_' || *name == '$')
- && *(name + 1) == 'N')
- /* This looks like the anonymous namespace identifier.
- Replace it with something comprehensible. */
- dyn_string_copy_cstr (identifier, "(anonymous namespace)");
- }
- }
-
- return STATUS_OK;
-}
-
-/* Demangles and emits an <operator-name>. If SHORT_NAME is non-zero,
- the short form is emitted; otherwise the full source form
- (`operator +' etc.) is emitted. *NUM_ARGS is set to the number of
- operands that the operator takes. If TYPE_ARG is non-NULL,
- *TYPE_ARG is set to 1 if the first argument is a type and 0
- otherwise.
-
- <operator-name>
- ::= nw # new
- ::= na # new[]
- ::= dl # delete
- ::= da # delete[]
- ::= ps # + (unary)
- ::= ng # - (unary)
- ::= ad # & (unary)
- ::= de # * (unary)
- ::= co # ~
- ::= pl # +
- ::= mi # -
- ::= ml # *
- ::= dv # /
- ::= rm # %
- ::= an # &
- ::= or # |
- ::= eo # ^
- ::= aS # =
- ::= pL # +=
- ::= mI # -=
- ::= mL # *=
- ::= dV # /=
- ::= rM # %=
- ::= aN # &=
- ::= oR # |=
- ::= eO # ^=
- ::= ls # <<
- ::= rs # >>
- ::= lS # <<=
- ::= rS # >>=
- ::= eq # ==
- ::= ne # !=
- ::= lt # <
- ::= gt # >
- ::= le # <=
- ::= ge # >=
- ::= nt # !
- ::= aa # &&
- ::= oo # ||
- ::= pp # ++
- ::= mm # --
- ::= cm # ,
- ::= pm # ->*
- ::= pt # ->
- ::= cl # ()
- ::= ix # []
- ::= qu # ?
- ::= st # sizeof (a type)
- ::= sz # sizeof (an expression)
- ::= cv <type> # cast
- ::= v [0-9] <source-name> # vendor extended operator */
-
-static status_t
-demangle_operator_name (dm, short_name, num_args, type_arg)
- demangling_t dm;
- int short_name;
- int *num_args;
- int *type_arg;
-{
- struct operator_code
- {
- /* The mangled code for this operator. */
- const char *const code;
- /* The source name of this operator. */
- const char *const name;
- /* The number of arguments this operator takes. */
- const int num_args;
- };
-
- static const struct operator_code operators[] =
- {
- { "aN", "&=" , 2 },
- { "aS", "=" , 2 },
- { "aa", "&&" , 2 },
- { "ad", "&" , 1 },
- { "an", "&" , 2 },
- { "cl", "()" , 0 },
- { "cm", "," , 2 },
- { "co", "~" , 1 },
- { "dV", "/=" , 2 },
- { "da", " delete[]", 1 },
- { "de", "*" , 1 },
- { "dl", " delete" , 1 },
- { "dv", "/" , 2 },
- { "eO", "^=" , 2 },
- { "eo", "^" , 2 },
- { "eq", "==" , 2 },
- { "ge", ">=" , 2 },
- { "gt", ">" , 2 },
- { "ix", "[]" , 2 },
- { "lS", "<<=" , 2 },
- { "le", "<=" , 2 },
- { "ls", "<<" , 2 },
- { "lt", "<" , 2 },
- { "mI", "-=" , 2 },
- { "mL", "*=" , 2 },
- { "mi", "-" , 2 },
- { "ml", "*" , 2 },
- { "mm", "--" , 1 },
- { "na", " new[]" , 1 },
- { "ne", "!=" , 2 },
- { "ng", "-" , 1 },
- { "nt", "!" , 1 },
- { "nw", " new" , 1 },
- { "oR", "|=" , 2 },
- { "oo", "||" , 2 },
- { "or", "|" , 2 },
- { "pL", "+=" , 2 },
- { "pl", "+" , 2 },
- { "pm", "->*" , 2 },
- { "pp", "++" , 1 },
- { "ps", "+" , 1 },
- { "pt", "->" , 2 },
- { "qu", "?" , 3 },
- { "rM", "%=" , 2 },
- { "rS", ">>=" , 2 },
- { "rm", "%" , 2 },
- { "rs", ">>" , 2 },
- { "sz", " sizeof" , 1 }
- };
-
- const int num_operators =
- sizeof (operators) / sizeof (struct operator_code);
-
- int c0 = next_char (dm);
- int c1 = next_char (dm);
- const struct operator_code* p1 = operators;
- const struct operator_code* p2 = operators + num_operators;
-
- DEMANGLE_TRACE ("operator-name", dm);
-
- /* Assume the first argument is not a type. */
- if (type_arg)
- *type_arg = 0;
-
- /* Is this a vendor-extended operator? */
- if (c0 == 'v' && IS_DIGIT (c1))
- {
- RETURN_IF_ERROR (result_add (dm, "operator "));
- RETURN_IF_ERROR (demangle_source_name (dm));
- *num_args = 0;
- return STATUS_OK;
- }
-
- /* Is this a conversion operator? */
- if (c0 == 'c' && c1 == 'v')
- {
- RETURN_IF_ERROR (result_add (dm, "operator "));
- /* Demangle the converted-to type. */
- RETURN_IF_ERROR (demangle_type (dm));
- *num_args = 0;
- return STATUS_OK;
- }
-
- /* Is it the sizeof variant that takes a type? */
- if (c0 == 's' && c1 == 't')
- {
- RETURN_IF_ERROR (result_add (dm, " sizeof"));
- *num_args = 1;
- if (type_arg)
- *type_arg = 1;
- return STATUS_OK;
- }
-
- /* Perform a binary search for the operator code. */
- while (1)
- {
- const struct operator_code* p = p1 + (p2 - p1) / 2;
- char match0 = p->code[0];
- char match1 = p->code[1];
-
- if (c0 == match0 && c1 == match1)
- /* Found it. */
- {
- if (!short_name)
- RETURN_IF_ERROR (result_add (dm, "operator"));
- RETURN_IF_ERROR (result_add (dm, p->name));
- *num_args = p->num_args;
-
- return STATUS_OK;
- }
-
- if (p == p1)
- /* Couldn't find it. */
- return "Unknown code in <operator-name>.";
-
- /* Try again. */
- if (c0 < match0 || (c0 == match0 && c1 < match1))
- p2 = p;
- else
- p1 = p;
- }
-}
-
-/* Demangles and omits an <nv-offset>.
-
- <nv-offset> ::= <offset number> # non-virtual base override */
-
-static status_t
-demangle_nv_offset (dm)
- demangling_t dm;
-{
- dyn_string_t number;
- status_t status = STATUS_OK;
-
- DEMANGLE_TRACE ("h-offset", dm);
-
- /* Demangle the offset. */
- number = dyn_string_new (4);
- if (number == NULL)
- return STATUS_ALLOCATION_FAILED;
- demangle_number_literally (dm, number, 10, 1);
-
- /* Don't display the offset unless in verbose mode. */
- if (flag_verbose)
- {
- status = result_add (dm, " [nv:");
- if (STATUS_NO_ERROR (status))
- status = result_add_string (dm, number);
- if (STATUS_NO_ERROR (status))
- status = result_add_char (dm, ']');
- }
-
- /* Clean up. */
- dyn_string_delete (number);
- RETURN_IF_ERROR (status);
- return STATUS_OK;
-}
-
-/* Demangles and emits a <v-offset>.
-
- <v-offset> ::= <offset number> _ <virtual offset number>
- # virtual base override, with vcall offset */
-
-static status_t
-demangle_v_offset (dm)
- demangling_t dm;
-{
- dyn_string_t number;
- status_t status = STATUS_OK;
-
- DEMANGLE_TRACE ("v-offset", dm);
-
- /* Demangle the offset. */
- number = dyn_string_new (4);
- if (number == NULL)
- return STATUS_ALLOCATION_FAILED;
- demangle_number_literally (dm, number, 10, 1);
-
- /* Don't display the offset unless in verbose mode. */
- if (flag_verbose)
- {
- status = result_add (dm, " [v:");
- if (STATUS_NO_ERROR (status))
- status = result_add_string (dm, number);
- if (STATUS_NO_ERROR (status))
- result_add_char (dm, ',');
- }
- dyn_string_delete (number);
- RETURN_IF_ERROR (status);
-
- /* Demangle the separator. */
- RETURN_IF_ERROR (demangle_char (dm, '_'));
-
- /* Demangle the vcall offset. */
- number = dyn_string_new (4);
- if (number == NULL)
- return STATUS_ALLOCATION_FAILED;
- demangle_number_literally (dm, number, 10, 1);
-
- /* Don't display the vcall offset unless in verbose mode. */
- if (flag_verbose)
- {
- status = result_add_string (dm, number);
- if (STATUS_NO_ERROR (status))
- status = result_add_char (dm, ']');
- }
- dyn_string_delete (number);
- RETURN_IF_ERROR (status);
-
- return STATUS_OK;
-}
-
-/* Demangles and emits a <call-offset>.
-
- <call-offset> ::= h <nv-offset> _
- ::= v <v-offset> _ */
-
-static status_t
-demangle_call_offset (dm)
- demangling_t dm;
-{
- DEMANGLE_TRACE ("call-offset", dm);
-
- switch (peek_char (dm))
- {
- case 'h':
- advance_char (dm);
- /* Demangle the offset. */
- RETURN_IF_ERROR (demangle_nv_offset (dm));
- /* Demangle the separator. */
- RETURN_IF_ERROR (demangle_char (dm, '_'));
- break;
-
- case 'v':
- advance_char (dm);
- /* Demangle the offset. */
- RETURN_IF_ERROR (demangle_v_offset (dm));
- /* Demangle the separator. */
- RETURN_IF_ERROR (demangle_char (dm, '_'));
- break;
-
- default:
- return "Unrecognized <call-offset>.";
- }
-
- return STATUS_OK;
-}
-
-/* Demangles and emits a <special-name>.
-
- <special-name> ::= GV <object name> # Guard variable
- ::= TV <type> # virtual table
- ::= TT <type> # VTT
- ::= TI <type> # typeinfo structure
- ::= TS <type> # typeinfo name
-
- Other relevant productions include thunks:
-
- <special-name> ::= T <call-offset> <base encoding>
- # base is the nominal target function of thunk
-
- <special-name> ::= Tc <call-offset> <call-offset> <base encoding>
- # base is the nominal target function of thunk
- # first call-offset is 'this' adjustment
- # second call-offset is result adjustment
-
- where
-
- <call-offset> ::= h <nv-offset> _
- ::= v <v-offset> _
-
- Also demangles the special g++ manglings,
-
- <special-name> ::= TC <type> <offset number> _ <base type>
- # construction vtable
- ::= TF <type> # typeinfo function (old ABI only)
- ::= TJ <type> # java Class structure */
-
-static status_t
-demangle_special_name (dm)
- demangling_t dm;
-{
- dyn_string_t number;
- int unused;
- char peek = peek_char (dm);
-
- DEMANGLE_TRACE ("special-name", dm);
-
- if (peek == 'G')
- {
- /* Consume the G. */
- advance_char (dm);
- switch (peek_char (dm))
- {
- case 'V':
- /* A guard variable name. */
- advance_char (dm);
- RETURN_IF_ERROR (result_add (dm, "guard variable for "));
- RETURN_IF_ERROR (demangle_name (dm, &unused));
- break;
-
- case 'R':
- /* A reference temporary. */
- advance_char (dm);
- RETURN_IF_ERROR (result_add (dm, "reference temporary for "));
- RETURN_IF_ERROR (demangle_name (dm, &unused));
- break;
-
- default:
- return "Unrecognized <special-name>.";
- }
- }
- else if (peek == 'T')
- {
- status_t status = STATUS_OK;
-
- /* Other C++ implementation miscellania. Consume the T. */
- advance_char (dm);
-
- switch (peek_char (dm))
- {
- case 'V':
- /* Virtual table. */
- advance_char (dm);
- RETURN_IF_ERROR (result_add (dm, "vtable for "));
- RETURN_IF_ERROR (demangle_type (dm));
- break;
-
- case 'T':
- /* VTT structure. */
- advance_char (dm);
- RETURN_IF_ERROR (result_add (dm, "VTT for "));
- RETURN_IF_ERROR (demangle_type (dm));
- break;
-
- case 'I':
- /* Typeinfo structure. */
- advance_char (dm);
- RETURN_IF_ERROR (result_add (dm, "typeinfo for "));
- RETURN_IF_ERROR (demangle_type (dm));
- break;
-
- case 'F':
- /* Typeinfo function. Used only in old ABI with new mangling. */
- advance_char (dm);
- RETURN_IF_ERROR (result_add (dm, "typeinfo fn for "));
- RETURN_IF_ERROR (demangle_type (dm));
- break;
-
- case 'S':
- /* Character string containing type name, used in typeinfo. */
- advance_char (dm);
- RETURN_IF_ERROR (result_add (dm, "typeinfo name for "));
- RETURN_IF_ERROR (demangle_type (dm));
- break;
-
- case 'J':
- /* The java Class variable corresponding to a C++ class. */
- advance_char (dm);
- RETURN_IF_ERROR (result_add (dm, "java Class for "));
- RETURN_IF_ERROR (demangle_type (dm));
- break;
-
- case 'h':
- /* Non-virtual thunk. */
- advance_char (dm);
- RETURN_IF_ERROR (result_add (dm, "non-virtual thunk"));
- RETURN_IF_ERROR (demangle_nv_offset (dm));
- /* Demangle the separator. */
- RETURN_IF_ERROR (demangle_char (dm, '_'));
- /* Demangle and emit the target name and function type. */
- RETURN_IF_ERROR (result_add (dm, " to "));
- RETURN_IF_ERROR (demangle_encoding (dm));
- break;
-
- case 'v':
- /* Virtual thunk. */
- advance_char (dm);
- RETURN_IF_ERROR (result_add (dm, "virtual thunk"));
- RETURN_IF_ERROR (demangle_v_offset (dm));
- /* Demangle the separator. */
- RETURN_IF_ERROR (demangle_char (dm, '_'));
- /* Demangle and emit the target function. */
- RETURN_IF_ERROR (result_add (dm, " to "));
- RETURN_IF_ERROR (demangle_encoding (dm));
- break;
-
- case 'c':
- /* Covariant return thunk. */
- advance_char (dm);
- RETURN_IF_ERROR (result_add (dm, "covariant return thunk"));
- RETURN_IF_ERROR (demangle_call_offset (dm));
- RETURN_IF_ERROR (demangle_call_offset (dm));
- /* Demangle and emit the target function. */
- RETURN_IF_ERROR (result_add (dm, " to "));
- RETURN_IF_ERROR (demangle_encoding (dm));
- break;
-
- case 'C':
- /* TC is a special g++ mangling for a construction vtable. */
- if (!flag_strict)
- {
- dyn_string_t derived_type;
-
- advance_char (dm);
- RETURN_IF_ERROR (result_add (dm, "construction vtable for "));
-
- /* Demangle the derived type off to the side. */
- RETURN_IF_ERROR (result_push (dm));
- RETURN_IF_ERROR (demangle_type (dm));
- derived_type = (dyn_string_t) result_pop (dm);
-
- /* Demangle the offset. */
- number = dyn_string_new (4);
- if (number == NULL)
- {
- dyn_string_delete (derived_type);
- return STATUS_ALLOCATION_FAILED;
- }
- demangle_number_literally (dm, number, 10, 1);
- /* Demangle the underscore separator. */
- status = demangle_char (dm, '_');
-
- /* Demangle the base type. */
- if (STATUS_NO_ERROR (status))
- status = demangle_type (dm);
-
- /* Emit the derived type. */
- if (STATUS_NO_ERROR (status))
- status = result_add (dm, "-in-");
- if (STATUS_NO_ERROR (status))
- status = result_add_string (dm, derived_type);
- dyn_string_delete (derived_type);
-
- /* Don't display the offset unless in verbose mode. */
- if (flag_verbose)
- {
- status = result_add_char (dm, ' ');
- if (STATUS_NO_ERROR (status))
- result_add_string (dm, number);
- }
- dyn_string_delete (number);
- RETURN_IF_ERROR (status);
- break;
- }
- /* If flag_strict, fall through. */
-
- default:
- return "Unrecognized <special-name>.";
- }
- }
- else
- return STATUS_ERROR;
-
- return STATUS_OK;
-}
-
-/* Demangles and emits a <ctor-dtor-name>.
-
- <ctor-dtor-name>
- ::= C1 # complete object (in-charge) ctor
- ::= C2 # base object (not-in-charge) ctor
- ::= C3 # complete object (in-charge) allocating ctor
- ::= D0 # deleting (in-charge) dtor
- ::= D1 # complete object (in-charge) dtor
- ::= D2 # base object (not-in-charge) dtor */
-
-static status_t
-demangle_ctor_dtor_name (dm)
- demangling_t dm;
-{
- static const char *const ctor_flavors[] =
- {
- "in-charge",
- "not-in-charge",
- "allocating"
- };
- static const char *const dtor_flavors[] =
- {
- "in-charge deleting",
- "in-charge",
- "not-in-charge"
- };
-
- int flavor;
- char peek = peek_char (dm);
-
- DEMANGLE_TRACE ("ctor-dtor-name", dm);
-
- if (peek == 'C')
- {
- /* A constructor name. Consume the C. */
- advance_char (dm);
- flavor = next_char (dm);
- if (flavor < '1' || flavor > '3')
- return "Unrecognized constructor.";
- RETURN_IF_ERROR (result_add_string (dm, dm->last_source_name));
- switch (flavor)
- {
- case '1': dm->is_constructor = gnu_v3_complete_object_ctor;
- break;
- case '2': dm->is_constructor = gnu_v3_base_object_ctor;
- break;
- case '3': dm->is_constructor = gnu_v3_complete_object_allocating_ctor;
- break;
- }
- /* Print the flavor of the constructor if in verbose mode. */
- if (flag_verbose)
- {
- RETURN_IF_ERROR (result_add (dm, "["));
- RETURN_IF_ERROR (result_add (dm, ctor_flavors[flavor - '1']));
- RETURN_IF_ERROR (result_add_char (dm, ']'));
- }
- }
- else if (peek == 'D')
- {
- /* A destructor name. Consume the D. */
- advance_char (dm);
- flavor = next_char (dm);
- if (flavor < '0' || flavor > '2')
- return "Unrecognized destructor.";
- RETURN_IF_ERROR (result_add_char (dm, '~'));
- RETURN_IF_ERROR (result_add_string (dm, dm->last_source_name));
- switch (flavor)
- {
- case '0': dm->is_destructor = gnu_v3_deleting_dtor;
- break;
- case '1': dm->is_destructor = gnu_v3_complete_object_dtor;
- break;
- case '2': dm->is_destructor = gnu_v3_base_object_dtor;
- break;
- }
- /* Print the flavor of the destructor if in verbose mode. */
- if (flag_verbose)
- {
- RETURN_IF_ERROR (result_add (dm, " ["));
- RETURN_IF_ERROR (result_add (dm, dtor_flavors[flavor - '0']));
- RETURN_IF_ERROR (result_add_char (dm, ']'));
- }
- }
- else
- return STATUS_ERROR;
-
- return STATUS_OK;
-}
-
-/* Handle pointer, reference, and pointer-to-member cases for
- demangle_type. All consecutive `P's, `R's, and 'M's are joined to
- build a pointer/reference type. We snarf all these, plus the
- following <type>, all at once since we need to know whether we have
- a pointer to data or pointer to function to construct the right
- output syntax. C++'s pointer syntax is hairy.
-
- This function adds substitution candidates for every nested
- pointer/reference type it processes, including the outermost, final
- type, assuming the substitution starts at SUBSTITUTION_START in the
- demangling result. For example, if this function demangles
- `PP3Foo', it will add a substitution for `Foo', `Foo*', and
- `Foo**', in that order.
-
- *INSERT_POS is a quantity used internally, when this function calls
- itself recursively, to figure out where to insert pointer
- punctuation on the way up. On entry to this function, INSERT_POS
- should point to a temporary value, but that value need not be
- initialized.
-
- <type> ::= P <type>
- ::= R <type>
- ::= <pointer-to-member-type>
-
- <pointer-to-member-type> ::= M </class/ type> </member/ type> */
-
-static status_t
-demangle_type_ptr (dm, insert_pos, substitution_start)
- demangling_t dm;
- int *insert_pos;
- int substitution_start;
-{
- status_t status;
- int is_substitution_candidate = 1;
-
- DEMANGLE_TRACE ("type*", dm);
-
- /* Scan forward, collecting pointers and references into symbols,
- until we hit something else. Then emit the type. */
- switch (peek_char (dm))
- {
- case 'P':
- /* A pointer. Snarf the `P'. */
- advance_char (dm);
- /* Demangle the underlying type. */
- RETURN_IF_ERROR (demangle_type_ptr (dm, insert_pos,
- substitution_start));
- /* Insert an asterisk where we're told to; it doesn't
- necessarily go at the end. If we're doing Java style output,
- there is no pointer symbol. */
- if (dm->style != DMGL_JAVA)
- RETURN_IF_ERROR (result_insert_char (dm, *insert_pos, '*'));
- /* The next (outermost) pointer or reference character should go
- after this one. */
- ++(*insert_pos);
- break;
-
- case 'R':
- /* A reference. Snarf the `R'. */
- advance_char (dm);
- /* Demangle the underlying type. */
- RETURN_IF_ERROR (demangle_type_ptr (dm, insert_pos,
- substitution_start));
- /* Insert an ampersand where we're told to; it doesn't
- necessarily go at the end. */
- RETURN_IF_ERROR (result_insert_char (dm, *insert_pos, '&'));
- /* The next (outermost) pointer or reference character should go
- after this one. */
- ++(*insert_pos);
- break;
-
- case 'M':
- {
- /* A pointer-to-member. */
- dyn_string_t class_type;
-
- /* Eat the 'M'. */
- advance_char (dm);
-
- /* Capture the type of which this is a pointer-to-member. */
- RETURN_IF_ERROR (result_push (dm));
- RETURN_IF_ERROR (demangle_type (dm));
- class_type = (dyn_string_t) result_pop (dm);
-
- if (peek_char (dm) == 'F')
- /* A pointer-to-member function. We want output along the
- lines of `void (C::*) (int, int)'. Demangle the function
- type, which would in this case give `void () (int, int)'
- and set *insert_pos to the spot between the first
- parentheses. */
- status = demangle_type_ptr (dm, insert_pos, substitution_start);
- else if (peek_char (dm) == 'A')
- /* A pointer-to-member array variable. We want output that
- looks like `int (Klass::*) [10]'. Demangle the array type
- as `int () [10]', and set *insert_pos to the spot between
- the parentheses. */
- status = demangle_array_type (dm, insert_pos);
- else
- {
- /* A pointer-to-member variable. Demangle the type of the
- pointed-to member. */
- status = demangle_type (dm);
- /* Make it pretty. */
- if (STATUS_NO_ERROR (status)
- && !result_previous_char_is_space (dm))
- status = result_add_char (dm, ' ');
- /* The pointer-to-member notation (e.g. `C::*') follows the
- member's type. */
- *insert_pos = result_caret_pos (dm);
- }
-
- /* Build the pointer-to-member notation. */
- if (STATUS_NO_ERROR (status))
- status = result_insert (dm, *insert_pos, "::*");
- if (STATUS_NO_ERROR (status))
- status = result_insert_string (dm, *insert_pos, class_type);
- /* There may be additional levels of (pointer or reference)
- indirection in this type. If so, the `*' and `&' should be
- added after the pointer-to-member notation (e.g. `C::*&' for
- a reference to a pointer-to-member of class C). */
- *insert_pos += dyn_string_length (class_type) + 3;
-
- /* Clean up. */
- dyn_string_delete (class_type);
-
- RETURN_IF_ERROR (status);
- }
- break;
-
- case 'F':
- /* Ooh, tricky, a pointer-to-function. When we demangle the
- function type, the return type should go at the very
- beginning. */
- *insert_pos = result_caret_pos (dm);
- /* The parentheses indicate this is a function pointer or
- reference type. */
- RETURN_IF_ERROR (result_add (dm, "()"));
- /* Now demangle the function type. The return type will be
- inserted before the `()', and the argument list will go after
- it. */
- RETURN_IF_ERROR (demangle_function_type (dm, insert_pos));
- /* We should now have something along the lines of
- `void () (int, int)'. The pointer or reference characters
- have to inside the first set of parentheses. *insert_pos has
- already been updated to point past the end of the return
- type. Move it one character over so it points inside the
- `()'. */
- ++(*insert_pos);
- break;
-
- case 'A':
- /* An array pointer or reference. demangle_array_type will figure
- out where the asterisks and ampersands go. */
- RETURN_IF_ERROR (demangle_array_type (dm, insert_pos));
- break;
-
- default:
- /* No more pointer or reference tokens; this is therefore a
- pointer to data. Finish up by demangling the underlying
- type. */
- RETURN_IF_ERROR (demangle_type (dm));
- /* The pointer or reference characters follow the underlying
- type, as in `int*&'. */
- *insert_pos = result_caret_pos (dm);
- /* Because of the production <type> ::= <substitution>,
- demangle_type will already have added the underlying type as
- a substitution candidate. Don't do it again. */
- is_substitution_candidate = 0;
- break;
- }
-
- if (is_substitution_candidate)
- RETURN_IF_ERROR (substitution_add (dm, substitution_start, 0));
-
- return STATUS_OK;
-}
-
-/* Demangles and emits a <type>.
-
- <type> ::= <builtin-type>
- ::= <function-type>
- ::= <class-enum-type>
- ::= <array-type>
- ::= <pointer-to-member-type>
- ::= <template-param>
- ::= <template-template-param> <template-args>
- ::= <CV-qualifiers> <type>
- ::= P <type> # pointer-to
- ::= R <type> # reference-to
- ::= C <type> # complex pair (C 2000)
- ::= G <type> # imaginary (C 2000)
- ::= U <source-name> <type> # vendor extended type qualifier
- ::= <substitution> */
-
-static status_t
-demangle_type (dm)
- demangling_t dm;
-{
- int start = substitution_start (dm);
- char peek = peek_char (dm);
- char peek_next;
- int encode_return_type = 0;
- template_arg_list_t old_arg_list = current_template_arg_list (dm);
- int insert_pos;
-
- /* A <type> can be a <substitution>; therefore, this <type> is a
- substitution candidate unless a special condition holds (see
- below). */
- int is_substitution_candidate = 1;
-
- DEMANGLE_TRACE ("type", dm);
-
- /* A <class-enum-type> can start with a digit (a <source-name>), an
- N (a <nested-name>), or a Z (a <local-name>). */
- if (IS_DIGIT ((unsigned char) peek) || peek == 'N' || peek == 'Z')
- RETURN_IF_ERROR (demangle_class_enum_type (dm, &encode_return_type));
- /* Lower-case letters begin <builtin-type>s, except for `r', which
- denotes restrict. */
- else if (peek >= 'a' && peek <= 'z' && peek != 'r')
- {
- RETURN_IF_ERROR (demangle_builtin_type (dm));
- /* Built-in types are not substitution candidates. */
- is_substitution_candidate = 0;
- }
- else
- switch (peek)
- {
- case 'r':
- case 'V':
- case 'K':
- /* CV-qualifiers (including restrict). We have to demangle
- them off to the side, since C++ syntax puts them in a funny
- place for qualified pointer and reference types. */
- {
- status_t status;
- dyn_string_t cv_qualifiers = dyn_string_new (24);
- int old_caret_position = result_get_caret (dm);
-
- if (cv_qualifiers == NULL)
- return STATUS_ALLOCATION_FAILED;
-
- /* Decode all adjacent CV qualifiers. */
- demangle_CV_qualifiers (dm, cv_qualifiers);
- /* Emit them, and shift the caret left so that the
- underlying type will be emitted before the qualifiers. */
- status = result_add_string (dm, cv_qualifiers);
- result_shift_caret (dm, -dyn_string_length (cv_qualifiers));
- /* Clean up. */
- dyn_string_delete (cv_qualifiers);
- RETURN_IF_ERROR (status);
- /* Also prepend a blank, if needed. */
- RETURN_IF_ERROR (result_add_char (dm, ' '));
- result_shift_caret (dm, -1);
-
- /* Demangle the underlying type. It will be emitted before
- the CV qualifiers, since we moved the caret. */
- RETURN_IF_ERROR (demangle_type (dm));
-
- /* Put the caret back where it was previously. */
- result_set_caret (dm, old_caret_position);
- }
- break;
-
- case 'F':
- return "Non-pointer or -reference function type.";
-
- case 'A':
- RETURN_IF_ERROR (demangle_array_type (dm, NULL));
- break;
-
- case 'T':
- /* It's either a <template-param> or a
- <template-template-param>. In either case, demangle the
- `T' token first. */
- RETURN_IF_ERROR (demangle_template_param (dm));
-
- /* Check for a template argument list; if one is found, it's a
- <template-template-param> ::= <template-param>
- ::= <substitution> */
- if (peek_char (dm) == 'I')
- {
- /* Add a substitution candidate. The template parameter
- `T' token is a substitution candidate by itself,
- without the template argument list. */
- RETURN_IF_ERROR (substitution_add (dm, start, encode_return_type));
-
- /* Now demangle the template argument list. */
- RETURN_IF_ERROR (demangle_template_args (dm));
- /* The entire type, including the template template
- parameter and its argument list, will be added as a
- substitution candidate below. */
- }
-
- break;
-
- case 'S':
- /* First check if this is a special substitution. If it is,
- this is a <class-enum-type>. Special substitutions have a
- letter following the `S'; other substitutions have a digit
- or underscore. */
- peek_next = peek_char_next (dm);
- if (IS_DIGIT (peek_next) || peek_next == '_')
- {
- RETURN_IF_ERROR (demangle_substitution (dm, &encode_return_type));
-
- /* The substituted name may have been a template name.
- Check if template arguments follow, and if so, demangle
- them. */
- if (peek_char (dm) == 'I')
- RETURN_IF_ERROR (demangle_template_args (dm));
- else
- /* A substitution token is not itself a substitution
- candidate. (However, if the substituted template is
- instantiated, the resulting type is.) */
- is_substitution_candidate = 0;
- }
- else
- {
- /* Now some trickiness. We have a special substitution
- here. Often, the special substitution provides the
- name of a template that's subsequently instantiated,
- for instance `SaIcE' => std::allocator<char>. In these
- cases we need to add a substitution candidate for the
- entire <class-enum-type> and thus don't want to clear
- the is_substitution_candidate flag.
-
- However, it's possible that what we have here is a
- substitution token representing an entire type, such as
- `Ss' => std::string. In this case, we mustn't add a
- new substitution candidate for this substitution token.
- To detect this case, remember where the start of the
- substitution token is. */
- const char *next = dm->next;
- /* Now demangle the <class-enum-type>. */
- RETURN_IF_ERROR
- (demangle_class_enum_type (dm, &encode_return_type));
- /* If all that was just demangled is the two-character
- special substitution token, supress the addition of a
- new candidate for it. */
- if (dm->next == next + 2)
- is_substitution_candidate = 0;
- }
-
- break;
-
- case 'P':
- case 'R':
- case 'M':
- RETURN_IF_ERROR (demangle_type_ptr (dm, &insert_pos, start));
- /* demangle_type_ptr adds all applicable substitution
- candidates. */
- is_substitution_candidate = 0;
- break;
-
- case 'C':
- /* A C99 complex type. */
- RETURN_IF_ERROR (result_add (dm, "complex "));
- advance_char (dm);
- RETURN_IF_ERROR (demangle_type (dm));
- break;
-
- case 'G':
- /* A C99 imaginary type. */
- RETURN_IF_ERROR (result_add (dm, "imaginary "));
- advance_char (dm);
- RETURN_IF_ERROR (demangle_type (dm));
- break;
-
- case 'U':
- /* Vendor-extended type qualifier. */
- advance_char (dm);
- RETURN_IF_ERROR (demangle_source_name (dm));
- RETURN_IF_ERROR (result_add_char (dm, ' '));
- RETURN_IF_ERROR (demangle_type (dm));
- break;
-
- default:
- return "Unexpected character in <type>.";
- }
-
- if (is_substitution_candidate)
- /* Add a new substitution for the type. If this type was a
- <template-param>, pass its index since from the point of
- substitutions; a <template-param> token is a substitution
- candidate distinct from the type that is substituted for it. */
- RETURN_IF_ERROR (substitution_add (dm, start, encode_return_type));
-
- /* Pop off template argument lists added during mangling of this
- type. */
- pop_to_template_arg_list (dm, old_arg_list);
-
- return STATUS_OK;
-}
-
-/* C++ source names of builtin types, indexed by the mangled code
- letter's position in the alphabet ('a' -> 0, 'b' -> 1, etc). */
-static const char *const builtin_type_names[26] =
-{
- "signed char", /* a */
- "bool", /* b */
- "char", /* c */
- "double", /* d */
- "long double", /* e */
- "float", /* f */
- "__float128", /* g */
- "unsigned char", /* h */
- "int", /* i */
- "unsigned", /* j */
- NULL, /* k */
- "long", /* l */
- "unsigned long", /* m */
- "__int128", /* n */
- "unsigned __int128", /* o */
- NULL, /* p */
- NULL, /* q */
- NULL, /* r */
- "short", /* s */
- "unsigned short", /* t */
- NULL, /* u */
- "void", /* v */
- "wchar_t", /* w */
- "long long", /* x */
- "unsigned long long", /* y */
- "..." /* z */
-};
-
-/* Java source names of builtin types. Types that arn't valid in Java
- are also included here - we don't fail if someone attempts to demangle a
- C++ symbol in Java style. */
-static const char *const java_builtin_type_names[26] =
-{
- "signed char", /* a */
- "boolean", /* C++ "bool" */ /* b */
- "byte", /* C++ "char" */ /* c */
- "double", /* d */
- "long double", /* e */
- "float", /* f */
- "__float128", /* g */
- "unsigned char", /* h */
- "int", /* i */
- "unsigned", /* j */
- NULL, /* k */
- "long", /* l */
- "unsigned long", /* m */
- "__int128", /* n */
- "unsigned __int128", /* o */
- NULL, /* p */
- NULL, /* q */
- NULL, /* r */
- "short", /* s */
- "unsigned short", /* t */
- NULL, /* u */
- "void", /* v */
- "char", /* C++ "wchar_t" */ /* w */
- "long", /* C++ "long long" */ /* x */
- "unsigned long long", /* y */
- "..." /* z */
-};
-
-/* Demangles and emits a <builtin-type>.
-
- <builtin-type> ::= v # void
- ::= w # wchar_t
- ::= b # bool
- ::= c # char
- ::= a # signed char
- ::= h # unsigned char
- ::= s # short
- ::= t # unsigned short
- ::= i # int
- ::= j # unsigned int
- ::= l # long
- ::= m # unsigned long
- ::= x # long long, __int64
- ::= y # unsigned long long, __int64
- ::= n # __int128
- ::= o # unsigned __int128
- ::= f # float
- ::= d # double
- ::= e # long double, __float80
- ::= g # __float128
- ::= z # ellipsis
- ::= u <source-name> # vendor extended type */
-
-static status_t
-demangle_builtin_type (dm)
- demangling_t dm;
-{
-
- char code = peek_char (dm);
-
- DEMANGLE_TRACE ("builtin-type", dm);
-
- if (code == 'u')
- {
- advance_char (dm);
- RETURN_IF_ERROR (demangle_source_name (dm));
- return STATUS_OK;
- }
- else if (code >= 'a' && code <= 'z')
- {
- const char *type_name;
- /* Java uses different names for some built-in types. */
- if (dm->style == DMGL_JAVA)
- type_name = java_builtin_type_names[code - 'a'];
- else
- type_name = builtin_type_names[code - 'a'];
- if (type_name == NULL)
- return "Unrecognized <builtin-type> code.";
-
- RETURN_IF_ERROR (result_add (dm, type_name));
- advance_char (dm);
- return STATUS_OK;
- }
- else
- return "Non-alphabetic <builtin-type> code.";
-}
-
-/* Demangles all consecutive CV-qualifiers (const, volatile, and
- restrict) at the current position. The qualifiers are appended to
- QUALIFIERS. Returns STATUS_OK. */
-
-static status_t
-demangle_CV_qualifiers (dm, qualifiers)
- demangling_t dm;
- dyn_string_t qualifiers;
-{
- DEMANGLE_TRACE ("CV-qualifiers", dm);
-
- while (1)
- {
- switch (peek_char (dm))
- {
- case 'r':
- if (!dyn_string_append_space (qualifiers))
- return STATUS_ALLOCATION_FAILED;
- if (!dyn_string_append_cstr (qualifiers, "restrict"))
- return STATUS_ALLOCATION_FAILED;
- break;
-
- case 'V':
- if (!dyn_string_append_space (qualifiers))
- return STATUS_ALLOCATION_FAILED;
- if (!dyn_string_append_cstr (qualifiers, "volatile"))
- return STATUS_ALLOCATION_FAILED;
- break;
-
- case 'K':
- if (!dyn_string_append_space (qualifiers))
- return STATUS_ALLOCATION_FAILED;
- if (!dyn_string_append_cstr (qualifiers, "const"))
- return STATUS_ALLOCATION_FAILED;
- break;
-
- default:
- return STATUS_OK;
- }
-
- advance_char (dm);
- }
-}
-
-/* Demangles and emits a <function-type>. *FUNCTION_NAME_POS is the
- position in the result string of the start of the function
- identifier, at which the function's return type will be inserted;
- *FUNCTION_NAME_POS is updated to position past the end of the
- function's return type.
-
- <function-type> ::= F [Y] <bare-function-type> E */
-
-static status_t
-demangle_function_type (dm, function_name_pos)
- demangling_t dm;
- int *function_name_pos;
-{
- DEMANGLE_TRACE ("function-type", dm);
- RETURN_IF_ERROR (demangle_char (dm, 'F'));
- if (peek_char (dm) == 'Y')
- {
- /* Indicate this function has C linkage if in verbose mode. */
- if (flag_verbose)
- RETURN_IF_ERROR (result_add (dm, " [extern \"C\"] "));
- advance_char (dm);
- }
- RETURN_IF_ERROR (demangle_bare_function_type (dm, function_name_pos));
- RETURN_IF_ERROR (demangle_char (dm, 'E'));
- return STATUS_OK;
-}
-
-/* Demangles and emits a <bare-function-type>. RETURN_TYPE_POS is the
- position in the result string at which the function return type
- should be inserted. If RETURN_TYPE_POS is BFT_NO_RETURN_TYPE, the
- function's return type is assumed not to be encoded.
-
- <bare-function-type> ::= <signature type>+ */
-
-static status_t
-demangle_bare_function_type (dm, return_type_pos)
- demangling_t dm;
- int *return_type_pos;
-{
- /* Sequence is the index of the current function parameter, counting
- from zero. The value -1 denotes the return type. */
- int sequence =
- (return_type_pos == BFT_NO_RETURN_TYPE ? 0 : -1);
-
- DEMANGLE_TRACE ("bare-function-type", dm);
-
- RETURN_IF_ERROR (result_add_char (dm, '('));
- while (!end_of_name_p (dm) && peek_char (dm) != 'E')
- {
- if (sequence == -1)
- /* We're decoding the function's return type. */
- {
- dyn_string_t return_type;
- status_t status = STATUS_OK;
-
- /* Decode the return type off to the side. */
- RETURN_IF_ERROR (result_push (dm));
- RETURN_IF_ERROR (demangle_type (dm));
- return_type = (dyn_string_t) result_pop (dm);
-
- /* Add a space to the end of the type. Insert the return
- type where we've been asked to. */
- if (!dyn_string_append_space (return_type))
- status = STATUS_ALLOCATION_FAILED;
- if (STATUS_NO_ERROR (status))
- {
- if (!dyn_string_insert (result_string (dm), *return_type_pos,
- return_type))
- status = STATUS_ALLOCATION_FAILED;
- else
- *return_type_pos += dyn_string_length (return_type);
- }
-
- dyn_string_delete (return_type);
- RETURN_IF_ERROR (status);
- }
- else
- {
- /* Skip `void' parameter types. One should only occur as
- the only type in a parameter list; in that case, we want
- to print `foo ()' instead of `foo (void)'. */
- if (peek_char (dm) == 'v')
- /* Consume the v. */
- advance_char (dm);
- else
- {
- /* Separate parameter types by commas. */
- if (sequence > 0)
- RETURN_IF_ERROR (result_add (dm, ", "));
- /* Demangle the type. */
- RETURN_IF_ERROR (demangle_type (dm));
- }
- }
-
- ++sequence;
- }
- RETURN_IF_ERROR (result_add_char (dm, ')'));
-
- /* We should have demangled at least one parameter type (which would
- be void, for a function that takes no parameters), plus the
- return type, if we were supposed to demangle that. */
- if (sequence == -1)
- return "Missing function return type.";
- else if (sequence == 0)
- return "Missing function parameter.";
-
- return STATUS_OK;
-}
-
-/* Demangles and emits a <class-enum-type>. *ENCODE_RETURN_TYPE is set to
- non-zero if the type is a template-id, zero otherwise.
-
- <class-enum-type> ::= <name> */
-
-static status_t
-demangle_class_enum_type (dm, encode_return_type)
- demangling_t dm;
- int *encode_return_type;
-{
- DEMANGLE_TRACE ("class-enum-type", dm);
-
- RETURN_IF_ERROR (demangle_name (dm, encode_return_type));
- return STATUS_OK;
-}
-
-/* Demangles and emits an <array-type>.
-
- If PTR_INSERT_POS is not NULL, the array type is formatted as a
- pointer or reference to an array, except that asterisk and
- ampersand punctuation is omitted (since it's not know at this
- point). *PTR_INSERT_POS is set to the position in the demangled
- name at which this punctuation should be inserted. For example,
- `A10_i' is demangled to `int () [10]' and *PTR_INSERT_POS points
- between the parentheses.
-
- If PTR_INSERT_POS is NULL, the array type is assumed not to be
- pointer- or reference-qualified. Then, for example, `A10_i' is
- demangled simply as `int[10]'.
-
- <array-type> ::= A [<dimension number>] _ <element type>
- ::= A <dimension expression> _ <element type> */
-
-static status_t
-demangle_array_type (dm, ptr_insert_pos)
- demangling_t dm;
- int *ptr_insert_pos;
-{
- status_t status = STATUS_OK;
- dyn_string_t array_size = NULL;
- char peek;
-
- DEMANGLE_TRACE ("array-type", dm);
-
- RETURN_IF_ERROR (demangle_char (dm, 'A'));
-
- /* Demangle the array size into array_size. */
- peek = peek_char (dm);
- if (peek == '_')
- /* Array bound is omitted. This is a C99-style VLA. */
- ;
- else if (IS_DIGIT (peek_char (dm)))
- {
- /* It looks like a constant array bound. */
- array_size = dyn_string_new (10);
- if (array_size == NULL)
- return STATUS_ALLOCATION_FAILED;
- status = demangle_number_literally (dm, array_size, 10, 0);
- }
- else
- {
- /* Anything is must be an expression for a nont-constant array
- bound. This happens if the array type occurs in a template
- and the array bound references a template parameter. */
- RETURN_IF_ERROR (result_push (dm));
- RETURN_IF_ERROR (demangle_expression (dm));
- array_size = (dyn_string_t) result_pop (dm);
- }
- /* array_size may have been allocated by now, so we can't use
- RETURN_IF_ERROR until it's been deallocated. */
-
- /* Demangle the base type of the array. */
- if (STATUS_NO_ERROR (status))
- status = demangle_char (dm, '_');
- if (STATUS_NO_ERROR (status))
- status = demangle_type (dm);
-
- if (ptr_insert_pos != NULL)
- {
- /* This array is actually part of an pointer- or
- reference-to-array type. Format appropriately, except we
- don't know which and how much punctuation to use. */
- if (STATUS_NO_ERROR (status))
- status = result_add (dm, " () ");
- /* Let the caller know where to insert the punctuation. */
- *ptr_insert_pos = result_caret_pos (dm) - 2;
- }
-
- /* Emit the array dimension syntax. */
- if (STATUS_NO_ERROR (status))
- status = result_add_char (dm, '[');
- if (STATUS_NO_ERROR (status) && array_size != NULL)
- status = result_add_string (dm, array_size);
- if (STATUS_NO_ERROR (status))
- status = result_add_char (dm, ']');
- if (array_size != NULL)
- dyn_string_delete (array_size);
-
- RETURN_IF_ERROR (status);
-
- return STATUS_OK;
-}
-
-/* Demangles and emits a <template-param>.
-
- <template-param> ::= T_ # first template parameter
- ::= T <parameter-2 number> _ */
-
-static status_t
-demangle_template_param (dm)
- demangling_t dm;
-{
- int parm_number;
- template_arg_list_t current_arg_list = current_template_arg_list (dm);
- string_list_t arg;
-
- DEMANGLE_TRACE ("template-param", dm);
-
- /* Make sure there is a template argmust list in which to look up
- this parameter reference. */
- if (current_arg_list == NULL)
- return "Template parameter outside of template.";
-
- RETURN_IF_ERROR (demangle_char (dm, 'T'));
- if (peek_char (dm) == '_')
- parm_number = 0;
- else
- {
- RETURN_IF_ERROR (demangle_number (dm, &parm_number, 10, 0));
- ++parm_number;
- }
- RETURN_IF_ERROR (demangle_char (dm, '_'));
-
- arg = template_arg_list_get_arg (current_arg_list, parm_number);
- if (arg == NULL)
- /* parm_number exceeded the number of arguments in the current
- template argument list. */
- return "Template parameter number out of bounds.";
- RETURN_IF_ERROR (result_add_string (dm, (dyn_string_t) arg));
-
- return STATUS_OK;
-}
-
-/* Demangles and emits a <template-args>.
-
- <template-args> ::= I <template-arg>+ E */
-
-static status_t
-demangle_template_args (dm)
- demangling_t dm;
-{
- int first = 1;
- dyn_string_t old_last_source_name;
- template_arg_list_t arg_list = template_arg_list_new ();
-
- if (arg_list == NULL)
- return STATUS_ALLOCATION_FAILED;
-
- /* Preserve the most recently demangled source name. */
- old_last_source_name = dm->last_source_name;
- dm->last_source_name = dyn_string_new (0);
-
- DEMANGLE_TRACE ("template-args", dm);
-
- if (dm->last_source_name == NULL)
- return STATUS_ALLOCATION_FAILED;
-
- RETURN_IF_ERROR (demangle_char (dm, 'I'));
- RETURN_IF_ERROR (result_open_template_list (dm));
- do
- {
- string_list_t arg;
-
- if (first)
- first = 0;
- else
- RETURN_IF_ERROR (result_add (dm, ", "));
-
- /* Capture the template arg. */
- RETURN_IF_ERROR (result_push (dm));
- RETURN_IF_ERROR (demangle_template_arg (dm));
- arg = result_pop (dm);
-
- /* Emit it in the demangled name. */
- RETURN_IF_ERROR (result_add_string (dm, (dyn_string_t) arg));
-
- /* Save it for use in expanding <template-param>s. */
- template_arg_list_add_arg (arg_list, arg);
- }
- while (peek_char (dm) != 'E');
- /* Append the '>'. */
- RETURN_IF_ERROR (result_close_template_list (dm));
-
- /* Consume the 'E'. */
- advance_char (dm);
-
- /* Restore the most recent demangled source name. */
- dyn_string_delete (dm->last_source_name);
- dm->last_source_name = old_last_source_name;
-
- /* Push the list onto the top of the stack of template argument
- lists, so that arguments from it are used from now on when
- expanding <template-param>s. */
- push_template_arg_list (dm, arg_list);
-
- return STATUS_OK;
-}
-
-/* This function, which does not correspond to a production in the
- mangling spec, handles the `literal' production for both
- <template-arg> and <expr-primary>. It does not expect or consume
- the initial `L' or final `E'. The demangling is given by:
-
- <literal> ::= <type> </value/ number>
-
- and the emitted output is `(type)number'. */
-
-static status_t
-demangle_literal (dm)
- demangling_t dm;
-{
- char peek = peek_char (dm);
- dyn_string_t value_string;
- status_t status;
-
- DEMANGLE_TRACE ("literal", dm);
-
- if (!flag_verbose && peek >= 'a' && peek <= 'z')
- {
- /* If not in verbose mode and this is a builtin type, see if we
- can produce simpler numerical output. In particular, for
- integer types shorter than `long', just write the number
- without type information; for bools, write `true' or `false'.
- Other refinements could be made here too. */
-
- /* This constant string is used to map from <builtin-type> codes
- (26 letters of the alphabet) to codes that determine how the
- value will be displayed. The codes are:
- b: display as bool
- i: display as int
- l: display as long
- A space means the value will be represented using cast
- notation. */
- static const char *const code_map = "ibi iii ll ii i ";
-
- char code = code_map[peek - 'a'];
- /* FIXME: Implement demangling of floats and doubles. */
- if (code == 'u')
- return STATUS_UNIMPLEMENTED;
- if (code == 'b')
- {
- /* It's a boolean. */
- char value;
-
- /* Consume the b. */
- advance_char (dm);
- /* Look at the next character. It should be 0 or 1,
- corresponding to false or true, respectively. */
- value = peek_char (dm);
- if (value == '0')
- RETURN_IF_ERROR (result_add (dm, "false"));
- else if (value == '1')
- RETURN_IF_ERROR (result_add (dm, "true"));
- else
- return "Unrecognized bool constant.";
- /* Consume the 0 or 1. */
- advance_char (dm);
- return STATUS_OK;
- }
- else if (code == 'i' || code == 'l')
- {
- /* It's an integer or long. */
-
- /* Consume the type character. */
- advance_char (dm);
-
- /* Demangle the number and write it out. */
- value_string = dyn_string_new (0);
- status = demangle_number_literally (dm, value_string, 10, 1);
- if (STATUS_NO_ERROR (status))
- status = result_add_string (dm, value_string);
- /* For long integers, append an l. */
- if (code == 'l' && STATUS_NO_ERROR (status))
- status = result_add_char (dm, code);
- dyn_string_delete (value_string);
-
- RETURN_IF_ERROR (status);
- return STATUS_OK;
- }
- /* ...else code == ' ', so fall through to represent this
- literal's type explicitly using cast syntax. */
- }
-
- RETURN_IF_ERROR (result_add_char (dm, '('));
- RETURN_IF_ERROR (demangle_type (dm));
- RETURN_IF_ERROR (result_add_char (dm, ')'));
-
- value_string = dyn_string_new (0);
- if (value_string == NULL)
- return STATUS_ALLOCATION_FAILED;
-
- status = demangle_number_literally (dm, value_string, 10, 1);
- if (STATUS_NO_ERROR (status))
- status = result_add_string (dm, value_string);
- dyn_string_delete (value_string);
- RETURN_IF_ERROR (status);
-
- return STATUS_OK;
-}
-
-/* Demangles and emits a <template-arg>.
-
- <template-arg> ::= <type> # type
- ::= L <type> <value number> E # literal
- ::= LZ <encoding> E # external name
- ::= X <expression> E # expression */
-
-static status_t
-demangle_template_arg (dm)
- demangling_t dm;
-{
- DEMANGLE_TRACE ("template-arg", dm);
-
- switch (peek_char (dm))
- {
- case 'L':
- advance_char (dm);
-
- if (peek_char (dm) == 'Z')
- {
- /* External name. */
- advance_char (dm);
- /* FIXME: Standard is contradictory here. */
- RETURN_IF_ERROR (demangle_encoding (dm));
- }
- else
- RETURN_IF_ERROR (demangle_literal (dm));
- RETURN_IF_ERROR (demangle_char (dm, 'E'));
- break;
-
- case 'X':
- /* Expression. */
- advance_char (dm);
- RETURN_IF_ERROR (demangle_expression (dm));
- RETURN_IF_ERROR (demangle_char (dm, 'E'));
- break;
-
- default:
- RETURN_IF_ERROR (demangle_type (dm));
- break;
- }
-
- return STATUS_OK;
-}
-
-/* Demangles and emits an <expression>.
-
- <expression> ::= <unary operator-name> <expression>
- ::= <binary operator-name> <expression> <expression>
- ::= <expr-primary>
- ::= <scope-expression> */
-
-static status_t
-demangle_expression (dm)
- demangling_t dm;
-{
- char peek = peek_char (dm);
-
- DEMANGLE_TRACE ("expression", dm);
-
- if (peek == 'L' || peek == 'T')
- RETURN_IF_ERROR (demangle_expr_primary (dm));
- else if (peek == 's' && peek_char_next (dm) == 'r')
- RETURN_IF_ERROR (demangle_scope_expression (dm));
- else
- /* An operator expression. */
- {
- int num_args;
- int type_arg;
- status_t status = STATUS_OK;
- dyn_string_t operator_name;
-
- /* We have an operator name. Since we want to output binary
- operations in infix notation, capture the operator name
- first. */
- RETURN_IF_ERROR (result_push (dm));
- RETURN_IF_ERROR (demangle_operator_name (dm, 1, &num_args,
- &type_arg));
- operator_name = (dyn_string_t) result_pop (dm);
-
- /* If it's binary, do an operand first. */
- if (num_args > 1)
- {
- status = result_add_char (dm, '(');
- if (STATUS_NO_ERROR (status))
- status = demangle_expression (dm);
- if (STATUS_NO_ERROR (status))
- status = result_add_char (dm, ')');
- }
-
- /* Emit the operator. */
- if (STATUS_NO_ERROR (status))
- status = result_add_string (dm, operator_name);
- dyn_string_delete (operator_name);
- RETURN_IF_ERROR (status);
-
- /* Emit its second (if binary) or only (if unary) operand. */
- RETURN_IF_ERROR (result_add_char (dm, '('));
- if (type_arg)
- RETURN_IF_ERROR (demangle_type (dm));
- else
- RETURN_IF_ERROR (demangle_expression (dm));
- RETURN_IF_ERROR (result_add_char (dm, ')'));
-
- /* The ternary operator takes a third operand. */
- if (num_args == 3)
- {
- RETURN_IF_ERROR (result_add (dm, ":("));
- RETURN_IF_ERROR (demangle_expression (dm));
- RETURN_IF_ERROR (result_add_char (dm, ')'));
- }
- }
-
- return STATUS_OK;
-}
-
-/* Demangles and emits a <scope-expression>.
-
- <scope-expression> ::= sr <qualifying type> <source-name>
- ::= sr <qualifying type> <encoding> */
-
-static status_t
-demangle_scope_expression (dm)
- demangling_t dm;
-{
- RETURN_IF_ERROR (demangle_char (dm, 's'));
- RETURN_IF_ERROR (demangle_char (dm, 'r'));
- RETURN_IF_ERROR (demangle_type (dm));
- RETURN_IF_ERROR (result_add (dm, "::"));
- RETURN_IF_ERROR (demangle_encoding (dm));
- return STATUS_OK;
-}
-
-/* Demangles and emits an <expr-primary>.
-
- <expr-primary> ::= <template-param>
- ::= L <type> <value number> E # literal
- ::= L <mangled-name> E # external name */
-
-static status_t
-demangle_expr_primary (dm)
- demangling_t dm;
-{
- char peek = peek_char (dm);
-
- DEMANGLE_TRACE ("expr-primary", dm);
-
- if (peek == 'T')
- RETURN_IF_ERROR (demangle_template_param (dm));
- else if (peek == 'L')
- {
- /* Consume the `L'. */
- advance_char (dm);
- peek = peek_char (dm);
-
- if (peek == '_')
- RETURN_IF_ERROR (demangle_mangled_name (dm));
- else
- RETURN_IF_ERROR (demangle_literal (dm));
-
- RETURN_IF_ERROR (demangle_char (dm, 'E'));
- }
- else
- return STATUS_ERROR;
-
- return STATUS_OK;
-}
-
-/* Demangles and emits a <substitution>. Sets *TEMPLATE_P to non-zero
- if the substitution is the name of a template, zero otherwise.
-
- <substitution> ::= S <seq-id> _
- ::= S_
-
- ::= St # ::std::
- ::= Sa # ::std::allocator
- ::= Sb # ::std::basic_string
- ::= Ss # ::std::basic_string<char,
- ::std::char_traits<char>,
- ::std::allocator<char> >
- ::= Si # ::std::basic_istream<char,
- std::char_traits<char> >
- ::= So # ::std::basic_ostream<char,
- std::char_traits<char> >
- ::= Sd # ::std::basic_iostream<char,
- std::char_traits<char> >
-*/
-
-static status_t
-demangle_substitution (dm, template_p)
- demangling_t dm;
- int *template_p;
-{
- int seq_id;
- int peek;
- dyn_string_t text;
-
- DEMANGLE_TRACE ("substitution", dm);
-
- RETURN_IF_ERROR (demangle_char (dm, 'S'));
-
- /* Scan the substitution sequence index. A missing number denotes
- the first index. */
- peek = peek_char (dm);
- if (peek == '_')
- seq_id = -1;
- /* If the following character is 0-9 or a capital letter, interpret
- the sequence up to the next underscore as a base-36 substitution
- index. */
- else if (IS_DIGIT ((unsigned char) peek)
- || (peek >= 'A' && peek <= 'Z'))
- RETURN_IF_ERROR (demangle_number (dm, &seq_id, 36, 0));
- else
- {
- const char *new_last_source_name = NULL;
-
- switch (peek)
- {
- case 't':
- RETURN_IF_ERROR (result_add (dm, "std"));
- break;
-
- case 'a':
- RETURN_IF_ERROR (result_add (dm, "std::allocator"));
- new_last_source_name = "allocator";
- *template_p = 1;
- break;
-
- case 'b':
- RETURN_IF_ERROR (result_add (dm, "std::basic_string"));
- new_last_source_name = "basic_string";
- *template_p = 1;
- break;
-
- case 's':
- if (!flag_verbose)
- {
- RETURN_IF_ERROR (result_add (dm, "std::string"));
- new_last_source_name = "string";
- }
- else
- {
- RETURN_IF_ERROR (result_add (dm, "std::basic_string<char, std::char_traits<char>, std::allocator<char> >"));
- new_last_source_name = "basic_string";
- }
- *template_p = 0;
- break;
-
- case 'i':
- if (!flag_verbose)
- {
- RETURN_IF_ERROR (result_add (dm, "std::istream"));
- new_last_source_name = "istream";
- }
- else
- {
- RETURN_IF_ERROR (result_add (dm, "std::basic_istream<char, std::char_traints<char> >"));
- new_last_source_name = "basic_istream";
- }
- *template_p = 0;
- break;
-
- case 'o':
- if (!flag_verbose)
- {
- RETURN_IF_ERROR (result_add (dm, "std::ostream"));
- new_last_source_name = "ostream";
- }
- else
- {
- RETURN_IF_ERROR (result_add (dm, "std::basic_ostream<char, std::char_traits<char> >"));
- new_last_source_name = "basic_ostream";
- }
- *template_p = 0;
- break;
-
- case 'd':
- if (!flag_verbose)
- {
- RETURN_IF_ERROR (result_add (dm, "std::iostream"));
- new_last_source_name = "iostream";
- }
- else
- {
- RETURN_IF_ERROR (result_add (dm, "std::basic_iostream<char, std::char_traits<char> >"));
- new_last_source_name = "basic_iostream";
- }
- *template_p = 0;
- break;
-
- default:
- return "Unrecognized <substitution>.";
- }
-
- /* Consume the character we just processed. */
- advance_char (dm);
-
- if (new_last_source_name != NULL)
- {
- if (!dyn_string_copy_cstr (dm->last_source_name,
- new_last_source_name))
- return STATUS_ALLOCATION_FAILED;
- }
-
- return STATUS_OK;
- }
-
- /* Look up the substitution text. Since `S_' is the most recent
- substitution, `S0_' is the second-most-recent, etc., shift the
- numbering by one. */
- text = substitution_get (dm, seq_id + 1, template_p);
- if (text == NULL)
- return "Substitution number out of range.";
-
- /* Emit the substitution text. */
- RETURN_IF_ERROR (result_add_string (dm, text));
-
- RETURN_IF_ERROR (demangle_char (dm, '_'));
- return STATUS_OK;
-}
-
-/* Demangles and emits a <local-name>.
-
- <local-name> := Z <function encoding> E <entity name> [<discriminator>]
- := Z <function encoding> E s [<discriminator>] */
-
-static status_t
-demangle_local_name (dm)
- demangling_t dm;
-{
- DEMANGLE_TRACE ("local-name", dm);
-
- RETURN_IF_ERROR (demangle_char (dm, 'Z'));
- RETURN_IF_ERROR (demangle_encoding (dm));
- RETURN_IF_ERROR (demangle_char (dm, 'E'));
- RETURN_IF_ERROR (result_add (dm, "::"));
-
- if (peek_char (dm) == 's')
- {
- /* Local character string literal. */
- RETURN_IF_ERROR (result_add (dm, "string literal"));
- /* Consume the s. */
- advance_char (dm);
- RETURN_IF_ERROR (demangle_discriminator (dm, 0));
- }
- else
- {
- int unused;
- /* Local name for some other entity. Demangle its name. */
- RETURN_IF_ERROR (demangle_name (dm, &unused));
- RETURN_IF_ERROR (demangle_discriminator (dm, 1));
- }
-
- return STATUS_OK;
- }
-
- /* Optimonally demangles and emits a <discriminator>. If there is no
- <discriminator> at the current position in the mangled string, the
- descriminator is assumed to be zero. Emit the discriminator number
- in parentheses, unless SUPPRESS_FIRST is non-zero and the
- discriminator is zero.
-
- <discriminator> ::= _ <number> */
-
-static status_t
-demangle_discriminator (dm, suppress_first)
- demangling_t dm;
- int suppress_first;
-{
- /* Output for <discriminator>s to the demangled name is completely
- suppressed if not in verbose mode. */
-
- if (peek_char (dm) == '_')
- {
- /* Consume the underscore. */
- advance_char (dm);
- if (flag_verbose)
- RETURN_IF_ERROR (result_add (dm, " [#"));
- /* Check if there's a number following the underscore. */
- if (IS_DIGIT ((unsigned char) peek_char (dm)))
- {
- int discriminator;
- /* Demangle the number. */
- RETURN_IF_ERROR (demangle_number (dm, &discriminator, 10, 0));
- if (flag_verbose)
- /* Write the discriminator. The mangled number is two
- less than the discriminator ordinal, counting from
- zero. */
- RETURN_IF_ERROR (int_to_dyn_string (discriminator + 1,
- (dyn_string_t) dm->result));
- }
- else
- return STATUS_ERROR;
- if (flag_verbose)
- RETURN_IF_ERROR (result_add_char (dm, ']'));
- }
- else if (!suppress_first)
- {
- if (flag_verbose)
- RETURN_IF_ERROR (result_add (dm, " [#0]"));
- }
-
- return STATUS_OK;
-}
-
-/* Demangle NAME into RESULT, which must be an initialized
- dyn_string_t. On success, returns STATUS_OK. On failure, returns
- an error message, and the contents of RESULT are unchanged. */
-
-static status_t
-cp_demangle (name, result, style)
- const char *name;
- dyn_string_t result;
- int style;
-{
- status_t status;
- int length = strlen (name);
-
- if (length > 2 && name[0] == '_' && name[1] == 'Z')
- {
- demangling_t dm = demangling_new (name, style);
- if (dm == NULL)
- return STATUS_ALLOCATION_FAILED;
-
- status = result_push (dm);
- if (status != STATUS_OK)
- {
- demangling_delete (dm);
- return status;
- }
-
- status = demangle_mangled_name (dm);
- if (STATUS_NO_ERROR (status))
- {
- dyn_string_t demangled = (dyn_string_t) result_pop (dm);
- if (!dyn_string_copy (result, demangled))
- return STATUS_ALLOCATION_FAILED;
- dyn_string_delete (demangled);
- }
-
- demangling_delete (dm);
- }
- else
- {
- /* It's evidently not a mangled C++ name. It could be the name
- of something with C linkage, though, so just copy NAME into
- RESULT. */
- if (!dyn_string_copy_cstr (result, name))
- return STATUS_ALLOCATION_FAILED;
- status = STATUS_OK;
- }
-
- return status;
-}
-
-/* Demangle TYPE_NAME into RESULT, which must be an initialized
- dyn_string_t. On success, returns STATUS_OK. On failiure, returns
- an error message, and the contents of RESULT are unchanged. */
-
-static status_t
-cp_demangle_type (type_name, result)
- const char* type_name;
- dyn_string_t result;
-{
- status_t status;
- demangling_t dm = demangling_new (type_name, DMGL_GNU_V3);
-
- if (dm == NULL)
- return STATUS_ALLOCATION_FAILED;
-
- /* Demangle the type name. The demangled name is stored in dm. */
- status = result_push (dm);
- if (status != STATUS_OK)
- {
- demangling_delete (dm);
- return status;
- }
-
- status = demangle_type (dm);
-
- if (STATUS_NO_ERROR (status))
- {
- /* The demangling succeeded. Pop the result out of dm and copy
- it into RESULT. */
- dyn_string_t demangled = (dyn_string_t) result_pop (dm);
- if (!dyn_string_copy (result, demangled))
- return STATUS_ALLOCATION_FAILED;
- dyn_string_delete (demangled);
- }
-
- /* Clean up. */
- demangling_delete (dm);
-
- return status;
-}
-
-#if defined(IN_LIBGCC2) || defined(IN_GLIBCPP_V3)
-extern char *__cxa_demangle PARAMS ((const char *, char *, size_t *, int *));
-
-/* ia64 ABI-mandated entry point in the C++ runtime library for performing
- demangling. MANGLED_NAME is a NUL-terminated character string
- containing the name to be demangled.
-
- OUTPUT_BUFFER is a region of memory, allocated with malloc, of
- *LENGTH bytes, into which the demangled name is stored. If
- OUTPUT_BUFFER is not long enough, it is expanded using realloc.
- OUTPUT_BUFFER may instead be NULL; in that case, the demangled name
- is placed in a region of memory allocated with malloc.
-
- If LENGTH is non-NULL, the length of the buffer conaining the
- demangled name, is placed in *LENGTH.
-
- The return value is a pointer to the start of the NUL-terminated
- demangled name, or NULL if the demangling fails. The caller is
- responsible for deallocating this memory using free.
-
- *STATUS is set to one of the following values:
- 0: The demangling operation succeeded.
- -1: A memory allocation failiure occurred.
- -2: MANGLED_NAME is not a valid name under the C++ ABI mangling rules.
- -3: One of the arguments is invalid.
-
- The demagling is performed using the C++ ABI mangling rules, with
- GNU extensions. */
-
-char *
-__cxa_demangle (mangled_name, output_buffer, length, status)
- const char *mangled_name;
- char *output_buffer;
- size_t *length;
- int *status;
-{
- struct dyn_string demangled_name;
- status_t result;
-
- if (status == NULL)
- return NULL;
-
- if (mangled_name == NULL) {
- *status = -3;
- return NULL;
- }
-
- /* Did the caller provide a buffer for the demangled name? */
- if (output_buffer == NULL) {
- /* No; dyn_string will malloc a buffer for us. */
- if (!dyn_string_init (&demangled_name, 0))
- {
- *status = -1;
- return NULL;
- }
- }
- else {
- /* Yes. Check that the length was provided. */
- if (length == NULL) {
- *status = -3;
- return NULL;
- }
- /* Install the buffer into a dyn_string. */
- demangled_name.allocated = *length;
- demangled_name.length = 0;
- demangled_name.s = output_buffer;
- }
-
- if (mangled_name[0] == '_' && mangled_name[1] == 'Z')
- /* MANGLED_NAME apprears to be a function or variable name.
- Demangle it accordingly. */
- result = cp_demangle (mangled_name, &demangled_name, 0);
- else
- /* Try to demangled MANGLED_NAME as the name of a type. */
- result = cp_demangle_type (mangled_name, &demangled_name);
-
- if (result == STATUS_OK)
- /* The demangling succeeded. */
- {
- /* If LENGTH isn't NULL, store the allocated buffer length
- there; the buffer may have been realloced by dyn_string
- functions. */
- if (length != NULL)
- *length = demangled_name.allocated;
- /* The operation was a success. */
- *status = 0;
- return dyn_string_buf (&demangled_name);
- }
- else if (result == STATUS_ALLOCATION_FAILED)
- /* A call to malloc or realloc failed during the demangling
- operation. */
- {
- *status = -1;
- return NULL;
- }
- else
- /* The demangling failed for another reason, most probably because
- MANGLED_NAME isn't a valid mangled name. */
- {
- /* If the buffer containing the demangled name wasn't provided
- by the caller, free it. */
- if (output_buffer == NULL)
- free (dyn_string_buf (&demangled_name));
- *status = -2;
- return NULL;
- }
-}
-
-#else /* ! (IN_LIBGCC2 || IN_GLIBCPP_V3) */
-
-/* Variant entry point for integration with the existing cplus-dem
- demangler. Attempts to demangle MANGLED. If the demangling
- succeeds, returns a buffer, allocated with malloc, containing the
- demangled name. The caller must deallocate the buffer using free.
- If the demangling failes, returns NULL. */
-
-char *
-cplus_demangle_v3 (mangled, options)
- const char* mangled;
- int options;
-{
- dyn_string_t demangled;
- status_t status;
- int type = !!(options & DMGL_TYPES);
-
- if (mangled[0] == '_' && mangled[1] == 'Z')
- /* It is not a type. */
- type = 0;
- else
- {
- /* It is a type. Stop if we don't want to demangle types. */
- if (!type)
- return NULL;
- }
-
- flag_verbose = !!(options & DMGL_VERBOSE);
-
- /* Create a dyn_string to hold the demangled name. */
- demangled = dyn_string_new (0);
- /* Attempt the demangling. */
- if (!type)
- /* Appears to be a function or variable name. */
- status = cp_demangle (mangled, demangled, 0);
- else
- /* Try to demangle it as the name of a type. */
- status = cp_demangle_type (mangled, demangled);
-
- if (STATUS_NO_ERROR (status))
- /* Demangling succeeded. */
- {
- /* Grab the demangled result from the dyn_string. It was
- allocated with malloc, so we can return it directly. */
- char *return_value = dyn_string_release (demangled);
- /* Hand back the demangled name. */
- return return_value;
- }
- else if (status == STATUS_ALLOCATION_FAILED)
- {
- fprintf (stderr, "Memory allocation failed.\n");
- abort ();
- }
- else
- /* Demangling failed. */
- {
- dyn_string_delete (demangled);
- return NULL;
- }
-}
-
-/* Demangle a Java symbol. Java uses a subset of the V3 ABI C++ mangling
- conventions, but the output formatting is a little different.
- This instructs the C++ demangler not to emit pointer characters ("*"), and
- to use Java's namespace separator symbol ("." instead of "::"). It then
- does an additional pass over the demangled output to replace instances
- of JArray<TYPE> with TYPE[]. */
-
-char *
-java_demangle_v3 (mangled)
- const char* mangled;
-{
- dyn_string_t demangled;
- char *next;
- char *end;
- int len;
- status_t status;
- int nesting = 0;
- char *cplus_demangled;
- char *return_value;
-
- /* Create a dyn_string to hold the demangled name. */
- demangled = dyn_string_new (0);
-
- /* Attempt the demangling. */
- status = cp_demangle ((char *) mangled, demangled, DMGL_JAVA);
-
- if (STATUS_NO_ERROR (status))
- /* Demangling succeeded. */
- {
- /* Grab the demangled result from the dyn_string. */
- cplus_demangled = dyn_string_release (demangled);
- }
- else if (status == STATUS_ALLOCATION_FAILED)
- {
- fprintf (stderr, "Memory allocation failed.\n");
- abort ();
- }
- else
- /* Demangling failed. */
- {
- dyn_string_delete (demangled);
- return NULL;
- }
-
- len = strlen (cplus_demangled);
- next = cplus_demangled;
- end = next + len;
- demangled = NULL;
-
- /* Replace occurances of JArray<TYPE> with TYPE[]. */
- while (next < end)
- {
- char *open_str = strstr (next, "JArray<");
- char *close_str = NULL;
- if (nesting > 0)
- close_str = strchr (next, '>');
-
- if (open_str != NULL && (close_str == NULL || close_str > open_str))
- {
- ++nesting;
-
- if (!demangled)
- demangled = dyn_string_new(len);
-
- /* Copy prepending symbols, if any. */
- if (open_str > next)
- {
- open_str[0] = 0;
- dyn_string_append_cstr (demangled, next);
- }
- next = open_str + 7;
- }
- else if (close_str != NULL)
- {
- --nesting;
-
- /* Copy prepending type symbol, if any. Squash any spurious
- whitespace. */
- if (close_str > next && next[0] != ' ')
- {
- close_str[0] = 0;
- dyn_string_append_cstr (demangled, next);
- }
- dyn_string_append_cstr (demangled, "[]");
- next = close_str + 1;
- }
- else
- {
- /* There are no more arrays. Copy the rest of the symbol, or
- simply return the original symbol if no changes were made. */
- if (next == cplus_demangled)
- return cplus_demangled;
-
- dyn_string_append_cstr (demangled, next);
- next = end;
- }
- }
-
- free (cplus_demangled);
-
- if (demangled)
- return_value = dyn_string_release (demangled);
- else
- return_value = NULL;
-
- return return_value;
-}
-
-#endif /* IN_LIBGCC2 || IN_GLIBCPP_V3 */
-
-
-#ifndef IN_GLIBCPP_V3
-/* Demangle NAME in the G++ V3 ABI demangling style, and return either
- zero, indicating that some error occurred, or a demangling_t
- holding the results. */
-static demangling_t
-demangle_v3_with_details (name)
- const char *name;
-{
- demangling_t dm;
- status_t status;
-
- if (strncmp (name, "_Z", 2))
- return 0;
-
- dm = demangling_new (name, DMGL_GNU_V3);
- if (dm == NULL)
- {
- fprintf (stderr, "Memory allocation failed.\n");
- abort ();
- }
-
- status = result_push (dm);
- if (! STATUS_NO_ERROR (status))
- {
- demangling_delete (dm);
- fprintf (stderr, "%s\n", status);
- abort ();
- }
-
- status = demangle_mangled_name (dm);
- if (STATUS_NO_ERROR (status))
- return dm;
-
- demangling_delete (dm);
- return 0;
-}
-
-
-/* Return non-zero iff NAME is the mangled form of a constructor name
- in the G++ V3 ABI demangling style. Specifically, return:
- - '1' if NAME is a complete object constructor,
- - '2' if NAME is a base object constructor, or
- - '3' if NAME is a complete object allocating constructor. */
-enum gnu_v3_ctor_kinds
-is_gnu_v3_mangled_ctor (name)
- const char *name;
-{
- demangling_t dm = demangle_v3_with_details (name);
-
- if (dm)
- {
- enum gnu_v3_ctor_kinds result = dm->is_constructor;
- demangling_delete (dm);
- return result;
- }
- else
- return (enum gnu_v3_ctor_kinds) 0;
-}
-
-
-/* Return non-zero iff NAME is the mangled form of a destructor name
- in the G++ V3 ABI demangling style. Specifically, return:
- - '0' if NAME is a deleting destructor,
- - '1' if NAME is a complete object destructor, or
- - '2' if NAME is a base object destructor. */
-enum gnu_v3_dtor_kinds
-is_gnu_v3_mangled_dtor (name)
- const char *name;
-{
- demangling_t dm = demangle_v3_with_details (name);
-
- if (dm)
- {
- enum gnu_v3_dtor_kinds result = dm->is_destructor;
- demangling_delete (dm);
- return result;
- }
- else
- return (enum gnu_v3_dtor_kinds) 0;
-}
-#endif /* IN_GLIBCPP_V3 */
-
-
-#ifdef STANDALONE_DEMANGLER
-
-#include "getopt.h"
-
-static void print_usage
- PARAMS ((FILE* fp, int exit_value));
-
-/* Non-zero if CHAR is a character than can occur in a mangled name. */
-#define is_mangled_char(CHAR) \
- (IS_ALPHA (CHAR) || IS_DIGIT (CHAR) \
- || (CHAR) == '_' || (CHAR) == '.' || (CHAR) == '$')
-
-/* The name of this program, as invoked. */
-const char* program_name;
-
-/* Prints usage summary to FP and then exits with EXIT_VALUE. */
-
-static void
-print_usage (fp, exit_value)
- FILE* fp;
- int exit_value;
-{
- fprintf (fp, "Usage: %s [options] [names ...]\n", program_name);
- fprintf (fp, "Options:\n");
- fprintf (fp, " -h,--help Display this message.\n");
- fprintf (fp, " -s,--strict Demangle standard names only.\n");
- fprintf (fp, " -v,--verbose Produce verbose demanglings.\n");
- fprintf (fp, "If names are provided, they are demangled. Otherwise filters standard input.\n");
-
- exit (exit_value);
-}
-
-/* Option specification for getopt_long. */
-static const struct option long_options[] =
-{
- { "help", no_argument, NULL, 'h' },
- { "strict", no_argument, NULL, 's' },
- { "verbose", no_argument, NULL, 'v' },
- { NULL, no_argument, NULL, 0 },
-};
-
-/* Main entry for a demangling filter executable. It will demangle
- its command line arguments, if any. If none are provided, it will
- filter stdin to stdout, replacing any recognized mangled C++ names
- with their demangled equivalents. */
-
-int
-main (argc, argv)
- int argc;
- char *argv[];
-{
- status_t status;
- int i;
- int opt_char;
-
- /* Use the program name of this program, as invoked. */
- program_name = argv[0];
-
- /* Parse options. */
- do
- {
- opt_char = getopt_long (argc, argv, "hsv", long_options, NULL);
- switch (opt_char)
- {
- case '?': /* Unrecognized option. */
- print_usage (stderr, 1);
- break;
-
- case 'h':
- print_usage (stdout, 0);
- break;
-
- case 's':
- flag_strict = 1;
- break;
-
- case 'v':
- flag_verbose = 1;
- break;
- }
- }
- while (opt_char != -1);
-
- if (optind == argc)
- /* No command line arguments were provided. Filter stdin. */
- {
- dyn_string_t mangled = dyn_string_new (3);
- dyn_string_t demangled = dyn_string_new (0);
- status_t status;
-
- /* Read all of input. */
- while (!feof (stdin))
- {
- char c = getchar ();
-
- /* The first character of a mangled name is an underscore. */
- if (feof (stdin))
- break;
- if (c != '_')
- {
- /* It's not a mangled name. Print the character and go
- on. */
- putchar (c);
- continue;
- }
- c = getchar ();
-
- /* The second character of a mangled name is a capital `Z'. */
- if (feof (stdin))
- break;
- if (c != 'Z')
- {
- /* It's not a mangled name. Print the previous
- underscore, the `Z', and go on. */
- putchar ('_');
- putchar (c);
- continue;
- }
-
- /* Start keeping track of the candidate mangled name. */
- dyn_string_append_char (mangled, '_');
- dyn_string_append_char (mangled, 'Z');
-
- /* Pile characters into mangled until we hit one that can't
- occur in a mangled name. */
- c = getchar ();
- while (!feof (stdin) && is_mangled_char (c))
- {
- dyn_string_append_char (mangled, c);
- if (feof (stdin))
- break;
- c = getchar ();
- }
-
- /* Attempt to demangle the name. */
- status = cp_demangle (dyn_string_buf (mangled), demangled, 0);
-
- /* If the demangling succeeded, great! Print out the
- demangled version. */
- if (STATUS_NO_ERROR (status))
- fputs (dyn_string_buf (demangled), stdout);
- /* Abort on allocation failures. */
- else if (status == STATUS_ALLOCATION_FAILED)
- {
- fprintf (stderr, "Memory allocation failed.\n");
- abort ();
- }
- /* Otherwise, it might not have been a mangled name. Just
- print out the original text. */
- else
- fputs (dyn_string_buf (mangled), stdout);
-
- /* If we haven't hit EOF yet, we've read one character that
- can't occur in a mangled name, so print it out. */
- if (!feof (stdin))
- putchar (c);
-
- /* Clear the candidate mangled name, to start afresh next
- time we hit a `_Z'. */
- dyn_string_clear (mangled);
- }
-
- dyn_string_delete (mangled);
- dyn_string_delete (demangled);
- }
- else
- /* Demangle command line arguments. */
- {
- dyn_string_t result = dyn_string_new (0);
-
- /* Loop over command line arguments. */
- for (i = optind; i < argc; ++i)
- {
- /* Attempt to demangle. */
- status = cp_demangle (argv[i], result, 0);
-
- /* If it worked, print the demangled name. */
- if (STATUS_NO_ERROR (status))
- printf ("%s\n", dyn_string_buf (result));
- /* Abort on allocaiton failures. */
- else if (status == STATUS_ALLOCATION_FAILED)
- {
- fprintf (stderr, "Memory allocation failed.\n");
- abort ();
- }
- /* If not, print the error message to stderr instead. */
- else
- fprintf (stderr, "%s\n", status);
- }
- dyn_string_delete (result);
- }
-
- return 0;
-}
-
-#endif /* STANDALONE_DEMANGLER */
diff --git a/libiberty/cplus-dem.c b/libiberty/cplus-dem.c
deleted file mode 100644
index 4c47783..0000000
--- a/libiberty/cplus-dem.c
+++ /dev/null
@@ -1,4880 +0,0 @@
-/* Demangler for GNU C++
- Copyright 1989, 1991, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001 Free Software Foundation, Inc.
- Written by James Clark (jjc@jclark.uucp)
- Rewritten by Fred Fish (fnf@cygnus.com) for ARM and Lucid demangling
- Modified by Satish Pai (pai@apollo.hp.com) for HP demangling
-
-This file is part of the libiberty library.
-Libiberty is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public
-License as published by the Free Software Foundation; either
-version 2 of the License, or (at your option) any later version.
-
-Libiberty is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with libiberty; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-/* This file exports two functions; cplus_mangle_opname and cplus_demangle.
-
- This file imports xmalloc and xrealloc, which are like malloc and
- realloc except that they generate a fatal error if there is no
- available memory. */
-
-/* This file lives in both GCC and libiberty. When making changes, please
- try not to break either. */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "safe-ctype.h"
-
-#include <sys/types.h>
-#include <string.h>
-#include <stdio.h>
-
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#else
-char * malloc ();
-char * realloc ();
-#endif
-
-#include <demangle.h>
-#undef CURRENT_DEMANGLING_STYLE
-#define CURRENT_DEMANGLING_STYLE work->options
-
-#include "libiberty.h"
-
-static char *ada_demangle PARAMS ((const char *, int));
-
-#define min(X,Y) (((X) < (Y)) ? (X) : (Y))
-
-/* A value at least one greater than the maximum number of characters
- that will be output when using the `%d' format with `printf'. */
-#define INTBUF_SIZE 32
-
-extern void fancy_abort PARAMS ((void)) ATTRIBUTE_NORETURN;
-
-/* In order to allow a single demangler executable to demangle strings
- using various common values of CPLUS_MARKER, as well as any specific
- one set at compile time, we maintain a string containing all the
- commonly used ones, and check to see if the marker we are looking for
- is in that string. CPLUS_MARKER is usually '$' on systems where the
- assembler can deal with that. Where the assembler can't, it's usually
- '.' (but on many systems '.' is used for other things). We put the
- current defined CPLUS_MARKER first (which defaults to '$'), followed
- by the next most common value, followed by an explicit '$' in case
- the value of CPLUS_MARKER is not '$'.
-
- We could avoid this if we could just get g++ to tell us what the actual
- cplus marker character is as part of the debug information, perhaps by
- ensuring that it is the character that terminates the gcc<n>_compiled
- marker symbol (FIXME). */
-
-#if !defined (CPLUS_MARKER)
-#define CPLUS_MARKER '$'
-#endif
-
-enum demangling_styles current_demangling_style = auto_demangling;
-
-static char cplus_markers[] = { CPLUS_MARKER, '.', '$', '\0' };
-
-static char char_str[2] = { '\000', '\000' };
-
-void
-set_cplus_marker_for_demangling (ch)
- int ch;
-{
- cplus_markers[0] = ch;
-}
-
-typedef struct string /* Beware: these aren't required to be */
-{ /* '\0' terminated. */
- char *b; /* pointer to start of string */
- char *p; /* pointer after last character */
- char *e; /* pointer after end of allocated space */
-} string;
-
-/* Stuff that is shared between sub-routines.
- Using a shared structure allows cplus_demangle to be reentrant. */
-
-struct work_stuff
-{
- int options;
- char **typevec;
- char **ktypevec;
- char **btypevec;
- int numk;
- int numb;
- int ksize;
- int bsize;
- int ntypes;
- int typevec_size;
- int constructor;
- int destructor;
- int static_type; /* A static member function */
- int temp_start; /* index in demangled to start of template args */
- int type_quals; /* The type qualifiers. */
- int dllimported; /* Symbol imported from a PE DLL */
- char **tmpl_argvec; /* Template function arguments. */
- int ntmpl_args; /* The number of template function arguments. */
- int forgetting_types; /* Nonzero if we are not remembering the types
- we see. */
- string* previous_argument; /* The last function argument demangled. */
- int nrepeats; /* The number of times to repeat the previous
- argument. */
-};
-
-#define PRINT_ANSI_QUALIFIERS (work -> options & DMGL_ANSI)
-#define PRINT_ARG_TYPES (work -> options & DMGL_PARAMS)
-
-static const struct optable
-{
- const char *const in;
- const char *const out;
- const int flags;
-} optable[] = {
- {"nw", " new", DMGL_ANSI}, /* new (1.92, ansi) */
- {"dl", " delete", DMGL_ANSI}, /* new (1.92, ansi) */
- {"new", " new", 0}, /* old (1.91, and 1.x) */
- {"delete", " delete", 0}, /* old (1.91, and 1.x) */
- {"vn", " new []", DMGL_ANSI}, /* GNU, pending ansi */
- {"vd", " delete []", DMGL_ANSI}, /* GNU, pending ansi */
- {"as", "=", DMGL_ANSI}, /* ansi */
- {"ne", "!=", DMGL_ANSI}, /* old, ansi */
- {"eq", "==", DMGL_ANSI}, /* old, ansi */
- {"ge", ">=", DMGL_ANSI}, /* old, ansi */
- {"gt", ">", DMGL_ANSI}, /* old, ansi */
- {"le", "<=", DMGL_ANSI}, /* old, ansi */
- {"lt", "<", DMGL_ANSI}, /* old, ansi */
- {"plus", "+", 0}, /* old */
- {"pl", "+", DMGL_ANSI}, /* ansi */
- {"apl", "+=", DMGL_ANSI}, /* ansi */
- {"minus", "-", 0}, /* old */
- {"mi", "-", DMGL_ANSI}, /* ansi */
- {"ami", "-=", DMGL_ANSI}, /* ansi */
- {"mult", "*", 0}, /* old */
- {"ml", "*", DMGL_ANSI}, /* ansi */
- {"amu", "*=", DMGL_ANSI}, /* ansi (ARM/Lucid) */
- {"aml", "*=", DMGL_ANSI}, /* ansi (GNU/g++) */
- {"convert", "+", 0}, /* old (unary +) */
- {"negate", "-", 0}, /* old (unary -) */
- {"trunc_mod", "%", 0}, /* old */
- {"md", "%", DMGL_ANSI}, /* ansi */
- {"amd", "%=", DMGL_ANSI}, /* ansi */
- {"trunc_div", "/", 0}, /* old */
- {"dv", "/", DMGL_ANSI}, /* ansi */
- {"adv", "/=", DMGL_ANSI}, /* ansi */
- {"truth_andif", "&&", 0}, /* old */
- {"aa", "&&", DMGL_ANSI}, /* ansi */
- {"truth_orif", "||", 0}, /* old */
- {"oo", "||", DMGL_ANSI}, /* ansi */
- {"truth_not", "!", 0}, /* old */
- {"nt", "!", DMGL_ANSI}, /* ansi */
- {"postincrement","++", 0}, /* old */
- {"pp", "++", DMGL_ANSI}, /* ansi */
- {"postdecrement","--", 0}, /* old */
- {"mm", "--", DMGL_ANSI}, /* ansi */
- {"bit_ior", "|", 0}, /* old */
- {"or", "|", DMGL_ANSI}, /* ansi */
- {"aor", "|=", DMGL_ANSI}, /* ansi */
- {"bit_xor", "^", 0}, /* old */
- {"er", "^", DMGL_ANSI}, /* ansi */
- {"aer", "^=", DMGL_ANSI}, /* ansi */
- {"bit_and", "&", 0}, /* old */
- {"ad", "&", DMGL_ANSI}, /* ansi */
- {"aad", "&=", DMGL_ANSI}, /* ansi */
- {"bit_not", "~", 0}, /* old */
- {"co", "~", DMGL_ANSI}, /* ansi */
- {"call", "()", 0}, /* old */
- {"cl", "()", DMGL_ANSI}, /* ansi */
- {"alshift", "<<", 0}, /* old */
- {"ls", "<<", DMGL_ANSI}, /* ansi */
- {"als", "<<=", DMGL_ANSI}, /* ansi */
- {"arshift", ">>", 0}, /* old */
- {"rs", ">>", DMGL_ANSI}, /* ansi */
- {"ars", ">>=", DMGL_ANSI}, /* ansi */
- {"component", "->", 0}, /* old */
- {"pt", "->", DMGL_ANSI}, /* ansi; Lucid C++ form */
- {"rf", "->", DMGL_ANSI}, /* ansi; ARM/GNU form */
- {"indirect", "*", 0}, /* old */
- {"method_call", "->()", 0}, /* old */
- {"addr", "&", 0}, /* old (unary &) */
- {"array", "[]", 0}, /* old */
- {"vc", "[]", DMGL_ANSI}, /* ansi */
- {"compound", ", ", 0}, /* old */
- {"cm", ", ", DMGL_ANSI}, /* ansi */
- {"cond", "?:", 0}, /* old */
- {"cn", "?:", DMGL_ANSI}, /* pseudo-ansi */
- {"max", ">?", 0}, /* old */
- {"mx", ">?", DMGL_ANSI}, /* pseudo-ansi */
- {"min", "<?", 0}, /* old */
- {"mn", "<?", DMGL_ANSI}, /* pseudo-ansi */
- {"nop", "", 0}, /* old (for operator=) */
- {"rm", "->*", DMGL_ANSI}, /* ansi */
- {"sz", "sizeof ", DMGL_ANSI} /* pseudo-ansi */
-};
-
-/* These values are used to indicate the various type varieties.
- They are all non-zero so that they can be used as `success'
- values. */
-typedef enum type_kind_t
-{
- tk_none,
- tk_pointer,
- tk_reference,
- tk_integral,
- tk_bool,
- tk_char,
- tk_real
-} type_kind_t;
-
-const struct demangler_engine libiberty_demanglers[] =
-{
- {
- NO_DEMANGLING_STYLE_STRING,
- no_demangling,
- "Demangling disabled"
- }
- ,
- {
- AUTO_DEMANGLING_STYLE_STRING,
- auto_demangling,
- "Automatic selection based on executable"
- }
- ,
- {
- GNU_DEMANGLING_STYLE_STRING,
- gnu_demangling,
- "GNU (g++) style demangling"
- }
- ,
- {
- LUCID_DEMANGLING_STYLE_STRING,
- lucid_demangling,
- "Lucid (lcc) style demangling"
- }
- ,
- {
- ARM_DEMANGLING_STYLE_STRING,
- arm_demangling,
- "ARM style demangling"
- }
- ,
- {
- HP_DEMANGLING_STYLE_STRING,
- hp_demangling,
- "HP (aCC) style demangling"
- }
- ,
- {
- EDG_DEMANGLING_STYLE_STRING,
- edg_demangling,
- "EDG style demangling"
- }
- ,
- {
- GNU_V3_DEMANGLING_STYLE_STRING,
- gnu_v3_demangling,
- "GNU (g++) V3 ABI-style demangling"
- }
- ,
- {
- JAVA_DEMANGLING_STYLE_STRING,
- java_demangling,
- "Java style demangling"
- }
- ,
- {
- GNAT_DEMANGLING_STYLE_STRING,
- gnat_demangling,
- "GNAT style demangling"
- }
- ,
- {
- NULL, unknown_demangling, NULL
- }
-};
-
-#define STRING_EMPTY(str) ((str) -> b == (str) -> p)
-#define APPEND_BLANK(str) {if (!STRING_EMPTY(str)) \
- string_append(str, " ");}
-#define LEN_STRING(str) ( (STRING_EMPTY(str))?0:((str)->p - (str)->b))
-
-/* The scope separator appropriate for the language being demangled. */
-
-#define SCOPE_STRING(work) ((work->options & DMGL_JAVA) ? "." : "::")
-
-#define ARM_VTABLE_STRING "__vtbl__" /* Lucid/ARM virtual table prefix */
-#define ARM_VTABLE_STRLEN 8 /* strlen (ARM_VTABLE_STRING) */
-
-/* Prototypes for local functions */
-
-static void
-delete_work_stuff PARAMS ((struct work_stuff *));
-
-static void
-delete_non_B_K_work_stuff PARAMS ((struct work_stuff *));
-
-static char *
-mop_up PARAMS ((struct work_stuff *, string *, int));
-
-static void
-squangle_mop_up PARAMS ((struct work_stuff *));
-
-static void
-work_stuff_copy_to_from PARAMS ((struct work_stuff *, struct work_stuff *));
-
-#if 0
-static int
-demangle_method_args PARAMS ((struct work_stuff *, const char **, string *));
-#endif
-
-static char *
-internal_cplus_demangle PARAMS ((struct work_stuff *, const char *));
-
-static int
-demangle_template_template_parm PARAMS ((struct work_stuff *work,
- const char **, string *));
-
-static int
-demangle_template PARAMS ((struct work_stuff *work, const char **, string *,
- string *, int, int));
-
-static int
-arm_pt PARAMS ((struct work_stuff *, const char *, int, const char **,
- const char **));
-
-static int
-demangle_class_name PARAMS ((struct work_stuff *, const char **, string *));
-
-static int
-demangle_qualified PARAMS ((struct work_stuff *, const char **, string *,
- int, int));
-
-static int
-demangle_class PARAMS ((struct work_stuff *, const char **, string *));
-
-static int
-demangle_fund_type PARAMS ((struct work_stuff *, const char **, string *));
-
-static int
-demangle_signature PARAMS ((struct work_stuff *, const char **, string *));
-
-static int
-demangle_prefix PARAMS ((struct work_stuff *, const char **, string *));
-
-static int
-gnu_special PARAMS ((struct work_stuff *, const char **, string *));
-
-static int
-arm_special PARAMS ((const char **, string *));
-
-static void
-string_need PARAMS ((string *, int));
-
-static void
-string_delete PARAMS ((string *));
-
-static void
-string_init PARAMS ((string *));
-
-static void
-string_clear PARAMS ((string *));
-
-#if 0
-static int
-string_empty PARAMS ((string *));
-#endif
-
-static void
-string_append PARAMS ((string *, const char *));
-
-static void
-string_appends PARAMS ((string *, string *));
-
-static void
-string_appendn PARAMS ((string *, const char *, int));
-
-static void
-string_prepend PARAMS ((string *, const char *));
-
-static void
-string_prependn PARAMS ((string *, const char *, int));
-
-static void
-string_append_template_idx PARAMS ((string *, int));
-
-static int
-get_count PARAMS ((const char **, int *));
-
-static int
-consume_count PARAMS ((const char **));
-
-static int
-consume_count_with_underscores PARAMS ((const char**));
-
-static int
-demangle_args PARAMS ((struct work_stuff *, const char **, string *));
-
-static int
-demangle_nested_args PARAMS ((struct work_stuff*, const char**, string*));
-
-static int
-do_type PARAMS ((struct work_stuff *, const char **, string *));
-
-static int
-do_arg PARAMS ((struct work_stuff *, const char **, string *));
-
-static void
-demangle_function_name PARAMS ((struct work_stuff *, const char **, string *,
- const char *));
-
-static int
-iterate_demangle_function PARAMS ((struct work_stuff *,
- const char **, string *, const char *));
-
-static void
-remember_type PARAMS ((struct work_stuff *, const char *, int));
-
-static void
-remember_Btype PARAMS ((struct work_stuff *, const char *, int, int));
-
-static int
-register_Btype PARAMS ((struct work_stuff *));
-
-static void
-remember_Ktype PARAMS ((struct work_stuff *, const char *, int));
-
-static void
-forget_types PARAMS ((struct work_stuff *));
-
-static void
-forget_B_and_K_types PARAMS ((struct work_stuff *));
-
-static void
-string_prepends PARAMS ((string *, string *));
-
-static int
-demangle_template_value_parm PARAMS ((struct work_stuff*, const char**,
- string*, type_kind_t));
-
-static int
-do_hpacc_template_const_value PARAMS ((struct work_stuff *, const char **, string *));
-
-static int
-do_hpacc_template_literal PARAMS ((struct work_stuff *, const char **, string *));
-
-static int
-snarf_numeric_literal PARAMS ((const char **, string *));
-
-/* There is a TYPE_QUAL value for each type qualifier. They can be
- combined by bitwise-or to form the complete set of qualifiers for a
- type. */
-
-#define TYPE_UNQUALIFIED 0x0
-#define TYPE_QUAL_CONST 0x1
-#define TYPE_QUAL_VOLATILE 0x2
-#define TYPE_QUAL_RESTRICT 0x4
-
-static int
-code_for_qualifier PARAMS ((int));
-
-static const char*
-qualifier_string PARAMS ((int));
-
-static const char*
-demangle_qualifier PARAMS ((int));
-
-static int
-demangle_expression PARAMS ((struct work_stuff *, const char **, string *,
- type_kind_t));
-
-static int
-demangle_integral_value PARAMS ((struct work_stuff *, const char **,
- string *));
-
-static int
-demangle_real_value PARAMS ((struct work_stuff *, const char **, string *));
-
-static void
-demangle_arm_hp_template PARAMS ((struct work_stuff *, const char **, int,
- string *));
-
-static void
-recursively_demangle PARAMS ((struct work_stuff *, const char **, string *,
- int));
-
-static void
-grow_vect PARAMS ((void **, size_t *, size_t, int));
-
-/* Translate count to integer, consuming tokens in the process.
- Conversion terminates on the first non-digit character.
-
- Trying to consume something that isn't a count results in no
- consumption of input and a return of -1.
-
- Overflow consumes the rest of the digits, and returns -1. */
-
-static int
-consume_count (type)
- const char **type;
-{
- int count = 0;
-
- if (! ISDIGIT ((unsigned char)**type))
- return -1;
-
- while (ISDIGIT ((unsigned char)**type))
- {
- count *= 10;
-
- /* Check for overflow.
- We assume that count is represented using two's-complement;
- no power of two is divisible by ten, so if an overflow occurs
- when multiplying by ten, the result will not be a multiple of
- ten. */
- if ((count % 10) != 0)
- {
- while (ISDIGIT ((unsigned char) **type))
- (*type)++;
- return -1;
- }
-
- count += **type - '0';
- (*type)++;
- }
-
- if (count < 0)
- count = -1;
-
- return (count);
-}
-
-
-/* Like consume_count, but for counts that are preceded and followed
- by '_' if they are greater than 10. Also, -1 is returned for
- failure, since 0 can be a valid value. */
-
-static int
-consume_count_with_underscores (mangled)
- const char **mangled;
-{
- int idx;
-
- if (**mangled == '_')
- {
- (*mangled)++;
- if (!ISDIGIT ((unsigned char)**mangled))
- return -1;
-
- idx = consume_count (mangled);
- if (**mangled != '_')
- /* The trailing underscore was missing. */
- return -1;
-
- (*mangled)++;
- }
- else
- {
- if (**mangled < '0' || **mangled > '9')
- return -1;
-
- idx = **mangled - '0';
- (*mangled)++;
- }
-
- return idx;
-}
-
-/* C is the code for a type-qualifier. Return the TYPE_QUAL
- corresponding to this qualifier. */
-
-static int
-code_for_qualifier (c)
- int c;
-{
- switch (c)
- {
- case 'C':
- return TYPE_QUAL_CONST;
-
- case 'V':
- return TYPE_QUAL_VOLATILE;
-
- case 'u':
- return TYPE_QUAL_RESTRICT;
-
- default:
- break;
- }
-
- /* C was an invalid qualifier. */
- abort ();
-}
-
-/* Return the string corresponding to the qualifiers given by
- TYPE_QUALS. */
-
-static const char*
-qualifier_string (type_quals)
- int type_quals;
-{
- switch (type_quals)
- {
- case TYPE_UNQUALIFIED:
- return "";
-
- case TYPE_QUAL_CONST:
- return "const";
-
- case TYPE_QUAL_VOLATILE:
- return "volatile";
-
- case TYPE_QUAL_RESTRICT:
- return "__restrict";
-
- case TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE:
- return "const volatile";
-
- case TYPE_QUAL_CONST | TYPE_QUAL_RESTRICT:
- return "const __restrict";
-
- case TYPE_QUAL_VOLATILE | TYPE_QUAL_RESTRICT:
- return "volatile __restrict";
-
- case TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE | TYPE_QUAL_RESTRICT:
- return "const volatile __restrict";
-
- default:
- break;
- }
-
- /* TYPE_QUALS was an invalid qualifier set. */
- abort ();
-}
-
-/* C is the code for a type-qualifier. Return the string
- corresponding to this qualifier. This function should only be
- called with a valid qualifier code. */
-
-static const char*
-demangle_qualifier (c)
- int c;
-{
- return qualifier_string (code_for_qualifier (c));
-}
-
-int
-cplus_demangle_opname (opname, result, options)
- const char *opname;
- char *result;
- int options;
-{
- int len, len1, ret;
- string type;
- struct work_stuff work[1];
- const char *tem;
-
- len = strlen(opname);
- result[0] = '\0';
- ret = 0;
- memset ((char *) work, 0, sizeof (work));
- work->options = options;
-
- if (opname[0] == '_' && opname[1] == '_'
- && opname[2] == 'o' && opname[3] == 'p')
- {
- /* ANSI. */
- /* type conversion operator. */
- tem = opname + 4;
- if (do_type (work, &tem, &type))
- {
- strcat (result, "operator ");
- strncat (result, type.b, type.p - type.b);
- string_delete (&type);
- ret = 1;
- }
- }
- else if (opname[0] == '_' && opname[1] == '_'
- && ISLOWER((unsigned char)opname[2])
- && ISLOWER((unsigned char)opname[3]))
- {
- if (opname[4] == '\0')
- {
- /* Operator. */
- size_t i;
- for (i = 0; i < ARRAY_SIZE (optable); i++)
- {
- if (strlen (optable[i].in) == 2
- && memcmp (optable[i].in, opname + 2, 2) == 0)
- {
- strcat (result, "operator");
- strcat (result, optable[i].out);
- ret = 1;
- break;
- }
- }
- }
- else
- {
- if (opname[2] == 'a' && opname[5] == '\0')
- {
- /* Assignment. */
- size_t i;
- for (i = 0; i < ARRAY_SIZE (optable); i++)
- {
- if (strlen (optable[i].in) == 3
- && memcmp (optable[i].in, opname + 2, 3) == 0)
- {
- strcat (result, "operator");
- strcat (result, optable[i].out);
- ret = 1;
- break;
- }
- }
- }
- }
- }
- else if (len >= 3
- && opname[0] == 'o'
- && opname[1] == 'p'
- && strchr (cplus_markers, opname[2]) != NULL)
- {
- /* see if it's an assignment expression */
- if (len >= 10 /* op$assign_ */
- && memcmp (opname + 3, "assign_", 7) == 0)
- {
- size_t i;
- for (i = 0; i < ARRAY_SIZE (optable); i++)
- {
- len1 = len - 10;
- if ((int) strlen (optable[i].in) == len1
- && memcmp (optable[i].in, opname + 10, len1) == 0)
- {
- strcat (result, "operator");
- strcat (result, optable[i].out);
- strcat (result, "=");
- ret = 1;
- break;
- }
- }
- }
- else
- {
- size_t i;
- for (i = 0; i < ARRAY_SIZE (optable); i++)
- {
- len1 = len - 3;
- if ((int) strlen (optable[i].in) == len1
- && memcmp (optable[i].in, opname + 3, len1) == 0)
- {
- strcat (result, "operator");
- strcat (result, optable[i].out);
- ret = 1;
- break;
- }
- }
- }
- }
- else if (len >= 5 && memcmp (opname, "type", 4) == 0
- && strchr (cplus_markers, opname[4]) != NULL)
- {
- /* type conversion operator */
- tem = opname + 5;
- if (do_type (work, &tem, &type))
- {
- strcat (result, "operator ");
- strncat (result, type.b, type.p - type.b);
- string_delete (&type);
- ret = 1;
- }
- }
- squangle_mop_up (work);
- return ret;
-
-}
-
-/* Takes operator name as e.g. "++" and returns mangled
- operator name (e.g. "postincrement_expr"), or NULL if not found.
-
- If OPTIONS & DMGL_ANSI == 1, return the ANSI name;
- if OPTIONS & DMGL_ANSI == 0, return the old GNU name. */
-
-const char *
-cplus_mangle_opname (opname, options)
- const char *opname;
- int options;
-{
- size_t i;
- int len;
-
- len = strlen (opname);
- for (i = 0; i < ARRAY_SIZE (optable); i++)
- {
- if ((int) strlen (optable[i].out) == len
- && (options & DMGL_ANSI) == (optable[i].flags & DMGL_ANSI)
- && memcmp (optable[i].out, opname, len) == 0)
- return optable[i].in;
- }
- return (0);
-}
-
-/* Add a routine to set the demangling style to be sure it is valid and
- allow for any demangler initialization that maybe necessary. */
-
-enum demangling_styles
-cplus_demangle_set_style (style)
- enum demangling_styles style;
-{
- const struct demangler_engine *demangler = libiberty_demanglers;
-
- for (; demangler->demangling_style != unknown_demangling; ++demangler)
- if (style == demangler->demangling_style)
- {
- current_demangling_style = style;
- return current_demangling_style;
- }
-
- return unknown_demangling;
-}
-
-/* Do string name to style translation */
-
-enum demangling_styles
-cplus_demangle_name_to_style (name)
- const char *name;
-{
- const struct demangler_engine *demangler = libiberty_demanglers;
-
- for (; demangler->demangling_style != unknown_demangling; ++demangler)
- if (strcmp (name, demangler->demangling_style_name) == 0)
- return demangler->demangling_style;
-
- return unknown_demangling;
-}
-
-/* char *cplus_demangle (const char *mangled, int options)
-
- If MANGLED is a mangled function name produced by GNU C++, then
- a pointer to a @code{malloc}ed string giving a C++ representation
- of the name will be returned; otherwise NULL will be returned.
- It is the caller's responsibility to free the string which
- is returned.
-
- The OPTIONS arg may contain one or more of the following bits:
-
- DMGL_ANSI ANSI qualifiers such as `const' and `void' are
- included.
- DMGL_PARAMS Function parameters are included.
-
- For example,
-
- cplus_demangle ("foo__1Ai", DMGL_PARAMS) => "A::foo(int)"
- cplus_demangle ("foo__1Ai", DMGL_PARAMS | DMGL_ANSI) => "A::foo(int)"
- cplus_demangle ("foo__1Ai", 0) => "A::foo"
-
- cplus_demangle ("foo__1Afe", DMGL_PARAMS) => "A::foo(float,...)"
- cplus_demangle ("foo__1Afe", DMGL_PARAMS | DMGL_ANSI)=> "A::foo(float,...)"
- cplus_demangle ("foo__1Afe", 0) => "A::foo"
-
- Note that any leading underscores, or other such characters prepended by
- the compilation system, are presumed to have already been stripped from
- MANGLED. */
-
-char *
-cplus_demangle (mangled, options)
- const char *mangled;
- int options;
-{
- char *ret;
- struct work_stuff work[1];
-
- if (current_demangling_style == no_demangling)
- return xstrdup (mangled);
-
- memset ((char *) work, 0, sizeof (work));
- work->options = options;
- if ((work->options & DMGL_STYLE_MASK) == 0)
- work->options |= (int) current_demangling_style & DMGL_STYLE_MASK;
-
- /* The V3 ABI demangling is implemented elsewhere. */
- if (GNU_V3_DEMANGLING || AUTO_DEMANGLING)
- {
- ret = cplus_demangle_v3 (mangled, work->options);
- if (ret || GNU_V3_DEMANGLING)
- return ret;
- }
-
- if (JAVA_DEMANGLING)
- {
- ret = java_demangle_v3 (mangled);
- if (ret)
- return ret;
- }
-
- if (GNAT_DEMANGLING)
- return ada_demangle(mangled,options);
-
- ret = internal_cplus_demangle (work, mangled);
- squangle_mop_up (work);
- return (ret);
-}
-
-
-/* Assuming *OLD_VECT points to an array of *SIZE objects of size
- ELEMENT_SIZE, grow it to contain at least MIN_SIZE objects,
- updating *OLD_VECT and *SIZE as necessary. */
-
-static void
-grow_vect (old_vect, size, min_size, element_size)
- void **old_vect;
- size_t *size;
- size_t min_size;
- int element_size;
-{
- if (*size < min_size)
- {
- *size *= 2;
- if (*size < min_size)
- *size = min_size;
- *old_vect = (void *) xrealloc (*old_vect, *size * element_size);
- }
-}
-
-/* Demangle ada names:
- 1. Discard final __{DIGIT}+ or ${DIGIT}+
- 2. Convert other instances of embedded "__" to `.'.
- 3. Discard leading _ada_.
- 4. Remove everything after first ___ if it is followed by 'X'.
- 5. Put symbols that should be suppressed in <...> brackets.
- The resulting string is valid until the next call of ada_demangle. */
-
-static char *
-ada_demangle (mangled, option)
- const char *mangled;
- int option ATTRIBUTE_UNUSED;
-{
- int i, j;
- int len0;
- const char* p;
- char *demangled = NULL;
- int at_start_name;
- int changed;
- char *demangling_buffer = NULL;
- size_t demangling_buffer_size = 0;
-
- changed = 0;
-
- if (strncmp (mangled, "_ada_", 5) == 0)
- {
- mangled += 5;
- changed = 1;
- }
-
- if (mangled[0] == '_' || mangled[0] == '<')
- goto Suppress;
-
- p = strstr (mangled, "___");
- if (p == NULL)
- len0 = strlen (mangled);
- else
- {
- if (p[3] == 'X')
- {
- len0 = p - mangled;
- changed = 1;
- }
- else
- goto Suppress;
- }
-
- /* Make demangled big enough for possible expansion by operator name. */
- grow_vect ((void **) &(demangling_buffer),
- &demangling_buffer_size, 2 * len0 + 1,
- sizeof (char));
- demangled = demangling_buffer;
-
- if (ISDIGIT ((unsigned char) mangled[len0 - 1])) {
- for (i = len0 - 2; i >= 0 && ISDIGIT ((unsigned char) mangled[i]); i -= 1)
- ;
- if (i > 1 && mangled[i] == '_' && mangled[i - 1] == '_')
- {
- len0 = i - 1;
- changed = 1;
- }
- else if (mangled[i] == '$')
- {
- len0 = i;
- changed = 1;
- }
- }
-
- for (i = 0, j = 0; i < len0 && ! ISALPHA ((unsigned char)mangled[i]);
- i += 1, j += 1)
- demangled[j] = mangled[i];
-
- at_start_name = 1;
- while (i < len0)
- {
- at_start_name = 0;
-
- if (i < len0 - 2 && mangled[i] == '_' && mangled[i + 1] == '_')
- {
- demangled[j] = '.';
- changed = at_start_name = 1;
- i += 2; j += 1;
- }
- else
- {
- demangled[j] = mangled[i];
- i += 1; j += 1;
- }
- }
- demangled[j] = '\000';
-
- for (i = 0; demangled[i] != '\0'; i += 1)
- if (ISUPPER ((unsigned char)demangled[i]) || demangled[i] == ' ')
- goto Suppress;
-
- if (! changed)
- return NULL;
- else
- return demangled;
-
- Suppress:
- grow_vect ((void **) &(demangling_buffer),
- &demangling_buffer_size, strlen (mangled) + 3,
- sizeof (char));
- demangled = demangling_buffer;
- if (mangled[0] == '<')
- strcpy (demangled, mangled);
- else
- sprintf (demangled, "<%s>", mangled);
-
- return demangled;
-}
-
-/* This function performs most of what cplus_demangle use to do, but
- to be able to demangle a name with a B, K or n code, we need to
- have a longer term memory of what types have been seen. The original
- now intializes and cleans up the squangle code info, while internal
- calls go directly to this routine to avoid resetting that info. */
-
-static char *
-internal_cplus_demangle (work, mangled)
- struct work_stuff *work;
- const char *mangled;
-{
-
- string decl;
- int success = 0;
- char *demangled = NULL;
- int s1, s2, s3, s4;
- s1 = work->constructor;
- s2 = work->destructor;
- s3 = work->static_type;
- s4 = work->type_quals;
- work->constructor = work->destructor = 0;
- work->type_quals = TYPE_UNQUALIFIED;
- work->dllimported = 0;
-
- if ((mangled != NULL) && (*mangled != '\0'))
- {
- string_init (&decl);
-
- /* First check to see if gnu style demangling is active and if the
- string to be demangled contains a CPLUS_MARKER. If so, attempt to
- recognize one of the gnu special forms rather than looking for a
- standard prefix. In particular, don't worry about whether there
- is a "__" string in the mangled string. Consider "_$_5__foo" for
- example. */
-
- if ((AUTO_DEMANGLING || GNU_DEMANGLING))
- {
- success = gnu_special (work, &mangled, &decl);
- }
- if (!success)
- {
- success = demangle_prefix (work, &mangled, &decl);
- }
- if (success && (*mangled != '\0'))
- {
- success = demangle_signature (work, &mangled, &decl);
- }
- if (work->constructor == 2)
- {
- string_prepend (&decl, "global constructors keyed to ");
- work->constructor = 0;
- }
- else if (work->destructor == 2)
- {
- string_prepend (&decl, "global destructors keyed to ");
- work->destructor = 0;
- }
- else if (work->dllimported == 1)
- {
- string_prepend (&decl, "import stub for ");
- work->dllimported = 0;
- }
- demangled = mop_up (work, &decl, success);
- }
- work->constructor = s1;
- work->destructor = s2;
- work->static_type = s3;
- work->type_quals = s4;
- return demangled;
-}
-
-
-/* Clear out and squangling related storage */
-static void
-squangle_mop_up (work)
- struct work_stuff *work;
-{
- /* clean up the B and K type mangling types. */
- forget_B_and_K_types (work);
- if (work -> btypevec != NULL)
- {
- free ((char *) work -> btypevec);
- }
- if (work -> ktypevec != NULL)
- {
- free ((char *) work -> ktypevec);
- }
-}
-
-
-/* Copy the work state and storage. */
-
-static void
-work_stuff_copy_to_from (to, from)
- struct work_stuff *to;
- struct work_stuff *from;
-{
- int i;
-
- delete_work_stuff (to);
-
- /* Shallow-copy scalars. */
- memcpy (to, from, sizeof (*to));
-
- /* Deep-copy dynamic storage. */
- if (from->typevec_size)
- to->typevec
- = (char **) xmalloc (from->typevec_size * sizeof (to->typevec[0]));
-
- for (i = 0; i < from->ntypes; i++)
- {
- int len = strlen (from->typevec[i]) + 1;
-
- to->typevec[i] = xmalloc (len);
- memcpy (to->typevec[i], from->typevec[i], len);
- }
-
- if (from->ksize)
- to->ktypevec
- = (char **) xmalloc (from->ksize * sizeof (to->ktypevec[0]));
-
- for (i = 0; i < from->numk; i++)
- {
- int len = strlen (from->ktypevec[i]) + 1;
-
- to->ktypevec[i] = xmalloc (len);
- memcpy (to->ktypevec[i], from->ktypevec[i], len);
- }
-
- if (from->bsize)
- to->btypevec
- = (char **) xmalloc (from->bsize * sizeof (to->btypevec[0]));
-
- for (i = 0; i < from->numb; i++)
- {
- int len = strlen (from->btypevec[i]) + 1;
-
- to->btypevec[i] = xmalloc (len);
- memcpy (to->btypevec[i], from->btypevec[i], len);
- }
-
- if (from->ntmpl_args)
- to->tmpl_argvec
- = (char **) xmalloc (from->ntmpl_args * sizeof (to->tmpl_argvec[0]));
-
- for (i = 0; i < from->ntmpl_args; i++)
- {
- int len = strlen (from->tmpl_argvec[i]) + 1;
-
- to->tmpl_argvec[i] = xmalloc (len);
- memcpy (to->tmpl_argvec[i], from->tmpl_argvec[i], len);
- }
-
- if (from->previous_argument)
- {
- to->previous_argument = (string*) xmalloc (sizeof (string));
- string_init (to->previous_argument);
- string_appends (to->previous_argument, from->previous_argument);
- }
-}
-
-
-/* Delete dynamic stuff in work_stuff that is not to be re-used. */
-
-static void
-delete_non_B_K_work_stuff (work)
- struct work_stuff *work;
-{
- /* Discard the remembered types, if any. */
-
- forget_types (work);
- if (work -> typevec != NULL)
- {
- free ((char *) work -> typevec);
- work -> typevec = NULL;
- work -> typevec_size = 0;
- }
- if (work->tmpl_argvec)
- {
- int i;
-
- for (i = 0; i < work->ntmpl_args; i++)
- if (work->tmpl_argvec[i])
- free ((char*) work->tmpl_argvec[i]);
-
- free ((char*) work->tmpl_argvec);
- work->tmpl_argvec = NULL;
- }
- if (work->previous_argument)
- {
- string_delete (work->previous_argument);
- free ((char*) work->previous_argument);
- work->previous_argument = NULL;
- }
-}
-
-
-/* Delete all dynamic storage in work_stuff. */
-static void
-delete_work_stuff (work)
- struct work_stuff *work;
-{
- delete_non_B_K_work_stuff (work);
- squangle_mop_up (work);
-}
-
-
-/* Clear out any mangled storage */
-
-static char *
-mop_up (work, declp, success)
- struct work_stuff *work;
- string *declp;
- int success;
-{
- char *demangled = NULL;
-
- delete_non_B_K_work_stuff (work);
-
- /* If demangling was successful, ensure that the demangled string is null
- terminated and return it. Otherwise, free the demangling decl. */
-
- if (!success)
- {
- string_delete (declp);
- }
- else
- {
- string_appendn (declp, "", 1);
- demangled = declp->b;
- }
- return (demangled);
-}
-
-/*
-
-LOCAL FUNCTION
-
- demangle_signature -- demangle the signature part of a mangled name
-
-SYNOPSIS
-
- static int
- demangle_signature (struct work_stuff *work, const char **mangled,
- string *declp);
-
-DESCRIPTION
-
- Consume and demangle the signature portion of the mangled name.
-
- DECLP is the string where demangled output is being built. At
- entry it contains the demangled root name from the mangled name
- prefix. I.E. either a demangled operator name or the root function
- name. In some special cases, it may contain nothing.
-
- *MANGLED points to the current unconsumed location in the mangled
- name. As tokens are consumed and demangling is performed, the
- pointer is updated to continuously point at the next token to
- be consumed.
-
- Demangling GNU style mangled names is nasty because there is no
- explicit token that marks the start of the outermost function
- argument list. */
-
-static int
-demangle_signature (work, mangled, declp)
- struct work_stuff *work;
- const char **mangled;
- string *declp;
-{
- int success = 1;
- int func_done = 0;
- int expect_func = 0;
- int expect_return_type = 0;
- const char *oldmangled = NULL;
- string trawname;
- string tname;
-
- while (success && (**mangled != '\0'))
- {
- switch (**mangled)
- {
- case 'Q':
- oldmangled = *mangled;
- success = demangle_qualified (work, mangled, declp, 1, 0);
- if (success)
- remember_type (work, oldmangled, *mangled - oldmangled);
- if (AUTO_DEMANGLING || GNU_DEMANGLING)
- expect_func = 1;
- oldmangled = NULL;
- break;
-
- case 'K':
- oldmangled = *mangled;
- success = demangle_qualified (work, mangled, declp, 1, 0);
- if (AUTO_DEMANGLING || GNU_DEMANGLING)
- {
- expect_func = 1;
- }
- oldmangled = NULL;
- break;
-
- case 'S':
- /* Static member function */
- if (oldmangled == NULL)
- {
- oldmangled = *mangled;
- }
- (*mangled)++;
- work -> static_type = 1;
- break;
-
- case 'C':
- case 'V':
- case 'u':
- work->type_quals |= code_for_qualifier (**mangled);
-
- /* a qualified member function */
- if (oldmangled == NULL)
- oldmangled = *mangled;
- (*mangled)++;
- break;
-
- case 'L':
- /* Local class name follows after "Lnnn_" */
- if (HP_DEMANGLING)
- {
- while (**mangled && (**mangled != '_'))
- (*mangled)++;
- if (!**mangled)
- success = 0;
- else
- (*mangled)++;
- }
- else
- success = 0;
- break;
-
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- if (oldmangled == NULL)
- {
- oldmangled = *mangled;
- }
- work->temp_start = -1; /* uppermost call to demangle_class */
- success = demangle_class (work, mangled, declp);
- if (success)
- {
- remember_type (work, oldmangled, *mangled - oldmangled);
- }
- if (AUTO_DEMANGLING || GNU_DEMANGLING || EDG_DEMANGLING)
- {
- /* EDG and others will have the "F", so we let the loop cycle
- if we are looking at one. */
- if (**mangled != 'F')
- expect_func = 1;
- }
- oldmangled = NULL;
- break;
-
- case 'B':
- {
- string s;
- success = do_type (work, mangled, &s);
- if (success)
- {
- string_append (&s, SCOPE_STRING (work));
- string_prepends (declp, &s);
- }
- oldmangled = NULL;
- expect_func = 1;
- }
- break;
-
- case 'F':
- /* Function */
- /* ARM/HP style demangling includes a specific 'F' character after
- the class name. For GNU style, it is just implied. So we can
- safely just consume any 'F' at this point and be compatible
- with either style. */
-
- oldmangled = NULL;
- func_done = 1;
- (*mangled)++;
-
- /* For lucid/ARM/HP style we have to forget any types we might
- have remembered up to this point, since they were not argument
- types. GNU style considers all types seen as available for
- back references. See comment in demangle_args() */
-
- if (LUCID_DEMANGLING || ARM_DEMANGLING || HP_DEMANGLING || EDG_DEMANGLING)
- {
- forget_types (work);
- }
- success = demangle_args (work, mangled, declp);
- /* After picking off the function args, we expect to either
- find the function return type (preceded by an '_') or the
- end of the string. */
- if (success && (AUTO_DEMANGLING || EDG_DEMANGLING) && **mangled == '_')
- {
- ++(*mangled);
- /* At this level, we do not care about the return type. */
- success = do_type (work, mangled, &tname);
- string_delete (&tname);
- }
-
- break;
-
- case 't':
- /* G++ Template */
- string_init(&trawname);
- string_init(&tname);
- if (oldmangled == NULL)
- {
- oldmangled = *mangled;
- }
- success = demangle_template (work, mangled, &tname,
- &trawname, 1, 1);
- if (success)
- {
- remember_type (work, oldmangled, *mangled - oldmangled);
- }
- string_append (&tname, SCOPE_STRING (work));
-
- string_prepends(declp, &tname);
- if (work -> destructor & 1)
- {
- string_prepend (&trawname, "~");
- string_appends (declp, &trawname);
- work->destructor -= 1;
- }
- if ((work->constructor & 1) || (work->destructor & 1))
- {
- string_appends (declp, &trawname);
- work->constructor -= 1;
- }
- string_delete(&trawname);
- string_delete(&tname);
- oldmangled = NULL;
- expect_func = 1;
- break;
-
- case '_':
- if ((AUTO_DEMANGLING || GNU_DEMANGLING) && expect_return_type)
- {
- /* Read the return type. */
- string return_type;
- string_init (&return_type);
-
- (*mangled)++;
- success = do_type (work, mangled, &return_type);
- APPEND_BLANK (&return_type);
-
- string_prepends (declp, &return_type);
- string_delete (&return_type);
- break;
- }
- else
- /* At the outermost level, we cannot have a return type specified,
- so if we run into another '_' at this point we are dealing with
- a mangled name that is either bogus, or has been mangled by
- some algorithm we don't know how to deal with. So just
- reject the entire demangling. */
- /* However, "_nnn" is an expected suffix for alternate entry point
- numbered nnn for a function, with HP aCC, so skip over that
- without reporting failure. pai/1997-09-04 */
- if (HP_DEMANGLING)
- {
- (*mangled)++;
- while (**mangled && ISDIGIT ((unsigned char)**mangled))
- (*mangled)++;
- }
- else
- success = 0;
- break;
-
- case 'H':
- if (AUTO_DEMANGLING || GNU_DEMANGLING)
- {
- /* A G++ template function. Read the template arguments. */
- success = demangle_template (work, mangled, declp, 0, 0,
- 0);
- if (!(work->constructor & 1))
- expect_return_type = 1;
- (*mangled)++;
- break;
- }
- else
- /* fall through */
- {;}
-
- default:
- if (AUTO_DEMANGLING || GNU_DEMANGLING)
- {
- /* Assume we have stumbled onto the first outermost function
- argument token, and start processing args. */
- func_done = 1;
- success = demangle_args (work, mangled, declp);
- }
- else
- {
- /* Non-GNU demanglers use a specific token to mark the start
- of the outermost function argument tokens. Typically 'F',
- for ARM/HP-demangling, for example. So if we find something
- we are not prepared for, it must be an error. */
- success = 0;
- }
- break;
- }
- /*
- if (AUTO_DEMANGLING || GNU_DEMANGLING)
- */
- {
- if (success && expect_func)
- {
- func_done = 1;
- if (LUCID_DEMANGLING || ARM_DEMANGLING || EDG_DEMANGLING)
- {
- forget_types (work);
- }
- success = demangle_args (work, mangled, declp);
- /* Since template include the mangling of their return types,
- we must set expect_func to 0 so that we don't try do
- demangle more arguments the next time we get here. */
- expect_func = 0;
- }
- }
- }
- if (success && !func_done)
- {
- if (AUTO_DEMANGLING || GNU_DEMANGLING)
- {
- /* With GNU style demangling, bar__3foo is 'foo::bar(void)', and
- bar__3fooi is 'foo::bar(int)'. We get here when we find the
- first case, and need to ensure that the '(void)' gets added to
- the current declp. Note that with ARM/HP, the first case
- represents the name of a static data member 'foo::bar',
- which is in the current declp, so we leave it alone. */
- success = demangle_args (work, mangled, declp);
- }
- }
- if (success && PRINT_ARG_TYPES)
- {
- if (work->static_type)
- string_append (declp, " static");
- if (work->type_quals != TYPE_UNQUALIFIED)
- {
- APPEND_BLANK (declp);
- string_append (declp, qualifier_string (work->type_quals));
- }
- }
-
- return (success);
-}
-
-#if 0
-
-static int
-demangle_method_args (work, mangled, declp)
- struct work_stuff *work;
- const char **mangled;
- string *declp;
-{
- int success = 0;
-
- if (work -> static_type)
- {
- string_append (declp, *mangled + 1);
- *mangled += strlen (*mangled);
- success = 1;
- }
- else
- {
- success = demangle_args (work, mangled, declp);
- }
- return (success);
-}
-
-#endif
-
-static int
-demangle_template_template_parm (work, mangled, tname)
- struct work_stuff *work;
- const char **mangled;
- string *tname;
-{
- int i;
- int r;
- int need_comma = 0;
- int success = 1;
- string temp;
-
- string_append (tname, "template <");
- /* get size of template parameter list */
- if (get_count (mangled, &r))
- {
- for (i = 0; i < r; i++)
- {
- if (need_comma)
- {
- string_append (tname, ", ");
- }
-
- /* Z for type parameters */
- if (**mangled == 'Z')
- {
- (*mangled)++;
- string_append (tname, "class");
- }
- /* z for template parameters */
- else if (**mangled == 'z')
- {
- (*mangled)++;
- success =
- demangle_template_template_parm (work, mangled, tname);
- if (!success)
- {
- break;
- }
- }
- else
- {
- /* temp is initialized in do_type */
- success = do_type (work, mangled, &temp);
- if (success)
- {
- string_appends (tname, &temp);
- }
- string_delete(&temp);
- if (!success)
- {
- break;
- }
- }
- need_comma = 1;
- }
-
- }
- if (tname->p[-1] == '>')
- string_append (tname, " ");
- string_append (tname, "> class");
- return (success);
-}
-
-static int
-demangle_expression (work, mangled, s, tk)
- struct work_stuff *work;
- const char** mangled;
- string* s;
- type_kind_t tk;
-{
- int need_operator = 0;
- int success;
-
- success = 1;
- string_appendn (s, "(", 1);
- (*mangled)++;
- while (success && **mangled != 'W' && **mangled != '\0')
- {
- if (need_operator)
- {
- size_t i;
- size_t len;
-
- success = 0;
-
- len = strlen (*mangled);
-
- for (i = 0; i < ARRAY_SIZE (optable); ++i)
- {
- size_t l = strlen (optable[i].in);
-
- if (l <= len
- && memcmp (optable[i].in, *mangled, l) == 0)
- {
- string_appendn (s, " ", 1);
- string_append (s, optable[i].out);
- string_appendn (s, " ", 1);
- success = 1;
- (*mangled) += l;
- break;
- }
- }
-
- if (!success)
- break;
- }
- else
- need_operator = 1;
-
- success = demangle_template_value_parm (work, mangled, s, tk);
- }
-
- if (**mangled != 'W')
- success = 0;
- else
- {
- string_appendn (s, ")", 1);
- (*mangled)++;
- }
-
- return success;
-}
-
-static int
-demangle_integral_value (work, mangled, s)
- struct work_stuff *work;
- const char** mangled;
- string* s;
-{
- int success;
-
- if (**mangled == 'E')
- success = demangle_expression (work, mangled, s, tk_integral);
- else if (**mangled == 'Q' || **mangled == 'K')
- success = demangle_qualified (work, mangled, s, 0, 1);
- else
- {
- int value;
-
- /* By default, we let the number decide whether we shall consume an
- underscore. */
- int multidigit_without_leading_underscore = 0;
- int leave_following_underscore = 0;
-
- success = 0;
-
- /* Negative numbers are indicated with a leading `m'. */
- if (**mangled == 'm')
- {
- string_appendn (s, "-", 1);
- (*mangled)++;
- }
- else if (mangled[0][0] == '_' && mangled[0][1] == 'm')
- {
- /* Since consume_count_with_underscores does not handle the
- `m'-prefix we must do it here, using consume_count and
- adjusting underscores: we have to consume the underscore
- matching the prepended one. */
- multidigit_without_leading_underscore = 1;
- string_appendn (s, "-", 1);
- (*mangled) += 2;
- }
- else if (**mangled == '_')
- {
- /* Do not consume a following underscore;
- multidigit_without_leading_underscore will consume what should be
- consumed. */
- leave_following_underscore = 1;
- }
- else
- {
- /* Since consume_count_with_underscores does not handle
- multi-digit numbers that do not start with an underscore,
- and this number can be an integer template parameter,
- we have to call consume_count. */
- multidigit_without_leading_underscore = 1;
- /* These multi-digit numbers never end on an underscore,
- so if there is one then don't eat it. */
- leave_following_underscore = 1;
- }
-
- /* We must call consume_count if we expect to remove a trailing
- underscore, since consume_count_with_underscores expects
- the leading underscore (that we consumed) if it is to handle
- multi-digit numbers. */
- if (multidigit_without_leading_underscore)
- value = consume_count (mangled);
- else
- value = consume_count_with_underscores (mangled);
-
- if (value != -1)
- {
- char buf[INTBUF_SIZE];
- sprintf (buf, "%d", value);
- string_append (s, buf);
-
- /* Numbers not otherwise delimited, might have an underscore
- appended as a delimeter, which we should skip.
-
- ??? This used to always remove a following underscore, which
- is wrong. If other (arbitrary) cases are followed by an
- underscore, we need to do something more radical. */
-
- if ((value > 9 || multidigit_without_leading_underscore)
- && ! leave_following_underscore
- && **mangled == '_')
- (*mangled)++;
-
- /* All is well. */
- success = 1;
- }
- }
-
- return success;
-}
-
-/* Demangle the real value in MANGLED. */
-
-static int
-demangle_real_value (work, mangled, s)
- struct work_stuff *work;
- const char **mangled;
- string* s;
-{
- if (**mangled == 'E')
- return demangle_expression (work, mangled, s, tk_real);
-
- if (**mangled == 'm')
- {
- string_appendn (s, "-", 1);
- (*mangled)++;
- }
- while (ISDIGIT ((unsigned char)**mangled))
- {
- string_appendn (s, *mangled, 1);
- (*mangled)++;
- }
- if (**mangled == '.') /* fraction */
- {
- string_appendn (s, ".", 1);
- (*mangled)++;
- while (ISDIGIT ((unsigned char)**mangled))
- {
- string_appendn (s, *mangled, 1);
- (*mangled)++;
- }
- }
- if (**mangled == 'e') /* exponent */
- {
- string_appendn (s, "e", 1);
- (*mangled)++;
- while (ISDIGIT ((unsigned char)**mangled))
- {
- string_appendn (s, *mangled, 1);
- (*mangled)++;
- }
- }
-
- return 1;
-}
-
-static int
-demangle_template_value_parm (work, mangled, s, tk)
- struct work_stuff *work;
- const char **mangled;
- string* s;
- type_kind_t tk;
-{
- int success = 1;
-
- if (**mangled == 'Y')
- {
- /* The next argument is a template parameter. */
- int idx;
-
- (*mangled)++;
- idx = consume_count_with_underscores (mangled);
- if (idx == -1
- || (work->tmpl_argvec && idx >= work->ntmpl_args)
- || consume_count_with_underscores (mangled) == -1)
- return -1;
- if (work->tmpl_argvec)
- string_append (s, work->tmpl_argvec[idx]);
- else
- string_append_template_idx (s, idx);
- }
- else if (tk == tk_integral)
- success = demangle_integral_value (work, mangled, s);
- else if (tk == tk_char)
- {
- char tmp[2];
- int val;
- if (**mangled == 'm')
- {
- string_appendn (s, "-", 1);
- (*mangled)++;
- }
- string_appendn (s, "'", 1);
- val = consume_count(mangled);
- if (val <= 0)
- success = 0;
- else
- {
- tmp[0] = (char)val;
- tmp[1] = '\0';
- string_appendn (s, &tmp[0], 1);
- string_appendn (s, "'", 1);
- }
- }
- else if (tk == tk_bool)
- {
- int val = consume_count (mangled);
- if (val == 0)
- string_appendn (s, "false", 5);
- else if (val == 1)
- string_appendn (s, "true", 4);
- else
- success = 0;
- }
- else if (tk == tk_real)
- success = demangle_real_value (work, mangled, s);
- else if (tk == tk_pointer || tk == tk_reference)
- {
- if (**mangled == 'Q')
- success = demangle_qualified (work, mangled, s,
- /*isfuncname=*/0,
- /*append=*/1);
- else
- {
- int symbol_len = consume_count (mangled);
- if (symbol_len == -1)
- return -1;
- if (symbol_len == 0)
- string_appendn (s, "0", 1);
- else
- {
- char *p = xmalloc (symbol_len + 1), *q;
- strncpy (p, *mangled, symbol_len);
- p [symbol_len] = '\0';
- /* We use cplus_demangle here, rather than
- internal_cplus_demangle, because the name of the entity
- mangled here does not make use of any of the squangling
- or type-code information we have built up thus far; it is
- mangled independently. */
- q = cplus_demangle (p, work->options);
- if (tk == tk_pointer)
- string_appendn (s, "&", 1);
- /* FIXME: Pointer-to-member constants should get a
- qualifying class name here. */
- if (q)
- {
- string_append (s, q);
- free (q);
- }
- else
- string_append (s, p);
- free (p);
- }
- *mangled += symbol_len;
- }
- }
-
- return success;
-}
-
-/* Demangle the template name in MANGLED. The full name of the
- template (e.g., S<int>) is placed in TNAME. The name without the
- template parameters (e.g. S) is placed in TRAWNAME if TRAWNAME is
- non-NULL. If IS_TYPE is nonzero, this template is a type template,
- not a function template. If both IS_TYPE and REMEMBER are nonzero,
- the template is remembered in the list of back-referenceable
- types. */
-
-static int
-demangle_template (work, mangled, tname, trawname, is_type, remember)
- struct work_stuff *work;
- const char **mangled;
- string *tname;
- string *trawname;
- int is_type;
- int remember;
-{
- int i;
- int r;
- int need_comma = 0;
- int success = 0;
- const char *start;
- int is_java_array = 0;
- string temp;
- int bindex = 0;
-
- (*mangled)++;
- if (is_type)
- {
- if (remember)
- bindex = register_Btype (work);
- start = *mangled;
- /* get template name */
- if (**mangled == 'z')
- {
- int idx;
- (*mangled)++;
- (*mangled)++;
-
- idx = consume_count_with_underscores (mangled);
- if (idx == -1
- || (work->tmpl_argvec && idx >= work->ntmpl_args)
- || consume_count_with_underscores (mangled) == -1)
- return (0);
-
- if (work->tmpl_argvec)
- {
- string_append (tname, work->tmpl_argvec[idx]);
- if (trawname)
- string_append (trawname, work->tmpl_argvec[idx]);
- }
- else
- {
- string_append_template_idx (tname, idx);
- if (trawname)
- string_append_template_idx (trawname, idx);
- }
- }
- else
- {
- if ((r = consume_count (mangled)) <= 0
- || (int) strlen (*mangled) < r)
- {
- return (0);
- }
- is_java_array = (work -> options & DMGL_JAVA)
- && strncmp (*mangled, "JArray1Z", 8) == 0;
- if (! is_java_array)
- {
- string_appendn (tname, *mangled, r);
- }
- if (trawname)
- string_appendn (trawname, *mangled, r);
- *mangled += r;
- }
- }
- if (!is_java_array)
- string_append (tname, "<");
- /* get size of template parameter list */
- if (!get_count (mangled, &r))
- {
- return (0);
- }
- if (!is_type)
- {
- /* Create an array for saving the template argument values. */
- work->tmpl_argvec = (char**) xmalloc (r * sizeof (char *));
- work->ntmpl_args = r;
- for (i = 0; i < r; i++)
- work->tmpl_argvec[i] = 0;
- }
- for (i = 0; i < r; i++)
- {
- if (need_comma)
- {
- string_append (tname, ", ");
- }
- /* Z for type parameters */
- if (**mangled == 'Z')
- {
- (*mangled)++;
- /* temp is initialized in do_type */
- success = do_type (work, mangled, &temp);
- if (success)
- {
- string_appends (tname, &temp);
-
- if (!is_type)
- {
- /* Save the template argument. */
- int len = temp.p - temp.b;
- work->tmpl_argvec[i] = xmalloc (len + 1);
- memcpy (work->tmpl_argvec[i], temp.b, len);
- work->tmpl_argvec[i][len] = '\0';
- }
- }
- string_delete(&temp);
- if (!success)
- {
- break;
- }
- }
- /* z for template parameters */
- else if (**mangled == 'z')
- {
- int r2;
- (*mangled)++;
- success = demangle_template_template_parm (work, mangled, tname);
-
- if (success
- && (r2 = consume_count (mangled)) > 0
- && (int) strlen (*mangled) >= r2)
- {
- string_append (tname, " ");
- string_appendn (tname, *mangled, r2);
- if (!is_type)
- {
- /* Save the template argument. */
- int len = r2;
- work->tmpl_argvec[i] = xmalloc (len + 1);
- memcpy (work->tmpl_argvec[i], *mangled, len);
- work->tmpl_argvec[i][len] = '\0';
- }
- *mangled += r2;
- }
- if (!success)
- {
- break;
- }
- }
- else
- {
- string param;
- string* s;
-
- /* otherwise, value parameter */
-
- /* temp is initialized in do_type */
- success = do_type (work, mangled, &temp);
- string_delete(&temp);
- if (!success)
- break;
-
- if (!is_type)
- {
- s = &param;
- string_init (s);
- }
- else
- s = tname;
-
- success = demangle_template_value_parm (work, mangled, s,
- (type_kind_t) success);
-
- if (!success)
- {
- if (!is_type)
- string_delete (s);
- success = 0;
- break;
- }
-
- if (!is_type)
- {
- int len = s->p - s->b;
- work->tmpl_argvec[i] = xmalloc (len + 1);
- memcpy (work->tmpl_argvec[i], s->b, len);
- work->tmpl_argvec[i][len] = '\0';
-
- string_appends (tname, s);
- string_delete (s);
- }
- }
- need_comma = 1;
- }
- if (is_java_array)
- {
- string_append (tname, "[]");
- }
- else
- {
- if (tname->p[-1] == '>')
- string_append (tname, " ");
- string_append (tname, ">");
- }
-
- if (is_type && remember)
- remember_Btype (work, tname->b, LEN_STRING (tname), bindex);
-
- /*
- if (work -> static_type)
- {
- string_append (declp, *mangled + 1);
- *mangled += strlen (*mangled);
- success = 1;
- }
- else
- {
- success = demangle_args (work, mangled, declp);
- }
- }
- */
- return (success);
-}
-
-static int
-arm_pt (work, mangled, n, anchor, args)
- struct work_stuff *work;
- const char *mangled;
- int n;
- const char **anchor, **args;
-{
- /* Check if ARM template with "__pt__" in it ("parameterized type") */
- /* Allow HP also here, because HP's cfront compiler follows ARM to some extent */
- if ((ARM_DEMANGLING || HP_DEMANGLING) && (*anchor = strstr (mangled, "__pt__")))
- {
- int len;
- *args = *anchor + 6;
- len = consume_count (args);
- if (len == -1)
- return 0;
- if (*args + len == mangled + n && **args == '_')
- {
- ++*args;
- return 1;
- }
- }
- if (AUTO_DEMANGLING || EDG_DEMANGLING)
- {
- if ((*anchor = strstr (mangled, "__tm__"))
- || (*anchor = strstr (mangled, "__ps__"))
- || (*anchor = strstr (mangled, "__pt__")))
- {
- int len;
- *args = *anchor + 6;
- len = consume_count (args);
- if (len == -1)
- return 0;
- if (*args + len == mangled + n && **args == '_')
- {
- ++*args;
- return 1;
- }
- }
- else if ((*anchor = strstr (mangled, "__S")))
- {
- int len;
- *args = *anchor + 3;
- len = consume_count (args);
- if (len == -1)
- return 0;
- if (*args + len == mangled + n && **args == '_')
- {
- ++*args;
- return 1;
- }
- }
- }
-
- return 0;
-}
-
-static void
-demangle_arm_hp_template (work, mangled, n, declp)
- struct work_stuff *work;
- const char **mangled;
- int n;
- string *declp;
-{
- const char *p;
- const char *args;
- const char *e = *mangled + n;
- string arg;
-
- /* Check for HP aCC template spec: classXt1t2 where t1, t2 are
- template args */
- if (HP_DEMANGLING && ((*mangled)[n] == 'X'))
- {
- char *start_spec_args = NULL;
-
- /* First check for and omit template specialization pseudo-arguments,
- such as in "Spec<#1,#1.*>" */
- start_spec_args = strchr (*mangled, '<');
- if (start_spec_args && (start_spec_args - *mangled < n))
- string_appendn (declp, *mangled, start_spec_args - *mangled);
- else
- string_appendn (declp, *mangled, n);
- (*mangled) += n + 1;
- string_init (&arg);
- if (work->temp_start == -1) /* non-recursive call */
- work->temp_start = declp->p - declp->b;
- string_append (declp, "<");
- while (1)
- {
- string_clear (&arg);
- switch (**mangled)
- {
- case 'T':
- /* 'T' signals a type parameter */
- (*mangled)++;
- if (!do_type (work, mangled, &arg))
- goto hpacc_template_args_done;
- break;
-
- case 'U':
- case 'S':
- /* 'U' or 'S' signals an integral value */
- if (!do_hpacc_template_const_value (work, mangled, &arg))
- goto hpacc_template_args_done;
- break;
-
- case 'A':
- /* 'A' signals a named constant expression (literal) */
- if (!do_hpacc_template_literal (work, mangled, &arg))
- goto hpacc_template_args_done;
- break;
-
- default:
- /* Today, 1997-09-03, we have only the above types
- of template parameters */
- /* FIXME: maybe this should fail and return null */
- goto hpacc_template_args_done;
- }
- string_appends (declp, &arg);
- /* Check if we're at the end of template args.
- 0 if at end of static member of template class,
- _ if done with template args for a function */
- if ((**mangled == '\000') || (**mangled == '_'))
- break;
- else
- string_append (declp, ",");
- }
- hpacc_template_args_done:
- string_append (declp, ">");
- string_delete (&arg);
- if (**mangled == '_')
- (*mangled)++;
- return;
- }
- /* ARM template? (Also handles HP cfront extensions) */
- else if (arm_pt (work, *mangled, n, &p, &args))
- {
- string type_str;
-
- string_init (&arg);
- string_appendn (declp, *mangled, p - *mangled);
- if (work->temp_start == -1) /* non-recursive call */
- work->temp_start = declp->p - declp->b;
- string_append (declp, "<");
- /* should do error checking here */
- while (args < e) {
- string_clear (&arg);
-
- /* Check for type or literal here */
- switch (*args)
- {
- /* HP cfront extensions to ARM for template args */
- /* spec: Xt1Lv1 where t1 is a type, v1 is a literal value */
- /* FIXME: We handle only numeric literals for HP cfront */
- case 'X':
- /* A typed constant value follows */
- args++;
- if (!do_type (work, &args, &type_str))
- goto cfront_template_args_done;
- string_append (&arg, "(");
- string_appends (&arg, &type_str);
- string_append (&arg, ")");
- if (*args != 'L')
- goto cfront_template_args_done;
- args++;
- /* Now snarf a literal value following 'L' */
- if (!snarf_numeric_literal (&args, &arg))
- goto cfront_template_args_done;
- break;
-
- case 'L':
- /* Snarf a literal following 'L' */
- args++;
- if (!snarf_numeric_literal (&args, &arg))
- goto cfront_template_args_done;
- break;
- default:
- /* Not handling other HP cfront stuff */
- {
- const char* old_args = args;
- if (!do_type (work, &args, &arg))
- goto cfront_template_args_done;
-
- /* Fail if we didn't make any progress: prevent infinite loop. */
- if (args == old_args)
- return;
- }
- }
- string_appends (declp, &arg);
- string_append (declp, ",");
- }
- cfront_template_args_done:
- string_delete (&arg);
- if (args >= e)
- --declp->p; /* remove extra comma */
- string_append (declp, ">");
- }
- else if (n>10 && strncmp (*mangled, "_GLOBAL_", 8) == 0
- && (*mangled)[9] == 'N'
- && (*mangled)[8] == (*mangled)[10]
- && strchr (cplus_markers, (*mangled)[8]))
- {
- /* A member of the anonymous namespace. */
- string_append (declp, "{anonymous}");
- }
- else
- {
- if (work->temp_start == -1) /* non-recursive call only */
- work->temp_start = 0; /* disable in recursive calls */
- string_appendn (declp, *mangled, n);
- }
- *mangled += n;
-}
-
-/* Extract a class name, possibly a template with arguments, from the
- mangled string; qualifiers, local class indicators, etc. have
- already been dealt with */
-
-static int
-demangle_class_name (work, mangled, declp)
- struct work_stuff *work;
- const char **mangled;
- string *declp;
-{
- int n;
- int success = 0;
-
- n = consume_count (mangled);
- if (n == -1)
- return 0;
- if ((int) strlen (*mangled) >= n)
- {
- demangle_arm_hp_template (work, mangled, n, declp);
- success = 1;
- }
-
- return (success);
-}
-
-/*
-
-LOCAL FUNCTION
-
- demangle_class -- demangle a mangled class sequence
-
-SYNOPSIS
-
- static int
- demangle_class (struct work_stuff *work, const char **mangled,
- strint *declp)
-
-DESCRIPTION
-
- DECLP points to the buffer into which demangling is being done.
-
- *MANGLED points to the current token to be demangled. On input,
- it points to a mangled class (I.E. "3foo", "13verylongclass", etc.)
- On exit, it points to the next token after the mangled class on
- success, or the first unconsumed token on failure.
-
- If the CONSTRUCTOR or DESTRUCTOR flags are set in WORK, then
- we are demangling a constructor or destructor. In this case
- we prepend "class::class" or "class::~class" to DECLP.
-
- Otherwise, we prepend "class::" to the current DECLP.
-
- Reset the constructor/destructor flags once they have been
- "consumed". This allows demangle_class to be called later during
- the same demangling, to do normal class demangling.
-
- Returns 1 if demangling is successful, 0 otherwise.
-
-*/
-
-static int
-demangle_class (work, mangled, declp)
- struct work_stuff *work;
- const char **mangled;
- string *declp;
-{
- int success = 0;
- int btype;
- string class_name;
- char *save_class_name_end = 0;
-
- string_init (&class_name);
- btype = register_Btype (work);
- if (demangle_class_name (work, mangled, &class_name))
- {
- save_class_name_end = class_name.p;
- if ((work->constructor & 1) || (work->destructor & 1))
- {
- /* adjust so we don't include template args */
- if (work->temp_start && (work->temp_start != -1))
- {
- class_name.p = class_name.b + work->temp_start;
- }
- string_prepends (declp, &class_name);
- if (work -> destructor & 1)
- {
- string_prepend (declp, "~");
- work -> destructor -= 1;
- }
- else
- {
- work -> constructor -= 1;
- }
- }
- class_name.p = save_class_name_end;
- remember_Ktype (work, class_name.b, LEN_STRING(&class_name));
- remember_Btype (work, class_name.b, LEN_STRING(&class_name), btype);
- string_prepend (declp, SCOPE_STRING (work));
- string_prepends (declp, &class_name);
- success = 1;
- }
- string_delete (&class_name);
- return (success);
-}
-
-
-/* Called when there's a "__" in the mangled name, with `scan' pointing to
- the rightmost guess.
-
- Find the correct "__"-sequence where the function name ends and the
- signature starts, which is ambiguous with GNU mangling.
- Call demangle_signature here, so we can make sure we found the right
- one; *mangled will be consumed so caller will not make further calls to
- demangle_signature. */
-
-static int
-iterate_demangle_function (work, mangled, declp, scan)
- struct work_stuff *work;
- const char **mangled;
- string *declp;
- const char *scan;
-{
- const char *mangle_init = *mangled;
- int success = 0;
- string decl_init;
- struct work_stuff work_init;
-
- if (*(scan + 2) == '\0')
- return 0;
-
- /* Do not iterate for some demangling modes, or if there's only one
- "__"-sequence. This is the normal case. */
- if (ARM_DEMANGLING || LUCID_DEMANGLING || HP_DEMANGLING || EDG_DEMANGLING
- || strstr (scan + 2, "__") == NULL)
- {
- demangle_function_name (work, mangled, declp, scan);
- return 1;
- }
-
- /* Save state so we can restart if the guess at the correct "__" was
- wrong. */
- string_init (&decl_init);
- string_appends (&decl_init, declp);
- memset (&work_init, 0, sizeof work_init);
- work_stuff_copy_to_from (&work_init, work);
-
- /* Iterate over occurrences of __, allowing names and types to have a
- "__" sequence in them. We must start with the first (not the last)
- occurrence, since "__" most often occur between independent mangled
- parts, hence starting at the last occurence inside a signature
- might get us a "successful" demangling of the signature. */
-
- while (scan[2])
- {
- demangle_function_name (work, mangled, declp, scan);
- success = demangle_signature (work, mangled, declp);
- if (success)
- break;
-
- /* Reset demangle state for the next round. */
- *mangled = mangle_init;
- string_clear (declp);
- string_appends (declp, &decl_init);
- work_stuff_copy_to_from (work, &work_init);
-
- /* Leave this underscore-sequence. */
- scan += 2;
-
- /* Scan for the next "__" sequence. */
- while (*scan && (scan[0] != '_' || scan[1] != '_'))
- scan++;
-
- /* Move to last "__" in this sequence. */
- while (*scan && *scan == '_')
- scan++;
- scan -= 2;
- }
-
- /* Delete saved state. */
- delete_work_stuff (&work_init);
- string_delete (&decl_init);
-
- return success;
-}
-
-/*
-
-LOCAL FUNCTION
-
- demangle_prefix -- consume the mangled name prefix and find signature
-
-SYNOPSIS
-
- static int
- demangle_prefix (struct work_stuff *work, const char **mangled,
- string *declp);
-
-DESCRIPTION
-
- Consume and demangle the prefix of the mangled name.
- While processing the function name root, arrange to call
- demangle_signature if the root is ambiguous.
-
- DECLP points to the string buffer into which demangled output is
- placed. On entry, the buffer is empty. On exit it contains
- the root function name, the demangled operator name, or in some
- special cases either nothing or the completely demangled result.
-
- MANGLED points to the current pointer into the mangled name. As each
- token of the mangled name is consumed, it is updated. Upon entry
- the current mangled name pointer points to the first character of
- the mangled name. Upon exit, it should point to the first character
- of the signature if demangling was successful, or to the first
- unconsumed character if demangling of the prefix was unsuccessful.
-
- Returns 1 on success, 0 otherwise.
- */
-
-static int
-demangle_prefix (work, mangled, declp)
- struct work_stuff *work;
- const char **mangled;
- string *declp;
-{
- int success = 1;
- const char *scan;
- int i;
-
- if (strlen(*mangled) > 6
- && (strncmp(*mangled, "_imp__", 6) == 0
- || strncmp(*mangled, "__imp_", 6) == 0))
- {
- /* it's a symbol imported from a PE dynamic library. Check for both
- new style prefix _imp__ and legacy __imp_ used by older versions
- of dlltool. */
- (*mangled) += 6;
- work->dllimported = 1;
- }
- else if (strlen(*mangled) >= 11 && strncmp(*mangled, "_GLOBAL_", 8) == 0)
- {
- char *marker = strchr (cplus_markers, (*mangled)[8]);
- if (marker != NULL && *marker == (*mangled)[10])
- {
- if ((*mangled)[9] == 'D')
- {
- /* it's a GNU global destructor to be executed at program exit */
- (*mangled) += 11;
- work->destructor = 2;
- if (gnu_special (work, mangled, declp))
- return success;
- }
- else if ((*mangled)[9] == 'I')
- {
- /* it's a GNU global constructor to be executed at program init */
- (*mangled) += 11;
- work->constructor = 2;
- if (gnu_special (work, mangled, declp))
- return success;
- }
- }
- }
- else if ((ARM_DEMANGLING || HP_DEMANGLING || EDG_DEMANGLING) && strncmp(*mangled, "__std__", 7) == 0)
- {
- /* it's a ARM global destructor to be executed at program exit */
- (*mangled) += 7;
- work->destructor = 2;
- }
- else if ((ARM_DEMANGLING || HP_DEMANGLING || EDG_DEMANGLING) && strncmp(*mangled, "__sti__", 7) == 0)
- {
- /* it's a ARM global constructor to be executed at program initial */
- (*mangled) += 7;
- work->constructor = 2;
- }
-
- /* This block of code is a reduction in strength time optimization
- of:
- scan = strstr (*mangled, "__"); */
-
- {
- scan = *mangled;
-
- do {
- scan = strchr (scan, '_');
- } while (scan != NULL && *++scan != '_');
-
- if (scan != NULL) --scan;
- }
-
- if (scan != NULL)
- {
- /* We found a sequence of two or more '_', ensure that we start at
- the last pair in the sequence. */
- i = strspn (scan, "_");
- if (i > 2)
- {
- scan += (i - 2);
- }
- }
-
- if (scan == NULL)
- {
- success = 0;
- }
- else if (work -> static_type)
- {
- if (!ISDIGIT ((unsigned char)scan[0]) && (scan[0] != 't'))
- {
- success = 0;
- }
- }
- else if ((scan == *mangled)
- && (ISDIGIT ((unsigned char)scan[2]) || (scan[2] == 'Q')
- || (scan[2] == 't') || (scan[2] == 'K') || (scan[2] == 'H')))
- {
- /* The ARM says nothing about the mangling of local variables.
- But cfront mangles local variables by prepending __<nesting_level>
- to them. As an extension to ARM demangling we handle this case. */
- if ((LUCID_DEMANGLING || ARM_DEMANGLING || HP_DEMANGLING)
- && ISDIGIT ((unsigned char)scan[2]))
- {
- *mangled = scan + 2;
- consume_count (mangled);
- string_append (declp, *mangled);
- *mangled += strlen (*mangled);
- success = 1;
- }
- else
- {
- /* A GNU style constructor starts with __[0-9Qt]. But cfront uses
- names like __Q2_3foo3bar for nested type names. So don't accept
- this style of constructor for cfront demangling. A GNU
- style member-template constructor starts with 'H'. */
- if (!(LUCID_DEMANGLING || ARM_DEMANGLING || HP_DEMANGLING || EDG_DEMANGLING))
- work -> constructor += 1;
- *mangled = scan + 2;
- }
- }
- else if (ARM_DEMANGLING && scan[2] == 'p' && scan[3] == 't')
- {
- /* Cfront-style parameterized type. Handled later as a signature. */
- success = 1;
-
- /* ARM template? */
- demangle_arm_hp_template (work, mangled, strlen (*mangled), declp);
- }
- else if (EDG_DEMANGLING && ((scan[2] == 't' && scan[3] == 'm')
- || (scan[2] == 'p' && scan[3] == 's')
- || (scan[2] == 'p' && scan[3] == 't')))
- {
- /* EDG-style parameterized type. Handled later as a signature. */
- success = 1;
-
- /* EDG template? */
- demangle_arm_hp_template (work, mangled, strlen (*mangled), declp);
- }
- else if ((scan == *mangled) && !ISDIGIT ((unsigned char)scan[2])
- && (scan[2] != 't'))
- {
- /* Mangled name starts with "__". Skip over any leading '_' characters,
- then find the next "__" that separates the prefix from the signature.
- */
- if (!(ARM_DEMANGLING || LUCID_DEMANGLING || HP_DEMANGLING || EDG_DEMANGLING)
- || (arm_special (mangled, declp) == 0))
- {
- while (*scan == '_')
- {
- scan++;
- }
- if ((scan = strstr (scan, "__")) == NULL || (*(scan + 2) == '\0'))
- {
- /* No separator (I.E. "__not_mangled"), or empty signature
- (I.E. "__not_mangled_either__") */
- success = 0;
- }
- else
- return iterate_demangle_function (work, mangled, declp, scan);
- }
- }
- else if (*(scan + 2) != '\0')
- {
- /* Mangled name does not start with "__" but does have one somewhere
- in there with non empty stuff after it. Looks like a global
- function name. Iterate over all "__":s until the right
- one is found. */
- return iterate_demangle_function (work, mangled, declp, scan);
- }
- else
- {
- /* Doesn't look like a mangled name */
- success = 0;
- }
-
- if (!success && (work->constructor == 2 || work->destructor == 2))
- {
- string_append (declp, *mangled);
- *mangled += strlen (*mangled);
- success = 1;
- }
- return (success);
-}
-
-/*
-
-LOCAL FUNCTION
-
- gnu_special -- special handling of gnu mangled strings
-
-SYNOPSIS
-
- static int
- gnu_special (struct work_stuff *work, const char **mangled,
- string *declp);
-
-
-DESCRIPTION
-
- Process some special GNU style mangling forms that don't fit
- the normal pattern. For example:
-
- _$_3foo (destructor for class foo)
- _vt$foo (foo virtual table)
- _vt$foo$bar (foo::bar virtual table)
- __vt_foo (foo virtual table, new style with thunks)
- _3foo$varname (static data member)
- _Q22rs2tu$vw (static data member)
- __t6vector1Zii (constructor with template)
- __thunk_4__$_7ostream (virtual function thunk)
- */
-
-static int
-gnu_special (work, mangled, declp)
- struct work_stuff *work;
- const char **mangled;
- string *declp;
-{
- int n;
- int success = 1;
- const char *p;
-
- if ((*mangled)[0] == '_'
- && strchr (cplus_markers, (*mangled)[1]) != NULL
- && (*mangled)[2] == '_')
- {
- /* Found a GNU style destructor, get past "_<CPLUS_MARKER>_" */
- (*mangled) += 3;
- work -> destructor += 1;
- }
- else if ((*mangled)[0] == '_'
- && (((*mangled)[1] == '_'
- && (*mangled)[2] == 'v'
- && (*mangled)[3] == 't'
- && (*mangled)[4] == '_')
- || ((*mangled)[1] == 'v'
- && (*mangled)[2] == 't'
- && strchr (cplus_markers, (*mangled)[3]) != NULL)))
- {
- /* Found a GNU style virtual table, get past "_vt<CPLUS_MARKER>"
- and create the decl. Note that we consume the entire mangled
- input string, which means that demangle_signature has no work
- to do. */
- if ((*mangled)[2] == 'v')
- (*mangled) += 5; /* New style, with thunks: "__vt_" */
- else
- (*mangled) += 4; /* Old style, no thunks: "_vt<CPLUS_MARKER>" */
- while (**mangled != '\0')
- {
- switch (**mangled)
- {
- case 'Q':
- case 'K':
- success = demangle_qualified (work, mangled, declp, 0, 1);
- break;
- case 't':
- success = demangle_template (work, mangled, declp, 0, 1,
- 1);
- break;
- default:
- if (ISDIGIT((unsigned char)*mangled[0]))
- {
- n = consume_count(mangled);
- /* We may be seeing a too-large size, or else a
- ".<digits>" indicating a static local symbol. In
- any case, declare victory and move on; *don't* try
- to use n to allocate. */
- if (n > (int) strlen (*mangled))
- {
- success = 1;
- break;
- }
- }
- else
- {
- n = strcspn (*mangled, cplus_markers);
- }
- string_appendn (declp, *mangled, n);
- (*mangled) += n;
- }
-
- p = strpbrk (*mangled, cplus_markers);
- if (success && ((p == NULL) || (p == *mangled)))
- {
- if (p != NULL)
- {
- string_append (declp, SCOPE_STRING (work));
- (*mangled)++;
- }
- }
- else
- {
- success = 0;
- break;
- }
- }
- if (success)
- string_append (declp, " virtual table");
- }
- else if ((*mangled)[0] == '_'
- && (strchr("0123456789Qt", (*mangled)[1]) != NULL)
- && (p = strpbrk (*mangled, cplus_markers)) != NULL)
- {
- /* static data member, "_3foo$varname" for example */
- (*mangled)++;
- switch (**mangled)
- {
- case 'Q':
- case 'K':
- success = demangle_qualified (work, mangled, declp, 0, 1);
- break;
- case 't':
- success = demangle_template (work, mangled, declp, 0, 1, 1);
- break;
- default:
- n = consume_count (mangled);
- if (n < 0 || n > (long) strlen (*mangled))
- {
- success = 0;
- break;
- }
-
- if (n > 10 && strncmp (*mangled, "_GLOBAL_", 8) == 0
- && (*mangled)[9] == 'N'
- && (*mangled)[8] == (*mangled)[10]
- && strchr (cplus_markers, (*mangled)[8]))
- {
- /* A member of the anonymous namespace. There's information
- about what identifier or filename it was keyed to, but
- it's just there to make the mangled name unique; we just
- step over it. */
- string_append (declp, "{anonymous}");
- (*mangled) += n;
-
- /* Now p points to the marker before the N, so we need to
- update it to the first marker after what we consumed. */
- p = strpbrk (*mangled, cplus_markers);
- break;
- }
-
- string_appendn (declp, *mangled, n);
- (*mangled) += n;
- }
- if (success && (p == *mangled))
- {
- /* Consumed everything up to the cplus_marker, append the
- variable name. */
- (*mangled)++;
- string_append (declp, SCOPE_STRING (work));
- n = strlen (*mangled);
- string_appendn (declp, *mangled, n);
- (*mangled) += n;
- }
- else
- {
- success = 0;
- }
- }
- else if (strncmp (*mangled, "__thunk_", 8) == 0)
- {
- int delta;
-
- (*mangled) += 8;
- delta = consume_count (mangled);
- if (delta == -1)
- success = 0;
- else
- {
- char *method = internal_cplus_demangle (work, ++*mangled);
-
- if (method)
- {
- char buf[50];
- sprintf (buf, "virtual function thunk (delta:%d) for ", -delta);
- string_append (declp, buf);
- string_append (declp, method);
- free (method);
- n = strlen (*mangled);
- (*mangled) += n;
- }
- else
- {
- success = 0;
- }
- }
- }
- else if (strncmp (*mangled, "__t", 3) == 0
- && ((*mangled)[3] == 'i' || (*mangled)[3] == 'f'))
- {
- p = (*mangled)[3] == 'i' ? " type_info node" : " type_info function";
- (*mangled) += 4;
- switch (**mangled)
- {
- case 'Q':
- case 'K':
- success = demangle_qualified (work, mangled, declp, 0, 1);
- break;
- case 't':
- success = demangle_template (work, mangled, declp, 0, 1, 1);
- break;
- default:
- success = do_type (work, mangled, declp);
- break;
- }
- if (success && **mangled != '\0')
- success = 0;
- if (success)
- string_append (declp, p);
- }
- else
- {
- success = 0;
- }
- return (success);
-}
-
-static void
-recursively_demangle(work, mangled, result, namelength)
- struct work_stuff *work;
- const char **mangled;
- string *result;
- int namelength;
-{
- char * recurse = (char *)NULL;
- char * recurse_dem = (char *)NULL;
-
- recurse = (char *) xmalloc (namelength + 1);
- memcpy (recurse, *mangled, namelength);
- recurse[namelength] = '\000';
-
- recurse_dem = cplus_demangle (recurse, work->options);
-
- if (recurse_dem)
- {
- string_append (result, recurse_dem);
- free (recurse_dem);
- }
- else
- {
- string_appendn (result, *mangled, namelength);
- }
- free (recurse);
- *mangled += namelength;
-}
-
-/*
-
-LOCAL FUNCTION
-
- arm_special -- special handling of ARM/lucid mangled strings
-
-SYNOPSIS
-
- static int
- arm_special (const char **mangled,
- string *declp);
-
-
-DESCRIPTION
-
- Process some special ARM style mangling forms that don't fit
- the normal pattern. For example:
-
- __vtbl__3foo (foo virtual table)
- __vtbl__3foo__3bar (bar::foo virtual table)
-
- */
-
-static int
-arm_special (mangled, declp)
- const char **mangled;
- string *declp;
-{
- int n;
- int success = 1;
- const char *scan;
-
- if (strncmp (*mangled, ARM_VTABLE_STRING, ARM_VTABLE_STRLEN) == 0)
- {
- /* Found a ARM style virtual table, get past ARM_VTABLE_STRING
- and create the decl. Note that we consume the entire mangled
- input string, which means that demangle_signature has no work
- to do. */
- scan = *mangled + ARM_VTABLE_STRLEN;
- while (*scan != '\0') /* first check it can be demangled */
- {
- n = consume_count (&scan);
- if (n == -1)
- {
- return (0); /* no good */
- }
- scan += n;
- if (scan[0] == '_' && scan[1] == '_')
- {
- scan += 2;
- }
- }
- (*mangled) += ARM_VTABLE_STRLEN;
- while (**mangled != '\0')
- {
- n = consume_count (mangled);
- if (n == -1
- || n > (long) strlen (*mangled))
- return 0;
- string_prependn (declp, *mangled, n);
- (*mangled) += n;
- if ((*mangled)[0] == '_' && (*mangled)[1] == '_')
- {
- string_prepend (declp, "::");
- (*mangled) += 2;
- }
- }
- string_append (declp, " virtual table");
- }
- else
- {
- success = 0;
- }
- return (success);
-}
-
-/*
-
-LOCAL FUNCTION
-
- demangle_qualified -- demangle 'Q' qualified name strings
-
-SYNOPSIS
-
- static int
- demangle_qualified (struct work_stuff *, const char *mangled,
- string *result, int isfuncname, int append);
-
-DESCRIPTION
-
- Demangle a qualified name, such as "Q25Outer5Inner" which is
- the mangled form of "Outer::Inner". The demangled output is
- prepended or appended to the result string according to the
- state of the append flag.
-
- If isfuncname is nonzero, then the qualified name we are building
- is going to be used as a member function name, so if it is a
- constructor or destructor function, append an appropriate
- constructor or destructor name. I.E. for the above example,
- the result for use as a constructor is "Outer::Inner::Inner"
- and the result for use as a destructor is "Outer::Inner::~Inner".
-
-BUGS
-
- Numeric conversion is ASCII dependent (FIXME).
-
- */
-
-static int
-demangle_qualified (work, mangled, result, isfuncname, append)
- struct work_stuff *work;
- const char **mangled;
- string *result;
- int isfuncname;
- int append;
-{
- int qualifiers = 0;
- int success = 1;
- char num[2];
- string temp;
- string last_name;
- int bindex = register_Btype (work);
-
- /* We only make use of ISFUNCNAME if the entity is a constructor or
- destructor. */
- isfuncname = (isfuncname
- && ((work->constructor & 1) || (work->destructor & 1)));
-
- string_init (&temp);
- string_init (&last_name);
-
- if ((*mangled)[0] == 'K')
- {
- /* Squangling qualified name reuse */
- int idx;
- (*mangled)++;
- idx = consume_count_with_underscores (mangled);
- if (idx == -1 || idx >= work -> numk)
- success = 0;
- else
- string_append (&temp, work -> ktypevec[idx]);
- }
- else
- switch ((*mangled)[1])
- {
- case '_':
- /* GNU mangled name with more than 9 classes. The count is preceded
- by an underscore (to distinguish it from the <= 9 case) and followed
- by an underscore. */
- (*mangled)++;
- qualifiers = consume_count_with_underscores (mangled);
- if (qualifiers == -1)
- success = 0;
- break;
-
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- /* The count is in a single digit. */
- num[0] = (*mangled)[1];
- num[1] = '\0';
- qualifiers = atoi (num);
-
- /* If there is an underscore after the digit, skip it. This is
- said to be for ARM-qualified names, but the ARM makes no
- mention of such an underscore. Perhaps cfront uses one. */
- if ((*mangled)[2] == '_')
- {
- (*mangled)++;
- }
- (*mangled) += 2;
- break;
-
- case '0':
- default:
- success = 0;
- }
-
- if (!success)
- return success;
-
- /* Pick off the names and collect them in the temp buffer in the order
- in which they are found, separated by '::'. */
-
- while (qualifiers-- > 0)
- {
- int remember_K = 1;
- string_clear (&last_name);
-
- if (*mangled[0] == '_')
- (*mangled)++;
-
- if (*mangled[0] == 't')
- {
- /* Here we always append to TEMP since we will want to use
- the template name without the template parameters as a
- constructor or destructor name. The appropriate
- (parameter-less) value is returned by demangle_template
- in LAST_NAME. We do not remember the template type here,
- in order to match the G++ mangling algorithm. */
- success = demangle_template(work, mangled, &temp,
- &last_name, 1, 0);
- if (!success)
- break;
- }
- else if (*mangled[0] == 'K')
- {
- int idx;
- (*mangled)++;
- idx = consume_count_with_underscores (mangled);
- if (idx == -1 || idx >= work->numk)
- success = 0;
- else
- string_append (&temp, work->ktypevec[idx]);
- remember_K = 0;
-
- if (!success) break;
- }
- else
- {
- if (EDG_DEMANGLING)
- {
- int namelength;
- /* Now recursively demangle the qualifier
- * This is necessary to deal with templates in
- * mangling styles like EDG */
- namelength = consume_count (mangled);
- if (namelength == -1)
- {
- success = 0;
- break;
- }
- recursively_demangle(work, mangled, &temp, namelength);
- }
- else
- {
- success = do_type (work, mangled, &last_name);
- if (!success)
- break;
- string_appends (&temp, &last_name);
- }
- }
-
- if (remember_K)
- remember_Ktype (work, temp.b, LEN_STRING (&temp));
-
- if (qualifiers > 0)
- string_append (&temp, SCOPE_STRING (work));
- }
-
- remember_Btype (work, temp.b, LEN_STRING (&temp), bindex);
-
- /* If we are using the result as a function name, we need to append
- the appropriate '::' separated constructor or destructor name.
- We do this here because this is the most convenient place, where
- we already have a pointer to the name and the length of the name. */
-
- if (isfuncname)
- {
- string_append (&temp, SCOPE_STRING (work));
- if (work -> destructor & 1)
- string_append (&temp, "~");
- string_appends (&temp, &last_name);
- }
-
- /* Now either prepend the temp buffer to the result, or append it,
- depending upon the state of the append flag. */
-
- if (append)
- string_appends (result, &temp);
- else
- {
- if (!STRING_EMPTY (result))
- string_append (&temp, SCOPE_STRING (work));
- string_prepends (result, &temp);
- }
-
- string_delete (&last_name);
- string_delete (&temp);
- return (success);
-}
-
-/*
-
-LOCAL FUNCTION
-
- get_count -- convert an ascii count to integer, consuming tokens
-
-SYNOPSIS
-
- static int
- get_count (const char **type, int *count)
-
-DESCRIPTION
-
- Assume that *type points at a count in a mangled name; set
- *count to its value, and set *type to the next character after
- the count. There are some weird rules in effect here.
-
- If *type does not point at a string of digits, return zero.
-
- If *type points at a string of digits followed by an
- underscore, set *count to their value as an integer, advance
- *type to point *after the underscore, and return 1.
-
- If *type points at a string of digits not followed by an
- underscore, consume only the first digit. Set *count to its
- value as an integer, leave *type pointing after that digit,
- and return 1.
-
- The excuse for this odd behavior: in the ARM and HP demangling
- styles, a type can be followed by a repeat count of the form
- `Nxy', where:
-
- `x' is a single digit specifying how many additional copies
- of the type to append to the argument list, and
-
- `y' is one or more digits, specifying the zero-based index of
- the first repeated argument in the list. Yes, as you're
- unmangling the name you can figure this out yourself, but
- it's there anyway.
-
- So, for example, in `bar__3fooFPiN51', the first argument is a
- pointer to an integer (`Pi'), and then the next five arguments
- are the same (`N5'), and the first repeat is the function's
- second argument (`1').
-*/
-
-static int
-get_count (type, count)
- const char **type;
- int *count;
-{
- const char *p;
- int n;
-
- if (!ISDIGIT ((unsigned char)**type))
- return (0);
- else
- {
- *count = **type - '0';
- (*type)++;
- if (ISDIGIT ((unsigned char)**type))
- {
- p = *type;
- n = *count;
- do
- {
- n *= 10;
- n += *p - '0';
- p++;
- }
- while (ISDIGIT ((unsigned char)*p));
- if (*p == '_')
- {
- *type = p + 1;
- *count = n;
- }
- }
- }
- return (1);
-}
-
-/* RESULT will be initialised here; it will be freed on failure. The
- value returned is really a type_kind_t. */
-
-static int
-do_type (work, mangled, result)
- struct work_stuff *work;
- const char **mangled;
- string *result;
-{
- int n;
- int done;
- int success;
- string decl;
- const char *remembered_type;
- int type_quals;
- string btype;
- type_kind_t tk = tk_none;
-
- string_init (&btype);
- string_init (&decl);
- string_init (result);
-
- done = 0;
- success = 1;
- while (success && !done)
- {
- int member;
- switch (**mangled)
- {
-
- /* A pointer type */
- case 'P':
- case 'p':
- (*mangled)++;
- if (! (work -> options & DMGL_JAVA))
- string_prepend (&decl, "*");
- if (tk == tk_none)
- tk = tk_pointer;
- break;
-
- /* A reference type */
- case 'R':
- (*mangled)++;
- string_prepend (&decl, "&");
- if (tk == tk_none)
- tk = tk_reference;
- break;
-
- /* An array */
- case 'A':
- {
- ++(*mangled);
- if (!STRING_EMPTY (&decl)
- && (decl.b[0] == '*' || decl.b[0] == '&'))
- {
- string_prepend (&decl, "(");
- string_append (&decl, ")");
- }
- string_append (&decl, "[");
- if (**mangled != '_')
- success = demangle_template_value_parm (work, mangled, &decl,
- tk_integral);
- if (**mangled == '_')
- ++(*mangled);
- string_append (&decl, "]");
- break;
- }
-
- /* A back reference to a previously seen type */
- case 'T':
- (*mangled)++;
- if (!get_count (mangled, &n) || n >= work -> ntypes)
- {
- success = 0;
- }
- else
- {
- remembered_type = work -> typevec[n];
- mangled = &remembered_type;
- }
- break;
-
- /* A function */
- case 'F':
- (*mangled)++;
- if (!STRING_EMPTY (&decl)
- && (decl.b[0] == '*' || decl.b[0] == '&'))
- {
- string_prepend (&decl, "(");
- string_append (&decl, ")");
- }
- /* After picking off the function args, we expect to either find the
- function return type (preceded by an '_') or the end of the
- string. */
- if (!demangle_nested_args (work, mangled, &decl)
- || (**mangled != '_' && **mangled != '\0'))
- {
- success = 0;
- break;
- }
- if (success && (**mangled == '_'))
- (*mangled)++;
- break;
-
- case 'M':
- case 'O':
- {
- type_quals = TYPE_UNQUALIFIED;
-
- member = **mangled == 'M';
- (*mangled)++;
-
- string_append (&decl, ")");
-
- /* We don't need to prepend `::' for a qualified name;
- demangle_qualified will do that for us. */
- if (**mangled != 'Q')
- string_prepend (&decl, SCOPE_STRING (work));
-
- if (ISDIGIT ((unsigned char)**mangled))
- {
- n = consume_count (mangled);
- if (n == -1
- || (int) strlen (*mangled) < n)
- {
- success = 0;
- break;
- }
- string_prependn (&decl, *mangled, n);
- *mangled += n;
- }
- else if (**mangled == 'X' || **mangled == 'Y')
- {
- string temp;
- do_type (work, mangled, &temp);
- string_prepends (&decl, &temp);
- }
- else if (**mangled == 't')
- {
- string temp;
- string_init (&temp);
- success = demangle_template (work, mangled, &temp,
- NULL, 1, 1);
- if (success)
- {
- string_prependn (&decl, temp.b, temp.p - temp.b);
- string_clear (&temp);
- }
- else
- break;
- }
- else if (**mangled == 'Q')
- {
- success = demangle_qualified (work, mangled, &decl,
- /*isfuncnam=*/0,
- /*append=*/0);
- if (!success)
- break;
- }
- else
- {
- success = 0;
- break;
- }
-
- string_prepend (&decl, "(");
- if (member)
- {
- switch (**mangled)
- {
- case 'C':
- case 'V':
- case 'u':
- type_quals |= code_for_qualifier (**mangled);
- (*mangled)++;
- break;
-
- default:
- break;
- }
-
- if (*(*mangled)++ != 'F')
- {
- success = 0;
- break;
- }
- }
- if ((member && !demangle_nested_args (work, mangled, &decl))
- || **mangled != '_')
- {
- success = 0;
- break;
- }
- (*mangled)++;
- if (! PRINT_ANSI_QUALIFIERS)
- {
- break;
- }
- if (type_quals != TYPE_UNQUALIFIED)
- {
- APPEND_BLANK (&decl);
- string_append (&decl, qualifier_string (type_quals));
- }
- break;
- }
- case 'G':
- (*mangled)++;
- break;
-
- case 'C':
- case 'V':
- case 'u':
- if (PRINT_ANSI_QUALIFIERS)
- {
- if (!STRING_EMPTY (&decl))
- string_prepend (&decl, " ");
-
- string_prepend (&decl, demangle_qualifier (**mangled));
- }
- (*mangled)++;
- break;
- /*
- }
- */
-
- /* fall through */
- default:
- done = 1;
- break;
- }
- }
-
- if (success) switch (**mangled)
- {
- /* A qualified name, such as "Outer::Inner". */
- case 'Q':
- case 'K':
- {
- success = demangle_qualified (work, mangled, result, 0, 1);
- break;
- }
-
- /* A back reference to a previously seen squangled type */
- case 'B':
- (*mangled)++;
- if (!get_count (mangled, &n) || n >= work -> numb)
- success = 0;
- else
- string_append (result, work->btypevec[n]);
- break;
-
- case 'X':
- case 'Y':
- /* A template parm. We substitute the corresponding argument. */
- {
- int idx;
-
- (*mangled)++;
- idx = consume_count_with_underscores (mangled);
-
- if (idx == -1
- || (work->tmpl_argvec && idx >= work->ntmpl_args)
- || consume_count_with_underscores (mangled) == -1)
- {
- success = 0;
- break;
- }
-
- if (work->tmpl_argvec)
- string_append (result, work->tmpl_argvec[idx]);
- else
- string_append_template_idx (result, idx);
-
- success = 1;
- }
- break;
-
- default:
- success = demangle_fund_type (work, mangled, result);
- if (tk == tk_none)
- tk = (type_kind_t) success;
- break;
- }
-
- if (success)
- {
- if (!STRING_EMPTY (&decl))
- {
- string_append (result, " ");
- string_appends (result, &decl);
- }
- }
- else
- string_delete (result);
- string_delete (&decl);
-
- if (success)
- /* Assume an integral type, if we're not sure. */
- return (int) ((tk == tk_none) ? tk_integral : tk);
- else
- return 0;
-}
-
-/* Given a pointer to a type string that represents a fundamental type
- argument (int, long, unsigned int, etc) in TYPE, a pointer to the
- string in which the demangled output is being built in RESULT, and
- the WORK structure, decode the types and add them to the result.
-
- For example:
-
- "Ci" => "const int"
- "Sl" => "signed long"
- "CUs" => "const unsigned short"
-
- The value returned is really a type_kind_t. */
-
-static int
-demangle_fund_type (work, mangled, result)
- struct work_stuff *work;
- const char **mangled;
- string *result;
-{
- int done = 0;
- int success = 1;
- char buf[10];
- unsigned int dec = 0;
- string btype;
- type_kind_t tk = tk_integral;
-
- string_init (&btype);
-
- /* First pick off any type qualifiers. There can be more than one. */
-
- while (!done)
- {
- switch (**mangled)
- {
- case 'C':
- case 'V':
- case 'u':
- if (PRINT_ANSI_QUALIFIERS)
- {
- if (!STRING_EMPTY (result))
- string_prepend (result, " ");
- string_prepend (result, demangle_qualifier (**mangled));
- }
- (*mangled)++;
- break;
- case 'U':
- (*mangled)++;
- APPEND_BLANK (result);
- string_append (result, "unsigned");
- break;
- case 'S': /* signed char only */
- (*mangled)++;
- APPEND_BLANK (result);
- string_append (result, "signed");
- break;
- case 'J':
- (*mangled)++;
- APPEND_BLANK (result);
- string_append (result, "__complex");
- break;
- default:
- done = 1;
- break;
- }
- }
-
- /* Now pick off the fundamental type. There can be only one. */
-
- switch (**mangled)
- {
- case '\0':
- case '_':
- break;
- case 'v':
- (*mangled)++;
- APPEND_BLANK (result);
- string_append (result, "void");
- break;
- case 'x':
- (*mangled)++;
- APPEND_BLANK (result);
- string_append (result, "long long");
- break;
- case 'l':
- (*mangled)++;
- APPEND_BLANK (result);
- string_append (result, "long");
- break;
- case 'i':
- (*mangled)++;
- APPEND_BLANK (result);
- string_append (result, "int");
- break;
- case 's':
- (*mangled)++;
- APPEND_BLANK (result);
- string_append (result, "short");
- break;
- case 'b':
- (*mangled)++;
- APPEND_BLANK (result);
- string_append (result, "bool");
- tk = tk_bool;
- break;
- case 'c':
- (*mangled)++;
- APPEND_BLANK (result);
- string_append (result, "char");
- tk = tk_char;
- break;
- case 'w':
- (*mangled)++;
- APPEND_BLANK (result);
- string_append (result, "wchar_t");
- tk = tk_char;
- break;
- case 'r':
- (*mangled)++;
- APPEND_BLANK (result);
- string_append (result, "long double");
- tk = tk_real;
- break;
- case 'd':
- (*mangled)++;
- APPEND_BLANK (result);
- string_append (result, "double");
- tk = tk_real;
- break;
- case 'f':
- (*mangled)++;
- APPEND_BLANK (result);
- string_append (result, "float");
- tk = tk_real;
- break;
- case 'G':
- (*mangled)++;
- if (!ISDIGIT ((unsigned char)**mangled))
- {
- success = 0;
- break;
- }
- case 'I':
- (*mangled)++;
- if (**mangled == '_')
- {
- int i;
- (*mangled)++;
- for (i = 0;
- i < (long) sizeof (buf) - 1 && **mangled && **mangled != '_';
- (*mangled)++, i++)
- buf[i] = **mangled;
- if (**mangled != '_')
- {
- success = 0;
- break;
- }
- buf[i] = '\0';
- (*mangled)++;
- }
- else
- {
- strncpy (buf, *mangled, 2);
- buf[2] = '\0';
- *mangled += min (strlen (*mangled), 2);
- }
- sscanf (buf, "%x", &dec);
- sprintf (buf, "int%u_t", dec);
- APPEND_BLANK (result);
- string_append (result, buf);
- break;
-
- /* fall through */
- /* An explicit type, such as "6mytype" or "7integer" */
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- {
- int bindex = register_Btype (work);
- string btype;
- string_init (&btype);
- if (demangle_class_name (work, mangled, &btype)) {
- remember_Btype (work, btype.b, LEN_STRING (&btype), bindex);
- APPEND_BLANK (result);
- string_appends (result, &btype);
- }
- else
- success = 0;
- string_delete (&btype);
- break;
- }
- case 't':
- {
- success = demangle_template (work, mangled, &btype, 0, 1, 1);
- string_appends (result, &btype);
- break;
- }
- default:
- success = 0;
- break;
- }
-
- return success ? ((int) tk) : 0;
-}
-
-
-/* Handle a template's value parameter for HP aCC (extension from ARM)
- **mangled points to 'S' or 'U' */
-
-static int
-do_hpacc_template_const_value (work, mangled, result)
- struct work_stuff *work ATTRIBUTE_UNUSED;
- const char **mangled;
- string *result;
-{
- int unsigned_const;
-
- if (**mangled != 'U' && **mangled != 'S')
- return 0;
-
- unsigned_const = (**mangled == 'U');
-
- (*mangled)++;
-
- switch (**mangled)
- {
- case 'N':
- string_append (result, "-");
- /* fall through */
- case 'P':
- (*mangled)++;
- break;
- case 'M':
- /* special case for -2^31 */
- string_append (result, "-2147483648");
- (*mangled)++;
- return 1;
- default:
- return 0;
- }
-
- /* We have to be looking at an integer now */
- if (!(ISDIGIT ((unsigned char)**mangled)))
- return 0;
-
- /* We only deal with integral values for template
- parameters -- so it's OK to look only for digits */
- while (ISDIGIT ((unsigned char)**mangled))
- {
- char_str[0] = **mangled;
- string_append (result, char_str);
- (*mangled)++;
- }
-
- if (unsigned_const)
- string_append (result, "U");
-
- /* FIXME? Some day we may have 64-bit (or larger :-) ) constants
- with L or LL suffixes. pai/1997-09-03 */
-
- return 1; /* success */
-}
-
-/* Handle a template's literal parameter for HP aCC (extension from ARM)
- **mangled is pointing to the 'A' */
-
-static int
-do_hpacc_template_literal (work, mangled, result)
- struct work_stuff *work;
- const char **mangled;
- string *result;
-{
- int literal_len = 0;
- char * recurse;
- char * recurse_dem;
-
- if (**mangled != 'A')
- return 0;
-
- (*mangled)++;
-
- literal_len = consume_count (mangled);
-
- if (literal_len <= 0)
- return 0;
-
- /* Literal parameters are names of arrays, functions, etc. and the
- canonical representation uses the address operator */
- string_append (result, "&");
-
- /* Now recursively demangle the literal name */
- recurse = (char *) xmalloc (literal_len + 1);
- memcpy (recurse, *mangled, literal_len);
- recurse[literal_len] = '\000';
-
- recurse_dem = cplus_demangle (recurse, work->options);
-
- if (recurse_dem)
- {
- string_append (result, recurse_dem);
- free (recurse_dem);
- }
- else
- {
- string_appendn (result, *mangled, literal_len);
- }
- (*mangled) += literal_len;
- free (recurse);
-
- return 1;
-}
-
-static int
-snarf_numeric_literal (args, arg)
- const char ** args;
- string * arg;
-{
- if (**args == '-')
- {
- char_str[0] = '-';
- string_append (arg, char_str);
- (*args)++;
- }
- else if (**args == '+')
- (*args)++;
-
- if (!ISDIGIT ((unsigned char)**args))
- return 0;
-
- while (ISDIGIT ((unsigned char)**args))
- {
- char_str[0] = **args;
- string_append (arg, char_str);
- (*args)++;
- }
-
- return 1;
-}
-
-/* Demangle the next argument, given by MANGLED into RESULT, which
- *should be an uninitialized* string. It will be initialized here,
- and free'd should anything go wrong. */
-
-static int
-do_arg (work, mangled, result)
- struct work_stuff *work;
- const char **mangled;
- string *result;
-{
- /* Remember where we started so that we can record the type, for
- non-squangling type remembering. */
- const char *start = *mangled;
-
- string_init (result);
-
- if (work->nrepeats > 0)
- {
- --work->nrepeats;
-
- if (work->previous_argument == 0)
- return 0;
-
- /* We want to reissue the previous type in this argument list. */
- string_appends (result, work->previous_argument);
- return 1;
- }
-
- if (**mangled == 'n')
- {
- /* A squangling-style repeat. */
- (*mangled)++;
- work->nrepeats = consume_count(mangled);
-
- if (work->nrepeats <= 0)
- /* This was not a repeat count after all. */
- return 0;
-
- if (work->nrepeats > 9)
- {
- if (**mangled != '_')
- /* The repeat count should be followed by an '_' in this
- case. */
- return 0;
- else
- (*mangled)++;
- }
-
- /* Now, the repeat is all set up. */
- return do_arg (work, mangled, result);
- }
-
- /* Save the result in WORK->previous_argument so that we can find it
- if it's repeated. Note that saving START is not good enough: we
- do not want to add additional types to the back-referenceable
- type vector when processing a repeated type. */
- if (work->previous_argument)
- string_clear (work->previous_argument);
- else
- {
- work->previous_argument = (string*) xmalloc (sizeof (string));
- string_init (work->previous_argument);
- }
-
- if (!do_type (work, mangled, work->previous_argument))
- return 0;
-
- string_appends (result, work->previous_argument);
-
- remember_type (work, start, *mangled - start);
- return 1;
-}
-
-static void
-remember_type (work, start, len)
- struct work_stuff *work;
- const char *start;
- int len;
-{
- char *tem;
-
- if (work->forgetting_types)
- return;
-
- if (work -> ntypes >= work -> typevec_size)
- {
- if (work -> typevec_size == 0)
- {
- work -> typevec_size = 3;
- work -> typevec
- = (char **) xmalloc (sizeof (char *) * work -> typevec_size);
- }
- else
- {
- work -> typevec_size *= 2;
- work -> typevec
- = (char **) xrealloc ((char *)work -> typevec,
- sizeof (char *) * work -> typevec_size);
- }
- }
- tem = xmalloc (len + 1);
- memcpy (tem, start, len);
- tem[len] = '\0';
- work -> typevec[work -> ntypes++] = tem;
-}
-
-
-/* Remember a K type class qualifier. */
-static void
-remember_Ktype (work, start, len)
- struct work_stuff *work;
- const char *start;
- int len;
-{
- char *tem;
-
- if (work -> numk >= work -> ksize)
- {
- if (work -> ksize == 0)
- {
- work -> ksize = 5;
- work -> ktypevec
- = (char **) xmalloc (sizeof (char *) * work -> ksize);
- }
- else
- {
- work -> ksize *= 2;
- work -> ktypevec
- = (char **) xrealloc ((char *)work -> ktypevec,
- sizeof (char *) * work -> ksize);
- }
- }
- tem = xmalloc (len + 1);
- memcpy (tem, start, len);
- tem[len] = '\0';
- work -> ktypevec[work -> numk++] = tem;
-}
-
-/* Register a B code, and get an index for it. B codes are registered
- as they are seen, rather than as they are completed, so map<temp<char> >
- registers map<temp<char> > as B0, and temp<char> as B1 */
-
-static int
-register_Btype (work)
- struct work_stuff *work;
-{
- int ret;
-
- if (work -> numb >= work -> bsize)
- {
- if (work -> bsize == 0)
- {
- work -> bsize = 5;
- work -> btypevec
- = (char **) xmalloc (sizeof (char *) * work -> bsize);
- }
- else
- {
- work -> bsize *= 2;
- work -> btypevec
- = (char **) xrealloc ((char *)work -> btypevec,
- sizeof (char *) * work -> bsize);
- }
- }
- ret = work -> numb++;
- work -> btypevec[ret] = NULL;
- return(ret);
-}
-
-/* Store a value into a previously registered B code type. */
-
-static void
-remember_Btype (work, start, len, index)
- struct work_stuff *work;
- const char *start;
- int len, index;
-{
- char *tem;
-
- tem = xmalloc (len + 1);
- memcpy (tem, start, len);
- tem[len] = '\0';
- work -> btypevec[index] = tem;
-}
-
-/* Lose all the info related to B and K type codes. */
-static void
-forget_B_and_K_types (work)
- struct work_stuff *work;
-{
- int i;
-
- while (work -> numk > 0)
- {
- i = --(work -> numk);
- if (work -> ktypevec[i] != NULL)
- {
- free (work -> ktypevec[i]);
- work -> ktypevec[i] = NULL;
- }
- }
-
- while (work -> numb > 0)
- {
- i = --(work -> numb);
- if (work -> btypevec[i] != NULL)
- {
- free (work -> btypevec[i]);
- work -> btypevec[i] = NULL;
- }
- }
-}
-/* Forget the remembered types, but not the type vector itself. */
-
-static void
-forget_types (work)
- struct work_stuff *work;
-{
- int i;
-
- while (work -> ntypes > 0)
- {
- i = --(work -> ntypes);
- if (work -> typevec[i] != NULL)
- {
- free (work -> typevec[i]);
- work -> typevec[i] = NULL;
- }
- }
-}
-
-/* Process the argument list part of the signature, after any class spec
- has been consumed, as well as the first 'F' character (if any). For
- example:
-
- "__als__3fooRT0" => process "RT0"
- "complexfunc5__FPFPc_PFl_i" => process "PFPc_PFl_i"
-
- DECLP must be already initialised, usually non-empty. It won't be freed
- on failure.
-
- Note that g++ differs significantly from ARM and lucid style mangling
- with regards to references to previously seen types. For example, given
- the source fragment:
-
- class foo {
- public:
- foo::foo (int, foo &ia, int, foo &ib, int, foo &ic);
- };
-
- foo::foo (int, foo &ia, int, foo &ib, int, foo &ic) { ia = ib = ic; }
- void foo (int, foo &ia, int, foo &ib, int, foo &ic) { ia = ib = ic; }
-
- g++ produces the names:
-
- __3fooiRT0iT2iT2
- foo__FiR3fooiT1iT1
-
- while lcc (and presumably other ARM style compilers as well) produces:
-
- foo__FiR3fooT1T2T1T2
- __ct__3fooFiR3fooT1T2T1T2
-
- Note that g++ bases its type numbers starting at zero and counts all
- previously seen types, while lucid/ARM bases its type numbers starting
- at one and only considers types after it has seen the 'F' character
- indicating the start of the function args. For lucid/ARM style, we
- account for this difference by discarding any previously seen types when
- we see the 'F' character, and subtracting one from the type number
- reference.
-
- */
-
-static int
-demangle_args (work, mangled, declp)
- struct work_stuff *work;
- const char **mangled;
- string *declp;
-{
- string arg;
- int need_comma = 0;
- int r;
- int t;
- const char *tem;
- char temptype;
-
- if (PRINT_ARG_TYPES)
- {
- string_append (declp, "(");
- if (**mangled == '\0')
- {
- string_append (declp, "void");
- }
- }
-
- while ((**mangled != '_' && **mangled != '\0' && **mangled != 'e')
- || work->nrepeats > 0)
- {
- if ((**mangled == 'N') || (**mangled == 'T'))
- {
- temptype = *(*mangled)++;
-
- if (temptype == 'N')
- {
- if (!get_count (mangled, &r))
- {
- return (0);
- }
- }
- else
- {
- r = 1;
- }
- if ((HP_DEMANGLING || ARM_DEMANGLING || EDG_DEMANGLING) && work -> ntypes >= 10)
- {
- /* If we have 10 or more types we might have more than a 1 digit
- index so we'll have to consume the whole count here. This
- will lose if the next thing is a type name preceded by a
- count but it's impossible to demangle that case properly
- anyway. Eg if we already have 12 types is T12Pc "(..., type1,
- Pc, ...)" or "(..., type12, char *, ...)" */
- if ((t = consume_count(mangled)) <= 0)
- {
- return (0);
- }
- }
- else
- {
- if (!get_count (mangled, &t))
- {
- return (0);
- }
- }
- if (LUCID_DEMANGLING || ARM_DEMANGLING || HP_DEMANGLING || EDG_DEMANGLING)
- {
- t--;
- }
- /* Validate the type index. Protect against illegal indices from
- malformed type strings. */
- if ((t < 0) || (t >= work -> ntypes))
- {
- return (0);
- }
- while (work->nrepeats > 0 || --r >= 0)
- {
- tem = work -> typevec[t];
- if (need_comma && PRINT_ARG_TYPES)
- {
- string_append (declp, ", ");
- }
- if (!do_arg (work, &tem, &arg))
- {
- return (0);
- }
- if (PRINT_ARG_TYPES)
- {
- string_appends (declp, &arg);
- }
- string_delete (&arg);
- need_comma = 1;
- }
- }
- else
- {
- if (need_comma && PRINT_ARG_TYPES)
- string_append (declp, ", ");
- if (!do_arg (work, mangled, &arg))
- return (0);
- if (PRINT_ARG_TYPES)
- string_appends (declp, &arg);
- string_delete (&arg);
- need_comma = 1;
- }
- }
-
- if (**mangled == 'e')
- {
- (*mangled)++;
- if (PRINT_ARG_TYPES)
- {
- if (need_comma)
- {
- string_append (declp, ",");
- }
- string_append (declp, "...");
- }
- }
-
- if (PRINT_ARG_TYPES)
- {
- string_append (declp, ")");
- }
- return (1);
-}
-
-/* Like demangle_args, but for demangling the argument lists of function
- and method pointers or references, not top-level declarations. */
-
-static int
-demangle_nested_args (work, mangled, declp)
- struct work_stuff *work;
- const char **mangled;
- string *declp;
-{
- string* saved_previous_argument;
- int result;
- int saved_nrepeats;
-
- /* The G++ name-mangling algorithm does not remember types on nested
- argument lists, unless -fsquangling is used, and in that case the
- type vector updated by remember_type is not used. So, we turn
- off remembering of types here. */
- ++work->forgetting_types;
-
- /* For the repeat codes used with -fsquangling, we must keep track of
- the last argument. */
- saved_previous_argument = work->previous_argument;
- saved_nrepeats = work->nrepeats;
- work->previous_argument = 0;
- work->nrepeats = 0;
-
- /* Actually demangle the arguments. */
- result = demangle_args (work, mangled, declp);
-
- /* Restore the previous_argument field. */
- if (work->previous_argument)
- string_delete (work->previous_argument);
- work->previous_argument = saved_previous_argument;
- --work->forgetting_types;
- work->nrepeats = saved_nrepeats;
-
- return result;
-}
-
-static void
-demangle_function_name (work, mangled, declp, scan)
- struct work_stuff *work;
- const char **mangled;
- string *declp;
- const char *scan;
-{
- size_t i;
- string type;
- const char *tem;
-
- string_appendn (declp, (*mangled), scan - (*mangled));
- string_need (declp, 1);
- *(declp -> p) = '\0';
-
- /* Consume the function name, including the "__" separating the name
- from the signature. We are guaranteed that SCAN points to the
- separator. */
-
- (*mangled) = scan + 2;
- /* We may be looking at an instantiation of a template function:
- foo__Xt1t2_Ft3t4, where t1, t2, ... are template arguments and a
- following _F marks the start of the function arguments. Handle
- the template arguments first. */
-
- if (HP_DEMANGLING && (**mangled == 'X'))
- {
- demangle_arm_hp_template (work, mangled, 0, declp);
- /* This leaves MANGLED pointing to the 'F' marking func args */
- }
-
- if (LUCID_DEMANGLING || ARM_DEMANGLING || HP_DEMANGLING || EDG_DEMANGLING)
- {
-
- /* See if we have an ARM style constructor or destructor operator.
- If so, then just record it, clear the decl, and return.
- We can't build the actual constructor/destructor decl until later,
- when we recover the class name from the signature. */
-
- if (strcmp (declp -> b, "__ct") == 0)
- {
- work -> constructor += 1;
- string_clear (declp);
- return;
- }
- else if (strcmp (declp -> b, "__dt") == 0)
- {
- work -> destructor += 1;
- string_clear (declp);
- return;
- }
- }
-
- if (declp->p - declp->b >= 3
- && declp->b[0] == 'o'
- && declp->b[1] == 'p'
- && strchr (cplus_markers, declp->b[2]) != NULL)
- {
- /* see if it's an assignment expression */
- if (declp->p - declp->b >= 10 /* op$assign_ */
- && memcmp (declp->b + 3, "assign_", 7) == 0)
- {
- for (i = 0; i < ARRAY_SIZE (optable); i++)
- {
- int len = declp->p - declp->b - 10;
- if ((int) strlen (optable[i].in) == len
- && memcmp (optable[i].in, declp->b + 10, len) == 0)
- {
- string_clear (declp);
- string_append (declp, "operator");
- string_append (declp, optable[i].out);
- string_append (declp, "=");
- break;
- }
- }
- }
- else
- {
- for (i = 0; i < ARRAY_SIZE (optable); i++)
- {
- int len = declp->p - declp->b - 3;
- if ((int) strlen (optable[i].in) == len
- && memcmp (optable[i].in, declp->b + 3, len) == 0)
- {
- string_clear (declp);
- string_append (declp, "operator");
- string_append (declp, optable[i].out);
- break;
- }
- }
- }
- }
- else if (declp->p - declp->b >= 5 && memcmp (declp->b, "type", 4) == 0
- && strchr (cplus_markers, declp->b[4]) != NULL)
- {
- /* type conversion operator */
- tem = declp->b + 5;
- if (do_type (work, &tem, &type))
- {
- string_clear (declp);
- string_append (declp, "operator ");
- string_appends (declp, &type);
- string_delete (&type);
- }
- }
- else if (declp->b[0] == '_' && declp->b[1] == '_'
- && declp->b[2] == 'o' && declp->b[3] == 'p')
- {
- /* ANSI. */
- /* type conversion operator. */
- tem = declp->b + 4;
- if (do_type (work, &tem, &type))
- {
- string_clear (declp);
- string_append (declp, "operator ");
- string_appends (declp, &type);
- string_delete (&type);
- }
- }
- else if (declp->b[0] == '_' && declp->b[1] == '_'
- && ISLOWER((unsigned char)declp->b[2])
- && ISLOWER((unsigned char)declp->b[3]))
- {
- if (declp->b[4] == '\0')
- {
- /* Operator. */
- for (i = 0; i < ARRAY_SIZE (optable); i++)
- {
- if (strlen (optable[i].in) == 2
- && memcmp (optable[i].in, declp->b + 2, 2) == 0)
- {
- string_clear (declp);
- string_append (declp, "operator");
- string_append (declp, optable[i].out);
- break;
- }
- }
- }
- else
- {
- if (declp->b[2] == 'a' && declp->b[5] == '\0')
- {
- /* Assignment. */
- for (i = 0; i < ARRAY_SIZE (optable); i++)
- {
- if (strlen (optable[i].in) == 3
- && memcmp (optable[i].in, declp->b + 2, 3) == 0)
- {
- string_clear (declp);
- string_append (declp, "operator");
- string_append (declp, optable[i].out);
- break;
- }
- }
- }
- }
- }
-}
-
-/* a mini string-handling package */
-
-static void
-string_need (s, n)
- string *s;
- int n;
-{
- int tem;
-
- if (s->b == NULL)
- {
- if (n < 32)
- {
- n = 32;
- }
- s->p = s->b = xmalloc (n);
- s->e = s->b + n;
- }
- else if (s->e - s->p < n)
- {
- tem = s->p - s->b;
- n += tem;
- n *= 2;
- s->b = xrealloc (s->b, n);
- s->p = s->b + tem;
- s->e = s->b + n;
- }
-}
-
-static void
-string_delete (s)
- string *s;
-{
- if (s->b != NULL)
- {
- free (s->b);
- s->b = s->e = s->p = NULL;
- }
-}
-
-static void
-string_init (s)
- string *s;
-{
- s->b = s->p = s->e = NULL;
-}
-
-static void
-string_clear (s)
- string *s;
-{
- s->p = s->b;
-}
-
-#if 0
-
-static int
-string_empty (s)
- string *s;
-{
- return (s->b == s->p);
-}
-
-#endif
-
-static void
-string_append (p, s)
- string *p;
- const char *s;
-{
- int n;
- if (s == NULL || *s == '\0')
- return;
- n = strlen (s);
- string_need (p, n);
- memcpy (p->p, s, n);
- p->p += n;
-}
-
-static void
-string_appends (p, s)
- string *p, *s;
-{
- int n;
-
- if (s->b != s->p)
- {
- n = s->p - s->b;
- string_need (p, n);
- memcpy (p->p, s->b, n);
- p->p += n;
- }
-}
-
-static void
-string_appendn (p, s, n)
- string *p;
- const char *s;
- int n;
-{
- if (n != 0)
- {
- string_need (p, n);
- memcpy (p->p, s, n);
- p->p += n;
- }
-}
-
-static void
-string_prepend (p, s)
- string *p;
- const char *s;
-{
- if (s != NULL && *s != '\0')
- {
- string_prependn (p, s, strlen (s));
- }
-}
-
-static void
-string_prepends (p, s)
- string *p, *s;
-{
- if (s->b != s->p)
- {
- string_prependn (p, s->b, s->p - s->b);
- }
-}
-
-static void
-string_prependn (p, s, n)
- string *p;
- const char *s;
- int n;
-{
- char *q;
-
- if (n != 0)
- {
- string_need (p, n);
- for (q = p->p - 1; q >= p->b; q--)
- {
- q[n] = q[0];
- }
- memcpy (p->b, s, n);
- p->p += n;
- }
-}
-
-static void
-string_append_template_idx (s, idx)
- string *s;
- int idx;
-{
- char buf[INTBUF_SIZE + 1 /* 'T' */];
- sprintf(buf, "T%d", idx);
- string_append (s, buf);
-}
diff --git a/libiberty/dyn-string.c b/libiberty/dyn-string.c
deleted file mode 100644
index 1da76c2..0000000
--- a/libiberty/dyn-string.c
+++ /dev/null
@@ -1,442 +0,0 @@
-/* An abstract string datatype.
- Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
- Contributed by Mark Mitchell (mark@markmitchell.com).
-
-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.
-
-In addition to the permissions in the GNU General Public License, the
-Free Software Foundation gives you unlimited permission to link the
-compiled version of this file into combinations with other programs,
-and to distribute those combinations without any restriction coming
-from the use of this file. (The General Public License restrictions
-do apply in other respects; for example, they cover modification of
-the file, and distribution when not linked into a combined
-executable.)
-
-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. */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdio.h>
-
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-
-#include "libiberty.h"
-#include "dyn-string.h"
-
-/* If this file is being compiled for inclusion in the C++ runtime
- library, as part of the demangler implementation, we don't want to
- abort if an allocation fails. Instead, percolate an error code up
- through the call chain. */
-
-#if defined(IN_LIBGCC2) || defined(IN_GLIBCPP_V3)
-#define RETURN_ON_ALLOCATION_FAILURE
-#endif
-
-/* Performs in-place initialization of a dyn_string struct. This
- function can be used with a dyn_string struct on the stack or
- embedded in another object. The contents of of the string itself
- are still dynamically allocated. The string initially is capable
- of holding at least SPACE characeters, including the terminating
- NUL. If SPACE is 0, it will silently be increated to 1.
-
- If RETURN_ON_ALLOCATION_FAILURE is defined and memory allocation
- fails, returns 0. Otherwise returns 1. */
-
-int
-dyn_string_init (ds_struct_ptr, space)
- struct dyn_string *ds_struct_ptr;
- int space;
-{
- /* We need at least one byte in which to store the terminating NUL. */
- if (space == 0)
- space = 1;
-
-#ifdef RETURN_ON_ALLOCATION_FAILURE
- ds_struct_ptr->s = (char *) malloc (space);
- if (ds_struct_ptr->s == NULL)
- return 0;
-#else
- ds_struct_ptr->s = (char *) xmalloc (space);
-#endif
- ds_struct_ptr->allocated = space;
- ds_struct_ptr->length = 0;
- ds_struct_ptr->s[0] = '\0';
-
- return 1;
-}
-
-/* Create a new dynamic string capable of holding at least SPACE
- characters, including the terminating NUL. If SPACE is 0, it will
- be silently increased to 1. If RETURN_ON_ALLOCATION_FAILURE is
- defined and memory allocation fails, returns NULL. Otherwise
- returns the newly allocated string. */
-
-dyn_string_t
-dyn_string_new (space)
- int space;
-{
- dyn_string_t result;
-#ifdef RETURN_ON_ALLOCATION_FAILURE
- result = (dyn_string_t) malloc (sizeof (struct dyn_string));
- if (result == NULL)
- return NULL;
- if (!dyn_string_init (result, space))
- {
- free (result);
- return NULL;
- }
-#else
- result = (dyn_string_t) xmalloc (sizeof (struct dyn_string));
- dyn_string_init (result, space);
-#endif
- return result;
-}
-
-/* Free the memory used by DS. */
-
-void
-dyn_string_delete (ds)
- dyn_string_t ds;
-{
- free (ds->s);
- free (ds);
-}
-
-/* Returns the contents of DS in a buffer allocated with malloc. It
- is the caller's responsibility to deallocate the buffer using free.
- DS is then set to the empty string. Deletes DS itself. */
-
-char*
-dyn_string_release (ds)
- dyn_string_t ds;
-{
- /* Store the old buffer. */
- char* result = ds->s;
- /* The buffer is no longer owned by DS. */
- ds->s = NULL;
- /* Delete DS. */
- free (ds);
- /* Return the old buffer. */
- return result;
-}
-
-/* Increase the capacity of DS so it can hold at least SPACE
- characters, plus the terminating NUL. This function will not (at
- present) reduce the capacity of DS. Returns DS on success.
-
- If RETURN_ON_ALLOCATION_FAILURE is defined and a memory allocation
- operation fails, deletes DS and returns NULL. */
-
-dyn_string_t
-dyn_string_resize (ds, space)
- dyn_string_t ds;
- int space;
-{
- int new_allocated = ds->allocated;
-
- /* Increase SPACE to hold the NUL termination. */
- ++space;
-
- /* Increase allocation by factors of two. */
- while (space > new_allocated)
- new_allocated *= 2;
-
- if (new_allocated != ds->allocated)
- {
- ds->allocated = new_allocated;
- /* We actually need more space. */
-#ifdef RETURN_ON_ALLOCATION_FAILURE
- ds->s = (char *) realloc (ds->s, ds->allocated);
- if (ds->s == NULL)
- {
- free (ds);
- return NULL;
- }
-#else
- ds->s = (char *) xrealloc (ds->s, ds->allocated);
-#endif
- }
-
- return ds;
-}
-
-/* Sets the contents of DS to the empty string. */
-
-void
-dyn_string_clear (ds)
- dyn_string_t ds;
-{
- /* A dyn_string always has room for at least the NUL terminator. */
- ds->s[0] = '\0';
- ds->length = 0;
-}
-
-/* Makes the contents of DEST the same as the contents of SRC. DEST
- and SRC must be distinct. Returns 1 on success. On failure, if
- RETURN_ON_ALLOCATION_FAILURE, deletes DEST and returns 0. */
-
-int
-dyn_string_copy (dest, src)
- dyn_string_t dest;
- dyn_string_t src;
-{
- if (dest == src)
- abort ();
-
- /* Make room in DEST. */
- if (dyn_string_resize (dest, src->length) == NULL)
- return 0;
- /* Copy DEST into SRC. */
- strcpy (dest->s, src->s);
- /* Update the size of DEST. */
- dest->length = src->length;
- return 1;
-}
-
-/* Copies SRC, a NUL-terminated string, into DEST. Returns 1 on
- success. On failure, if RETURN_ON_ALLOCATION_FAILURE, deletes DEST
- and returns 0. */
-
-int
-dyn_string_copy_cstr (dest, src)
- dyn_string_t dest;
- const char *src;
-{
- int length = strlen (src);
- /* Make room in DEST. */
- if (dyn_string_resize (dest, length) == NULL)
- return 0;
- /* Copy DEST into SRC. */
- strcpy (dest->s, src);
- /* Update the size of DEST. */
- dest->length = length;
- return 1;
-}
-
-/* Inserts SRC at the beginning of DEST. DEST is expanded as
- necessary. SRC and DEST must be distinct. Returns 1 on success.
- On failure, if RETURN_ON_ALLOCATION_FAILURE, deletes DEST and
- returns 0. */
-
-int
-dyn_string_prepend (dest, src)
- dyn_string_t dest;
- dyn_string_t src;
-{
- return dyn_string_insert (dest, 0, src);
-}
-
-/* Inserts SRC, a NUL-terminated string, at the beginning of DEST.
- DEST is expanded as necessary. Returns 1 on success. On failure,
- if RETURN_ON_ALLOCATION_FAILURE, deletes DEST and returns 0. */
-
-int
-dyn_string_prepend_cstr (dest, src)
- dyn_string_t dest;
- const char *src;
-{
- return dyn_string_insert_cstr (dest, 0, src);
-}
-
-/* Inserts SRC into DEST starting at position POS. DEST is expanded
- as necessary. SRC and DEST must be distinct. Returns 1 on
- success. On failure, if RETURN_ON_ALLOCATION_FAILURE, deletes DEST
- and returns 0. */
-
-int
-dyn_string_insert (dest, pos, src)
- dyn_string_t dest;
- int pos;
- dyn_string_t src;
-{
- int i;
-
- if (src == dest)
- abort ();
-
- if (dyn_string_resize (dest, dest->length + src->length) == NULL)
- return 0;
- /* Make room for the insertion. Be sure to copy the NUL. */
- for (i = dest->length; i >= pos; --i)
- dest->s[i + src->length] = dest->s[i];
- /* Splice in the new stuff. */
- strncpy (dest->s + pos, src->s, src->length);
- /* Compute the new length. */
- dest->length += src->length;
- return 1;
-}
-
-/* Inserts SRC, a NUL-terminated string, into DEST starting at
- position POS. DEST is expanded as necessary. Returns 1 on
- success. On failure, RETURN_ON_ALLOCATION_FAILURE, deletes DEST
- and returns 0. */
-
-int
-dyn_string_insert_cstr (dest, pos, src)
- dyn_string_t dest;
- int pos;
- const char *src;
-{
- int i;
- int length = strlen (src);
-
- if (dyn_string_resize (dest, dest->length + length) == NULL)
- return 0;
- /* Make room for the insertion. Be sure to copy the NUL. */
- for (i = dest->length; i >= pos; --i)
- dest->s[i + length] = dest->s[i];
- /* Splice in the new stuff. */
- strncpy (dest->s + pos, src, length);
- /* Compute the new length. */
- dest->length += length;
- return 1;
-}
-
-/* Inserts character C into DEST starting at position POS. DEST is
- expanded as necessary. Returns 1 on success. On failure,
- RETURN_ON_ALLOCATION_FAILURE, deletes DEST and returns 0. */
-
-int
-dyn_string_insert_char (dest, pos, c)
- dyn_string_t dest;
- int pos;
- int c;
-{
- int i;
-
- if (dyn_string_resize (dest, dest->length + 1) == NULL)
- return 0;
- /* Make room for the insertion. Be sure to copy the NUL. */
- for (i = dest->length; i >= pos; --i)
- dest->s[i + 1] = dest->s[i];
- /* Add the new character. */
- dest->s[pos] = c;
- /* Compute the new length. */
- ++dest->length;
- return 1;
-}
-
-/* Append S to DS, resizing DS if necessary. Returns 1 on success.
- On failure, if RETURN_ON_ALLOCATION_FAILURE, deletes DEST and
- returns 0. */
-
-int
-dyn_string_append (dest, s)
- dyn_string_t dest;
- dyn_string_t s;
-{
- if (dyn_string_resize (dest, dest->length + s->length) == 0)
- return 0;
- strcpy (dest->s + dest->length, s->s);
- dest->length += s->length;
- return 1;
-}
-
-/* Append the NUL-terminated string S to DS, resizing DS if necessary.
- Returns 1 on success. On failure, if RETURN_ON_ALLOCATION_FAILURE,
- deletes DEST and returns 0. */
-
-int
-dyn_string_append_cstr (dest, s)
- dyn_string_t dest;
- const char *s;
-{
- int len = strlen (s);
-
- /* The new length is the old length plus the size of our string, plus
- one for the null at the end. */
- if (dyn_string_resize (dest, dest->length + len) == NULL)
- return 0;
- strcpy (dest->s + dest->length, s);
- dest->length += len;
- return 1;
-}
-
-/* Appends C to the end of DEST. Returns 1 on success. On failiure,
- if RETURN_ON_ALLOCATION_FAILURE, deletes DEST and returns 0. */
-
-int
-dyn_string_append_char (dest, c)
- dyn_string_t dest;
- int c;
-{
- /* Make room for the extra character. */
- if (dyn_string_resize (dest, dest->length + 1) == NULL)
- return 0;
- /* Append the character; it will overwrite the old NUL. */
- dest->s[dest->length] = c;
- /* Add a new NUL at the end. */
- dest->s[dest->length + 1] = '\0';
- /* Update the length. */
- ++(dest->length);
- return 1;
-}
-
-/* Sets the contents of DEST to the substring of SRC starting at START
- and ending before END. START must be less than or equal to END,
- and both must be between zero and the length of SRC, inclusive.
- Returns 1 on success. On failure, if RETURN_ON_ALLOCATION_FAILURE,
- deletes DEST and returns 0. */
-
-int
-dyn_string_substring (dest, src, start, end)
- dyn_string_t dest;
- dyn_string_t src;
- int start;
- int end;
-{
- int i;
- int length = end - start;
-
- if (start > end || start > src->length || end > src->length)
- abort ();
-
- /* Make room for the substring. */
- if (dyn_string_resize (dest, length) == NULL)
- return 0;
- /* Copy the characters in the substring, */
- for (i = length; --i >= 0; )
- dest->s[i] = src->s[start + i];
- /* NUL-terimate the result. */
- dest->s[length] = '\0';
- /* Record the length of the substring. */
- dest->length = length;
-
- return 1;
-}
-
-/* Returns non-zero if DS1 and DS2 have the same contents. */
-
-int
-dyn_string_eq (ds1, ds2)
- dyn_string_t ds1;
- dyn_string_t ds2;
-{
- /* If DS1 and DS2 have different lengths, they must not be the same. */
- if (ds1->length != ds2->length)
- return 0;
- else
- return !strcmp (ds1->s, ds2->s);
-}
diff --git a/libiberty/fdmatch.c b/libiberty/fdmatch.c
deleted file mode 100644
index 979c214..0000000
--- a/libiberty/fdmatch.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/* Compare two open file descriptors to see if they refer to the same file.
- Copyright (C) 1991 Free Software Foundation, Inc.
-
-This file is part of the libiberty library.
-Libiberty is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public
-License as published by the Free Software Foundation; either
-version 2 of the License, or (at your option) any later version.
-
-Libiberty is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with libiberty; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-
-/*
-
-@deftypefn Extension int fdmatch (int @var{fd1}, int @var{fd2})
-
-Check to see if two open file descriptors refer to the same file.
-This is useful, for example, when we have an open file descriptor for
-an unnamed file, and the name of a file that we believe to correspond
-to that fd. This can happen when we are exec'd with an already open
-file (@code{stdout} for example) or from the SVR4 @file{/proc} calls
-that return open file descriptors for mapped address spaces. All we
-have to do is open the file by name and check the two file descriptors
-for a match, which is done by comparing major and minor device numbers
-and inode numbers.
-
-@end deftypefn
-
-BUGS
-
- (FIXME: does this work for networks?)
- It works for NFS, which assigns a device number to each mount.
-
-*/
-
-#include "ansidecl.h"
-#include "libiberty.h"
-#include <sys/types.h>
-#include <sys/stat.h>
-
-int fdmatch (fd1, fd2)
- int fd1;
- int fd2;
-{
- struct stat sbuf1;
- struct stat sbuf2;
-
- if ((fstat (fd1, &sbuf1) == 0) &&
- (fstat (fd2, &sbuf2) == 0) &&
- (sbuf1.st_dev == sbuf2.st_dev) &&
- (sbuf1.st_ino == sbuf2.st_ino))
- {
- return (1);
- }
- else
- {
- return (0);
- }
-}
diff --git a/libiberty/ffs.c b/libiberty/ffs.c
deleted file mode 100644
index de047e2..0000000
--- a/libiberty/ffs.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* ffs -- Find the first bit set in the parameter
-
-@deftypefn Supplemental int ffs (int @var{valu})
-
-Find the first (least significant) bit set in @var{valu}. Bits are
-numbered from right to left, starting with bit 1 (corresponding to the
-value 1). If @var{valu} is zero, zero is returned.
-
-@end deftypefn
-
-*/
-
-int
-ffs (valu)
- register int valu;
-{
- register int bit;
-
- if (valu == 0)
- return 0;
-
- for (bit = 1; !(valu & 1); bit++)
- valu >>= 1;
-
- return bit;
-}
-
diff --git a/libiberty/fibheap.c b/libiberty/fibheap.c
deleted file mode 100644
index 36062d4..0000000
--- a/libiberty/fibheap.c
+++ /dev/null
@@ -1,523 +0,0 @@
-/* A Fibonacci heap datatype.
- Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
- Contributed by Daniel Berlin (dan@cgsoftware.com).
-
-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. */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#ifdef HAVE_LIMITS_H
-#include <limits.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-#include "libiberty.h"
-#include "fibheap.h"
-
-
-#define FIBHEAPKEY_MIN LONG_MIN
-
-static void fibheap_ins_root PARAMS ((fibheap_t, fibnode_t));
-static void fibheap_rem_root PARAMS ((fibheap_t, fibnode_t));
-static void fibheap_consolidate PARAMS ((fibheap_t));
-static void fibheap_link PARAMS ((fibheap_t, fibnode_t, fibnode_t));
-static void fibheap_cut PARAMS ((fibheap_t, fibnode_t, fibnode_t));
-static void fibheap_cascading_cut PARAMS ((fibheap_t, fibnode_t));
-static fibnode_t fibheap_extr_min_node PARAMS ((fibheap_t));
-static int fibheap_compare PARAMS ((fibheap_t, fibnode_t, fibnode_t));
-static int fibheap_comp_data PARAMS ((fibheap_t, fibheapkey_t, void *,
- fibnode_t));
-static fibnode_t fibnode_new PARAMS ((void));
-static void fibnode_insert_after PARAMS ((fibnode_t, fibnode_t));
-#define fibnode_insert_before(a, b) fibnode_insert_after (a->left, b)
-static fibnode_t fibnode_remove PARAMS ((fibnode_t));
-
-
-/* Create a new fibonacci heap. */
-fibheap_t
-fibheap_new ()
-{
- return (fibheap_t) xcalloc (1, sizeof (struct fibheap));
-}
-
-/* Create a new fibonacci heap node. */
-static fibnode_t
-fibnode_new ()
-{
- fibnode_t node;
-
- node = (fibnode_t) xcalloc (1, sizeof *node);
- node->left = node;
- node->right = node;
-
- return node;
-}
-
-static inline int
-fibheap_compare (heap, a, b)
- fibheap_t heap ATTRIBUTE_UNUSED;
- fibnode_t a;
- fibnode_t b;
-{
- if (a->key < b->key)
- return -1;
- if (a->key > b->key)
- return 1;
- return 0;
-}
-
-static inline int
-fibheap_comp_data (heap, key, data, b)
- fibheap_t heap;
- fibheapkey_t key;
- void *data;
- fibnode_t b;
-{
- struct fibnode a;
-
- a.key = key;
- a.data = data;
-
- return fibheap_compare (heap, &a, b);
-}
-
-/* Insert DATA, with priority KEY, into HEAP. */
-fibnode_t
-fibheap_insert (heap, key, data)
- fibheap_t heap;
- fibheapkey_t key;
- void *data;
-{
- fibnode_t node;
-
- /* Create the new node. */
- node = fibnode_new ();
-
- /* Set the node's data. */
- node->data = data;
- node->key = key;
-
- /* Insert it into the root list. */
- fibheap_ins_root (heap, node);
-
- /* If their was no minimum, or this key is less than the min,
- it's the new min. */
- if (heap->min == NULL || node->key < heap->min->key)
- heap->min = node;
-
- heap->nodes++;
-
- return node;
-}
-
-/* Return the data of the minimum node (if we know it). */
-void *
-fibheap_min (heap)
- fibheap_t heap;
-{
- /* If there is no min, we can't easily return it. */
- if (heap->min == NULL)
- return NULL;
- return heap->min->data;
-}
-
-/* Return the key of the minimum node (if we know it). */
-fibheapkey_t
-fibheap_min_key (heap)
- fibheap_t heap;
-{
- /* If there is no min, we can't easily return it. */
- if (heap->min == NULL)
- return 0;
- return heap->min->key;
-}
-
-/* Union HEAPA and HEAPB into a new heap. */
-fibheap_t
-fibheap_union (heapa, heapb)
- fibheap_t heapa;
- fibheap_t heapb;
-{
- fibnode_t a_root, b_root, temp;
-
- /* If one of the heaps is empty, the union is just the other heap. */
- if ((a_root = heapa->root) == NULL)
- {
- free (heapa);
- return heapb;
- }
- if ((b_root = heapb->root) == NULL)
- {
- free (heapb);
- return heapa;
- }
-
- /* Merge them to the next nodes on the opposite chain. */
- a_root->left->right = b_root;
- b_root->left->right = a_root;
- temp = a_root->left;
- a_root->left = b_root->left;
- b_root->left = temp;
- heapa->nodes += heapb->nodes;
-
- /* And set the new minimum, if it's changed. */
- if (fibheap_compare (heapa, heapb->min, heapa->min) < 0)
- heapa->min = heapb->min;
-
- free (heapb);
- return heapa;
-}
-
-/* Extract the data of the minimum node from HEAP. */
-void *
-fibheap_extract_min (heap)
- fibheap_t heap;
-{
- fibnode_t z;
- void *ret = NULL;
-
- /* If we don't have a min set, it means we have no nodes. */
- if (heap->min != NULL)
- {
- /* Otherwise, extract the min node, free the node, and return the
- node's data. */
- z = fibheap_extr_min_node (heap);
- ret = z->data;
- free (z);
- }
-
- return ret;
-}
-
-/* Replace both the KEY and the DATA associated with NODE. */
-void *
-fibheap_replace_key_data (heap, node, key, data)
- fibheap_t heap;
- fibnode_t node;
- fibheapkey_t key;
- void *data;
-{
- void *odata;
- int okey;
- fibnode_t y;
-
- /* If we wanted to, we could actually do a real increase by redeleting and
- inserting. However, this would require O (log n) time. So just bail out
- for now. */
- if (fibheap_comp_data (heap, key, data, node) > 0)
- return NULL;
-
- odata = node->data;
- okey = node->key;
- node->data = data;
- node->key = key;
- y = node->parent;
-
- if (okey == key)
- return odata;
-
- /* These two compares are specifically <= 0 to make sure that in the case
- of equality, a node we replaced the data on, becomes the new min. This
- is needed so that delete's call to extractmin gets the right node. */
- if (y != NULL && fibheap_compare (heap, node, y) <= 0)
- {
- fibheap_cut (heap, node, y);
- fibheap_cascading_cut (heap, y);
- }
-
- if (fibheap_compare (heap, node, heap->min) <= 0)
- heap->min = node;
-
- return odata;
-}
-
-/* Replace the DATA associated with NODE. */
-void *
-fibheap_replace_data (heap, node, data)
- fibheap_t heap;
- fibnode_t node;
- void *data;
-{
- return fibheap_replace_key_data (heap, node, node->key, data);
-}
-
-/* Replace the KEY associated with NODE. */
-fibheapkey_t
-fibheap_replace_key (heap, node, key)
- fibheap_t heap;
- fibnode_t node;
- fibheapkey_t key;
-{
- int okey = node->key;
- fibheap_replace_key_data (heap, node, key, node->data);
- return okey;
-}
-
-/* Delete NODE from HEAP. */
-void *
-fibheap_delete_node (heap, node)
- fibheap_t heap;
- fibnode_t node;
-{
- void *ret = node->data;
-
- /* To perform delete, we just make it the min key, and extract. */
- fibheap_replace_key (heap, node, FIBHEAPKEY_MIN);
- fibheap_extract_min (heap);
-
- return ret;
-}
-
-/* Delete HEAP. */
-void
-fibheap_delete (heap)
- fibheap_t heap;
-{
- while (heap->min != NULL)
- free (fibheap_extr_min_node (heap));
-
- free (heap);
-}
-
-/* Determine if HEAP is empty. */
-int
-fibheap_empty (heap)
- fibheap_t heap;
-{
- return heap->nodes == 0;
-}
-
-/* Extract the minimum node of the heap. */
-static fibnode_t
-fibheap_extr_min_node (heap)
- fibheap_t heap;
-{
- fibnode_t ret = heap->min;
- fibnode_t x, y, orig;
-
- /* Attach the child list of the minimum node to the root list of the heap.
- If there is no child list, we don't do squat. */
- for (x = ret->child, orig = NULL; x != orig && x != NULL; x = y)
- {
- if (orig == NULL)
- orig = x;
- y = x->right;
- x->parent = NULL;
- fibheap_ins_root (heap, x);
- }
-
- /* Remove the old root. */
- fibheap_rem_root (heap, ret);
- heap->nodes--;
-
- /* If we are left with no nodes, then the min is NULL. */
- if (heap->nodes == 0)
- heap->min = NULL;
- else
- {
- /* Otherwise, consolidate to find new minimum, as well as do the reorg
- work that needs to be done. */
- heap->min = ret->right;
- fibheap_consolidate (heap);
- }
-
- return ret;
-}
-
-/* Insert NODE into the root list of HEAP. */
-static void
-fibheap_ins_root (heap, node)
- fibheap_t heap;
- fibnode_t node;
-{
- /* If the heap is currently empty, the new node becomes the singleton
- circular root list. */
- if (heap->root == NULL)
- {
- heap->root = node;
- node->left = node;
- node->right = node;
- return;
- }
-
- /* Otherwise, insert it in the circular root list between the root
- and it's right node. */
- fibnode_insert_after (heap->root, node);
-}
-
-/* Remove NODE from the rootlist of HEAP. */
-static void
-fibheap_rem_root (heap, node)
- fibheap_t heap;
- fibnode_t node;
-{
- if (node->left == node)
- heap->root = NULL;
- else
- heap->root = fibnode_remove (node);
-}
-
-/* Consolidate the heap. */
-static void
-fibheap_consolidate (heap)
- fibheap_t heap;
-{
- fibnode_t a[1 + 8 * sizeof (long)];
- fibnode_t w;
- fibnode_t y;
- fibnode_t x;
- int i;
- int d;
- int D;
-
- D = 1 + 8 * sizeof (long);
-
- memset (a, 0, sizeof (fibnode_t) * D);
-
- while ((w = heap->root) != NULL)
- {
- x = w;
- fibheap_rem_root (heap, w);
- d = x->degree;
- while (a[d] != NULL)
- {
- y = a[d];
- if (fibheap_compare (heap, x, y) > 0)
- {
- fibnode_t temp;
- temp = x;
- x = y;
- y = temp;
- }
- fibheap_link (heap, y, x);
- a[d] = NULL;
- d++;
- }
- a[d] = x;
- }
- heap->min = NULL;
- for (i = 0; i < D; i++)
- if (a[i] != NULL)
- {
- fibheap_ins_root (heap, a[i]);
- if (heap->min == NULL || fibheap_compare (heap, a[i], heap->min) < 0)
- heap->min = a[i];
- }
-}
-
-/* Make NODE a child of PARENT. */
-static void
-fibheap_link (heap, node, parent)
- fibheap_t heap ATTRIBUTE_UNUSED;
- fibnode_t node;
- fibnode_t parent;
-{
- if (parent->child == NULL)
- parent->child = node;
- else
- fibnode_insert_before (parent->child, node);
- node->parent = parent;
- parent->degree++;
- node->mark = 0;
-}
-
-/* Remove NODE from PARENT's child list. */
-static void
-fibheap_cut (heap, node, parent)
- fibheap_t heap;
- fibnode_t node;
- fibnode_t parent;
-{
- fibnode_remove (node);
- parent->degree--;
- fibheap_ins_root (heap, node);
- node->parent = NULL;
- node->mark = 0;
-}
-
-static void
-fibheap_cascading_cut (heap, y)
- fibheap_t heap;
- fibnode_t y;
-{
- fibnode_t z;
-
- while ((z = y->parent) != NULL)
- {
- if (y->mark == 0)
- {
- y->mark = 1;
- return;
- }
- else
- {
- fibheap_cut (heap, y, z);
- y = z;
- }
- }
-}
-
-static void
-fibnode_insert_after (a, b)
- fibnode_t a;
- fibnode_t b;
-{
- if (a == a->right)
- {
- a->right = b;
- a->left = b;
- b->right = a;
- b->left = a;
- }
- else
- {
- b->right = a->right;
- a->right->left = b;
- a->right = b;
- b->left = a;
- }
-}
-
-static fibnode_t
-fibnode_remove (node)
- fibnode_t node;
-{
- fibnode_t ret;
-
- if (node == node->left)
- ret = NULL;
- else
- ret = node->left;
-
- if (node->parent != NULL && node->parent->child == node)
- node->parent->child = ret;
-
- node->right->left = node->left;
- node->left->right = node->right;
-
- node->parent = NULL;
- node->left = node;
- node->right = node;
-
- return ret;
-}
diff --git a/libiberty/floatformat.c b/libiberty/floatformat.c
deleted file mode 100644
index d9e9fad..0000000
--- a/libiberty/floatformat.c
+++ /dev/null
@@ -1,451 +0,0 @@
-/* IEEE floating point support routines, for GDB, the GNU Debugger.
- Copyright (C) 1991, 1994, 1999, 2000 Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-This program is free software; you can redistribute 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. */
-
-#include "floatformat.h"
-#include <math.h> /* ldexp */
-#ifdef __STDC__
-#include <stddef.h>
-extern void *memcpy (void *s1, const void *s2, size_t n);
-extern void *memset (void *s, int c, size_t n);
-#else
-extern char *memcpy ();
-extern char *memset ();
-#endif
-
-/* The odds that CHAR_BIT will be anything but 8 are low enough that I'm not
- going to bother with trying to muck around with whether it is defined in
- a system header, what we do if not, etc. */
-#define FLOATFORMAT_CHAR_BIT 8
-
-/* floatformats for IEEE single and double, big and little endian. */
-const struct floatformat floatformat_ieee_single_big =
-{
- floatformat_big, 32, 0, 1, 8, 127, 255, 9, 23,
- floatformat_intbit_no,
- "floatformat_ieee_single_big"
-};
-const struct floatformat floatformat_ieee_single_little =
-{
- floatformat_little, 32, 0, 1, 8, 127, 255, 9, 23,
- floatformat_intbit_no,
- "floatformat_ieee_single_little"
-};
-const struct floatformat floatformat_ieee_double_big =
-{
- floatformat_big, 64, 0, 1, 11, 1023, 2047, 12, 52,
- floatformat_intbit_no,
- "floatformat_ieee_double_big"
-};
-const struct floatformat floatformat_ieee_double_little =
-{
- floatformat_little, 64, 0, 1, 11, 1023, 2047, 12, 52,
- floatformat_intbit_no,
- "floatformat_ieee_double_little"
-};
-
-/* floatformat for IEEE double, little endian byte order, with big endian word
- ordering, as on the ARM. */
-
-const struct floatformat floatformat_ieee_double_littlebyte_bigword =
-{
- floatformat_littlebyte_bigword, 64, 0, 1, 11, 1023, 2047, 12, 52,
- floatformat_intbit_no,
- "floatformat_ieee_double_littlebyte_bigword"
-};
-
-const struct floatformat floatformat_i387_ext =
-{
- floatformat_little, 80, 0, 1, 15, 0x3fff, 0x7fff, 16, 64,
- floatformat_intbit_yes,
- "floatformat_i387_ext"
-};
-const struct floatformat floatformat_m68881_ext =
-{
- /* Note that the bits from 16 to 31 are unused. */
- floatformat_big, 96, 0, 1, 15, 0x3fff, 0x7fff, 32, 64,
- floatformat_intbit_yes,
- "floatformat_m68881_ext"
-};
-const struct floatformat floatformat_i960_ext =
-{
- /* Note that the bits from 0 to 15 are unused. */
- floatformat_little, 96, 16, 17, 15, 0x3fff, 0x7fff, 32, 64,
- floatformat_intbit_yes,
- "floatformat_i960_ext"
-};
-const struct floatformat floatformat_m88110_ext =
-{
- floatformat_big, 80, 0, 1, 15, 0x3fff, 0x7fff, 16, 64,
- floatformat_intbit_yes,
- "floatformat_m88110_ext"
-};
-const struct floatformat floatformat_m88110_harris_ext =
-{
- /* Harris uses raw format 128 bytes long, but the number is just an ieee
- double, and the last 64 bits are wasted. */
- floatformat_big,128, 0, 1, 11, 0x3ff, 0x7ff, 12, 52,
- floatformat_intbit_no,
- "floatformat_m88110_ext_harris"
-};
-const struct floatformat floatformat_arm_ext_big =
-{
- /* Bits 1 to 16 are unused. */
- floatformat_big, 96, 0, 17, 15, 0x3fff, 0x7fff, 32, 64,
- floatformat_intbit_yes,
- "floatformat_arm_ext_big"
-};
-const struct floatformat floatformat_arm_ext_littlebyte_bigword =
-{
- /* Bits 1 to 16 are unused. */
- floatformat_littlebyte_bigword, 96, 0, 17, 15, 0x3fff, 0x7fff, 32, 64,
- floatformat_intbit_yes,
- "floatformat_arm_ext_littlebyte_bigword"
-};
-const struct floatformat floatformat_ia64_spill_big =
-{
- floatformat_big, 128, 0, 1, 17, 65535, 0x1ffff, 18, 64,
- floatformat_intbit_yes,
- "floatformat_ia64_spill_big"
-};
-const struct floatformat floatformat_ia64_spill_little =
-{
- floatformat_little, 128, 0, 1, 17, 65535, 0x1ffff, 18, 64,
- floatformat_intbit_yes,
- "floatformat_ia64_spill_little"
-};
-const struct floatformat floatformat_ia64_quad_big =
-{
- floatformat_big, 128, 0, 1, 15, 16383, 0x7fff, 16, 112,
- floatformat_intbit_no,
- "floatformat_ia64_quad_big"
-};
-const struct floatformat floatformat_ia64_quad_little =
-{
- floatformat_little, 128, 0, 1, 15, 16383, 0x7fff, 16, 112,
- floatformat_intbit_no,
- "floatformat_ia64_quad_little"
-};
-
-static unsigned long get_field PARAMS ((unsigned char *,
- enum floatformat_byteorders,
- unsigned int,
- unsigned int,
- unsigned int));
-
-/* Extract a field which starts at START and is LEN bytes long. DATA and
- TOTAL_LEN are the thing we are extracting it from, in byteorder ORDER. */
-static unsigned long
-get_field (data, order, total_len, start, len)
- unsigned char *data;
- enum floatformat_byteorders order;
- unsigned int total_len;
- unsigned int start;
- unsigned int len;
-{
- unsigned long result;
- unsigned int cur_byte;
- int cur_bitshift;
-
- /* Start at the least significant part of the field. */
- cur_byte = (start + len) / FLOATFORMAT_CHAR_BIT;
- if (order == floatformat_little)
- cur_byte = (total_len / FLOATFORMAT_CHAR_BIT) - cur_byte - 1;
- cur_bitshift =
- ((start + len) % FLOATFORMAT_CHAR_BIT) - FLOATFORMAT_CHAR_BIT;
- result = *(data + cur_byte) >> (-cur_bitshift);
- cur_bitshift += FLOATFORMAT_CHAR_BIT;
- if (order == floatformat_little)
- ++cur_byte;
- else
- --cur_byte;
-
- /* Move towards the most significant part of the field. */
- while ((unsigned int) cur_bitshift < len)
- {
- if (len - cur_bitshift < FLOATFORMAT_CHAR_BIT)
- /* This is the last byte; zero out the bits which are not part of
- this field. */
- result |=
- (*(data + cur_byte) & ((1 << (len - cur_bitshift)) - 1))
- << cur_bitshift;
- else
- result |= *(data + cur_byte) << cur_bitshift;
- cur_bitshift += FLOATFORMAT_CHAR_BIT;
- if (order == floatformat_little)
- ++cur_byte;
- else
- --cur_byte;
- }
- return result;
-}
-
-#ifndef min
-#define min(a, b) ((a) < (b) ? (a) : (b))
-#endif
-
-/* Convert from FMT to a double.
- FROM is the address of the extended float.
- Store the double in *TO. */
-
-void
-floatformat_to_double (fmt, from, to)
- const struct floatformat *fmt;
- char *from;
- double *to;
-{
- unsigned char *ufrom = (unsigned char *)from;
- double dto;
- long exponent;
- unsigned long mant;
- unsigned int mant_bits, mant_off;
- int mant_bits_left;
- int special_exponent; /* It's a NaN, denorm or zero */
-
- exponent = get_field (ufrom, fmt->byteorder, fmt->totalsize,
- fmt->exp_start, fmt->exp_len);
- /* Note that if exponent indicates a NaN, we can't really do anything useful
- (not knowing if the host has NaN's, or how to build one). So it will
- end up as an infinity or something close; that is OK. */
-
- mant_bits_left = fmt->man_len;
- mant_off = fmt->man_start;
- dto = 0.0;
-
- special_exponent = exponent == 0 || (unsigned long) exponent == fmt->exp_nan;
-
- /* Don't bias zero's, denorms or NaNs. */
- if (!special_exponent)
- exponent -= fmt->exp_bias;
-
- /* Build the result algebraically. Might go infinite, underflow, etc;
- who cares. */
-
- /* If this format uses a hidden bit, explicitly add it in now. Otherwise,
- increment the exponent by one to account for the integer bit. */
-
- if (!special_exponent)
- {
- if (fmt->intbit == floatformat_intbit_no)
- dto = ldexp (1.0, exponent);
- else
- exponent++;
- }
-
- while (mant_bits_left > 0)
- {
- mant_bits = min (mant_bits_left, 32);
-
- mant = get_field (ufrom, fmt->byteorder, fmt->totalsize,
- mant_off, mant_bits);
-
- dto += ldexp ((double)mant, exponent - mant_bits);
- exponent -= mant_bits;
- mant_off += mant_bits;
- mant_bits_left -= mant_bits;
- }
-
- /* Negate it if negative. */
- if (get_field (ufrom, fmt->byteorder, fmt->totalsize, fmt->sign_start, 1))
- dto = -dto;
- *to = dto;
-}
-
-static void put_field PARAMS ((unsigned char *, enum floatformat_byteorders,
- unsigned int,
- unsigned int,
- unsigned int,
- unsigned long));
-
-/* Set a field which starts at START and is LEN bytes long. DATA and
- TOTAL_LEN are the thing we are extracting it from, in byteorder ORDER. */
-static void
-put_field (data, order, total_len, start, len, stuff_to_put)
- unsigned char *data;
- enum floatformat_byteorders order;
- unsigned int total_len;
- unsigned int start;
- unsigned int len;
- unsigned long stuff_to_put;
-{
- unsigned int cur_byte;
- int cur_bitshift;
-
- /* Start at the least significant part of the field. */
- cur_byte = (start + len) / FLOATFORMAT_CHAR_BIT;
- if (order == floatformat_little)
- cur_byte = (total_len / FLOATFORMAT_CHAR_BIT) - cur_byte - 1;
- cur_bitshift =
- ((start + len) % FLOATFORMAT_CHAR_BIT) - FLOATFORMAT_CHAR_BIT;
- *(data + cur_byte) &=
- ~(((1 << ((start + len) % FLOATFORMAT_CHAR_BIT)) - 1) << (-cur_bitshift));
- *(data + cur_byte) |=
- (stuff_to_put & ((1 << FLOATFORMAT_CHAR_BIT) - 1)) << (-cur_bitshift);
- cur_bitshift += FLOATFORMAT_CHAR_BIT;
- if (order == floatformat_little)
- ++cur_byte;
- else
- --cur_byte;
-
- /* Move towards the most significant part of the field. */
- while ((unsigned int) cur_bitshift < len)
- {
- if (len - cur_bitshift < FLOATFORMAT_CHAR_BIT)
- {
- /* This is the last byte. */
- *(data + cur_byte) &=
- ~((1 << (len - cur_bitshift)) - 1);
- *(data + cur_byte) |= (stuff_to_put >> cur_bitshift);
- }
- else
- *(data + cur_byte) = ((stuff_to_put >> cur_bitshift)
- & ((1 << FLOATFORMAT_CHAR_BIT) - 1));
- cur_bitshift += FLOATFORMAT_CHAR_BIT;
- if (order == floatformat_little)
- ++cur_byte;
- else
- --cur_byte;
- }
-}
-
-/* The converse: convert the double *FROM to an extended float
- and store where TO points. Neither FROM nor TO have any alignment
- restrictions. */
-
-void
-floatformat_from_double (fmt, from, to)
- const struct floatformat *fmt;
- double *from;
- char *to;
-{
- double dfrom;
- int exponent;
- double mant;
- unsigned int mant_bits, mant_off;
- int mant_bits_left;
- unsigned char *uto = (unsigned char *)to;
-
- memcpy (&dfrom, from, sizeof (dfrom));
- memset (uto, 0, fmt->totalsize / FLOATFORMAT_CHAR_BIT);
- if (dfrom == 0)
- return; /* Result is zero */
- if (dfrom != dfrom)
- {
- /* From is NaN */
- put_field (uto, fmt->byteorder, fmt->totalsize, fmt->exp_start,
- fmt->exp_len, fmt->exp_nan);
- /* Be sure it's not infinity, but NaN value is irrel */
- put_field (uto, fmt->byteorder, fmt->totalsize, fmt->man_start,
- 32, 1);
- return;
- }
-
- /* If negative, set the sign bit. */
- if (dfrom < 0)
- {
- put_field (uto, fmt->byteorder, fmt->totalsize, fmt->sign_start, 1, 1);
- dfrom = -dfrom;
- }
-
- /* How to tell an infinity from an ordinary number? FIXME-someday */
-
- mant = frexp (dfrom, &exponent);
- put_field (uto, fmt->byteorder, fmt->totalsize, fmt->exp_start, fmt->exp_len,
- exponent + fmt->exp_bias - 1);
-
- mant_bits_left = fmt->man_len;
- mant_off = fmt->man_start;
- while (mant_bits_left > 0)
- {
- unsigned long mant_long;
- mant_bits = mant_bits_left < 32 ? mant_bits_left : 32;
-
- mant *= 4294967296.0;
- mant_long = (unsigned long)mant;
- mant -= mant_long;
-
- /* If the integer bit is implicit, then we need to discard it.
- If we are discarding a zero, we should be (but are not) creating
- a denormalized number which means adjusting the exponent
- (I think). */
- if ((unsigned int) mant_bits_left == fmt->man_len
- && fmt->intbit == floatformat_intbit_no)
- {
- mant_long &= 0x7fffffff;
- mant_bits -= 1;
- }
- else if (mant_bits < 32)
- {
- /* The bits we want are in the most significant MANT_BITS bits of
- mant_long. Move them to the least significant. */
- mant_long >>= 32 - mant_bits;
- }
-
- put_field (uto, fmt->byteorder, fmt->totalsize,
- mant_off, mant_bits, mant_long);
- mant_off += mant_bits;
- mant_bits_left -= mant_bits;
- }
-}
-
-
-#ifdef IEEE_DEBUG
-
-/* This is to be run on a host which uses IEEE floating point. */
-
-void
-ieee_test (n)
- double n;
-{
- double result;
- char exten[16];
-
- floatformat_to_double (&floatformat_ieee_double_big, &n, &result);
- if (n != result)
- printf ("Differ(to): %.20g -> %.20g\n", n, result);
- floatformat_from_double (&floatformat_ieee_double_big, &n, &result);
- if (n != result)
- printf ("Differ(from): %.20g -> %.20g\n", n, result);
-
- floatformat_from_double (&floatformat_m68881_ext, &n, exten);
- floatformat_to_double (&floatformat_m68881_ext, exten, &result);
- if (n != result)
- printf ("Differ(to+from): %.20g -> %.20g\n", n, result);
-
-#if IEEE_DEBUG > 1
- /* This is to be run on a host which uses 68881 format. */
- {
- long double ex = *(long double *)exten;
- if (ex != n)
- printf ("Differ(from vs. extended): %.20g\n", n);
- }
-#endif
-}
-
-int
-main ()
-{
- ieee_test (0.5);
- ieee_test (256.0);
- ieee_test (0.12345);
- ieee_test (234235.78907234);
- ieee_test (-512.0);
- ieee_test (-0.004321);
- return 0;
-}
-#endif
diff --git a/libiberty/fnmatch.c b/libiberty/fnmatch.c
deleted file mode 100644
index eb898ee..0000000
--- a/libiberty/fnmatch.c
+++ /dev/null
@@ -1,223 +0,0 @@
-/* Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
-
-NOTE: This source is derived from an old version taken from the GNU C
-Library (glibc).
-
-This program is free software; you can redistribute 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, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-#ifdef HAVE_CONFIG_H
-#if defined (CONFIG_BROKETS)
-/* We use <config.h> instead of "config.h" so that a compilation
- using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
- (which it would do because it found this file in $srcdir). */
-#include <config.h>
-#else
-#include "config.h"
-#endif
-#endif
-
-
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-
-/* This code to undef const added in libiberty. */
-#ifndef __STDC__
-/* This is a separate conditional since some stdc systems
- reject `defined (const)'. */
-#ifndef const
-#define const
-#endif
-#endif
-
-#include <errno.h>
-#include <fnmatch.h>
-#include <safe-ctype.h>
-
-/* Comment out all this code if we are using the GNU C Library, and are not
- actually compiling the library itself. This code is part of the GNU C
- Library, but also included in many other GNU distributions. Compiling
- and linking in this code is a waste when using the GNU C library
- (especially if it is a shared library). Rather than having every GNU
- program understand `configure --with-gnu-libc' and omit the object files,
- it is simpler to just do this in the source for each such file. */
-
-#if defined (_LIBC) || !defined (__GNU_LIBRARY__)
-
-
-#if !defined(__GNU_LIBRARY__) && !defined(STDC_HEADERS)
-extern int errno;
-#endif
-
-/* Match STRING against the filename pattern PATTERN, returning zero if
- it matches, nonzero if not. */
-int
-fnmatch (pattern, string, flags)
- const char *pattern;
- const char *string;
- int flags;
-{
- register const char *p = pattern, *n = string;
- register unsigned char c;
-
-#define FOLD(c) ((flags & FNM_CASEFOLD) ? TOLOWER (c) : (c))
-
- while ((c = *p++) != '\0')
- {
- c = FOLD (c);
-
- switch (c)
- {
- case '?':
- if (*n == '\0')
- return FNM_NOMATCH;
- else if ((flags & FNM_FILE_NAME) && *n == '/')
- return FNM_NOMATCH;
- else if ((flags & FNM_PERIOD) && *n == '.' &&
- (n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/')))
- return FNM_NOMATCH;
- break;
-
- case '\\':
- if (!(flags & FNM_NOESCAPE))
- {
- c = *p++;
- c = FOLD (c);
- }
- if (FOLD ((unsigned char)*n) != c)
- return FNM_NOMATCH;
- break;
-
- case '*':
- if ((flags & FNM_PERIOD) && *n == '.' &&
- (n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/')))
- return FNM_NOMATCH;
-
- for (c = *p++; c == '?' || c == '*'; c = *p++, ++n)
- if (((flags & FNM_FILE_NAME) && *n == '/') ||
- (c == '?' && *n == '\0'))
- return FNM_NOMATCH;
-
- if (c == '\0')
- return 0;
-
- {
- unsigned char c1 = (!(flags & FNM_NOESCAPE) && c == '\\') ? *p : c;
- c1 = FOLD (c1);
- for (--p; *n != '\0'; ++n)
- if ((c == '[' || FOLD ((unsigned char)*n) == c1) &&
- fnmatch (p, n, flags & ~FNM_PERIOD) == 0)
- return 0;
- return FNM_NOMATCH;
- }
-
- case '[':
- {
- /* Nonzero if the sense of the character class is inverted. */
- register int not;
-
- if (*n == '\0')
- return FNM_NOMATCH;
-
- if ((flags & FNM_PERIOD) && *n == '.' &&
- (n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/')))
- return FNM_NOMATCH;
-
- not = (*p == '!' || *p == '^');
- if (not)
- ++p;
-
- c = *p++;
- for (;;)
- {
- register unsigned char cstart = c, cend = c;
-
- if (!(flags & FNM_NOESCAPE) && c == '\\')
- cstart = cend = *p++;
-
- cstart = cend = FOLD (cstart);
-
- if (c == '\0')
- /* [ (unterminated) loses. */
- return FNM_NOMATCH;
-
- c = *p++;
- c = FOLD (c);
-
- if ((flags & FNM_FILE_NAME) && c == '/')
- /* [/] can never match. */
- return FNM_NOMATCH;
-
- if (c == '-' && *p != ']')
- {
- cend = *p++;
- if (!(flags & FNM_NOESCAPE) && cend == '\\')
- cend = *p++;
- if (cend == '\0')
- return FNM_NOMATCH;
- cend = FOLD (cend);
-
- c = *p++;
- }
-
- if (FOLD ((unsigned char)*n) >= cstart
- && FOLD ((unsigned char)*n) <= cend)
- goto matched;
-
- if (c == ']')
- break;
- }
- if (!not)
- return FNM_NOMATCH;
- break;
-
- matched:;
- /* Skip the rest of the [...] that already matched. */
- while (c != ']')
- {
- if (c == '\0')
- /* [... (unterminated) loses. */
- return FNM_NOMATCH;
-
- c = *p++;
- if (!(flags & FNM_NOESCAPE) && c == '\\')
- /* XXX 1003.2d11 is unclear if this is right. */
- ++p;
- }
- if (not)
- return FNM_NOMATCH;
- }
- break;
-
- default:
- if (c != FOLD ((unsigned char)*n))
- return FNM_NOMATCH;
- }
-
- ++n;
- }
-
- if (*n == '\0')
- return 0;
-
- if ((flags & FNM_LEADING_DIR) && *n == '/')
- /* The FNM_LEADING_DIR flag says that "foo*" matches "foobar/frobozz". */
- return 0;
-
- return FNM_NOMATCH;
-}
-
-#endif /* _LIBC or not __GNU_LIBRARY__. */
diff --git a/libiberty/fnmatch.txh b/libiberty/fnmatch.txh
deleted file mode 100644
index 92e11bc..0000000
--- a/libiberty/fnmatch.txh
+++ /dev/null
@@ -1,48 +0,0 @@
-@deftypefn Replacement int fnmatch (const char *@var{pattern}, const char *@var{string}, int @var{flags})
-
-Matches @var{string} against @var{pattern}, returning zero if it
-matches, @code{FNM_NOMATCH} if not. @var{pattern} may contain the
-wildcards @code{?} to match any one character, @code{*} to match any
-zero or more characters, or a set of alternate characters in square
-brackets, like @samp{[a-gt8]}, which match one character (@code{a}
-through @code{g}, or @code{t}, or @code{8}, in this example) if that one
-character is in the set. A set may be inverted (i.e., match anything
-except what's in the set) by giving @code{^} or @code{!} as the first
-character in the set. To include those characters in the set, list them
-as anything other than the first character of the set. To include a
-dash in the set, list it last in the set. A backslash character makes
-the following character not special, so for example you could match
-against a literal asterisk with @samp{\*}. To match a literal
-backslash, use @samp{\\}.
-
-@code{flags} controls various aspects of the matching process, and is a
-boolean OR of zero or more of the following values (defined in
-@code{<fnmatch.h>}):
-
-@table @code
-
-@item FNM_PATHNAME
-@itemx FNM_FILE_NAME
-@var{string} is assumed to be a path name. No wildcard will ever match
-@code{/}.
-
-@item FNM_NOESCAPE
-Do not interpret backslashes as quoting the following special character.
-
-@item FNM_PERIOD
-A leading period (at the beginning of @var{string}, or if
-@code{FNM_PATHNAME} after a slash) is not matched by @code{*} or
-@code{?} but must be matched explicitly.
-
-@item FNM_LEADING_DIR
-Means that @var{string} also matches @var{pattern} if some initial part
-of @var{string} matches, and is followed by @code{/} and zero or more
-characters. For example, @samp{foo*} would match either @samp{foobar}
-or @samp{foobar/grill}.
-
-@item FNM_CASEFOLD
-Ignores case when performing the comparison.
-
-@end table
-
-@end deftypefn
diff --git a/libiberty/functions.texi b/libiberty/functions.texi
deleted file mode 100644
index b518243..0000000
--- a/libiberty/functions.texi
+++ /dev/null
@@ -1,965 +0,0 @@
-@c Automatically generated from *.c and others (the comments before
-@c each entry tell you which file and where in that file). DO NOT EDIT!
-@c Edit the *.c files, configure with --enable-maintainer-mode,
-@c and let gather-docs build you a new copy.
-
-@c alloca.c:26
-@deftypefn Replacement void* alloca (size_t @var{size})
-
-This function allocates memory which will be automatically reclaimed
-after the procedure exits. The @libib{} implementation does not free
-the memory immediately but will do so eventually during subsequent
-calls to this function. Memory is allocated using @code{xmalloc} under
-normal circumstances.
-
-The header file @file{alloca-conf.h} can be used in conjunction with the
-GNU Autoconf test @code{AC_FUNC_ALLOCA} to test for and properly make
-available this function. The @code{AC_FUNC_ALLOCA} test requires that
-client code use a block of preprocessor code to be safe (see the Autoconf
-manual for more); this header incorporates that logic and more, including
-the possibility of a GCC built-in function.
-
-@end deftypefn
-
-@c asprintf.c:33
-@deftypefn Extension int asprintf (char **@var{resptr}, const char *@var{format}, ...)
-
-Like @code{sprintf}, but instead of passing a pointer to a buffer, you
-pass a pointer to a pointer. This function will compute the size of
-the buffer needed, allocate memory with @code{malloc}, and store a
-pointer to the allocated memory in @code{*@var{resptr}}. The value
-returned is the same as @code{sprintf} would return. If memory could
-not be allocated, zero is returned and @code{NULL} is stored in
-@code{*@var{resptr}}.
-
-@end deftypefn
-
-@c atexit.c:6
-@deftypefn Supplemental int atexit (void (*@var{f})())
-
-Causes function @var{f} to be called at exit. Returns 0.
-
-@end deftypefn
-
-@c basename.c:6
-@deftypefn Supplemental char* basename (const char *@var{name})
-
-Returns a pointer to the last component of pathname @var{name}.
-Behavior is undefined if the pathname ends in a directory separator.
-
-@end deftypefn
-
-@c bcmp.c:6
-@deftypefn Supplemental int bcmp (char *@var{x}, char *@var{y}, int @var{count})
-
-Compares the first @var{count} bytes of two areas of memory. Returns
-zero if they are the same, nonzero otherwise. Returns zero if
-@var{count} is zero. A nonzero result only indicates a difference,
-it does not indicate any sorting order (say, by having a positive
-result mean @var{x} sorts before @var{y}).
-
-@end deftypefn
-
-@c bcopy.c:3
-@deftypefn Supplemental void bcopy (char *@var{in}, char *@var{out}, int @var{length})
-
-Copies @var{length} bytes from memory region @var{in} to region
-@var{out}. The use of @code{bcopy} is deprecated in new programs.
-
-@end deftypefn
-
-@c bsearch.c:33
-@deftypefn Supplemental void* bsearch (const void *@var{key}, const void *@var{base}, size_t @var{nmemb}, size_t @var{size}, int (*@var{compar})(const void *, const void *))
-
-Performs a search over an array of @var{nmemb} elements pointed to by
-@var{base} for a member that matches the object pointed to by @var{key}.
-The size of each member is specified by @var{size}. The array contents
-should be sorted in ascending order according to the @var{compar}
-comparison function. This routine should take two arguments pointing to
-the @var{key} and to an array member, in that order, and should return an
-integer less than, equal to, or greater than zero if the @var{key} object
-is respectively less than, matching, or greater than the array member.
-
-@end deftypefn
-
-@c argv.c:139
-@deftypefn Extension char** buildargv (char *@var{sp})
-
-Given a pointer to a string, parse the string extracting fields
-separated by whitespace and optionally enclosed within either single
-or double quotes (which are stripped off), and build a vector of
-pointers to copies of the string for each field. The input string
-remains unchanged. The last element of the vector is followed by a
-@code{NULL} element.
-
-All of the memory for the pointer array and copies of the string
-is obtained from @code{malloc}. All of the memory can be returned to the
-system with the single function call @code{freeargv}, which takes the
-returned result of @code{buildargv}, as it's argument.
-
-Returns a pointer to the argument vector if successful. Returns
-@code{NULL} if @var{sp} is @code{NULL} or if there is insufficient
-memory to complete building the argument vector.
-
-If the input is a null string (as opposed to a @code{NULL} pointer),
-then buildarg returns an argument vector that has one arg, a null
-string.
-
-@end deftypefn
-
-@c bzero.c:6
-@deftypefn Supplemental void bzero (char *@var{mem}, int @var{count})
-
-Zeros @var{count} bytes starting at @var{mem}. Use of this function
-is deprecated in favor of @code{memset}.
-
-@end deftypefn
-
-@c calloc.c:6
-@deftypefn Supplemental void* calloc (size_t @var{nelem}, size_t @var{elsize})
-
-Uses @code{malloc} to allocate storage for @var{nelem} objects of
-@var{elsize} bytes each, then zeros the memory.
-
-@end deftypefn
-
-@c choose-temp.c:42
-@deftypefn Extension char* choose_temp_base (void)
-
-Return a prefix for temporary file names or @code{NULL} if unable to
-find one. The current directory is chosen if all else fails so the
-program is exited if a temporary directory can't be found (@code{mktemp}
-fails). The buffer for the result is obtained with @code{xmalloc}.
-
-This function is provided for backwards compatability only. Its use is
-not recommended.
-
-@end deftypefn
-
-@c make-temp-file.c:88
-@deftypefn Replacement char* choose_tmpdir ()
-
-Returns a pointer to a directory path suitable for creating temporary
-files in.
-
-@end deftypefn
-
-@c clock.c:27
-@deftypefn Supplemental long clock (void)
-
-Returns an approximation of the CPU time used by the process as a
-@code{clock_t}; divide this number by @samp{CLOCKS_PER_SEC} to get the
-number of seconds used.
-
-@end deftypefn
-
-@c concat.c:24
-@deftypefn Extension char* concat (const char *@var{s1}, const char *@var{s2}, @dots{}, @code{NULL})
-
-Concatenate zero or more of strings and return the result in freshly
-@code{xmalloc}ed memory. Returns @code{NULL} if insufficient memory is
-available. The argument list is terminated by the first @code{NULL}
-pointer encountered. Pointers to empty strings are ignored.
-
-@end deftypefn
-
-@c argv.c:65
-@deftypefn Extension char** dupargv (char **@var{vector})
-
-Duplicate an argument vector. Simply scans through @var{vector},
-duplicating each argument until the terminating @code{NULL} is found.
-Returns a pointer to the argument vector if successful. Returns
-@code{NULL} if there is insufficient memory to complete building the
-argument vector.
-
-@end deftypefn
-
-@c strerror.c:566
-@deftypefn Extension int errno_max (void)
-
-Returns the maximum @code{errno} value for which a corresponding
-symbolic name or message is available. Note that in the case where we
-use the @code{sys_errlist} supplied by the system, it is possible for
-there to be more symbolic names than messages, or vice versa. In
-fact, the manual page for @code{perror(3C)} explicitly warns that one
-should check the size of the table (@code{sys_nerr}) before indexing
-it, since new error codes may be added to the system before they are
-added to the table. Thus @code{sys_nerr} might be smaller than value
-implied by the largest @code{errno} value defined in @code{<errno.h>}.
-
-We return the maximum value that can be used to obtain a meaningful
-symbolic name or message.
-
-@end deftypefn
-
-@c fdmatch.c:23
-@deftypefn Extension int fdmatch (int @var{fd1}, int @var{fd2})
-
-Check to see if two open file descriptors refer to the same file.
-This is useful, for example, when we have an open file descriptor for
-an unnamed file, and the name of a file that we believe to correspond
-to that fd. This can happen when we are exec'd with an already open
-file (@code{stdout} for example) or from the SVR4 @file{/proc} calls
-that return open file descriptors for mapped address spaces. All we
-have to do is open the file by name and check the two file descriptors
-for a match, which is done by comparing major and minor device numbers
-and inode numbers.
-
-@end deftypefn
-
-@c ffs.c:3
-@deftypefn Supplemental int ffs (int @var{valu})
-
-Find the first (least significant) bit set in @var{valu}. Bits are
-numbered from right to left, starting with bit 1 (corresponding to the
-value 1). If @var{valu} is zero, zero is returned.
-
-@end deftypefn
-
-@c fnmatch.txh:1
-@deftypefn Replacement int fnmatch (const char *@var{pattern}, const char *@var{string}, int @var{flags})
-
-Matches @var{string} against @var{pattern}, returning zero if it
-matches, @code{FNM_NOMATCH} if not. @var{pattern} may contain the
-wildcards @code{?} to match any one character, @code{*} to match any
-zero or more characters, or a set of alternate characters in square
-brackets, like @samp{[a-gt8]}, which match one character (@code{a}
-through @code{g}, or @code{t}, or @code{8}, in this example) if that one
-character is in the set. A set may be inverted (i.e., match anything
-except what's in the set) by giving @code{^} or @code{!} as the first
-character in the set. To include those characters in the set, list them
-as anything other than the first character of the set. To include a
-dash in the set, list it last in the set. A backslash character makes
-the following character not special, so for example you could match
-against a literal asterisk with @samp{\*}. To match a literal
-backslash, use @samp{\\}.
-
-@code{flags} controls various aspects of the matching process, and is a
-boolean OR of zero or more of the following values (defined in
-@code{<fnmatch.h>}):
-
-@table @code
-
-@item FNM_PATHNAME
-@itemx FNM_FILE_NAME
-@var{string} is assumed to be a path name. No wildcard will ever match
-@code{/}.
-
-@item FNM_NOESCAPE
-Do not interpret backslashes as quoting the following special character.
-
-@item FNM_PERIOD
-A leading period (at the beginning of @var{string}, or if
-@code{FNM_PATHNAME} after a slash) is not matched by @code{*} or
-@code{?} but must be matched explicitly.
-
-@item FNM_LEADING_DIR
-Means that @var{string} also matches @var{pattern} if some initial part
-of @var{string} matches, and is followed by @code{/} and zero or more
-characters. For example, @samp{foo*} would match either @samp{foobar}
-or @samp{foobar/grill}.
-
-@item FNM_CASEFOLD
-Ignores case when performing the comparison.
-
-@end table
-
-@end deftypefn
-
-@c argv.c:111
-@deftypefn Extension void freeargv (char **@var{vector})
-
-Free an argument vector that was built using @code{buildargv}. Simply
-scans through @var{vector}, freeing the memory for each argument until
-the terminating @code{NULL} is found, and then frees @var{vector}
-itself.
-
-@end deftypefn
-
-@c getruntime.c:78
-@deftypefn Replacement long get_run_time (void)
-
-Returns the time used so far, in microseconds. If possible, this is
-the time used by this process, else it is the elapsed time since the
-process started.
-
-@end deftypefn
-
-@c getcwd.c:6
-@deftypefn Supplemental char* getcwd (char *@var{pathname}, int @var{len})
-
-Copy the absolute pathname for the current working directory into
-@var{pathname}, which is assumed to point to a buffer of at least
-@var{len} bytes, and return a pointer to the buffer. If the current
-directory's path doesn't fit in @var{len} characters, the result is
-@code{NULL} and @code{errno} is set. If @var{pathname} is a null pointer,
-@code{getcwd} will obtain @var{len} bytes of space using
-@code{malloc}.
-
-@end deftypefn
-
-@c getpagesize.c:5
-@deftypefn Supplemental int getpagesize (void)
-
-Returns the number of bytes in a page of memory. This is the
-granularity of many of the system memory management routines. No
-guarantee is made as to whether or not it is the same as the basic
-memory management hardware page size.
-
-@end deftypefn
-
-@c getpwd.c:5
-@deftypefn Supplemental char* getpwd (void)
-
-Returns the current working directory. This implementation caches the
-result on the assumption that the process will not call @code{chdir}
-between calls to @code{getpwd}.
-
-@end deftypefn
-
-@c hex.c:25
-@deftypefn Extension void hex_init (void)
-
-Initializes the array mapping the current character set to
-corresponding hex values. This function must be called before any
-call to @code{hex_p} or @code{hex_value}.
-
-@end deftypefn
-
-@c hex.c:33
-@deftypefn Extension int hex_p (int @var{c})
-
-Evaluates to non-zero if the given character is a valid hex character,
-or zero if it is not. Note that the value you pass will be cast to
-@code{unsigned char} within the macro.
-
-@end deftypefn
-
-@c hex.c:41
-@deftypefn Extension int hex_value (int @var{c})
-
-Returns the numeric equivalent of the given character when interpreted
-as a hexidecimal digit. The result is undefined if you pass an
-invalid hex digit. Note that the value you pass will be cast to
-@code{unsigned char} within the macro.
-
-@end deftypefn
-
-@c index.c:5
-@deftypefn Supplemental char* index (char *@var{s}, int @var{c})
-
-Returns a pointer to the first occurrence of the character @var{c} in
-the string @var{s}, or @code{NULL} if not found. The use of @code{index} is
-deprecated in new programs in favor of @code{strchr}.
-
-@end deftypefn
-
-@c insque.c:6
-@deftypefn Supplemental void insque (struct qelem *@var{elem}, struct qelem *@var{pred})
-@deftypefnx Supplemental void remque (struct qelem *@var{elem})
-
-Routines to manipulate queues built from doubly linked lists. The
-@code{insque} routine inserts @var{elem} in the queue immediately
-after @var{pred}. The @code{remque} routine removes @var{elem} from
-its containing queue. These routines expect to be passed pointers to
-structures which have as their first members a forward pointer and a
-back pointer, like this prototype (although no prototype is provided):
-
-@example
-struct qelem @{
- struct qelem *q_forw;
- struct qelem *q_back;
- char q_data[];
-@};
-@end example
-
-@end deftypefn
-
-@c lbasename.c:23
-@deftypefn Replacement {const char*} lbasename (const char *@var{name})
-
-Given a pointer to a string containing a typical pathname
-(@samp{/usr/src/cmd/ls/ls.c} for example), returns a pointer to the
-last component of the pathname (@samp{ls.c} in this case). The
-returned pointer is guaranteed to lie within the original
-string. This latter fact is not true of many vendor C
-libraries, which return special strings or modify the passed
-strings for particular input.
-
-In particular, the empty string returns the same empty string,
-and a path ending in @code{/} returns the empty string after it.
-
-@end deftypefn
-
-@c make-temp-file.c:138
-@deftypefn Replacement char* make_temp_file (const char *@var{suffix})
-
-Return a temporary file name (as a string) or @code{NULL} if unable to
-create one. @var{suffix} is a suffix to append to the file name. The
-string is @code{malloc}ed, and the temporary file has been created.
-
-@end deftypefn
-
-@c memchr.c:3
-@deftypefn Supplemental void* memchr (const void *@var{s}, int @var{c}, size_t @var{n})
-
-This function searches memory starting at @code{*@var{s}} for the
-character @var{c}. The search only ends with the first occurrence of
-@var{c}, or after @var{length} characters; in particular, a null
-character does not terminate the search. If the character @var{c} is
-found within @var{length} characters of @code{*@var{s}}, a pointer
-to the character is returned. If @var{c} is not found, then @code{NULL} is
-returned.
-
-@end deftypefn
-
-@c memcmp.c:6
-@deftypefn Supplemental int memcmp (const void *@var{x}, const void *@var{y}, size_t @var{count})
-
-Compares the first @var{count} bytes of two areas of memory. Returns
-zero if they are the same, a value less than zero if @var{x} is
-lexically less than @var{y}, or a value greater than zero if @var{x}
-is lexically greater than @var{y}. Note that lexical order is determined
-as if comparing unsigned char arrays.
-
-@end deftypefn
-
-@c memcpy.c:6
-@deftypefn Supplemental void* memcpy (void *@var{out}, const void *@var{in}, size_t @var{length})
-
-Copies @var{length} bytes from memory region @var{in} to region
-@var{out}. Returns a pointer to @var{out}.
-
-@end deftypefn
-
-@c memmove.c:6
-@deftypefn Supplemental void* memmove (void *@var{from}, const void *@var{to}, size_t @var{count})
-
-Copies @var{count} bytes from memory area @var{from} to memory area
-@var{to}, returning a pointer to @var{to}.
-
-@end deftypefn
-
-@c memset.c:6
-@deftypefn Supplemental void* memset (void *@var{s}, int @var{c}, size_t @var{count})
-
-Sets the first @var{count} bytes of @var{s} to the constant byte
-@var{c}, returning a pointer to @var{s}.
-
-@end deftypefn
-
-@c mkstemps.c:54
-@deftypefn Replacement int mkstemps (char *@var{template}, int @var{suffix_len})
-
-Generate a unique temporary file name from @var{template}.
-@var{template} has the form:
-
-@example
- @var{path}/ccXXXXXX@var{suffix}
-@end example
-
-@var{suffix_len} tells us how long @var{suffix} is (it can be zero
-length). The last six characters of @var{template} before @var{suffix}
-must be @samp{XXXXXX}; they are replaced with a string that makes the
-filename unique. Returns a file descriptor open on the file for
-reading and writing.
-
-@end deftypefn
-
-@c pexecute.c:67
-@deftypefn Extension int pexecute (const char *@var{program}, char * const *@var{argv}, const char *@var{this_pname}, const char *@var{temp_base}, char **@var{errmsg_fmt}, char **@var{errmsg_arg}, int flags)
-
-Executes a program.
-
-@var{program} and @var{argv} are the arguments to
-@code{execv}/@code{execvp}.
-
-@var{this_pname} is name of the calling program (i.e., @code{argv[0]}).
-
-@var{temp_base} is the path name, sans suffix, of a temporary file to
-use if needed. This is currently only needed for MS-DOS ports that
-don't use @code{go32} (do any still exist?). Ports that don't need it
-can pass @code{NULL}.
-
-(@code{@var{flags} & PEXECUTE_SEARCH}) is non-zero if @env{PATH} should be searched
-(??? It's not clear that GCC passes this flag correctly). (@code{@var{flags} &
-PEXECUTE_FIRST}) is nonzero for the first process in chain.
-(@code{@var{flags} & PEXECUTE_FIRST}) is nonzero for the last process
-in chain. The first/last flags could be simplified to only mark the
-last of a chain of processes but that requires the caller to always
-mark the last one (and not give up early if some error occurs).
-It's more robust to require the caller to mark both ends of the chain.
-
-The result is the pid on systems like Unix where we
-@code{fork}/@code{exec} and on systems like WIN32 and OS/2 where we
-use @code{spawn}. It is up to the caller to wait for the child.
-
-The result is the @code{WEXITSTATUS} on systems like MS-DOS where we
-@code{spawn} and wait for the child here.
-
-Upon failure, @var{errmsg_fmt} and @var{errmsg_arg} are set to the
-text of the error message with an optional argument (if not needed,
-@var{errmsg_arg} is set to @code{NULL}), and @minus{}1 is returned.
-@code{errno} is available to the caller to use.
-
-@end deftypefn
-
-@c strsignal.c:547
-@deftypefn Supplemental void psignal (unsigned @var{signo}, char *@var{message})
-
-Print @var{message} to the standard error, followed by a colon,
-followed by the description of the signal specified by @var{signo},
-followed by a newline.
-
-@end deftypefn
-
-@c putenv.c:21
-@deftypefn Supplemental int putenv (const char *@var{string})
-
-Uses @code{setenv} or @code{unsetenv} to put @var{string} into
-the environment or remove it. If @var{string} is of the form
-@samp{name=value} the string is added; if no @samp{=} is present the
-name is unset/removed.
-
-@end deftypefn
-
-@c pexecute.c:104
-@deftypefn Extension int pwait (int @var{pid}, int *@var{status}, int @var{flags})
-
-Waits for a program started by @code{pexecute} to finish.
-
-@var{pid} is the process id of the task to wait for. @var{status} is
-the `status' argument to wait. @var{flags} is currently unused (allows
-future enhancement without breaking upward compatibility). Pass 0 for now.
-
-The result is the pid of the child reaped, or -1 for failure
-(@code{errno} says why).
-
-On systems that don't support waiting for a particular child, @var{pid} is
-ignored. On systems like MS-DOS that don't really multitask @code{pwait}
-is just a mechanism to provide a consistent interface for the caller.
-
-@end deftypefn
-
-@c random.c:39
-@deftypefn Supplement {long int} random (void)
-@deftypefnx Supplement void srandom (unsigned int @var{seed})
-@deftypefnx Supplement void* initstate (unsigned int @var{seed}, void *@var{arg_state}, unsigned long @var{n})
-@deftypefnx Supplement void* setstate (void *@var{arg_state})
-
-Random number functions. @code{random} returns a random number in the
-range 0 to @code{LONG_MAX}. @code{srandom} initializes the random
-number generator to some starting point determined by @var{seed}
-(else, the values returned by @code{random} are always the same for each
-run of the program). @code{initstate} and @code{setstate} allow fine-grained
-control over the state of the random number generator.
-
-@end deftypefn
-
-@c concat.c:177
-@deftypefn Extension char* reconcat (char *@var{optr}, const char *@var{s1}, @dots{}, @code{NULL})
-
-Same as @code{concat}, except that if @var{optr} is not @code{NULL} it
-is freed after the string is created. This is intended to be useful
-when you're extending an existing string or building up a string in a
-loop:
-
-@example
- str = reconcat (str, "pre-", str, NULL);
-@end example
-
-@end deftypefn
-
-@c rename.c:6
-@deftypefn Supplemental int rename (const char *@var{old}, const char *@var{new})
-
-Renames a file from @var{old} to @var{new}. If @var{new} already
-exists, it is removed.
-
-@end deftypefn
-
-@c rindex.c:5
-@deftypefn Supplemental char* rindex (const char *@var{s}, int @var{c})
-
-Returns a pointer to the last occurrence of the character @var{c} in
-the string @var{s}, or @code{NULL} if not found. The use of @code{rindex} is
-deprecated in new programs in favor of @code{strrchr}.
-
-@end deftypefn
-
-@c setenv.c:22
-@deftypefn Supplemental int setenv (const char *@var{name}, const char *@var{value}, int @var{overwrite})
-@deftypefnx Supplemental void unsetenv (const char *@var{name})
-
-@code{setenv} adds @var{name} to the environment with value
-@var{value}. If the name was already present in the environment,
-the new value will be stored only if @var{overwrite} is nonzero.
-The companion @code{unsetenv} function removes @var{name} from the
-environment. This implementation is not safe for multithreaded code.
-
-@end deftypefn
-
-@c strsignal.c:353
-@deftypefn Extension int signo_max (void)
-
-Returns the maximum signal value for which a corresponding symbolic
-name or message is available. Note that in the case where we use the
-@code{sys_siglist} supplied by the system, it is possible for there to
-be more symbolic names than messages, or vice versa. In fact, the
-manual page for @code{psignal(3b)} explicitly warns that one should
-check the size of the table (@code{NSIG}) before indexing it, since
-new signal codes may be added to the system before they are added to
-the table. Thus @code{NSIG} might be smaller than value implied by
-the largest signo value defined in @code{<signal.h>}.
-
-We return the maximum value that can be used to obtain a meaningful
-symbolic name or message.
-
-@end deftypefn
-
-@c sigsetmask.c:8
-@deftypefn Supplemental int sigsetmask (int @var{set})
-
-Sets the signal mask to the one provided in @var{set} and returns
-the old mask (which, for libiberty's implementation, will always
-be the value @code{1}).
-
-@end deftypefn
-
-@c spaces.c:22
-@deftypefn Extension char* spaces (int @var{count})
-
-Returns a pointer to a memory region filled with the specified
-number of spaces and null terminated. The returned pointer is
-valid until at least the next call.
-
-@end deftypefn
-
-@c strcasecmp.c:15
-@deftypefn Supplemental int strcasecmp (const char *@var{s1}, const char *@var{s2})
-
-A case-insensitive @code{strcmp}.
-
-@end deftypefn
-
-@c strchr.c:6
-@deftypefn Supplemental char* strchr (const char *@var{s}, int @var{c})
-
-Returns a pointer to the first occurrence of the character @var{c} in
-the string @var{s}, or @code{NULL} if not found. If @var{c} is itself the
-null character, the results are undefined.
-
-@end deftypefn
-
-@c strdup.c:3
-@deftypefn Supplemental char* strdup (const char *@var{s})
-
-Returns a pointer to a copy of @var{s} in memory obtained from
-@code{malloc}, or @code{NULL} if insufficient memory was available.
-
-@end deftypefn
-
-@c strerror.c:670
-@deftypefn Replacement {const char*} strerrno (int @var{errnum})
-
-Given an error number returned from a system call (typically returned
-in @code{errno}), returns a pointer to a string containing the
-symbolic name of that error number, as found in @code{<errno.h>}.
-
-If the supplied error number is within the valid range of indices for
-symbolic names, but no name is available for the particular error
-number, then returns the string @samp{Error @var{num}}, where @var{num}
-is the error number.
-
-If the supplied error number is not within the range of valid
-indices, then returns @code{NULL}.
-
-The contents of the location pointed to are only guaranteed to be
-valid until the next call to @code{strerrno}.
-
-@end deftypefn
-
-@c strerror.c:602
-@deftypefn Supplemental char* strerror (int @var{errnoval})
-
-Maps an @code{errno} number to an error message string, the contents
-of which are implementation defined. On systems which have the
-external variables @code{sys_nerr} and @code{sys_errlist}, these
-strings will be the same as the ones used by @code{perror}.
-
-If the supplied error number is within the valid range of indices for
-the @code{sys_errlist}, but no message is available for the particular
-error number, then returns the string @samp{Error @var{num}}, where
-@var{num} is the error number.
-
-If the supplied error number is not a valid index into
-@code{sys_errlist}, returns @code{NULL}.
-
-The returned string is only guaranteed to be valid only until the
-next call to @code{strerror}.
-
-@end deftypefn
-
-@c strncasecmp.c:15
-@deftypefn Supplemental int strncasecmp (const char *@var{s1}, const char *@var{s2})
-
-A case-insensitive @code{strncmp}.
-
-@end deftypefn
-
-@c strncmp.c:6
-@deftypefn Supplemental int strncmp (const char *@var{s1}, const char *@var{s2}, size_t @var{n})
-
-Compares the first @var{n} bytes of two strings, returning a value as
-@code{strcmp}.
-
-@end deftypefn
-
-@c strrchr.c:6
-@deftypefn Supplemental char* strrchr (const char *@var{s}, int @var{c})
-
-Returns a pointer to the last occurrence of the character @var{c} in
-the string @var{s}, or @code{NULL} if not found. If @var{c} is itself the
-null character, the results are undefined.
-
-@end deftypefn
-
-@c strsignal.c:388
-@deftypefn Supplemental {const char *} strsignal (int @var{signo})
-
-Maps an signal number to an signal message string, the contents of
-which are implementation defined. On systems which have the external
-variable @code{sys_siglist}, these strings will be the same as the
-ones used by @code{psignal()}.
-
-If the supplied signal number is within the valid range of indices for
-the @code{sys_siglist}, but no message is available for the particular
-signal number, then returns the string @samp{Signal @var{num}}, where
-@var{num} is the signal number.
-
-If the supplied signal number is not a valid index into
-@code{sys_siglist}, returns @code{NULL}.
-
-The returned string is only guaranteed to be valid only until the next
-call to @code{strsignal}.
-
-@end deftypefn
-
-@c strsignal.c:452
-@deftypefn Extension {const char*} strsigno (int @var{signo})
-
-Given an signal number, returns a pointer to a string containing the
-symbolic name of that signal number, as found in @code{<signal.h>}.
-
-If the supplied signal number is within the valid range of indices for
-symbolic names, but no name is available for the particular signal
-number, then returns the string @samp{Signal @var{num}}, where
-@var{num} is the signal number.
-
-If the supplied signal number is not within the range of valid
-indices, then returns @code{NULL}.
-
-The contents of the location pointed to are only guaranteed to be
-valid until the next call to @code{strsigno}.
-
-@end deftypefn
-
-@c strstr.c:6
-@deftypefn Supplemental char* strstr (const char *@var{string}, const char *@var{sub})
-
-This function searches for the substring @var{sub} in the string
-@var{string}, not including the terminating null characters. A pointer
-to the first occurrence of @var{sub} is returned, or @code{NULL} if the
-substring is absent. If @var{sub} points to a string with zero
-length, the function returns @var{string}.
-
-@end deftypefn
-
-@c strtod.c:27
-@deftypefn Supplemental double strtod (const char *@var{string}, char **@var{endptr})
-
-This ISO C function converts the initial portion of @var{string} to a
-@code{double}. If @var{endptr} is not @code{NULL}, a pointer to the
-character after the last character used in the conversion is stored in
-the location referenced by @var{endptr}. If no conversion is
-performed, zero is returned and the value of @var{string} is stored in
-the location referenced by @var{endptr}.
-
-@end deftypefn
-
-@c strerror.c:730
-@deftypefn Extension int strtoerrno (const char *@var{name})
-
-Given the symbolic name of a error number (e.g., @code{EACCES}), map it
-to an errno value. If no translation is found, returns 0.
-
-@end deftypefn
-
-@c strtol.c:33
-@deftypefn Supplemental {long int} strtol (const char *@var{string}, char **@var{endptr}, int @var{base})
-@deftypefnx Supplemental {unsigned long int} strtoul (const char *@var{string}, char **@var{endptr}, int @var{base})
-
-The @code{strtol} function converts the string in @var{string} to a
-long integer value according to the given @var{base}, which must be
-between 2 and 36 inclusive, or be the special value 0. If @var{base}
-is 0, @code{strtol} will look for the prefixes @code{0} and @code{0x}
-to indicate bases 8 and 16, respectively, else default to base 10.
-When the base is 16 (either explicitly or implicitly), a prefix of
-@code{0x} is allowed. The handling of @var{endptr} is as that of
-@code{strtod} above. The @code{strtoul} function is the same, except
-that the converted value is unsigned.
-
-@end deftypefn
-
-@c strsignal.c:507
-@deftypefn Extension int strtosigno (const char *@var{name})
-
-Given the symbolic name of a signal, map it to a signal number. If no
-translation is found, returns 0.
-
-@end deftypefn
-
-@c tmpnam.c:3
-@deftypefn Supplemental char* tmpnam (char *@var{s})
-
-This function attempts to create a name for a temporary file, which
-will be a valid file name yet not exist when @code{tmpnam} checks for
-it. @var{s} must point to a buffer of at least @code{L_tmpnam} bytes,
-or be @code{NULL}. Use of this function creates a security risk, and it must
-not be used in new projects. Use @code{mkstemp} instead.
-
-@end deftypefn
-
-@c vasprintf.c:48
-@deftypefn Extension int vasprintf (char **@var{resptr}, const char *@var{format}, va_list @var{args})
-
-Like @code{vsprintf}, but instead of passing a pointer to a buffer,
-you pass a pointer to a pointer. This function will compute the size
-of the buffer needed, allocate memory with @code{malloc}, and store a
-pointer to the allocated memory in @code{*@var{resptr}}. The value
-returned is the same as @code{vsprintf} would return. If memory could
-not be allocated, zero is returned and @code{NULL} is stored in
-@code{*@var{resptr}}.
-
-@end deftypefn
-
-@c vfork.c:6
-@deftypefn Supplemental int vfork (void)
-
-Emulates @code{vfork} by calling @code{fork} and returning its value.
-
-@end deftypefn
-
-@c vprintf.c:3
-@deftypefn Supplemental int vprintf (const char *@var{format}, va_list @var{ap})
-@deftypefnx Supplemental int vfprintf (FILE *@var{stream}, const char *@var{format}, va_list @var{ap})
-@deftypefnx Supplemental int vsprintf (char *@var{str}, const char *@var{format}, va_list @var{ap})
-
-These functions are the same as @code{printf}, @code{fprintf}, and
-@code{sprintf}, respectively, except that they are called with a
-@code{va_list} instead of a variable number of arguments. Note that
-they do not call @code{va_end}; this is the application's
-responsibility. In @libib{} they are implemented in terms of the
-nonstandard but common function @code{_doprnt}.
-
-@end deftypefn
-
-@c waitpid.c:3
-@deftypefn Supplemental int waitpid (int @var{pid}, int *@var{status}, int)
-
-This is a wrapper around the @code{wait} function. Any ``special''
-values of @var{pid} depend on your implementation of @code{wait}, as
-does the return value. The third argument is unused in @libib{}.
-
-@end deftypefn
-
-@c xatexit.c:11
-@deftypefun int xatexit (void (*@var{fn}) (void))
-
-Behaves as the standard @code{atexit} function, but with no limit on
-the number of registered functions. Returns 0 on success, or @minus{}1 on
-failure. If you use @code{xatexit} to register functions, you must use
-@code{xexit} to terminate your program.
-
-@end deftypefun
-
-@c xmalloc.c:38
-@deftypefn Replacement void* xcalloc (size_t @var{nelem}, size_t @var{elsize})
-
-Allocate memory without fail, and set it to zero. This routine functions
-like @code{calloc}, but will behave the same as @code{xmalloc} if memory
-cannot be found.
-
-@end deftypefn
-
-@c xexit.c:22
-@deftypefn Replacement void xexit (int @var{code})
-
-Terminates the program. If any functions have been registered with
-the @code{xatexit} replacement function, they will be called first.
-Termination is handled via the system's normal @code{exit} call.
-
-@end deftypefn
-
-@c xmalloc.c:22
-@deftypefn Replacement void* xmalloc (size_t)
-
-Allocate memory without fail. If @code{malloc} fails, this will print
-a message to @code{stderr} (using the name set by
-@code{xmalloc_set_program_name},
-if any) and then call @code{xexit}. Note that it is therefore safe for
-a program to contain @code{#define malloc xmalloc} in its source.
-
-@end deftypefn
-
-@c xmalloc.c:53
-@deftypefn Replacement void xmalloc_failed (size_t)
-
-This function is not meant to be called by client code, and is listed
-here for completeness only. If any of the allocation routines fail, this
-function will be called to print an error message and terminate execution.
-
-@end deftypefn
-
-@c xmalloc.c:46
-@deftypefn Replacement void xmalloc_set_program_name (const char *@var{name})
-
-You can use this to set the name of the program used by
-@code{xmalloc_failed} when printing a failure message.
-
-@end deftypefn
-
-@c xmemdup.c:7
-@deftypefn Replacement void* xmemdup (void *@var{input}, size_t @var{copy_size}, size_t @var{alloc_size})
-
-Duplicates a region of memory without fail. First, @var{alloc_size} bytes
-are allocated, then @var{copy_size} bytes from @var{input} are copied into
-it, and the new memory is returned. If fewer bytes are copied than were
-allocated, the remaining memory is zeroed.
-
-@end deftypefn
-
-@c xmalloc.c:32
-@deftypefn Replacement void* xrealloc (void *@var{ptr}, size_t @var{size})
-Reallocate memory without fail. This routine functions like @code{realloc},
-but will behave the same as @code{xmalloc} if memory cannot be found.
-
-@end deftypefn
-
-@c xstrdup.c:7
-@deftypefn Replacement char* xstrdup (const char *@var{s})
-
-Duplicates a character string without fail, using @code{xmalloc} to
-obtain memory.
-
-@end deftypefn
-
-@c xstrerror.c:7
-@deftypefn Replacement char* xstrerror (int @var{errnum})
-
-Behaves exactly like the standard @code{strerror} function, but
-will never return a @code{NULL} pointer.
-
-@end deftypefn
-
-
diff --git a/libiberty/gather-docs b/libiberty/gather-docs
deleted file mode 100644
index b272c02..0000000
--- a/libiberty/gather-docs
+++ /dev/null
@@ -1,128 +0,0 @@
-#!/usr/bin/perl
-# -*- perl -*-
-
-# Copyright (C) 2001
-# Free Software Foundation
-#
-# This file is part of the libiberty library.
-# Libiberty is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Library General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# Libiberty is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Library General Public License for more details.
-#
-# You should have received a copy of the GNU Library General Public
-# License along with libiberty; see the file COPYING.LIB. If not,
-# write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-#
-# Originally written by DJ Delorie <dj@redhat.com>
-
-
-
-# This program looks for texinfo snippets in source files and other
-# files, and builds per-category files with entries sorted in
-# alphabetical order.
-
-# The syntax it looks for is lines starting with '@def' in *.c and
-# other files (see TEXIFILES in Makefile.in). Entries are terminated
-# at the next @def* (which begins a new entry) or, for C files, a line
-# that begins with '*/' without leading spaces (this assumes that the
-# texinfo snippet is within a C-style /* */ comment).
-
-#
-
-
-
-if ($ARGV[0] eq "-v") {
- $verbose = 1;
- shift;
-}
-
-$srcdir = shift;
-$outfile = shift;
-
-if ($outfile !~ /\S/ || ! -f "$srcdir/Makefile.in" ) {
- print STDERR "Usage: gather-docs [-v] srcdir outfile.txi [files with snippets in them ...]\n";
- exit 1;
-}
-
-$errors = 0;
-
-for $in (@ARGV) {
-
- if (!open(IN, "$srcdir/$in")) {
- print STDERR "Cannot open $srcdir/$in for reading: $!\n";
- $errors ++;
-
- } else {
- $first = 1;
- $pertinent = 0;
- $man_mode = 0;
- $line = 0;
-
- while (<IN>) {
- $line ++;
- $pertinent = 1 if /^\@def[a-z]*[a-wyz] /;
- $pertinent = 0 if /^\*\//;
- next unless $pertinent;
-
- if (/^\@def[a-z]*[a-wyz] /) {
-
- ($name) = m/[^\(]* ([^\( \t\r\n]+) *\(/;
- $name =~ s/[ ]*$//;
- $key = $name;
- $key =~ tr/A-Z/a-z/;
- $key =~ s/[^a-z0-9]+/ /g;
- $name{$key} = $node;
- $lines{$key} = '';
- $src_file{$key} = $in;
- $src_line{$key} = $line;
- print "\nReading $in :" if $verbose && $first;
- $first = 0;
- print " $name" if $verbose;
- $node_lines{$key} .= $_;
-
- } else {
- $node_lines{$key} .= $_;
- }
-
- $pertinent = 0 if /^\@end def/;
- }
- close (IN);
- }
-}
-
-print "\n" if $verbose;
-exit $errors if $errors;
-
-if (!open (OUT, "> $outfile")) {
- print STDERR "Cannot open $outfile for writing: $!\n";
- $errors ++;
- next;
-}
-print "Writing $outfile\n" if $verbose;
-
-print OUT "\@c Automatically generated from *.c and others (the comments before\n";
-print OUT "\@c each entry tell you which file and where in that file). DO NOT EDIT!\n";
-print OUT "\@c Edit the *.c files, configure with --enable-maintainer-mode,\n";
-print OUT "\@c and let gather-docs build you a new copy.\n\n";
-
-for $key (sort keys %name) {
- print OUT "\@c $src_file{$key}:$src_line{$key}\n";
- print OUT $node_lines{$key};
- print OUT "\n";
-}
-
-if (! print OUT "\n") {
- print STDERR "Disk full writing $srcdir/$cat.texi\n";
- $errors ++;
-}
-
-close (OUT);
-
-exit $errors;
diff --git a/libiberty/getcwd.c b/libiberty/getcwd.c
deleted file mode 100644
index 465b4e0..0000000
--- a/libiberty/getcwd.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/* Emulate getcwd using getwd.
- This function is in the public domain. */
-
-/*
-
-@deftypefn Supplemental char* getcwd (char *@var{pathname}, int @var{len})
-
-Copy the absolute pathname for the current working directory into
-@var{pathname}, which is assumed to point to a buffer of at least
-@var{len} bytes, and return a pointer to the buffer. If the current
-directory's path doesn't fit in @var{len} characters, the result is
-@code{NULL} and @code{errno} is set. If @var{pathname} is a null pointer,
-@code{getcwd} will obtain @var{len} bytes of space using
-@code{malloc}.
-
-@end deftypefn
-
-*/
-
-#include "config.h"
-
-#ifdef HAVE_SYS_PARAM_H
-#include <sys/param.h>
-#endif
-#include <errno.h>
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-
-extern char *getwd ();
-extern int errno;
-
-#ifndef MAXPATHLEN
-#define MAXPATHLEN 1024
-#endif
-
-char *
-getcwd (buf, len)
- char *buf;
- int len;
-{
- char ourbuf[MAXPATHLEN];
- char *result;
-
- result = getwd (ourbuf);
- if (result) {
- if (strlen (ourbuf) >= len) {
- errno = ERANGE;
- return 0;
- }
- if (!buf) {
- buf = (char*)malloc(len);
- if (!buf) {
- errno = ENOMEM;
- return 0;
- }
- }
- strcpy (buf, ourbuf);
- }
- return buf;
-}
diff --git a/libiberty/getopt.c b/libiberty/getopt.c
deleted file mode 100644
index 2402a39..0000000
--- a/libiberty/getopt.c
+++ /dev/null
@@ -1,1056 +0,0 @@
-/* Getopt for GNU.
- NOTE: getopt is now part of the C library, so if you don't know what
- "Keep this file name-space clean" means, talk to drepper@gnu.org
- before changing it!
-
- Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98
- Free Software Foundation, Inc.
-
- NOTE: This source is derived from an old version taken from the GNU C
- Library (glibc).
-
- This program is free software; you can redistribute 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. */
-
-/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
- Ditto for AIX 3.2 and <stdlib.h>. */
-#ifndef _NO_PROTO
-# define _NO_PROTO
-#endif
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#if !defined __STDC__ || !__STDC__
-/* This is a separate conditional since some stdc systems
- reject `defined (const)'. */
-# ifndef const
-# define const
-# endif
-#endif
-
-#include <stdio.h>
-
-/* Comment out all this code if we are using the GNU C Library, and are not
- actually compiling the library itself. This code is part of the GNU C
- Library, but also included in many other GNU distributions. Compiling
- and linking in this code is a waste when using the GNU C library
- (especially if it is a shared library). Rather than having every GNU
- program understand `configure --with-gnu-libc' and omit the object files,
- it is simpler to just do this in the source for each such file. */
-
-#define GETOPT_INTERFACE_VERSION 2
-#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2
-# include <gnu-versions.h>
-# if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
-# define ELIDE_CODE
-# endif
-#endif
-
-#ifndef ELIDE_CODE
-
-
-/* This needs to come after some library #include
- to get __GNU_LIBRARY__ defined. */
-#ifdef __GNU_LIBRARY__
-/* Don't include stdlib.h for non-GNU C libraries because some of them
- contain conflicting prototypes for getopt. */
-# include <stdlib.h>
-# include <unistd.h>
-#endif /* GNU C library. */
-
-#ifdef VMS
-# include <unixlib.h>
-# if HAVE_STRING_H - 0
-# include <string.h>
-# endif
-#endif
-
-#ifndef _
-/* This is for other GNU distributions with internationalized messages.
- When compiling libc, the _ macro is predefined. */
-# if (HAVE_LIBINTL_H && ENABLE_NLS) || defined _LIBC
-# include <libintl.h>
-# define _(msgid) gettext (msgid)
-# else
-# define _(msgid) (msgid)
-# endif
-#endif
-
-/* This version of `getopt' appears to the caller like standard Unix `getopt'
- but it behaves differently for the user, since it allows the user
- to intersperse the options with the other arguments.
-
- As `getopt' works, it permutes the elements of ARGV so that,
- when it is done, all the options precede everything else. Thus
- all application programs are extended to handle flexible argument order.
-
- Setting the environment variable POSIXLY_CORRECT disables permutation.
- Then the behavior is completely standard.
-
- GNU application programs can use a third alternative mode in which
- they can distinguish the relative order of options and other arguments. */
-
-#include "getopt.h"
-
-/* For communication from `getopt' to the caller.
- When `getopt' finds an option that takes an argument,
- the argument value is returned here.
- Also, when `ordering' is RETURN_IN_ORDER,
- each non-option ARGV-element is returned here. */
-
-char *optarg = NULL;
-
-/* Index in ARGV of the next element to be scanned.
- This is used for communication to and from the caller
- and for communication between successive calls to `getopt'.
-
- On entry to `getopt', zero means this is the first call; initialize.
-
- When `getopt' returns -1, this is the index of the first of the
- non-option elements that the caller should itself scan.
-
- Otherwise, `optind' communicates from one call to the next
- how much of ARGV has been scanned so far. */
-
-/* 1003.2 says this must be 1 before any call. */
-int optind = 1;
-
-/* Formerly, initialization of getopt depended on optind==0, which
- causes problems with re-calling getopt as programs generally don't
- know that. */
-
-int __getopt_initialized = 0;
-
-/* The next char to be scanned in the option-element
- in which the last option character we returned was found.
- This allows us to pick up the scan where we left off.
-
- If this is zero, or a null string, it means resume the scan
- by advancing to the next ARGV-element. */
-
-static char *nextchar;
-
-/* Callers store zero here to inhibit the error message
- for unrecognized options. */
-
-int opterr = 1;
-
-/* Set to an option character which was unrecognized.
- This must be initialized on some systems to avoid linking in the
- system's own getopt implementation. */
-
-int optopt = '?';
-
-/* Describe how to deal with options that follow non-option ARGV-elements.
-
- If the caller did not specify anything,
- the default is REQUIRE_ORDER if the environment variable
- POSIXLY_CORRECT is defined, PERMUTE otherwise.
-
- REQUIRE_ORDER means don't recognize them as options;
- stop option processing when the first non-option is seen.
- This is what Unix does.
- This mode of operation is selected by either setting the environment
- variable POSIXLY_CORRECT, or using `+' as the first character
- of the list of option characters.
-
- PERMUTE is the default. We permute the contents of ARGV as we scan,
- so that eventually all the non-options are at the end. This allows options
- to be given in any order, even with programs that were not written to
- expect this.
-
- RETURN_IN_ORDER is an option available to programs that were written
- to expect options and other ARGV-elements in any order and that care about
- the ordering of the two. We describe each non-option ARGV-element
- as if it were the argument of an option with character code 1.
- Using `-' as the first character of the list of option characters
- selects this mode of operation.
-
- The special argument `--' forces an end of option-scanning regardless
- of the value of `ordering'. In the case of RETURN_IN_ORDER, only
- `--' can cause `getopt' to return -1 with `optind' != ARGC. */
-
-static enum
-{
- REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
-} ordering;
-
-/* Value of POSIXLY_CORRECT environment variable. */
-static char *posixly_correct;
-
-#ifdef __GNU_LIBRARY__
-/* We want to avoid inclusion of string.h with non-GNU libraries
- because there are many ways it can cause trouble.
- On some systems, it contains special magic macros that don't work
- in GCC. */
-# include <string.h>
-# define my_index strchr
-#else
-
-# if HAVE_STRING_H
-# include <string.h>
-# else
-# if HAVE_STRINGS_H
-# include <strings.h>
-# endif
-# endif
-
-/* Avoid depending on library functions or files
- whose names are inconsistent. */
-
-#ifndef getenv
-extern char *getenv ();
-#endif
-
-static char *
-my_index (str, chr)
- const char *str;
- int chr;
-{
- while (*str)
- {
- if (*str == chr)
- return (char *) str;
- str++;
- }
- return 0;
-}
-
-/* If using GCC, we can safely declare strlen this way.
- If not using GCC, it is ok not to declare it. */
-#ifdef __GNUC__
-/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h.
- That was relevant to code that was here before. */
-# if (!defined __STDC__ || !__STDC__) && !defined strlen
-/* gcc with -traditional declares the built-in strlen to return int,
- and has done so at least since version 2.4.5. -- rms. */
-extern int strlen (const char *);
-# endif /* not __STDC__ */
-#endif /* __GNUC__ */
-
-#endif /* not __GNU_LIBRARY__ */
-
-/* Handle permutation of arguments. */
-
-/* Describe the part of ARGV that contains non-options that have
- been skipped. `first_nonopt' is the index in ARGV of the first of them;
- `last_nonopt' is the index after the last of them. */
-
-static int first_nonopt;
-static int last_nonopt;
-
-#ifdef _LIBC
-/* Bash 2.0 gives us an environment variable containing flags
- indicating ARGV elements that should not be considered arguments. */
-
-/* Defined in getopt_init.c */
-extern char *__getopt_nonoption_flags;
-
-static int nonoption_flags_max_len;
-static int nonoption_flags_len;
-
-static int original_argc;
-static char *const *original_argv;
-
-/* Make sure the environment variable bash 2.0 puts in the environment
- is valid for the getopt call we must make sure that the ARGV passed
- to getopt is that one passed to the process. */
-static void
-__attribute__ ((unused))
-store_args_and_env (int argc, char *const *argv)
-{
- /* XXX This is no good solution. We should rather copy the args so
- that we can compare them later. But we must not use malloc(3). */
- original_argc = argc;
- original_argv = argv;
-}
-# ifdef text_set_element
-text_set_element (__libc_subinit, store_args_and_env);
-# endif /* text_set_element */
-
-# define SWAP_FLAGS(ch1, ch2) \
- if (nonoption_flags_len > 0) \
- { \
- char __tmp = __getopt_nonoption_flags[ch1]; \
- __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \
- __getopt_nonoption_flags[ch2] = __tmp; \
- }
-#else /* !_LIBC */
-# define SWAP_FLAGS(ch1, ch2)
-#endif /* _LIBC */
-
-/* Exchange two adjacent subsequences of ARGV.
- One subsequence is elements [first_nonopt,last_nonopt)
- which contains all the non-options that have been skipped so far.
- The other is elements [last_nonopt,optind), which contains all
- the options processed since those non-options were skipped.
-
- `first_nonopt' and `last_nonopt' are relocated so that they describe
- the new indices of the non-options in ARGV after they are moved. */
-
-#if defined __STDC__ && __STDC__
-static void exchange (char **);
-#endif
-
-static void
-exchange (argv)
- char **argv;
-{
- int bottom = first_nonopt;
- int middle = last_nonopt;
- int top = optind;
- char *tem;
-
- /* Exchange the shorter segment with the far end of the longer segment.
- That puts the shorter segment into the right place.
- It leaves the longer segment in the right place overall,
- but it consists of two parts that need to be swapped next. */
-
-#ifdef _LIBC
- /* First make sure the handling of the `__getopt_nonoption_flags'
- string can work normally. Our top argument must be in the range
- of the string. */
- if (nonoption_flags_len > 0 && top >= nonoption_flags_max_len)
- {
- /* We must extend the array. The user plays games with us and
- presents new arguments. */
- char *new_str = malloc (top + 1);
- if (new_str == NULL)
- nonoption_flags_len = nonoption_flags_max_len = 0;
- else
- {
- memset (__mempcpy (new_str, __getopt_nonoption_flags,
- nonoption_flags_max_len),
- '\0', top + 1 - nonoption_flags_max_len);
- nonoption_flags_max_len = top + 1;
- __getopt_nonoption_flags = new_str;
- }
- }
-#endif
-
- while (top > middle && middle > bottom)
- {
- if (top - middle > middle - bottom)
- {
- /* Bottom segment is the short one. */
- int len = middle - bottom;
- register int i;
-
- /* Swap it with the top part of the top segment. */
- for (i = 0; i < len; i++)
- {
- tem = argv[bottom + i];
- argv[bottom + i] = argv[top - (middle - bottom) + i];
- argv[top - (middle - bottom) + i] = tem;
- SWAP_FLAGS (bottom + i, top - (middle - bottom) + i);
- }
- /* Exclude the moved bottom segment from further swapping. */
- top -= len;
- }
- else
- {
- /* Top segment is the short one. */
- int len = top - middle;
- register int i;
-
- /* Swap it with the bottom part of the bottom segment. */
- for (i = 0; i < len; i++)
- {
- tem = argv[bottom + i];
- argv[bottom + i] = argv[middle + i];
- argv[middle + i] = tem;
- SWAP_FLAGS (bottom + i, middle + i);
- }
- /* Exclude the moved top segment from further swapping. */
- bottom += len;
- }
- }
-
- /* Update records for the slots the non-options now occupy. */
-
- first_nonopt += (optind - last_nonopt);
- last_nonopt = optind;
-}
-
-/* Initialize the internal data when the first call is made. */
-
-#if defined __STDC__ && __STDC__
-static const char *_getopt_initialize (int, char *const *, const char *);
-#endif
-static const char *
-_getopt_initialize (argc, argv, optstring)
- int argc;
- char *const *argv;
- const char *optstring;
-{
- /* Start processing options with ARGV-element 1 (since ARGV-element 0
- is the program name); the sequence of previously skipped
- non-option ARGV-elements is empty. */
-
- first_nonopt = last_nonopt = optind;
-
- nextchar = NULL;
-
- posixly_correct = getenv ("POSIXLY_CORRECT");
-
- /* Determine how to handle the ordering of options and nonoptions. */
-
- if (optstring[0] == '-')
- {
- ordering = RETURN_IN_ORDER;
- ++optstring;
- }
- else if (optstring[0] == '+')
- {
- ordering = REQUIRE_ORDER;
- ++optstring;
- }
- else if (posixly_correct != NULL)
- ordering = REQUIRE_ORDER;
- else
- ordering = PERMUTE;
-
-#ifdef _LIBC
- if (posixly_correct == NULL
- && argc == original_argc && argv == original_argv)
- {
- if (nonoption_flags_max_len == 0)
- {
- if (__getopt_nonoption_flags == NULL
- || __getopt_nonoption_flags[0] == '\0')
- nonoption_flags_max_len = -1;
- else
- {
- const char *orig_str = __getopt_nonoption_flags;
- int len = nonoption_flags_max_len = strlen (orig_str);
- if (nonoption_flags_max_len < argc)
- nonoption_flags_max_len = argc;
- __getopt_nonoption_flags =
- (char *) malloc (nonoption_flags_max_len);
- if (__getopt_nonoption_flags == NULL)
- nonoption_flags_max_len = -1;
- else
- memset (__mempcpy (__getopt_nonoption_flags, orig_str, len),
- '\0', nonoption_flags_max_len - len);
- }
- }
- nonoption_flags_len = nonoption_flags_max_len;
- }
- else
- nonoption_flags_len = 0;
-#endif
-
- return optstring;
-}
-
-/* Scan elements of ARGV (whose length is ARGC) for option characters
- given in OPTSTRING.
-
- If an element of ARGV starts with '-', and is not exactly "-" or "--",
- then it is an option element. The characters of this element
- (aside from the initial '-') are option characters. If `getopt'
- is called repeatedly, it returns successively each of the option characters
- from each of the option elements.
-
- If `getopt' finds another option character, it returns that character,
- updating `optind' and `nextchar' so that the next call to `getopt' can
- resume the scan with the following option character or ARGV-element.
-
- If there are no more option characters, `getopt' returns -1.
- Then `optind' is the index in ARGV of the first ARGV-element
- that is not an option. (The ARGV-elements have been permuted
- so that those that are not options now come last.)
-
- OPTSTRING is a string containing the legitimate option characters.
- If an option character is seen that is not listed in OPTSTRING,
- return '?' after printing an error message. If you set `opterr' to
- zero, the error message is suppressed but we still return '?'.
-
- If a char in OPTSTRING is followed by a colon, that means it wants an arg,
- so the following text in the same ARGV-element, or the text of the following
- ARGV-element, is returned in `optarg'. Two colons mean an option that
- wants an optional arg; if there is text in the current ARGV-element,
- it is returned in `optarg', otherwise `optarg' is set to zero.
-
- If OPTSTRING starts with `-' or `+', it requests different methods of
- handling the non-option ARGV-elements.
- See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above.
-
- Long-named options begin with `--' instead of `-'.
- Their names may be abbreviated as long as the abbreviation is unique
- or is an exact match for some defined option. If they have an
- argument, it follows the option name in the same ARGV-element, separated
- from the option name by a `=', or else the in next ARGV-element.
- When `getopt' finds a long-named option, it returns 0 if that option's
- `flag' field is nonzero, the value of the option's `val' field
- if the `flag' field is zero.
-
- The elements of ARGV aren't really const, because we permute them.
- But we pretend they're const in the prototype to be compatible
- with other systems.
-
- LONGOPTS is a vector of `struct option' terminated by an
- element containing a name which is zero.
-
- LONGIND returns the index in LONGOPT of the long-named option found.
- It is only valid when a long-named option has been found by the most
- recent call.
-
- If LONG_ONLY is nonzero, '-' as well as '--' can introduce
- long-named options. */
-
-int
-_getopt_internal (argc, argv, optstring, longopts, longind, long_only)
- int argc;
- char *const *argv;
- const char *optstring;
- const struct option *longopts;
- int *longind;
- int long_only;
-{
- optarg = NULL;
-
- if (optind == 0 || !__getopt_initialized)
- {
- if (optind == 0)
- optind = 1; /* Don't scan ARGV[0], the program name. */
- optstring = _getopt_initialize (argc, argv, optstring);
- __getopt_initialized = 1;
- }
-
- /* Test whether ARGV[optind] points to a non-option argument.
- Either it does not have option syntax, or there is an environment flag
- from the shell indicating it is not an option. The later information
- is only used when the used in the GNU libc. */
-#ifdef _LIBC
-# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \
- || (optind < nonoption_flags_len \
- && __getopt_nonoption_flags[optind] == '1'))
-#else
-# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0')
-#endif
-
- if (nextchar == NULL || *nextchar == '\0')
- {
- /* Advance to the next ARGV-element. */
-
- /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been
- moved back by the user (who may also have changed the arguments). */
- if (last_nonopt > optind)
- last_nonopt = optind;
- if (first_nonopt > optind)
- first_nonopt = optind;
-
- if (ordering == PERMUTE)
- {
- /* If we have just processed some options following some non-options,
- exchange them so that the options come first. */
-
- if (first_nonopt != last_nonopt && last_nonopt != optind)
- exchange ((char **) argv);
- else if (last_nonopt != optind)
- first_nonopt = optind;
-
- /* Skip any additional non-options
- and extend the range of non-options previously skipped. */
-
- while (optind < argc && NONOPTION_P)
- optind++;
- last_nonopt = optind;
- }
-
- /* The special ARGV-element `--' means premature end of options.
- Skip it like a null option,
- then exchange with previous non-options as if it were an option,
- then skip everything else like a non-option. */
-
- if (optind != argc && !strcmp (argv[optind], "--"))
- {
- optind++;
-
- if (first_nonopt != last_nonopt && last_nonopt != optind)
- exchange ((char **) argv);
- else if (first_nonopt == last_nonopt)
- first_nonopt = optind;
- last_nonopt = argc;
-
- optind = argc;
- }
-
- /* If we have done all the ARGV-elements, stop the scan
- and back over any non-options that we skipped and permuted. */
-
- if (optind == argc)
- {
- /* Set the next-arg-index to point at the non-options
- that we previously skipped, so the caller will digest them. */
- if (first_nonopt != last_nonopt)
- optind = first_nonopt;
- return -1;
- }
-
- /* If we have come to a non-option and did not permute it,
- either stop the scan or describe it to the caller and pass it by. */
-
- if (NONOPTION_P)
- {
- if (ordering == REQUIRE_ORDER)
- return -1;
- optarg = argv[optind++];
- return 1;
- }
-
- /* We have found another option-ARGV-element.
- Skip the initial punctuation. */
-
- nextchar = (argv[optind] + 1
- + (longopts != NULL && argv[optind][1] == '-'));
- }
-
- /* Decode the current option-ARGV-element. */
-
- /* Check whether the ARGV-element is a long option.
-
- If long_only and the ARGV-element has the form "-f", where f is
- a valid short option, don't consider it an abbreviated form of
- a long option that starts with f. Otherwise there would be no
- way to give the -f short option.
-
- On the other hand, if there's a long option "fubar" and
- the ARGV-element is "-fu", do consider that an abbreviation of
- the long option, just like "--fu", and not "-f" with arg "u".
-
- This distinction seems to be the most useful approach. */
-
- if (longopts != NULL
- && (argv[optind][1] == '-'
- || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1])))))
- {
- char *nameend;
- const struct option *p;
- const struct option *pfound = NULL;
- int exact = 0;
- int ambig = 0;
- int indfound = -1;
- int option_index;
-
- for (nameend = nextchar; *nameend && *nameend != '='; nameend++)
- /* Do nothing. */ ;
-
- /* Test all long options for either exact match
- or abbreviated matches. */
- for (p = longopts, option_index = 0; p->name; p++, option_index++)
- if (!strncmp (p->name, nextchar, nameend - nextchar))
- {
- if ((unsigned int) (nameend - nextchar)
- == (unsigned int) strlen (p->name))
- {
- /* Exact match found. */
- pfound = p;
- indfound = option_index;
- exact = 1;
- break;
- }
- else if (pfound == NULL)
- {
- /* First nonexact match found. */
- pfound = p;
- indfound = option_index;
- }
- else
- /* Second or later nonexact match found. */
- ambig = 1;
- }
-
- if (ambig && !exact)
- {
- if (opterr)
- fprintf (stderr, _("%s: option `%s' is ambiguous\n"),
- argv[0], argv[optind]);
- nextchar += strlen (nextchar);
- optind++;
- optopt = 0;
- return '?';
- }
-
- if (pfound != NULL)
- {
- option_index = indfound;
- optind++;
- if (*nameend)
- {
- /* Don't test has_arg with >, because some C compilers don't
- allow it to be used on enums. */
- if (pfound->has_arg)
- optarg = nameend + 1;
- else
- {
- if (opterr)
- {
- if (argv[optind - 1][1] == '-')
- /* --option */
- fprintf (stderr,
- _("%s: option `--%s' doesn't allow an argument\n"),
- argv[0], pfound->name);
- else
- /* +option or -option */
- fprintf (stderr,
- _("%s: option `%c%s' doesn't allow an argument\n"),
- argv[0], argv[optind - 1][0], pfound->name);
-
- nextchar += strlen (nextchar);
-
- optopt = pfound->val;
- return '?';
- }
- }
- }
- else if (pfound->has_arg == 1)
- {
- if (optind < argc)
- optarg = argv[optind++];
- else
- {
- if (opterr)
- fprintf (stderr,
- _("%s: option `%s' requires an argument\n"),
- argv[0], argv[optind - 1]);
- nextchar += strlen (nextchar);
- optopt = pfound->val;
- return optstring[0] == ':' ? ':' : '?';
- }
- }
- nextchar += strlen (nextchar);
- if (longind != NULL)
- *longind = option_index;
- if (pfound->flag)
- {
- *(pfound->flag) = pfound->val;
- return 0;
- }
- return pfound->val;
- }
-
- /* Can't find it as a long option. If this is not getopt_long_only,
- or the option starts with '--' or is not a valid short
- option, then it's an error.
- Otherwise interpret it as a short option. */
- if (!long_only || argv[optind][1] == '-'
- || my_index (optstring, *nextchar) == NULL)
- {
- if (opterr)
- {
- if (argv[optind][1] == '-')
- /* --option */
- fprintf (stderr, _("%s: unrecognized option `--%s'\n"),
- argv[0], nextchar);
- else
- /* +option or -option */
- fprintf (stderr, _("%s: unrecognized option `%c%s'\n"),
- argv[0], argv[optind][0], nextchar);
- }
- nextchar = (char *) "";
- optind++;
- optopt = 0;
- return '?';
- }
- }
-
- /* Look at and handle the next short option-character. */
-
- {
- char c = *nextchar++;
- char *temp = my_index (optstring, c);
-
- /* Increment `optind' when we start to process its last character. */
- if (*nextchar == '\0')
- ++optind;
-
- if (temp == NULL || c == ':')
- {
- if (opterr)
- {
- if (posixly_correct)
- /* 1003.2 specifies the format of this message. */
- fprintf (stderr, _("%s: illegal option -- %c\n"),
- argv[0], c);
- else
- fprintf (stderr, _("%s: invalid option -- %c\n"),
- argv[0], c);
- }
- optopt = c;
- return '?';
- }
- /* Convenience. Treat POSIX -W foo same as long option --foo */
- if (temp[0] == 'W' && temp[1] == ';')
- {
- char *nameend;
- const struct option *p;
- const struct option *pfound = NULL;
- int exact = 0;
- int ambig = 0;
- int indfound = 0;
- int option_index;
-
- /* This is an option that requires an argument. */
- if (*nextchar != '\0')
- {
- optarg = nextchar;
- /* If we end this ARGV-element by taking the rest as an arg,
- we must advance to the next element now. */
- optind++;
- }
- else if (optind == argc)
- {
- if (opterr)
- {
- /* 1003.2 specifies the format of this message. */
- fprintf (stderr, _("%s: option requires an argument -- %c\n"),
- argv[0], c);
- }
- optopt = c;
- if (optstring[0] == ':')
- c = ':';
- else
- c = '?';
- return c;
- }
- else
- /* We already incremented `optind' once;
- increment it again when taking next ARGV-elt as argument. */
- optarg = argv[optind++];
-
- /* optarg is now the argument, see if it's in the
- table of longopts. */
-
- for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++)
- /* Do nothing. */ ;
-
- /* Test all long options for either exact match
- or abbreviated matches. */
- for (p = longopts, option_index = 0; p->name; p++, option_index++)
- if (!strncmp (p->name, nextchar, nameend - nextchar))
- {
- if ((unsigned int) (nameend - nextchar) == strlen (p->name))
- {
- /* Exact match found. */
- pfound = p;
- indfound = option_index;
- exact = 1;
- break;
- }
- else if (pfound == NULL)
- {
- /* First nonexact match found. */
- pfound = p;
- indfound = option_index;
- }
- else
- /* Second or later nonexact match found. */
- ambig = 1;
- }
- if (ambig && !exact)
- {
- if (opterr)
- fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"),
- argv[0], argv[optind]);
- nextchar += strlen (nextchar);
- optind++;
- return '?';
- }
- if (pfound != NULL)
- {
- option_index = indfound;
- if (*nameend)
- {
- /* Don't test has_arg with >, because some C compilers don't
- allow it to be used on enums. */
- if (pfound->has_arg)
- optarg = nameend + 1;
- else
- {
- if (opterr)
- fprintf (stderr, _("\
-%s: option `-W %s' doesn't allow an argument\n"),
- argv[0], pfound->name);
-
- nextchar += strlen (nextchar);
- return '?';
- }
- }
- else if (pfound->has_arg == 1)
- {
- if (optind < argc)
- optarg = argv[optind++];
- else
- {
- if (opterr)
- fprintf (stderr,
- _("%s: option `%s' requires an argument\n"),
- argv[0], argv[optind - 1]);
- nextchar += strlen (nextchar);
- return optstring[0] == ':' ? ':' : '?';
- }
- }
- nextchar += strlen (nextchar);
- if (longind != NULL)
- *longind = option_index;
- if (pfound->flag)
- {
- *(pfound->flag) = pfound->val;
- return 0;
- }
- return pfound->val;
- }
- nextchar = NULL;
- return 'W'; /* Let the application handle it. */
- }
- if (temp[1] == ':')
- {
- if (temp[2] == ':')
- {
- /* This is an option that accepts an argument optionally. */
- if (*nextchar != '\0')
- {
- optarg = nextchar;
- optind++;
- }
- else
- optarg = NULL;
- nextchar = NULL;
- }
- else
- {
- /* This is an option that requires an argument. */
- if (*nextchar != '\0')
- {
- optarg = nextchar;
- /* If we end this ARGV-element by taking the rest as an arg,
- we must advance to the next element now. */
- optind++;
- }
- else if (optind == argc)
- {
- if (opterr)
- {
- /* 1003.2 specifies the format of this message. */
- fprintf (stderr,
- _("%s: option requires an argument -- %c\n"),
- argv[0], c);
- }
- optopt = c;
- if (optstring[0] == ':')
- c = ':';
- else
- c = '?';
- }
- else
- /* We already incremented `optind' once;
- increment it again when taking next ARGV-elt as argument. */
- optarg = argv[optind++];
- nextchar = NULL;
- }
- }
- return c;
- }
-}
-
-int
-getopt (argc, argv, optstring)
- int argc;
- char *const *argv;
- const char *optstring;
-{
- return _getopt_internal (argc, argv, optstring,
- (const struct option *) 0,
- (int *) 0,
- 0);
-}
-
-#endif /* Not ELIDE_CODE. */
-
-#ifdef TEST
-
-/* Compile with -DTEST to make an executable for use in testing
- the above definition of `getopt'. */
-
-int
-main (argc, argv)
- int argc;
- char **argv;
-{
- int c;
- int digit_optind = 0;
-
- while (1)
- {
- int this_option_optind = optind ? optind : 1;
-
- c = getopt (argc, argv, "abc:d:0123456789");
- if (c == -1)
- break;
-
- switch (c)
- {
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- if (digit_optind != 0 && digit_optind != this_option_optind)
- printf ("digits occur in two different argv-elements.\n");
- digit_optind = this_option_optind;
- printf ("option %c\n", c);
- break;
-
- case 'a':
- printf ("option a\n");
- break;
-
- case 'b':
- printf ("option b\n");
- break;
-
- case 'c':
- printf ("option c with value `%s'\n", optarg);
- break;
-
- case '?':
- break;
-
- default:
- printf ("?? getopt returned character code 0%o ??\n", c);
- }
- }
-
- if (optind < argc)
- {
- printf ("non-option ARGV-elements: ");
- while (optind < argc)
- printf ("%s ", argv[optind++]);
- printf ("\n");
- }
-
- exit (0);
-}
-
-#endif /* TEST */
diff --git a/libiberty/getopt1.c b/libiberty/getopt1.c
deleted file mode 100644
index a3637c2..0000000
--- a/libiberty/getopt1.c
+++ /dev/null
@@ -1,190 +0,0 @@
-/* getopt_long and getopt_long_only entry points for GNU getopt.
- Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98
- Free Software Foundation, Inc.
-
- NOTE: This source is derived from an old version taken from the GNU C
- Library (glibc).
-
- This program is free software; you can redistribute 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. */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "getopt.h"
-
-#if !defined __STDC__ || !__STDC__
-/* This is a separate conditional since some stdc systems
- reject `defined (const)'. */
-#ifndef const
-#define const
-#endif
-#endif
-
-#include <stdio.h>
-
-/* Comment out all this code if we are using the GNU C Library, and are not
- actually compiling the library itself. This code is part of the GNU C
- Library, but also included in many other GNU distributions. Compiling
- and linking in this code is a waste when using the GNU C library
- (especially if it is a shared library). Rather than having every GNU
- program understand `configure --with-gnu-libc' and omit the object files,
- it is simpler to just do this in the source for each such file. */
-
-#define GETOPT_INTERFACE_VERSION 2
-#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2
-#include <gnu-versions.h>
-#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
-#define ELIDE_CODE
-#endif
-#endif
-
-#ifndef ELIDE_CODE
-
-
-/* This needs to come after some library #include
- to get __GNU_LIBRARY__ defined. */
-#ifdef __GNU_LIBRARY__
-#include <stdlib.h>
-#endif
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-int
-getopt_long (argc, argv, options, long_options, opt_index)
- int argc;
- char *const *argv;
- const char *options;
- const struct option *long_options;
- int *opt_index;
-{
- return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
-}
-
-/* Like getopt_long, but '-' as well as '--' can indicate a long option.
- If an option that starts with '-' (not '--') doesn't match a long option,
- but does match a short option, it is parsed as a short option
- instead. */
-
-int
-getopt_long_only (argc, argv, options, long_options, opt_index)
- int argc;
- char *const *argv;
- const char *options;
- const struct option *long_options;
- int *opt_index;
-{
- return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
-}
-
-
-#endif /* Not ELIDE_CODE. */
-
-#ifdef TEST
-
-#include <stdio.h>
-
-int
-main (argc, argv)
- int argc;
- char **argv;
-{
- int c;
- int digit_optind = 0;
-
- while (1)
- {
- int this_option_optind = optind ? optind : 1;
- int option_index = 0;
- static struct option long_options[] =
- {
- {"add", 1, 0, 0},
- {"append", 0, 0, 0},
- {"delete", 1, 0, 0},
- {"verbose", 0, 0, 0},
- {"create", 0, 0, 0},
- {"file", 1, 0, 0},
- {0, 0, 0, 0}
- };
-
- c = getopt_long (argc, argv, "abc:d:0123456789",
- long_options, &option_index);
- if (c == -1)
- break;
-
- switch (c)
- {
- case 0:
- printf ("option %s", long_options[option_index].name);
- if (optarg)
- printf (" with arg %s", optarg);
- printf ("\n");
- break;
-
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- if (digit_optind != 0 && digit_optind != this_option_optind)
- printf ("digits occur in two different argv-elements.\n");
- digit_optind = this_option_optind;
- printf ("option %c\n", c);
- break;
-
- case 'a':
- printf ("option a\n");
- break;
-
- case 'b':
- printf ("option b\n");
- break;
-
- case 'c':
- printf ("option c with value `%s'\n", optarg);
- break;
-
- case 'd':
- printf ("option d with value `%s'\n", optarg);
- break;
-
- case '?':
- break;
-
- default:
- printf ("?? getopt returned character code 0%o ??\n", c);
- }
- }
-
- if (optind < argc)
- {
- printf ("non-option ARGV-elements: ");
- while (optind < argc)
- printf ("%s ", argv[optind++]);
- printf ("\n");
- }
-
- exit (0);
-}
-
-#endif /* TEST */
diff --git a/libiberty/getpagesize.c b/libiberty/getpagesize.c
deleted file mode 100644
index eed9680..0000000
--- a/libiberty/getpagesize.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/* Emulation of getpagesize() for systems that need it. */
-
-/*
-
-@deftypefn Supplemental int getpagesize (void)
-
-Returns the number of bytes in a page of memory. This is the
-granularity of many of the system memory management routines. No
-guarantee is made as to whether or not it is the same as the basic
-memory management hardware page size.
-
-@end deftypefn
-
-BUGS
-
- Is intended as a reasonable replacement for systems where this
- is not provided as a system call. The value of 4096 may or may
- not be correct for the systems where it is returned as the default
- value.
-
-*/
-
-#ifndef VMS
-
-#include "config.h"
-
-#include <sys/types.h>
-#ifdef HAVE_SYS_PARAM_H
-#include <sys/param.h>
-#endif
-
-#undef GNU_OUR_PAGESIZE
-#if defined (HAVE_SYSCONF) && defined (HAVE_UNISTD_H)
-#include <unistd.h>
-#ifdef _SC_PAGESIZE
-#define GNU_OUR_PAGESIZE sysconf(_SC_PAGESIZE)
-#endif
-#endif
-
-#ifndef GNU_OUR_PAGESIZE
-# ifdef PAGESIZE
-# define GNU_OUR_PAGESIZE PAGESIZE
-# else /* no PAGESIZE */
-# ifdef EXEC_PAGESIZE
-# define GNU_OUR_PAGESIZE EXEC_PAGESIZE
-# else /* no EXEC_PAGESIZE */
-# ifdef NBPG
-# define GNU_OUR_PAGESIZE (NBPG * CLSIZE)
-# ifndef CLSIZE
-# define CLSIZE 1
-# endif /* CLSIZE */
-# else /* no NBPG */
-# ifdef NBPC
-# define GNU_OUR_PAGESIZE NBPC
-# else /* no NBPC */
-# define GNU_OUR_PAGESIZE 4096 /* Just punt and use reasonable value */
-# endif /* NBPC */
-# endif /* NBPG */
-# endif /* EXEC_PAGESIZE */
-# endif /* PAGESIZE */
-#endif /* GNU_OUR_PAGESIZE */
-
-int
-getpagesize ()
-{
- return (GNU_OUR_PAGESIZE);
-}
-
-#else /* VMS */
-
-#if 0 /* older distributions of gcc-vms are missing <syidef.h> */
-#include <syidef.h>
-#endif
-#ifndef SYI$_PAGE_SIZE /* VMS V5.4 and earlier didn't have this yet */
-#define SYI$_PAGE_SIZE 4452
-#endif
-extern unsigned long lib$getsyi(const unsigned short *,...);
-
-int getpagesize ()
-{
- long pagsiz = 0L;
- unsigned short itmcod = SYI$_PAGE_SIZE;
-
- (void) lib$getsyi (&itmcod, (void *) &pagsiz);
- if (pagsiz == 0L)
- pagsiz = 512L; /* VAX default */
- return (int) pagsiz;
-}
-
-#endif /* VMS */
diff --git a/libiberty/getpwd.c b/libiberty/getpwd.c
deleted file mode 100644
index f508b1e..0000000
--- a/libiberty/getpwd.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/* getpwd.c - get the working directory */
-
-/*
-
-@deftypefn Supplemental char* getpwd (void)
-
-Returns the current working directory. This implementation caches the
-result on the assumption that the process will not call @code{chdir}
-between calls to @code{getpwd}.
-
-@end deftypefn
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <sys/types.h>
-
-#include <errno.h>
-#ifndef errno
-extern int errno;
-#endif
-
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_SYS_PARAM_H
-#include <sys/param.h>
-#endif
-#if HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif
-
-/* Prototype these in case the system headers don't provide them. */
-extern char *getpwd ();
-extern char *getwd ();
-
-#include "libiberty.h"
-
-/* Virtually every UN*X system now in common use (except for pre-4.3-tahoe
- BSD systems) now provides getcwd as called for by POSIX. Allow for
- the few exceptions to the general rule here. */
-
-#if !defined(HAVE_GETCWD) && defined(HAVE_GETWD)
-#define getcwd(buf,len) getwd(buf)
-#endif
-
-#ifdef MAXPATHLEN
-#define GUESSPATHLEN (MAXPATHLEN + 1)
-#else
-#define GUESSPATHLEN 100
-#endif
-
-#if !(defined (VMS) || (defined(_WIN32) && !defined(__CYGWIN__)))
-
-/* Get the working directory. Use the PWD environment variable if it's
- set correctly, since this is faster and gives more uniform answers
- to the user. Yield the working directory if successful; otherwise,
- yield 0 and set errno. */
-
-char *
-getpwd ()
-{
- static char *pwd;
- static int failure_errno;
-
- char *p = pwd;
- size_t s;
- struct stat dotstat, pwdstat;
-
- if (!p && !(errno = failure_errno))
- {
- if (! ((p = getenv ("PWD")) != 0
- && *p == '/'
- && stat (p, &pwdstat) == 0
- && stat (".", &dotstat) == 0
- && dotstat.st_ino == pwdstat.st_ino
- && dotstat.st_dev == pwdstat.st_dev))
-
- /* The shortcut didn't work. Try the slow, ``sure'' way. */
- for (s = GUESSPATHLEN; ! getcwd (p = xmalloc (s), s); s *= 2)
- {
- int e = errno;
- free (p);
-#ifdef ERANGE
- if (e != ERANGE)
-#endif
- {
- errno = failure_errno = e;
- p = 0;
- break;
- }
- }
-
- /* Cache the result. This assumes that the program does
- not invoke chdir between calls to getpwd. */
- pwd = p;
- }
- return p;
-}
-
-#else /* VMS || _WIN32 && !__CYGWIN__ */
-
-#ifndef MAXPATHLEN
-#define MAXPATHLEN 255
-#endif
-
-char *
-getpwd ()
-{
- static char *pwd = 0;
-
- if (!pwd)
- pwd = getcwd (xmalloc (MAXPATHLEN + 1), MAXPATHLEN + 1
-#ifdef VMS
- , 0
-#endif
- );
- return pwd;
-}
-
-#endif /* VMS || _WIN32 && !__CYGWIN__ */
diff --git a/libiberty/getruntime.c b/libiberty/getruntime.c
deleted file mode 100644
index 3f7dc0d..0000000
--- a/libiberty/getruntime.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/* Return time used so far, in microseconds.
- Copyright (C) 1994, 1999, 2002 Free Software Foundation, Inc.
-
-This file is part of the libiberty library.
-Libiberty is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public
-License as published by the Free Software Foundation; either
-version 2 of the License, or (at your option) any later version.
-
-Libiberty is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with libiberty; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-#include "config.h"
-
-#include "ansidecl.h"
-#include "libiberty.h"
-
-/* On some systems (such as WindISS), you must include <sys/types.h>
- to get the definition of "time_t" before you include <time.h>. */
-#include <sys/types.h>
-
-/* There are several ways to get elapsed execution time; unfortunately no
- single way is available for all host systems, nor are there reliable
- ways to find out which way is correct for a given host. */
-
-#ifdef TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <time.h>
-#else
-# if HAVE_SYS_TIME_H
-# include <sys/time.h>
-# else
-# ifdef HAVE_TIME_H
-# include <time.h>
-# endif
-# endif
-#endif
-
-#if defined (HAVE_GETRUSAGE) && defined (HAVE_SYS_RESOURCE_H)
-#include <sys/resource.h>
-#endif
-
-#ifdef HAVE_TIMES
-#ifdef HAVE_SYS_PARAM_H
-#include <sys/param.h>
-#endif
-#include <sys/times.h>
-#endif
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-/* This is a fallback; if wrong, it will likely make obviously wrong
- results. */
-
-#ifndef CLOCKS_PER_SEC
-#define CLOCKS_PER_SEC 1
-#endif
-
-#ifdef _SC_CLK_TCK
-#define GNU_HZ sysconf(_SC_CLK_TCK)
-#else
-#ifdef HZ
-#define GNU_HZ HZ
-#else
-#ifdef CLOCKS_PER_SEC
-#define GNU_HZ CLOCKS_PER_SEC
-#endif
-#endif
-#endif
-
-/*
-
-@deftypefn Replacement long get_run_time (void)
-
-Returns the time used so far, in microseconds. If possible, this is
-the time used by this process, else it is the elapsed time since the
-process started.
-
-@end deftypefn
-
-*/
-
-long
-get_run_time ()
-{
-#if defined (HAVE_GETRUSAGE) && defined (HAVE_SYS_RESOURCE_H)
- struct rusage rusage;
-
- getrusage (0, &rusage);
- return (rusage.ru_utime.tv_sec * 1000000 + rusage.ru_utime.tv_usec
- + rusage.ru_stime.tv_sec * 1000000 + rusage.ru_stime.tv_usec);
-#else /* ! HAVE_GETRUSAGE */
-#ifdef HAVE_TIMES
- struct tms tms;
-
- times (&tms);
- return (tms.tms_utime + tms.tms_stime) * (1000000 / GNU_HZ);
-#else /* ! HAVE_TIMES */
- /* Fall back on clock and hope it's correctly implemented. */
- const long clocks_per_sec = CLOCKS_PER_SEC;
- if (clocks_per_sec <= 1000000)
- return clock () * (1000000 / clocks_per_sec);
- else
- return clock () / clocks_per_sec;
-#endif /* HAVE_TIMES */
-#endif /* HAVE_GETRUSAGE */
-}
diff --git a/libiberty/hashtab.c b/libiberty/hashtab.c
deleted file mode 100644
index 6bf59ff..0000000
--- a/libiberty/hashtab.c
+++ /dev/null
@@ -1,616 +0,0 @@
-/* An expandable hash tables datatype.
- Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
- Contributed by Vladimir Makarov (vmakarov@cygnus.com).
-
-This file is part of the libiberty library.
-Libiberty is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public
-License as published by the Free Software Foundation; either
-version 2 of the License, or (at your option) any later version.
-
-Libiberty is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with libiberty; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-/* This package implements basic hash table functionality. It is possible
- to search for an entry, create an entry and destroy an entry.
-
- Elements in the table are generic pointers.
-
- The size of the table is not fixed; if the occupancy of the table
- grows too high the hash table will be expanded.
-
- The abstract data implementation is based on generalized Algorithm D
- from Knuth's book "The art of computer programming". Hash table is
- expanded by creation of new hash table and transferring elements from
- the old table to the new table. */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <sys/types.h>
-
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-
-#include <stdio.h>
-
-#include "libiberty.h"
-#include "hashtab.h"
-
-/* This macro defines reserved value for empty table entry. */
-
-#define EMPTY_ENTRY ((PTR) 0)
-
-/* This macro defines reserved value for table entry which contained
- a deleted element. */
-
-#define DELETED_ENTRY ((PTR) 1)
-
-static unsigned long higher_prime_number PARAMS ((unsigned long));
-static hashval_t hash_pointer PARAMS ((const void *));
-static int eq_pointer PARAMS ((const void *, const void *));
-static int htab_expand PARAMS ((htab_t));
-static PTR *find_empty_slot_for_expand PARAMS ((htab_t, hashval_t));
-
-/* At some point, we could make these be NULL, and modify the
- hash-table routines to handle NULL specially; that would avoid
- function-call overhead for the common case of hashing pointers. */
-htab_hash htab_hash_pointer = hash_pointer;
-htab_eq htab_eq_pointer = eq_pointer;
-
-/* The following function returns a nearest prime number which is
- greater than N, and near a power of two. */
-
-static unsigned long
-higher_prime_number (n)
- unsigned long n;
-{
- /* These are primes that are near, but slightly smaller than, a
- power of two. */
- static const unsigned long primes[] = {
- (unsigned long) 7,
- (unsigned long) 13,
- (unsigned long) 31,
- (unsigned long) 61,
- (unsigned long) 127,
- (unsigned long) 251,
- (unsigned long) 509,
- (unsigned long) 1021,
- (unsigned long) 2039,
- (unsigned long) 4093,
- (unsigned long) 8191,
- (unsigned long) 16381,
- (unsigned long) 32749,
- (unsigned long) 65521,
- (unsigned long) 131071,
- (unsigned long) 262139,
- (unsigned long) 524287,
- (unsigned long) 1048573,
- (unsigned long) 2097143,
- (unsigned long) 4194301,
- (unsigned long) 8388593,
- (unsigned long) 16777213,
- (unsigned long) 33554393,
- (unsigned long) 67108859,
- (unsigned long) 134217689,
- (unsigned long) 268435399,
- (unsigned long) 536870909,
- (unsigned long) 1073741789,
- (unsigned long) 2147483647,
- /* 4294967291L */
- ((unsigned long) 2147483647) + ((unsigned long) 2147483644),
- };
-
- const unsigned long *low = &primes[0];
- const unsigned long *high = &primes[sizeof(primes) / sizeof(primes[0])];
-
- while (low != high)
- {
- const unsigned long *mid = low + (high - low) / 2;
- if (n > *mid)
- low = mid + 1;
- else
- high = mid;
- }
-
- /* If we've run out of primes, abort. */
- if (n > *low)
- {
- fprintf (stderr, "Cannot find prime bigger than %lu\n", n);
- abort ();
- }
-
- return *low;
-}
-
-/* Returns a hash code for P. */
-
-static hashval_t
-hash_pointer (p)
- const PTR p;
-{
- return (hashval_t) ((long)p >> 3);
-}
-
-/* Returns non-zero if P1 and P2 are equal. */
-
-static int
-eq_pointer (p1, p2)
- const PTR p1;
- const PTR p2;
-{
- return p1 == p2;
-}
-
-/* This function creates table with length slightly longer than given
- source length. Created hash table is initiated as empty (all the
- hash table entries are EMPTY_ENTRY). The function returns the
- created hash table, or NULL if memory allocation fails. */
-
-htab_t
-htab_create_alloc (size, hash_f, eq_f, del_f, alloc_f, free_f)
- size_t size;
- htab_hash hash_f;
- htab_eq eq_f;
- htab_del del_f;
- htab_alloc alloc_f;
- htab_free free_f;
-{
- htab_t result;
-
- size = higher_prime_number (size);
- result = (htab_t) (*alloc_f) (1, sizeof (struct htab));
- if (result == NULL)
- return NULL;
- result->entries = (PTR *) (*alloc_f) (size, sizeof (PTR));
- if (result->entries == NULL)
- {
- if (free_f != NULL)
- (*free_f) (result);
- return NULL;
- }
- result->size = size;
- result->hash_f = hash_f;
- result->eq_f = eq_f;
- result->del_f = del_f;
- result->alloc_f = alloc_f;
- result->free_f = free_f;
- return result;
-}
-
-/* These functions exist solely for backward compatibility. */
-
-#undef htab_create
-htab_t
-htab_create (size, hash_f, eq_f, del_f)
- size_t size;
- htab_hash hash_f;
- htab_eq eq_f;
- htab_del del_f;
-{
- return htab_create_alloc (size, hash_f, eq_f, del_f, xcalloc, free);
-}
-
-htab_t
-htab_try_create (size, hash_f, eq_f, del_f)
- size_t size;
- htab_hash hash_f;
- htab_eq eq_f;
- htab_del del_f;
-{
- return htab_create_alloc (size, hash_f, eq_f, del_f, calloc, free);
-}
-
-/* This function frees all memory allocated for given hash table.
- Naturally the hash table must already exist. */
-
-void
-htab_delete (htab)
- htab_t htab;
-{
- int i;
-
- if (htab->del_f)
- for (i = htab->size - 1; i >= 0; i--)
- if (htab->entries[i] != EMPTY_ENTRY
- && htab->entries[i] != DELETED_ENTRY)
- (*htab->del_f) (htab->entries[i]);
-
- if (htab->free_f != NULL)
- {
- (*htab->free_f) (htab->entries);
- (*htab->free_f) (htab);
- }
-}
-
-/* This function clears all entries in the given hash table. */
-
-void
-htab_empty (htab)
- htab_t htab;
-{
- int i;
-
- if (htab->del_f)
- for (i = htab->size - 1; i >= 0; i--)
- if (htab->entries[i] != EMPTY_ENTRY
- && htab->entries[i] != DELETED_ENTRY)
- (*htab->del_f) (htab->entries[i]);
-
- memset (htab->entries, 0, htab->size * sizeof (PTR));
-}
-
-/* Similar to htab_find_slot, but without several unwanted side effects:
- - Does not call htab->eq_f when it finds an existing entry.
- - Does not change the count of elements/searches/collisions in the
- hash table.
- This function also assumes there are no deleted entries in the table.
- HASH is the hash value for the element to be inserted. */
-
-static PTR *
-find_empty_slot_for_expand (htab, hash)
- htab_t htab;
- hashval_t hash;
-{
- size_t size = htab->size;
- unsigned int index = hash % size;
- PTR *slot = htab->entries + index;
- hashval_t hash2;
-
- if (*slot == EMPTY_ENTRY)
- return slot;
- else if (*slot == DELETED_ENTRY)
- abort ();
-
- hash2 = 1 + hash % (size - 2);
- for (;;)
- {
- index += hash2;
- if (index >= size)
- index -= size;
-
- slot = htab->entries + index;
- if (*slot == EMPTY_ENTRY)
- return slot;
- else if (*slot == DELETED_ENTRY)
- abort ();
- }
-}
-
-/* The following function changes size of memory allocated for the
- entries and repeatedly inserts the table elements. The occupancy
- of the table after the call will be about 50%. Naturally the hash
- table must already exist. Remember also that the place of the
- table entries is changed. If memory allocation failures are allowed,
- this function will return zero, indicating that the table could not be
- expanded. If all goes well, it will return a non-zero value. */
-
-static int
-htab_expand (htab)
- htab_t htab;
-{
- PTR *oentries;
- PTR *olimit;
- PTR *p;
- PTR *nentries;
-
- oentries = htab->entries;
- olimit = oentries + htab->size;
-
- htab->size = higher_prime_number (htab->size * 2);
-
- nentries = (PTR *) (*htab->alloc_f) (htab->size, sizeof (PTR *));
- if (nentries == NULL)
- return 0;
- htab->entries = nentries;
-
- htab->n_elements -= htab->n_deleted;
- htab->n_deleted = 0;
-
- p = oentries;
- do
- {
- PTR x = *p;
-
- if (x != EMPTY_ENTRY && x != DELETED_ENTRY)
- {
- PTR *q = find_empty_slot_for_expand (htab, (*htab->hash_f) (x));
-
- *q = x;
- }
-
- p++;
- }
- while (p < olimit);
-
- if (htab->free_f != NULL)
- (*htab->free_f) (oentries);
- return 1;
-}
-
-/* This function searches for a hash table entry equal to the given
- element. It cannot be used to insert or delete an element. */
-
-PTR
-htab_find_with_hash (htab, element, hash)
- htab_t htab;
- const PTR element;
- hashval_t hash;
-{
- unsigned int index;
- hashval_t hash2;
- size_t size;
- PTR entry;
-
- htab->searches++;
- size = htab->size;
- index = hash % size;
-
- entry = htab->entries[index];
- if (entry == EMPTY_ENTRY
- || (entry != DELETED_ENTRY && (*htab->eq_f) (entry, element)))
- return entry;
-
- hash2 = 1 + hash % (size - 2);
-
- for (;;)
- {
- htab->collisions++;
- index += hash2;
- if (index >= size)
- index -= size;
-
- entry = htab->entries[index];
- if (entry == EMPTY_ENTRY
- || (entry != DELETED_ENTRY && (*htab->eq_f) (entry, element)))
- return entry;
- }
-}
-
-/* Like htab_find_slot_with_hash, but compute the hash value from the
- element. */
-
-PTR
-htab_find (htab, element)
- htab_t htab;
- const PTR element;
-{
- return htab_find_with_hash (htab, element, (*htab->hash_f) (element));
-}
-
-/* This function searches for a hash table slot containing an entry
- equal to the given element. To delete an entry, call this with
- INSERT = 0, then call htab_clear_slot on the slot returned (possibly
- after doing some checks). To insert an entry, call this with
- INSERT = 1, then write the value you want into the returned slot.
- When inserting an entry, NULL may be returned if memory allocation
- fails. */
-
-PTR *
-htab_find_slot_with_hash (htab, element, hash, insert)
- htab_t htab;
- const PTR element;
- hashval_t hash;
- enum insert_option insert;
-{
- PTR *first_deleted_slot;
- unsigned int index;
- hashval_t hash2;
- size_t size;
- PTR entry;
-
- if (insert == INSERT && htab->size * 3 <= htab->n_elements * 4
- && htab_expand (htab) == 0)
- return NULL;
-
- size = htab->size;
- index = hash % size;
-
- htab->searches++;
- first_deleted_slot = NULL;
-
- entry = htab->entries[index];
- if (entry == EMPTY_ENTRY)
- goto empty_entry;
- else if (entry == DELETED_ENTRY)
- first_deleted_slot = &htab->entries[index];
- else if ((*htab->eq_f) (entry, element))
- return &htab->entries[index];
-
- hash2 = 1 + hash % (size - 2);
- for (;;)
- {
- htab->collisions++;
- index += hash2;
- if (index >= size)
- index -= size;
-
- entry = htab->entries[index];
- if (entry == EMPTY_ENTRY)
- goto empty_entry;
- else if (entry == DELETED_ENTRY)
- {
- if (!first_deleted_slot)
- first_deleted_slot = &htab->entries[index];
- }
- else if ((*htab->eq_f) (entry, element))
- return &htab->entries[index];
- }
-
- empty_entry:
- if (insert == NO_INSERT)
- return NULL;
-
- htab->n_elements++;
-
- if (first_deleted_slot)
- {
- *first_deleted_slot = EMPTY_ENTRY;
- return first_deleted_slot;
- }
-
- return &htab->entries[index];
-}
-
-/* Like htab_find_slot_with_hash, but compute the hash value from the
- element. */
-
-PTR *
-htab_find_slot (htab, element, insert)
- htab_t htab;
- const PTR element;
- enum insert_option insert;
-{
- return htab_find_slot_with_hash (htab, element, (*htab->hash_f) (element),
- insert);
-}
-
-/* This function deletes an element with the given value from hash
- table. If there is no matching element in the hash table, this
- function does nothing. */
-
-void
-htab_remove_elt (htab, element)
- htab_t htab;
- PTR element;
-{
- PTR *slot;
-
- slot = htab_find_slot (htab, element, NO_INSERT);
- if (*slot == EMPTY_ENTRY)
- return;
-
- if (htab->del_f)
- (*htab->del_f) (*slot);
-
- *slot = DELETED_ENTRY;
- htab->n_deleted++;
-}
-
-/* This function clears a specified slot in a hash table. It is
- useful when you've already done the lookup and don't want to do it
- again. */
-
-void
-htab_clear_slot (htab, slot)
- htab_t htab;
- PTR *slot;
-{
- if (slot < htab->entries || slot >= htab->entries + htab->size
- || *slot == EMPTY_ENTRY || *slot == DELETED_ENTRY)
- abort ();
-
- if (htab->del_f)
- (*htab->del_f) (*slot);
-
- *slot = DELETED_ENTRY;
- htab->n_deleted++;
-}
-
-/* This function scans over the entire hash table calling
- CALLBACK for each live entry. If CALLBACK returns false,
- the iteration stops. INFO is passed as CALLBACK's second
- argument. */
-
-void
-htab_traverse (htab, callback, info)
- htab_t htab;
- htab_trav callback;
- PTR info;
-{
- PTR *slot = htab->entries;
- PTR *limit = slot + htab->size;
-
- do
- {
- PTR x = *slot;
-
- if (x != EMPTY_ENTRY && x != DELETED_ENTRY)
- if (!(*callback) (slot, info))
- break;
- }
- while (++slot < limit);
-}
-
-/* Return the current size of given hash table. */
-
-size_t
-htab_size (htab)
- htab_t htab;
-{
- return htab->size;
-}
-
-/* Return the current number of elements in given hash table. */
-
-size_t
-htab_elements (htab)
- htab_t htab;
-{
- return htab->n_elements - htab->n_deleted;
-}
-
-/* Return the fraction of fixed collisions during all work with given
- hash table. */
-
-double
-htab_collisions (htab)
- htab_t htab;
-{
- if (htab->searches == 0)
- return 0.0;
-
- return (double) htab->collisions / (double) htab->searches;
-}
-
-/* Hash P as a null-terminated string.
-
- Copied from gcc/hashtable.c. Zack had the following to say with respect
- to applicability, though note that unlike hashtable.c, this hash table
- implementation re-hashes rather than chain buckets.
-
- http://gcc.gnu.org/ml/gcc-patches/2001-08/msg01021.html
- From: Zack Weinberg <zackw@panix.com>
- Date: Fri, 17 Aug 2001 02:15:56 -0400
-
- I got it by extracting all the identifiers from all the source code
- I had lying around in mid-1999, and testing many recurrences of
- the form "H_n = H_{n-1} * K + c_n * L + M" where K, L, M were either
- prime numbers or the appropriate identity. This was the best one.
- I don't remember exactly what constituted "best", except I was
- looking at bucket-length distributions mostly.
-
- So it should be very good at hashing identifiers, but might not be
- as good at arbitrary strings.
-
- I'll add that it thoroughly trounces the hash functions recommended
- for this use at http://burtleburtle.net/bob/hash/index.html, both
- on speed and bucket distribution. I haven't tried it against the
- function they just started using for Perl's hashes. */
-
-hashval_t
-htab_hash_string (p)
- const PTR p;
-{
- const unsigned char *str = (const unsigned char *) p;
- hashval_t r = 0;
- unsigned char c;
-
- while ((c = *str++) != 0)
- r = r * 67 + c - 113;
-
- return r;
-}
diff --git a/libiberty/hex.c b/libiberty/hex.c
deleted file mode 100644
index 5f82292..0000000
--- a/libiberty/hex.c
+++ /dev/null
@@ -1,180 +0,0 @@
-/* Hex character manipulation support.
- Copyright (C) 1995, 2001 Free Software Foundation, Inc.
-
-This file is part of the libiberty library.
-Libiberty is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public
-License as published by the Free Software Foundation; either
-version 2 of the License, or (at your option) any later version.
-
-Libiberty is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with libiberty; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-#include <stdio.h> /* for EOF */
-#include "libiberty.h"
-
-/*
-
-@deftypefn Extension void hex_init (void)
-
-Initializes the array mapping the current character set to
-corresponding hex values. This function must be called before any
-call to @code{hex_p} or @code{hex_value}. If you fail to call it, a
-default ASCII-based table will normally be used on ASCII systems.
-
-@end deftypefn
-
-@deftypefn Extension int hex_p (int @var{c})
-
-Evaluates to non-zero if the given character is a valid hex character,
-or zero if it is not. Note that the value you pass will be cast to
-@code{unsigned char} within the macro.
-
-@end deftypefn
-
-@deftypefn Extension int hex_value (int @var{c})
-
-Returns the numeric equivalent of the given character when interpreted
-as a hexidecimal digit. The result is undefined if you pass an
-invalid hex digit. Note that the value you pass will be cast to
-@code{unsigned char} within the macro.
-
-@end deftypefn
-
-@undocumented _hex_array_size
-@undocumented _hex_bad
-@undocumented _hex_value
-
-*/
-
-
-/* Are we ASCII? */
-#if '\n' == 0x0A && ' ' == 0x20 && '0' == 0x30 \
- && 'A' == 0x41 && 'a' == 0x61 && '!' == 0x21 \
- && EOF == -1
-
-const char _hex_value[_hex_array_size] =
-{
- _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* NUL SOH STX ETX */
- _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* EOT ENQ ACK BEL */
- _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* BS HT LF VT */
- _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* FF CR SO SI */
- _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* DLE DC1 DC2 DC3 */
- _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* DC4 NAK SYN ETB */
- _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* CAN EM SUB ESC */
- _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* FS GS RS US */
-
- _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* SP ! " # */
- _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* $ % & ' */
- _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* ( ) * + */
- _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* , - . / */
- 0, 1, 2, 3, /* 0 1 2 3 */
- 4, 5, 6, 7, /* 4 5 6 7 */
- 8, 9, _hex_bad, _hex_bad, /* 8 9 : ; */
- _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* < = > ? */
-
- _hex_bad, 10, 11, 12, /* @ A B C */
- 13, 14, 15, _hex_bad, /* D E F G */
- _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* H I J K */
- _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* L M N O */
- _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* P Q R S */
- _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* T U V W */
- _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* X Y Z [ */
- _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* \ ] ^ _ */
-
- _hex_bad, 10, 11, 12, /* ` a b c */
- 13, 14, 15, _hex_bad, /* d e f g */
- _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* h i j k */
- _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* l m n o */
- _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* p q r s */
- _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* t u v w */
- _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* x y z { */
- _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* | } ~ DEL */
-
- /* The high half of unsigned char, all values are _hex_bad. */
- _hex_bad, _hex_bad, _hex_bad, _hex_bad,
- _hex_bad, _hex_bad, _hex_bad, _hex_bad,
- _hex_bad, _hex_bad, _hex_bad, _hex_bad,
- _hex_bad, _hex_bad, _hex_bad, _hex_bad,
- _hex_bad, _hex_bad, _hex_bad, _hex_bad,
- _hex_bad, _hex_bad, _hex_bad, _hex_bad,
- _hex_bad, _hex_bad, _hex_bad, _hex_bad,
- _hex_bad, _hex_bad, _hex_bad, _hex_bad,
-
- _hex_bad, _hex_bad, _hex_bad, _hex_bad,
- _hex_bad, _hex_bad, _hex_bad, _hex_bad,
- _hex_bad, _hex_bad, _hex_bad, _hex_bad,
- _hex_bad, _hex_bad, _hex_bad, _hex_bad,
- _hex_bad, _hex_bad, _hex_bad, _hex_bad,
- _hex_bad, _hex_bad, _hex_bad, _hex_bad,
- _hex_bad, _hex_bad, _hex_bad, _hex_bad,
- _hex_bad, _hex_bad, _hex_bad, _hex_bad,
-
- _hex_bad, _hex_bad, _hex_bad, _hex_bad,
- _hex_bad, _hex_bad, _hex_bad, _hex_bad,
- _hex_bad, _hex_bad, _hex_bad, _hex_bad,
- _hex_bad, _hex_bad, _hex_bad, _hex_bad,
- _hex_bad, _hex_bad, _hex_bad, _hex_bad,
- _hex_bad, _hex_bad, _hex_bad, _hex_bad,
- _hex_bad, _hex_bad, _hex_bad, _hex_bad,
- _hex_bad, _hex_bad, _hex_bad, _hex_bad,
-
- _hex_bad, _hex_bad, _hex_bad, _hex_bad,
- _hex_bad, _hex_bad, _hex_bad, _hex_bad,
- _hex_bad, _hex_bad, _hex_bad, _hex_bad,
- _hex_bad, _hex_bad, _hex_bad, _hex_bad,
- _hex_bad, _hex_bad, _hex_bad, _hex_bad,
- _hex_bad, _hex_bad, _hex_bad, _hex_bad,
- _hex_bad, _hex_bad, _hex_bad, _hex_bad,
- _hex_bad, _hex_bad, _hex_bad, _hex_bad,
-};
-#define HEX_TABLE_INITIALIZED
-
-#else
-
-char _hex_value[_hex_array_size];
-
-#endif /* not ASCII */
-
-void
-hex_init ()
-{
-#ifndef HEX_TABLE_INITIALIZED
- int i;
-
- for (i=0; i<_hex_array_size; i++)
- {
- switch (i)
- {
- case '0': _hex_value[i] = 0; break;
- case '1': _hex_value[i] = 1; break;
- case '2': _hex_value[i] = 2; break;
- case '3': _hex_value[i] = 3; break;
- case '4': _hex_value[i] = 4; break;
- case '5': _hex_value[i] = 5; break;
- case '6': _hex_value[i] = 6; break;
- case '7': _hex_value[i] = 7; break;
- case '8': _hex_value[i] = 8; break;
- case '9': _hex_value[i] = 9; break;
-
- case 'a': case 'A': _hex_value[i] = 10; break;
- case 'b': case 'B': _hex_value[i] = 11; break;
- case 'c': case 'C': _hex_value[i] = 12; break;
- case 'd': case 'D': _hex_value[i] = 13; break;
- case 'e': case 'E': _hex_value[i] = 14; break;
- case 'f': case 'F': _hex_value[i] = 15; break;
-
- default:
- _hex_value[i] = _hex_bad;
- break;
- }
- }
-#endif
-}
diff --git a/libiberty/index.c b/libiberty/index.c
deleted file mode 100644
index a2e2727..0000000
--- a/libiberty/index.c
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Stub implementation of (obsolete) index(). */
-
-/*
-
-@deftypefn Supplemental char* index (char *@var{s}, int @var{c})
-
-Returns a pointer to the first occurrence of the character @var{c} in
-the string @var{s}, or @code{NULL} if not found. The use of @code{index} is
-deprecated in new programs in favor of @code{strchr}.
-
-@end deftypefn
-
-*/
-
-extern char * strchr();
-
-char *
-index (s, c)
- char *s;
- int c;
-{
- return strchr (s, c);
-}
diff --git a/libiberty/insque.c b/libiberty/insque.c
deleted file mode 100644
index c0c1180..0000000
--- a/libiberty/insque.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/* insque(3C) routines
- This file is in the public domain. */
-
-/*
-
-@deftypefn Supplemental void insque (struct qelem *@var{elem}, struct qelem *@var{pred})
-@deftypefnx Supplemental void remque (struct qelem *@var{elem})
-
-Routines to manipulate queues built from doubly linked lists. The
-@code{insque} routine inserts @var{elem} in the queue immediately
-after @var{pred}. The @code{remque} routine removes @var{elem} from
-its containing queue. These routines expect to be passed pointers to
-structures which have as their first members a forward pointer and a
-back pointer, like this prototype (although no prototype is provided):
-
-@example
-struct qelem @{
- struct qelem *q_forw;
- struct qelem *q_back;
- char q_data[];
-@};
-@end example
-
-@end deftypefn
-
-*/
-
-
-struct qelem {
- struct qelem *q_forw;
- struct qelem *q_back;
-};
-
-
-void
-insque (elem, pred)
- struct qelem *elem;
- struct qelem *pred;
-{
- elem -> q_forw = pred -> q_forw;
- pred -> q_forw -> q_back = elem;
- elem -> q_back = pred;
- pred -> q_forw = elem;
-}
-
-
-void
-remque (elem)
- struct qelem *elem;
-{
- elem -> q_forw -> q_back = elem -> q_back;
- elem -> q_back -> q_forw = elem -> q_forw;
-}
diff --git a/libiberty/lbasename.c b/libiberty/lbasename.c
deleted file mode 100644
index 43cb73f..0000000
--- a/libiberty/lbasename.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/* Libiberty basename. Like basename, but is not overridden by the
- system C library.
- Copyright (C) 2001, 2002 Free Software Foundation, Inc.
-
-This file is part of the libiberty library.
-Libiberty is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public
-License as published by the Free Software Foundation; either
-version 2 of the License, or (at your option) any later version.
-
-Libiberty is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with libiberty; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-/*
-
-@deftypefn Replacement {const char*} lbasename (const char *@var{name})
-
-Given a pointer to a string containing a typical pathname
-(@samp{/usr/src/cmd/ls/ls.c} for example), returns a pointer to the
-last component of the pathname (@samp{ls.c} in this case). The
-returned pointer is guaranteed to lie within the original
-string. This latter fact is not true of many vendor C
-libraries, which return special strings or modify the passed
-strings for particular input.
-
-In particular, the empty string returns the same empty string,
-and a path ending in @code{/} returns the empty string after it.
-
-@end deftypefn
-
-*/
-
-#include "ansidecl.h"
-#include "libiberty.h"
-#include "safe-ctype.h"
-
-#ifndef DIR_SEPARATOR
-# define DIR_SEPARATOR '/'
-#endif
-
-#if defined (_WIN32) || defined (__MSDOS__) \
- || defined (__DJGPP__) || defined (__OS2__)
-# define HAVE_DOS_BASED_FILE_SYSTEM
-# ifndef DIR_SEPARATOR_2
-# define DIR_SEPARATOR_2 '\\'
-# endif
-#endif
-
-#ifndef DIR_SEPARATOR_2
-# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
-#else
-# define IS_DIR_SEPARATOR(ch) \
- (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
-#endif
-
-const char *
-lbasename (name)
- const char *name;
-{
- const char *base;
-
-#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
- /* Skip over a possible disk name. */
- if (ISALPHA (name[0]) && name[1] == ':')
- name += 2;
-#endif
-
- for (base = name; *name; name++)
- if (IS_DIR_SEPARATOR (*name))
- base = name + 1;
-
- return base;
-}
diff --git a/libiberty/libiberty.texi b/libiberty/libiberty.texi
deleted file mode 100644
index 4b60d6a..0000000
--- a/libiberty/libiberty.texi
+++ /dev/null
@@ -1,324 +0,0 @@
-\input texinfo @c -*-texinfo-*-
-@c %**start of header
-@setfilename libiberty.info
-@settitle @sc{gnu} libiberty
-@c %**end of header
-
-@syncodeindex fn cp
-@syncodeindex vr cp
-@syncodeindex pg cp
-
-@finalout
-@c %**end of header
-
-@dircategory GNU libraries
-@direntry
-* Libiberty: (libiberty). Library of utility functions which
- are missing or broken on some systems.
-@end direntry
-
-@macro libib
-@code{libiberty}
-@end macro
-
-@c The edition date is written in three locations. Search for 'thedate'.
-@ifinfo
-This manual describes the GNU @libib library of utility subroutines.
-This edition accompanies GCC 3, September 2001.
-
-Copyright @copyright{} 2001 Free Software Foundation, Inc.
-
- Permission is granted to copy, distribute and/or modify this document
- under the terms of the GNU Free Documentation License, Version 1.1
- or any later version published by the Free Software Foundation;
- with no Invariant Sections, with no Front-Cover Texts, and with no
- Back-Cover Texts. A copy of the license is included in the
- section entitled ``GNU Free Documentation License''.
-
-@ignore
-Permission is granted to process this file through TeX and print the
-results, provided the printed document carries a copying permission
-notice identical to this one except for the removal of this paragraph
-(this paragraph not being relevant to the printed manual).
-
-@end ignore
-@end ifinfo
-
-
-@c The edition date is written in three locations. Search for 'thedate'.
-@titlepage
-@title @sc{gnu} libiberty
-@subtitle September 2001
-@subtitle for GCC 3
-@author Phil Edwards et al.
-@page
-
-
-@vskip 0pt plus 1filll
-Copyright @copyright{} 2001 Free Software Foundation, Inc.
-
- Permission is granted to copy, distribute and/or modify this document
- under the terms of the GNU Free Documentation License, Version 1.1
- or any later version published by the Free Software Foundation;
- with no Invariant Sections, with no Front-Cover Texts, and with no
- Back-Cover Texts. A copy of the license is included in the
- section entitled ``GNU Free Documentation License''.
-
-@end titlepage
-@contents
-@page
-
-@ifnottex
-@node Top,Using,,
-@top Introduction
-
-The @libib{} library is a collection of subroutines used by various
-GNU programs. It is available under the Library General Public
-License; for more information, see @ref{Library Copying}.
-
-@c The edition date is written in three locations. Search for 'thedate'.
-This edition accompanies GCC 3, September 2001.
-
-@end ifnottex
-
-@menu
-* Using:: How to use libiberty in your code.
-
-* Overview:: Overview of available function groups.
-
-* Functions:: Available functions, macros, and global variables.
-
-* Obstacks:: Object Stacks.
-
-* Licenses:: The various licenses under which libiberty sources are
- distributed.
-
-* Index:: Index of functions and categories.
-@end menu
-
-@node Using
-@chapter Using
-@cindex using libiberty
-@cindex libiberty usage
-@cindex how to use
-
-@c THIS SECTION IS CRAP AND NEEDS REWRITING BADLY.
-
-To date, @libib{} is generally not installed on its own. It has evolved
-over years but does not have its own version number nor release schedule.
-
-Possibly the easiest way to use @libib{} in your projects is to drop the
-@libib{} code into your project's sources, and to build the library along
-with your own sources; the library would then be linked in at the end. This
-prevents any possible version mismatches with other copies of libiberty
-elsewhere on the system.
-
-Passing @option{--enable-install-libiberty} to the @command{configure}
-script when building @libib{} causes the header files and archive library
-to be installed when @kbd{make install} is run. This option also takes
-an (optional) argument to specify the installation location, in the same
-manner as @option{--prefix}.
-
-For your own projects, an approach which offers stability and flexibility
-is to include @libib{} with your code, but allow the end user to optionally
-choose to use a previously-installed version instead. In this way the
-user may choose (for example) to install @libib{} as part of GCC, and use
-that version for all software built with that compiler. (This approach
-has proven useful with software using the GNU @code{readline} library.)
-
-Making use of @libib{} code usually requires that you include one or more
-header files from the @libib{} distribution. (They will be named as
-necessary in the function descriptions.) At link time, you will need to
-add @option{-liberty} to your link command invocation.
-
-
-@node Overview
-@chapter Overview
-
-Functions contained in @libib{} can be divided into three general categories.
-
-
-@menu
-* Supplemental Functions:: Providing functions which don't exist
- on older operating systems.
-
-* Replacement Functions:: These functions are sometimes buggy or
- unpredictable on some operating systems.
-
-* Extensions:: Functions which provide useful extensions
- or safety wrappers around existing code.
-@end menu
-
-@node Supplemental Functions
-@section Supplemental Functions
-@cindex supplemental functions
-@cindex functions, supplemental
-@cindex functions, missing
-
-Certain operating systems do not provide functions which have since
-become standardized, or at least common. For example, the Single
-Unix Specification Version 2 requires that the @code{basename}
-function be provided, but an OS which predates that specification
-might not have this function. This should not prevent well-written
-code from running on such a system.
-
-Similarly, some functions exist only among a particular ``flavor''
-or ``family'' of operating systems. As an example, the @code{bzero}
-function is often not present on systems outside the BSD-derived
-family of systems.
-
-Many such functions are provided in @libib{}. They are quickly
-listed here with little description, as systems which lack them
-become less and less common. Each function @var{foo} is implemented
-in @file{@var{foo}.c} but not declared in any @libib{} header file; more
-comments and caveats for each function's implementation are often
-available in the source file. Generally, the function can simply
-be declared as @code{extern}.
-
-
-
-@node Replacement Functions
-@section Replacement Functions
-@cindex replacement functions
-@cindex functions, replacement
-
-Some functions have extremely limited implementations on different
-platforms. Other functions are tedious to use correctly; for example,
-proper use of @code{malloc} calls for the return value to be checked and
-appropriate action taken if memory has been exhausted. A group of
-``replacement functions'' is available in @libib{} to address these issues
-for some of the most commonly used subroutines.
-
-All of these functions are declared in the @file{libiberty.h} header
-file. Many of the implementations will use preprocessor macros set by
-GNU Autoconf, if you decide to make use of that program. Some of these
-functions may call one another.
-
-
-@menu
-* Memory Allocation:: Testing and handling failed memory
- requests automatically.
-* Exit Handlers:: Calling routines on program exit.
-* Error Reporting:: Mapping errno and signal numbers to
- more useful string formats.
-@end menu
-
-@node Memory Allocation
-@subsection Memory Allocation
-@cindex memory allocation
-
-The functions beginning with the letter @samp{x} are wrappers around
-standard functions; the functions provided by the system environment
-are called and their results checked before the results are passed back
-to client code. If the standard functions fail, these wrappers will
-terminate the program. Thus, these versions can be used with impunity.
-
-
-@node Exit Handlers
-@subsection Exit Handlers
-@cindex exit handlers
-
-The existence and implementation of the @code{atexit} routine varies
-amongst the flavors of Unix. @libib{} provides an unvarying dependable
-implementation via @code{xatexit} and @code{xexit}.
-
-
-@node Error Reporting
-@subsection Error Reporting
-@cindex error reporting
-
-These are a set of routines to facilitate programming with the system
-@code{errno} interface. The @libib{} source file @file{strerror.c}
-contains a good deal of documentation for these functions.
-
-@c signal stuff
-
-
-@node Extensions
-@section Extensions
-@cindex extensions
-@cindex functions, extension
-
-@libib{} includes additional functionality above and beyond standard
-functions, which has proven generically useful in GNU programs, such as
-obstacks and regex. These functions are often copied from other
-projects as they gain popularity, and are included here to provide a
-central location from which to use, maintain, and distribute them.
-
-@menu
-* Obstacks:: Stacks of arbitrary objects.
-@end menu
-
-@c This is generated from the glibc manual using a make-obstacks-texi.sh
-@c script of Phil's. Hope it's accurate.
-@include obstacks.texi
-
-@node Functions
-@chapter Function, Variable, and Macro Listing.
-@include functions.texi
-
-@node Licenses
-@appendix Licenses
-
-@menu
-
-* Library Copying:: The GNU Library General Public License
-* BSD:: Regents of the University of California
-
-@end menu
-
-@c This takes care of Library Copying. It is the copying-lib.texi from the
-@c GNU web site, with its @node line altered to make makeinfo shut up.
-@include copying-lib.texi
-
-@page
-@node BSD
-@appendixsec BSD
-
-Copyright @copyright{} 1990 Regents of the University of California.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-@enumerate
-
-@item
-Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-
-@item
-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.
-
-@item
-[rescinded 22 July 1999]
-
-@item
-Neither the name of the University nor the names of its contributors
-may be used to endorse or promote products derived from this software
-without specific prior written permission.
-
-@end enumerate
-
-THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-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 REGENTS 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.
-
-@node Index
-@unnumbered Index
-
-@printindex cp
-
-@bye
-
diff --git a/libiberty/maint-tool b/libiberty/maint-tool
deleted file mode 100644
index ceeb48d..0000000
--- a/libiberty/maint-tool
+++ /dev/null
@@ -1,278 +0,0 @@
-#!/usr/bin/perl
-# -*- perl -*-
-
-# Copyright (C) 2001
-# Free Software Foundation
-#
-# This file is part of the libiberty library.
-# Libiberty is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Library General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# Libiberty is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Library General Public License for more details.
-#
-# You should have received a copy of the GNU Library General Public
-# License along with libiberty; see the file COPYING.LIB. If not,
-# write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-#
-# Originally written by DJ Delorie <dj@redhat.com>
-
-
-# This is a trivial script which checks the lists of C and O files in
-# the Makefile for consistency.
-
-$mode = shift;
-$srcdir = ".";
-
-if ($mode eq "-s") {
- $srcdir = shift;
- $mode = shift;
-}
-
-&missing() if $mode eq "missing";
-&undoc() if $mode eq "undoc";
-&deps() if $mode eq "deps";
-
-exit 0;
-
-format STDOUT =
-^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<~
-$out
- ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<~~
-$out
-.
-
-######################################################################
-
-sub missing {
-
- opendir(S, $srcdir);
- while ($f = readdir S) {
- $have{$f} = 1;
- }
- closedir(S);
- opendir(S, ".");
- while ($f = readdir S) {
- $have{$f} = 1;
- }
- closedir(S);
-
- for $a (@ARGV) {
- $listed{$a} = 1;
- $have{$a} = 0;
- }
-
- for $f (sort keys %have) {
- next unless $have{$f};
- if ($f =~ /\.c$/) {
- print "S $f\n";
- }
- }
- for $f (sort keys %listed) {
- if ($f =~ /(.*)\.c$/) {
- $base = $1;
- if (! $listed{"$base.o"}) {
- print "O $f\n";
- }
- }
- }
-}
-
-######################################################################
-
-sub undoc {
-
- opendir(S, $srcdir);
- while ($file = readdir S) {
- if ($file =~ /\.texi$/) {
- open(T, "$srcdir/$file");
- while (<T>) {
- if (/^\@deftype[^\(]* ([^\s\(]+) *\(/) {
- $documented{$1} = 1;
- }
- }
- close(T);
- }
- if ($file =~ /\.c$/) {
- open(C, "$srcdir/$file");
- while (<C>) {
- if (/\@undocumented (\S+)/) {
- $documented{$1} = 1;
- }
- if (/^static /) {
- if (! /[\(;]/) {
- s/[\r\n]+$/ /;
- $_ .= <C>;
- }
- while ($_ =~ /\([^\)]*$/) {
- s/[\r\n]+$/ /;
- $_ .= <C>;
- }
- }
- s/ VPARAMS([ \(])/$1/;
- s/PREFIX\(([^\)]*)\)/byte_$1/;
- if (/^static [^\(]* ([^\s\(]+) *\(.*\)$/) {
- $documented{$1} = 1;
- }
- }
- }
- }
- closedir(D);
-
- # $out = join(' ', sort keys %documented);
- # write;
- # print "\n";
-
- system "etags $srcdir/*.c $srcdir/../include/*.h";
- open(TAGS, "TAGS");
- while (<TAGS>) {
- s/[\r\n]+$//;
- if (/^\014$/) {
- $filename = <TAGS>;
- $filename =~ s/[\r\n]+$//;
- $filename =~ s/,\d+$//;
- $filename =~ s@.*[/\\]@@;
- next;
- }
- if ($filename =~ /\.c$/ ) {
- next unless /^[_a-zA-Z]/;
- } else {
- next unless /^\# *define/;
- s/\# *define *//;
- }
- next if $filename =~ /mpw\.c/;
-
- s/ VPARAMS//;
- s/ *\177.*//;
- s/,$//;
- s/DEFUN\(//;
- s/\(//;
-
- next if /^static /;
- next if /\s/;
- next if /^_/;
- next if $documented{$_};
- next if /_H_?$/;
-
- if ($seen_in{$_} ne $filename) {
- $saw{$_} ++;
- }
- $seen_in{$_} = $filename;
- }
-
- for $k (keys %saw) {
- delete $saw{$k} if $saw{$k} > 1;
- }
-
- for $k (sort keys %saw) {
- $fromfile{$seen_in{$k}} .= " " if $fromfile{$seen_in{$k}};
- $fromfile{$seen_in{$k}} .= $k;
- }
-
- for $f (sort keys %fromfile) {
- $out = "$f: $fromfile{$f}";
- write;
- }
-}
-
-######################################################################
-
-sub deps_for {
- my($f) = @_;
- my(%d);
- open(F, $f);
- %d = ();
- while (<F>) {
- if (/^#\s*include\s+["<](.*)[">]/) {
- $d{$1} = 1;
- }
- }
- close(F);
- return keys %d;
-}
-
-sub canonicalize {
- my ($p) = @_;
- 0 while $p =~ s@/\./@/@g;
- 0 while $p =~ s@^\./@@g;
- 0 while $p =~ s@/[^/]+/\.\./@/@g;
- return $p;
-}
-
-sub locals_first {
- my ($a,$b) = @_;
- return -1 if $a eq "config.h";
- return 1 if $b eq "config.h";
- return $a cmp $b;
-}
-
-sub deps {
-
- $incdir = shift @ARGV;
-
- opendir(INC, $incdir);
- while ($f = readdir INC) {
- next unless $f =~ /\.h$/;
- $mine{$f} = "\$(INCDIR)/$f";
- $deps{$f} = join(' ', &deps_for("$incdir/$f"));
- }
- $mine{'config.h'} = "config.h";
-
- open(IN, "$srcdir/Makefile.in");
- open(OUT, ">$srcdir/Makefile.tmp");
- while (<IN>) {
- last if /remainder of this file/;
- print OUT;
- }
- print OUT "# The dependencies in the remainder of this file are automatically\n";
- print OUT "# generated by \"make maint-deps\". Manual edits will be lost.\n\n";
-
- opendir(S, $srcdir);
- for $f (sort readdir S) {
- if ($f =~ /\.c$/) {
-
- %scanned = ();
- @pending = &deps_for("$srcdir/$f");
- while (@pending) {
- @tmp = @pending;
- @pending = ();
- for $p (@tmp) {
- next unless $mine{$p};
- if (!$scanned{$p}) {
- push(@pending, split(' ', $deps{$p}));
- $scanned{$p} = 1;
- }
- }
- }
- @deps = sort { &locals_first($a,$b) } keys %scanned;
- $obj = $f;
- $obj =~ s/\.c$/.o/;
- $obj = "$obj:";
- if ($#deps >= 0) {
- print OUT $obj;
- $len = length($obj);
- for $dt (@deps) {
- $d = $mine{$dt};
- if ($len + length($d) > 70) {
- printf OUT " \\\n\t$d";
- $len = 8 + length($d);
- } else {
- print OUT " $d";
- $len += length($d) + 1;
- }
- }
- print OUT "\n";
- }
- }
- }
- closedir(S);
- close(IN);
- close(OUT);
-
- rename("$srcdir/Makefile.tmp", "$srcdir/Makefile.in");
-}
diff --git a/libiberty/make-temp-file.c b/libiberty/make-temp-file.c
deleted file mode 100644
index 8833504..0000000
--- a/libiberty/make-temp-file.c
+++ /dev/null
@@ -1,179 +0,0 @@
-/* Utility to pick a temporary filename prefix.
- Copyright (C) 1996, 1997, 1998, 2001 Free Software Foundation, Inc.
-
-This file is part of the libiberty library.
-Libiberty is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public
-License as published by the Free Software Foundation; either
-version 2 of the License, or (at your option) any later version.
-
-Libiberty is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with libiberty; see the file COPYING.LIB. If not,
-write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdio.h> /* May get P_tmpdir. */
-#include <sys/types.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-#ifdef HAVE_SYS_FILE_H
-#include <sys/file.h> /* May get R_OK, etc. on some systems. */
-#endif
-
-#ifndef R_OK
-#define R_OK 4
-#define W_OK 2
-#define X_OK 1
-#endif
-
-#include "libiberty.h"
-extern int mkstemps PARAMS ((char *, int));
-
-/* '/' works just fine on MS-DOS based systems. */
-#ifndef DIR_SEPARATOR
-#define DIR_SEPARATOR '/'
-#endif
-
-/* Name of temporary file.
- mktemp requires 6 trailing X's. */
-#define TEMP_FILE "ccXXXXXX"
-#define TEMP_FILE_LEN (sizeof(TEMP_FILE) - 1)
-
-/* Subroutine of choose_tmpdir.
- If BASE is non-NULL, return it.
- Otherwise it checks if DIR is a usable directory.
- If success, DIR is returned.
- Otherwise NULL is returned. */
-
-static inline const char *try PARAMS ((const char *, const char *));
-
-static inline const char *
-try (dir, base)
- const char *dir, *base;
-{
- if (base != 0)
- return base;
- if (dir != 0
- && access (dir, R_OK | W_OK | X_OK) == 0)
- return dir;
- return 0;
-}
-
-static const char tmp[] = { DIR_SEPARATOR, 't', 'm', 'p', 0 };
-static const char usrtmp[] =
-{ DIR_SEPARATOR, 'u', 's', 'r', DIR_SEPARATOR, 't', 'm', 'p', 0 };
-static const char vartmp[] =
-{ DIR_SEPARATOR, 'v', 'a', 'r', DIR_SEPARATOR, 't', 'm', 'p', 0 };
-
-static char *memoized_tmpdir;
-
-/*
-
-@deftypefn Replacement char* choose_tmpdir ()
-
-Returns a pointer to a directory path suitable for creating temporary
-files in.
-
-@end deftypefn
-
-*/
-
-char *
-choose_tmpdir ()
-{
- const char *base = 0;
- char *tmpdir;
- unsigned int len;
-
- if (memoized_tmpdir)
- return memoized_tmpdir;
-
- base = try (getenv ("TMPDIR"), base);
- base = try (getenv ("TMP"), base);
- base = try (getenv ("TEMP"), base);
-
-#ifdef P_tmpdir
- base = try (P_tmpdir, base);
-#endif
-
- /* Try /var/tmp, /usr/tmp, then /tmp. */
- base = try (vartmp, base);
- base = try (usrtmp, base);
- base = try (tmp, base);
-
- /* If all else fails, use the current directory! */
- if (base == 0)
- base = ".";
-
- /* Append DIR_SEPARATOR to the directory we've chosen
- and return it. */
- len = strlen (base);
- tmpdir = xmalloc (len + 2);
- strcpy (tmpdir, base);
- tmpdir[len] = DIR_SEPARATOR;
- tmpdir[len+1] = '\0';
-
- memoized_tmpdir = tmpdir;
- return tmpdir;
-}
-
-/*
-
-@deftypefn Replacement char* make_temp_file (const char *@var{suffix})
-
-Return a temporary file name (as a string) or @code{NULL} if unable to
-create one. @var{suffix} is a suffix to append to the file name. The
-string is @code{malloc}ed, and the temporary file has been created.
-
-@end deftypefn
-
-*/
-
-char *
-make_temp_file (suffix)
- const char *suffix;
-{
- const char *base = choose_tmpdir ();
- char *temp_filename;
- int base_len, suffix_len;
- int fd;
-
- if (suffix == 0)
- suffix = "";
-
- base_len = strlen (base);
- suffix_len = strlen (suffix);
-
- temp_filename = xmalloc (base_len
- + TEMP_FILE_LEN
- + suffix_len + 1);
- strcpy (temp_filename, base);
- strcpy (temp_filename + base_len, TEMP_FILE);
- strcpy (temp_filename + base_len + TEMP_FILE_LEN, suffix);
-
- fd = mkstemps (temp_filename, suffix_len);
- /* If mkstemps failed, then something bad is happening. Maybe we should
- issue a message about a possible security attack in progress? */
- if (fd == -1)
- abort ();
- /* Similarly if we can not close the file. */
- if (close (fd))
- abort ();
- return temp_filename;
-}
diff --git a/libiberty/makefile.vms b/libiberty/makefile.vms
deleted file mode 100644
index 6a7dd45..0000000
--- a/libiberty/makefile.vms
+++ /dev/null
@@ -1,33 +0,0 @@
-#
-# Makefile for libiberty under openVMS/Alpha
-#
-# For use with gnu-make for vms
-#
-# Created by Klaus K"ampf, kkaempf@progis.de
-#
-#
-
-OBJS=bcopy.obj,bcmp.obj,getopt.obj,obstack.obj,xexit.obj,xmalloc.obj,hex.obj,\
- getopt1.obj,cplus-dem.obj,strncasecmp.obj,strcasecmp.obj,strdup.obj,\
- concat.obj,getruntime.obj,getpagesize.obj,alloca.obj,xstrerror.obj,\
- xmemdup.obj,xstrdup.obj,xatexit.obj,choose-temp.obj,fnmatch.obj,objalloc.obj
-
-ifeq ($(CC),gcc)
-CFLAGS=/include=([],[-.include])
-else
-# assume dec c
-CFLAGS=/noopt/debug/include=([],[-.include])/define=("const=")/warnings=disable=(missingreturn,implicitfunc)
-endif
-
-libiberty.olb: config.h alloca-conf.h $(OBJS)
- purge
- lib/create libiberty *.obj
-
-config.h: config.h-vms
- $(CP) $< $@
-
-clean:
- $$ purge
- $(RM) config.h;
- $(RM) *.obj;
- $(RM) libiberty.olb;
diff --git a/libiberty/md5.c b/libiberty/md5.c
deleted file mode 100644
index 2e829fb..0000000
--- a/libiberty/md5.c
+++ /dev/null
@@ -1,421 +0,0 @@
-/* md5.c - Functions to compute MD5 message digest of files or memory blocks
- according to the definition of MD5 in RFC 1321 from April 1992.
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
-
- NOTE: This source is derived from an old version taken from the GNU C
- Library (glibc).
-
- This program is free software; you can redistribute 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. */
-
-/* Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <sys/types.h>
-
-#if STDC_HEADERS || defined _LIBC
-# include <stdlib.h>
-# include <string.h>
-#else
-# ifndef HAVE_MEMCPY
-# define memcpy(d, s, n) bcopy ((s), (d), (n))
-# endif
-#endif
-
-#include "ansidecl.h"
-#include "md5.h"
-
-#ifdef _LIBC
-# include <endian.h>
-# if __BYTE_ORDER == __BIG_ENDIAN
-# define WORDS_BIGENDIAN 1
-# endif
-#endif
-
-#ifdef WORDS_BIGENDIAN
-# define SWAP(n) \
- (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24))
-#else
-# define SWAP(n) (n)
-#endif
-
-
-/* This array contains the bytes used to pad the buffer to the next
- 64-byte boundary. (RFC 1321, 3.1: Step 1) */
-static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ };
-
-
-/* Initialize structure containing state of computation.
- (RFC 1321, 3.3: Step 3) */
-void
-md5_init_ctx (ctx)
- struct md5_ctx *ctx;
-{
- ctx->A = (md5_uint32) 0x67452301;
- ctx->B = (md5_uint32) 0xefcdab89;
- ctx->C = (md5_uint32) 0x98badcfe;
- ctx->D = (md5_uint32) 0x10325476;
-
- ctx->total[0] = ctx->total[1] = 0;
- ctx->buflen = 0;
-}
-
-/* Put result from CTX in first 16 bytes following RESBUF. The result
- must be in little endian byte order.
-
- IMPORTANT: On some systems it is required that RESBUF is correctly
- aligned for a 32 bits value. */
-void *
-md5_read_ctx (ctx, resbuf)
- const struct md5_ctx *ctx;
- void *resbuf;
-{
- ((md5_uint32 *) resbuf)[0] = SWAP (ctx->A);
- ((md5_uint32 *) resbuf)[1] = SWAP (ctx->B);
- ((md5_uint32 *) resbuf)[2] = SWAP (ctx->C);
- ((md5_uint32 *) resbuf)[3] = SWAP (ctx->D);
-
- return resbuf;
-}
-
-/* Process the remaining bytes in the internal buffer and the usual
- prolog according to the standard and write the result to RESBUF.
-
- IMPORTANT: On some systems it is required that RESBUF is correctly
- aligned for a 32 bits value. */
-void *
-md5_finish_ctx (ctx, resbuf)
- struct md5_ctx *ctx;
- void *resbuf;
-{
- /* Take yet unprocessed bytes into account. */
- md5_uint32 bytes = ctx->buflen;
- size_t pad;
-
- /* Now count remaining bytes. */
- ctx->total[0] += bytes;
- if (ctx->total[0] < bytes)
- ++ctx->total[1];
-
- pad = bytes >= 56 ? 64 + 56 - bytes : 56 - bytes;
- memcpy (&ctx->buffer[bytes], fillbuf, pad);
-
- /* Put the 64-bit file length in *bits* at the end of the buffer. */
- *(md5_uint32 *) &ctx->buffer[bytes + pad] = SWAP (ctx->total[0] << 3);
- *(md5_uint32 *) &ctx->buffer[bytes + pad + 4] = SWAP ((ctx->total[1] << 3) |
- (ctx->total[0] >> 29));
-
- /* Process last bytes. */
- md5_process_block (ctx->buffer, bytes + pad + 8, ctx);
-
- return md5_read_ctx (ctx, resbuf);
-}
-
-/* Compute MD5 message digest for bytes read from STREAM. The
- resulting message digest number will be written into the 16 bytes
- beginning at RESBLOCK. */
-int
-md5_stream (stream, resblock)
- FILE *stream;
- void *resblock;
-{
- /* Important: BLOCKSIZE must be a multiple of 64. */
-#define BLOCKSIZE 4096
- struct md5_ctx ctx;
- char buffer[BLOCKSIZE + 72];
- size_t sum;
-
- /* Initialize the computation context. */
- md5_init_ctx (&ctx);
-
- /* Iterate over full file contents. */
- while (1)
- {
- /* We read the file in blocks of BLOCKSIZE bytes. One call of the
- computation function processes the whole buffer so that with the
- next round of the loop another block can be read. */
- size_t n;
- sum = 0;
-
- /* Read block. Take care for partial reads. */
- do
- {
- n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
-
- sum += n;
- }
- while (sum < BLOCKSIZE && n != 0);
- if (n == 0 && ferror (stream))
- return 1;
-
- /* If end of file is reached, end the loop. */
- if (n == 0)
- break;
-
- /* Process buffer with BLOCKSIZE bytes. Note that
- BLOCKSIZE % 64 == 0
- */
- md5_process_block (buffer, BLOCKSIZE, &ctx);
- }
-
- /* Add the last bytes if necessary. */
- if (sum > 0)
- md5_process_bytes (buffer, sum, &ctx);
-
- /* Construct result in desired memory. */
- md5_finish_ctx (&ctx, resblock);
- return 0;
-}
-
-/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The
- result is always in little endian byte order, so that a byte-wise
- output yields to the wanted ASCII representation of the message
- digest. */
-void *
-md5_buffer (buffer, len, resblock)
- const char *buffer;
- size_t len;
- void *resblock;
-{
- struct md5_ctx ctx;
-
- /* Initialize the computation context. */
- md5_init_ctx (&ctx);
-
- /* Process whole buffer but last len % 64 bytes. */
- md5_process_bytes (buffer, len, &ctx);
-
- /* Put result in desired memory area. */
- return md5_finish_ctx (&ctx, resblock);
-}
-
-
-void
-md5_process_bytes (buffer, len, ctx)
- const void *buffer;
- size_t len;
- struct md5_ctx *ctx;
-{
- /* When we already have some bits in our internal buffer concatenate
- both inputs first. */
- if (ctx->buflen != 0)
- {
- size_t left_over = ctx->buflen;
- size_t add = 128 - left_over > len ? len : 128 - left_over;
-
- memcpy (&ctx->buffer[left_over], buffer, add);
- ctx->buflen += add;
-
- if (left_over + add > 64)
- {
- md5_process_block (ctx->buffer, (left_over + add) & ~63, ctx);
- /* The regions in the following copy operation cannot overlap. */
- memcpy (ctx->buffer, &ctx->buffer[(left_over + add) & ~63],
- (left_over + add) & 63);
- ctx->buflen = (left_over + add) & 63;
- }
-
- buffer = (const void *) ((const char *) buffer + add);
- len -= add;
- }
-
- /* Process available complete blocks. */
- if (len > 64)
- {
- md5_process_block (buffer, len & ~63, ctx);
- buffer = (const void *) ((const char *) buffer + (len & ~63));
- len &= 63;
- }
-
- /* Move remaining bytes in internal buffer. */
- if (len > 0)
- {
- memcpy (ctx->buffer, buffer, len);
- ctx->buflen = len;
- }
-}
-
-
-/* These are the four functions used in the four steps of the MD5 algorithm
- and defined in the RFC 1321. The first function is a little bit optimized
- (as found in Colin Plumbs public domain implementation). */
-/* #define FF(b, c, d) ((b & c) | (~b & d)) */
-#define FF(b, c, d) (d ^ (b & (c ^ d)))
-#define FG(b, c, d) FF (d, b, c)
-#define FH(b, c, d) (b ^ c ^ d)
-#define FI(b, c, d) (c ^ (b | ~d))
-
-/* Process LEN bytes of BUFFER, accumulating context into CTX.
- It is assumed that LEN % 64 == 0. */
-
-void
-md5_process_block (buffer, len, ctx)
- const void *buffer;
- size_t len;
- struct md5_ctx *ctx;
-{
- md5_uint32 correct_words[16];
- const md5_uint32 *words = (const md5_uint32 *) buffer;
- size_t nwords = len / sizeof (md5_uint32);
- const md5_uint32 *endp = words + nwords;
- md5_uint32 A = ctx->A;
- md5_uint32 B = ctx->B;
- md5_uint32 C = ctx->C;
- md5_uint32 D = ctx->D;
-
- /* First increment the byte count. RFC 1321 specifies the possible
- length of the file up to 2^64 bits. Here we only compute the
- number of bytes. Do a double word increment. */
- ctx->total[0] += len;
- if (ctx->total[0] < len)
- ++ctx->total[1];
-
- /* Process all bytes in the buffer with 64 bytes in each round of
- the loop. */
- while (words < endp)
- {
- md5_uint32 *cwp = correct_words;
- md5_uint32 A_save = A;
- md5_uint32 B_save = B;
- md5_uint32 C_save = C;
- md5_uint32 D_save = D;
-
- /* First round: using the given function, the context and a constant
- the next context is computed. Because the algorithms processing
- unit is a 32-bit word and it is determined to work on words in
- little endian byte order we perhaps have to change the byte order
- before the computation. To reduce the work for the next steps
- we store the swapped words in the array CORRECT_WORDS. */
-
-#define OP(a, b, c, d, s, T) \
- do \
- { \
- a += FF (b, c, d) + (*cwp++ = SWAP (*words)) + T; \
- ++words; \
- CYCLIC (a, s); \
- a += b; \
- } \
- while (0)
-
- /* It is unfortunate that C does not provide an operator for
- cyclic rotation. Hope the C compiler is smart enough. */
-#define CYCLIC(w, s) (w = (w << s) | (w >> (32 - s)))
-
- /* Before we start, one word to the strange constants.
- They are defined in RFC 1321 as
-
- T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64
- */
-
- /* Round 1. */
- OP (A, B, C, D, 7, (md5_uint32) 0xd76aa478);
- OP (D, A, B, C, 12, (md5_uint32) 0xe8c7b756);
- OP (C, D, A, B, 17, (md5_uint32) 0x242070db);
- OP (B, C, D, A, 22, (md5_uint32) 0xc1bdceee);
- OP (A, B, C, D, 7, (md5_uint32) 0xf57c0faf);
- OP (D, A, B, C, 12, (md5_uint32) 0x4787c62a);
- OP (C, D, A, B, 17, (md5_uint32) 0xa8304613);
- OP (B, C, D, A, 22, (md5_uint32) 0xfd469501);
- OP (A, B, C, D, 7, (md5_uint32) 0x698098d8);
- OP (D, A, B, C, 12, (md5_uint32) 0x8b44f7af);
- OP (C, D, A, B, 17, (md5_uint32) 0xffff5bb1);
- OP (B, C, D, A, 22, (md5_uint32) 0x895cd7be);
- OP (A, B, C, D, 7, (md5_uint32) 0x6b901122);
- OP (D, A, B, C, 12, (md5_uint32) 0xfd987193);
- OP (C, D, A, B, 17, (md5_uint32) 0xa679438e);
- OP (B, C, D, A, 22, (md5_uint32) 0x49b40821);
-
- /* For the second to fourth round we have the possibly swapped words
- in CORRECT_WORDS. Redefine the macro to take an additional first
- argument specifying the function to use. */
-#undef OP
-#define OP(f, a, b, c, d, k, s, T) \
- do \
- { \
- a += f (b, c, d) + correct_words[k] + T; \
- CYCLIC (a, s); \
- a += b; \
- } \
- while (0)
-
- /* Round 2. */
- OP (FG, A, B, C, D, 1, 5, (md5_uint32) 0xf61e2562);
- OP (FG, D, A, B, C, 6, 9, (md5_uint32) 0xc040b340);
- OP (FG, C, D, A, B, 11, 14, (md5_uint32) 0x265e5a51);
- OP (FG, B, C, D, A, 0, 20, (md5_uint32) 0xe9b6c7aa);
- OP (FG, A, B, C, D, 5, 5, (md5_uint32) 0xd62f105d);
- OP (FG, D, A, B, C, 10, 9, (md5_uint32) 0x02441453);
- OP (FG, C, D, A, B, 15, 14, (md5_uint32) 0xd8a1e681);
- OP (FG, B, C, D, A, 4, 20, (md5_uint32) 0xe7d3fbc8);
- OP (FG, A, B, C, D, 9, 5, (md5_uint32) 0x21e1cde6);
- OP (FG, D, A, B, C, 14, 9, (md5_uint32) 0xc33707d6);
- OP (FG, C, D, A, B, 3, 14, (md5_uint32) 0xf4d50d87);
- OP (FG, B, C, D, A, 8, 20, (md5_uint32) 0x455a14ed);
- OP (FG, A, B, C, D, 13, 5, (md5_uint32) 0xa9e3e905);
- OP (FG, D, A, B, C, 2, 9, (md5_uint32) 0xfcefa3f8);
- OP (FG, C, D, A, B, 7, 14, (md5_uint32) 0x676f02d9);
- OP (FG, B, C, D, A, 12, 20, (md5_uint32) 0x8d2a4c8a);
-
- /* Round 3. */
- OP (FH, A, B, C, D, 5, 4, (md5_uint32) 0xfffa3942);
- OP (FH, D, A, B, C, 8, 11, (md5_uint32) 0x8771f681);
- OP (FH, C, D, A, B, 11, 16, (md5_uint32) 0x6d9d6122);
- OP (FH, B, C, D, A, 14, 23, (md5_uint32) 0xfde5380c);
- OP (FH, A, B, C, D, 1, 4, (md5_uint32) 0xa4beea44);
- OP (FH, D, A, B, C, 4, 11, (md5_uint32) 0x4bdecfa9);
- OP (FH, C, D, A, B, 7, 16, (md5_uint32) 0xf6bb4b60);
- OP (FH, B, C, D, A, 10, 23, (md5_uint32) 0xbebfbc70);
- OP (FH, A, B, C, D, 13, 4, (md5_uint32) 0x289b7ec6);
- OP (FH, D, A, B, C, 0, 11, (md5_uint32) 0xeaa127fa);
- OP (FH, C, D, A, B, 3, 16, (md5_uint32) 0xd4ef3085);
- OP (FH, B, C, D, A, 6, 23, (md5_uint32) 0x04881d05);
- OP (FH, A, B, C, D, 9, 4, (md5_uint32) 0xd9d4d039);
- OP (FH, D, A, B, C, 12, 11, (md5_uint32) 0xe6db99e5);
- OP (FH, C, D, A, B, 15, 16, (md5_uint32) 0x1fa27cf8);
- OP (FH, B, C, D, A, 2, 23, (md5_uint32) 0xc4ac5665);
-
- /* Round 4. */
- OP (FI, A, B, C, D, 0, 6, (md5_uint32) 0xf4292244);
- OP (FI, D, A, B, C, 7, 10, (md5_uint32) 0x432aff97);
- OP (FI, C, D, A, B, 14, 15, (md5_uint32) 0xab9423a7);
- OP (FI, B, C, D, A, 5, 21, (md5_uint32) 0xfc93a039);
- OP (FI, A, B, C, D, 12, 6, (md5_uint32) 0x655b59c3);
- OP (FI, D, A, B, C, 3, 10, (md5_uint32) 0x8f0ccc92);
- OP (FI, C, D, A, B, 10, 15, (md5_uint32) 0xffeff47d);
- OP (FI, B, C, D, A, 1, 21, (md5_uint32) 0x85845dd1);
- OP (FI, A, B, C, D, 8, 6, (md5_uint32) 0x6fa87e4f);
- OP (FI, D, A, B, C, 15, 10, (md5_uint32) 0xfe2ce6e0);
- OP (FI, C, D, A, B, 6, 15, (md5_uint32) 0xa3014314);
- OP (FI, B, C, D, A, 13, 21, (md5_uint32) 0x4e0811a1);
- OP (FI, A, B, C, D, 4, 6, (md5_uint32) 0xf7537e82);
- OP (FI, D, A, B, C, 11, 10, (md5_uint32) 0xbd3af235);
- OP (FI, C, D, A, B, 2, 15, (md5_uint32) 0x2ad7d2bb);
- OP (FI, B, C, D, A, 9, 21, (md5_uint32) 0xeb86d391);
-
- /* Add the starting values of the context. */
- A += A_save;
- B += B_save;
- C += C_save;
- D += D_save;
- }
-
- /* Put checksum in context given as argument. */
- ctx->A = A;
- ctx->B = B;
- ctx->C = C;
- ctx->D = D;
-}
diff --git a/libiberty/memchr.c b/libiberty/memchr.c
deleted file mode 100644
index f94bea0..0000000
--- a/libiberty/memchr.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
-
-@deftypefn Supplemental void* memchr (const void *@var{s}, int @var{c}, size_t @var{n})
-
-This function searches memory starting at @code{*@var{s}} for the
-character @var{c}. The search only ends with the first occurrence of
-@var{c}, or after @var{length} characters; in particular, a null
-character does not terminate the search. If the character @var{c} is
-found within @var{length} characters of @code{*@var{s}}, a pointer
-to the character is returned. If @var{c} is not found, then @code{NULL} is
-returned.
-
-@end deftypefn
-
-*/
-
-#include <ansidecl.h>
-#ifdef __STDC__
-#include <stddef.h>
-#else
-#define size_t unsigned long
-#endif
-
-PTR
-memchr (src_void, c, length)
- register const PTR src_void;
- int c;
- size_t length;
-{
- const unsigned char *src = (const unsigned char *)src_void;
-
- while (length-- > 0)
- {
- if (*src == c)
- return (PTR)src;
- src++;
- }
- return NULL;
-}
diff --git a/libiberty/memcmp.c b/libiberty/memcmp.c
deleted file mode 100644
index d8d3997..0000000
--- a/libiberty/memcmp.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* memcmp -- compare two memory regions.
- This function is in the public domain. */
-
-/*
-
-@deftypefn Supplemental int memcmp (const void *@var{x}, const void *@var{y}, size_t @var{count})
-
-Compares the first @var{count} bytes of two areas of memory. Returns
-zero if they are the same, a value less than zero if @var{x} is
-lexically less than @var{y}, or a value greater than zero if @var{x}
-is lexically greater than @var{y}. Note that lexical order is determined
-as if comparing unsigned char arrays.
-
-@end deftypefn
-
-*/
-
-#include <ansidecl.h>
-#ifdef __STDC__
-#include <stddef.h>
-#else
-#define size_t unsigned long
-#endif
-
-int
-DEFUN(memcmp, (str1, str2, count),
- const PTR str1 AND const PTR str2 AND size_t count)
-{
- register const unsigned char *s1 = (const unsigned char*)str1;
- register const unsigned char *s2 = (const unsigned char*)str2;
-
- while (count-- > 0)
- {
- if (*s1++ != *s2++)
- return s1[-1] < s2[-1] ? -1 : 1;
- }
- return 0;
-}
-
diff --git a/libiberty/memcpy.c b/libiberty/memcpy.c
deleted file mode 100644
index 0f2bac7..0000000
--- a/libiberty/memcpy.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* memcpy (the standard C function)
- This function is in the public domain. */
-
-/*
-
-@deftypefn Supplemental void* memcpy (void *@var{out}, const void *@var{in}, size_t @var{length})
-
-Copies @var{length} bytes from memory region @var{in} to region
-@var{out}. Returns a pointer to @var{out}.
-
-@end deftypefn
-
-*/
-
-#include <ansidecl.h>
-#ifdef __STDC__
-#include <stddef.h>
-#else
-#define size_t unsigned long
-#endif
-
-PTR
-DEFUN(memcpy, (out, in, length), PTR out AND const PTR in AND size_t length)
-{
- bcopy(in, out, length);
- return out;
-}
diff --git a/libiberty/memmove.c b/libiberty/memmove.c
deleted file mode 100644
index 3ec7320..0000000
--- a/libiberty/memmove.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Wrapper to implement ANSI C's memmove using BSD's bcopy. */
-/* This function is in the public domain. --Per Bothner. */
-
-/*
-
-@deftypefn Supplemental void* memmove (void *@var{from}, const void *@var{to}, size_t @var{count})
-
-Copies @var{count} bytes from memory area @var{from} to memory area
-@var{to}, returning a pointer to @var{to}.
-
-@end deftypefn
-
-*/
-
-#include <ansidecl.h>
-#ifdef __STDC__
-#include <stddef.h>
-#else
-#define size_t unsigned long
-#endif
-
-PTR
-memmove (s1, s2, n)
- PTR s1;
- const PTR s2;
- size_t n;
-{
- bcopy (s2, s1, n);
- return s1;
-}
diff --git a/libiberty/memset.c b/libiberty/memset.c
deleted file mode 100644
index 489ca17..0000000
--- a/libiberty/memset.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* memset
- This implementation is in the public domain. */
-
-/*
-
-@deftypefn Supplemental void* memset (void *@var{s}, int @var{c}, size_t @var{count})
-
-Sets the first @var{count} bytes of @var{s} to the constant byte
-@var{c}, returning a pointer to @var{s}.
-
-@end deftypefn
-
-*/
-
-#include <ansidecl.h>
-#ifdef __STDC__
-#include <stddef.h>
-#else
-#define size_t unsigned long
-#endif
-
-PTR
-DEFUN(memset, (dest, val, len),
- PTR dest AND register int val AND register size_t len)
-{
- register unsigned char *ptr = (unsigned char*)dest;
- while (len-- > 0)
- *ptr++ = val;
- return dest;
-}
diff --git a/libiberty/mkstemps.c b/libiberty/mkstemps.c
deleted file mode 100644
index 1f6600a..0000000
--- a/libiberty/mkstemps.c
+++ /dev/null
@@ -1,142 +0,0 @@
-/* Copyright (C) 1991, 1992, 1996, 1998 Free Software Foundation, Inc.
- This file is derived from mkstemp.c from the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C 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
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <sys/types.h>
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-#include <errno.h>
-#include <stdio.h>
-#include <fcntl.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-#include "ansidecl.h"
-
-/* We need to provide a type for gcc_uint64_t. */
-#ifdef __GNUC__
-__extension__ typedef unsigned long long gcc_uint64_t;
-#else
-typedef unsigned long gcc_uint64_t;
-#endif
-
-#ifndef TMP_MAX
-#define TMP_MAX 16384
-#endif
-
-/*
-
-@deftypefn Replacement int mkstemps (char *@var{template}, int @var{suffix_len})
-
-Generate a unique temporary file name from @var{template}.
-@var{template} has the form:
-
-@example
- @var{path}/ccXXXXXX@var{suffix}
-@end example
-
-@var{suffix_len} tells us how long @var{suffix} is (it can be zero
-length). The last six characters of @var{template} before @var{suffix}
-must be @samp{XXXXXX}; they are replaced with a string that makes the
-filename unique. Returns a file descriptor open on the file for
-reading and writing.
-
-@end deftypefn
-
-*/
-
-int
-mkstemps (template, suffix_len)
- char *template;
- int suffix_len;
-{
- static const char letters[]
- = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
- static gcc_uint64_t value;
-#ifdef HAVE_GETTIMEOFDAY
- struct timeval tv;
-#endif
- char *XXXXXX;
- size_t len;
- int count;
-
- len = strlen (template);
-
- if ((int) len < 6 + suffix_len
- || strncmp (&template[len - 6 - suffix_len], "XXXXXX", 6))
- {
- return -1;
- }
-
- XXXXXX = &template[len - 6 - suffix_len];
-
-#ifdef HAVE_GETTIMEOFDAY
- /* Get some more or less random data. */
- gettimeofday (&tv, NULL);
- value += ((gcc_uint64_t) tv.tv_usec << 16) ^ tv.tv_sec ^ getpid ();
-#else
- value += getpid ();
-#endif
-
- for (count = 0; count < TMP_MAX; ++count)
- {
- gcc_uint64_t v = value;
- int fd;
-
- /* Fill in the random bits. */
- XXXXXX[0] = letters[v % 62];
- v /= 62;
- XXXXXX[1] = letters[v % 62];
- v /= 62;
- XXXXXX[2] = letters[v % 62];
- v /= 62;
- XXXXXX[3] = letters[v % 62];
- v /= 62;
- XXXXXX[4] = letters[v % 62];
- v /= 62;
- XXXXXX[5] = letters[v % 62];
-
-#ifdef VMS
- fd = open (template, O_RDWR|O_CREAT|O_EXCL, 0600, "fop=tmd");
-#else
- fd = open (template, O_RDWR|O_CREAT|O_EXCL, 0600);
-#endif
- if (fd >= 0)
- /* The file does not exist. */
- return fd;
-
- /* This is a random value. It is only necessary that the next
- TMP_MAX values generated by adding 7777 to VALUE are different
- with (module 2^32). */
- value += 7777;
- }
-
- /* We return the null string if we can't find a unique file name. */
- template[0] = '\0';
- return -1;
-}
diff --git a/libiberty/mpw-config.in b/libiberty/mpw-config.in
deleted file mode 100644
index 2a21802..0000000
--- a/libiberty/mpw-config.in
+++ /dev/null
@@ -1,7 +0,0 @@
-# MPW configuration fragment for libiberty.
-
-Echo '/* config.h. Generated by mpw-configure. */' > "{o}"config.new
-
-MoveIfChange "{o}"config.new "{o}"config.h
-
-
diff --git a/libiberty/mpw-make.sed b/libiberty/mpw-make.sed
deleted file mode 100644
index 6f2a5e7..0000000
--- a/libiberty/mpw-make.sed
+++ /dev/null
@@ -1,51 +0,0 @@
-# Sed commands to finish translating libiberty's Unix makefile to MPW syntax.
-
-# Comment out a useless thing.
-/^\.always\./s/^/#/
-
-# Replace the auto-generated list with the list of what we know we need.
-s/`cat needed-list`/"{o}"alloca.c.o "{o}"bcopy.c.o "{o}"getpagesize.c.o "{o}"insque.c.o "{o}"mpw.c.o "{o}"strcasecmp.c.o "{o}"strdup.c.o "{o}"strncasecmp.c.o/
-
-# Paste in some desirable definitions.
-# The default rule here completely replaces the tricky stuff in the Unix
-# Makefile.in.
-/^###$/a\
-\
-HDEFINES = -d NEED_sys_siglist -d NEED_sys_errlist -d NEED_basename -d NEED_strcasecmp -d NEED_strncasecmp\
-INCLUDES = -i : -i {INCDIR}: -i {INCDIR}:mpw: -i ::extra-include: -i "{s}"\
-\
-.c.o \\Option-f .c\
- {CC} @DASH_C_FLAG@ {DepDir}{Default}.c {LIBCFLAGS} {INCLUDES} {HDEFINES} @SEGMENT_FLAG({Default})@ -o {TargDir}{Default}.c.o\
-
-# Remove dependency on needed-list, which we don't use.
-/DO_ALSO =/s/needed-list//
-
-/INCDIR=/s/"{srcdir}"{MULTISRCTOP}::/"{topsrcdir}"/
-
-# Whack out the COMPILE.c trickiness.
-/^COMPILE.c /,/^$/d
-
-# Remove the multido trickiness from the "all" target.
-/^all \\Option-f/,/^$/c\
-all \\Option-f {TARGETLIB}\
-
-
-# Remove the RULE1/RULE2 crud.
-/if \[/,/fi/d
-/^RULE1 =/,/RULE2 =/d
-/RULE2/s/RULE2/TARGETLIB/
-
-# Don't want fdmatch ever.
-s/ "{o}"fdmatch.c.o//
-
-# Fix paths to generated files.
-/config.h/s/"{s}"config.h/"{o}"config.h/
-
-# Whack out config rebuild rules.
-/^"{o}"config.h \\Option-f/,/^$/d
-
-
-
-
-
-
diff --git a/libiberty/mpw.c b/libiberty/mpw.c
deleted file mode 100644
index ca3ae41..0000000
--- a/libiberty/mpw.c
+++ /dev/null
@@ -1,1010 +0,0 @@
-/* MPW-Unix compatibility library.
- Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
-
-This file is part of the libiberty library.
-Libiberty is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public
-License as published by the Free Software Foundation; either
-version 2 of the License, or (at your option) any later version.
-
-Libiberty is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with libiberty; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-/* This should only be compiled and linked under MPW. */
-
-#include "mpw.h"
-
-#include <stdlib.h>
-
-#ifndef USE_MW_HEADERS
-#include <sys/time.h>
-#include <sys/resource.h>
-#endif
-
-#include <Types.h>
-#include <Files.h>
-
-#include <Timer.h>
-
-/* Initialize to 0 at first, then set to errno_max() later. */
-
-int sys_nerr = 0;
-
-/* Debug flag for pathname hacking. Set this to one and rebuild. */
-
-int DebugPI = -1;
-
-void
-mpwify_filename(char *unixname, char *macname)
-{
- int i, j;
-
- /* (should truncate 255 chars from end of name, not beginning) */
- if (strlen (unixname) > 255)
- {
- fprintf (stderr, "Pathname \"%s\" is too long for Macs, truncating\n",
- unixname);
- }
- j = 0;
- /* If you're going to end up with one or more colons in the middle of a
- path after an all-Unix relative path is translated, you must add a
- colon on the front, so that the first component is not thought to be
- a disk name. */
- if (unixname[0] != '/' && ! strchr (unixname, ':') && strchr (unixname, '/'))
- {
- macname[j++] = ':';
- }
- for (i = 0; unixname[i] != '\0' && i < 255; ++i)
- {
- if (i == 0 && unixname[i] == '/')
- {
- if (strncmp (unixname, "/tmp/", 5) == 0)
- {
- /* A temporary name, make a more Mac-flavored tmpname. */
- /* A better choice would be {Boot}Trash:foo, but
- that would require being able to identify the
- boot disk's and trashcan's name. Another option
- would be to have an env var, so user can point it
- at a ramdisk. */
- macname[j++] = ':';
- macname[j++] = 't';
- macname[j++] = 'm';
- macname[j++] = 'p';
- macname[j++] = '_';
- i += 4;
- }
- else
- {
- /* Don't copy the leading slash. */
- }
- }
- else if (unixname[i] == ':' && unixname[i+1] == '/')
- {
- macname[j++] = ':';
- i += 1;
- }
- else if (unixname[i] == '.' && unixname[i+1] == '/')
- {
- macname[j++] = ':';
- i += 1;
- }
- else if (unixname[i] == '.' && unixname[i+1] == '.' && unixname[i+2] == '/')
- {
- macname[j++] = ':';
- macname[j++] = ':';
- i += 2;
- }
- else if (unixname[i] == '/')
- {
- macname[j++] = ':';
- }
- else
- {
- macname[j++] = unixname[i];
- }
- }
- macname[j] = '\0';
- /* Allow for getting the debug flag from an env var; quite useful. */
- if (DebugPI < 0)
- DebugPI = (*(getenv ("DEBUG_PATHNAMES")) == '1' ? 1 : 0);
- if (DebugPI)
- {
- fprintf (stderr, "# Made \"%s\"\n", unixname);
- fprintf (stderr, "# into \"%s\"\n", macname);
- }
-}
-
-/* MPW-flavored basename finder. */
-
-char *
-mpw_basename (name)
- char *name;
-{
- char *base = name;
-
- while (*name)
- {
- if (*name++ == ':')
- {
- base = name;
- }
- }
- return base;
-}
-
-/* Mixed MPW/Unix basename finder. This can be led astray by
- filenames with slashes in them and come up with a basename that
- either corresponds to no file or (worse) to some other file, so
- should only be tried if other methods of finding a file via a
- basename have failed. */
-
-char *
-mpw_mixed_basename (name)
- char *name;
-{
- char *base = name;
-
- while (*name)
- {
- if (*name == '/' || *name == ':')
- {
- base = name + 1;
- }
- ++name;
- }
- return base;
-}
-
-/* This function is fopen() modified to create files that are type TEXT
- or 'BIN ', and always of type 'MPS '. */
-
-FILE *
-mpw_fopen (char *name, char *mode)
-{
-#undef fopen
- int errnum;
- FILE *fp;
- char tmpname[256];
-
- mpwify_filename (name, tmpname);
- PROGRESS (1);
- fp = fopen (tmpname, mode);
- errnum = errno;
-
- /* If writing, need to set type and creator usefully. */
- if (strchr (mode, 'w'))
- {
- char *pname = (char *) malloc (strlen (tmpname) + 2);
- OSErr e;
- struct FInfo fi;
-
- pname[0] = strlen (tmpname);
- strcpy (pname+1, tmpname);
-
- e = GetFInfo ((ConstStr255Param) pname, 0, &fi);
- /* should do spiffier error handling */
- if (e != 0)
- fprintf(stderr, "GetFInfo returns %d\n", e);
- if (strchr (mode, 'b'))
- {
- fi.fdType = (OSType) 'BIN ';
- }
- else
- {
- fi.fdType = (OSType) 'TEXT';
- }
- fi.fdCreator = (OSType) 'MPS ';
- e = SetFInfo ((ConstStr255Param) pname, 0, &fi);
- if (e != 0)
- fprintf(stderr, "SetFInfo returns %d\n", e);
- free (pname);
- }
- if (fp == NULL)
- errno = errnum;
- return fp;
-}
-
-/* This is a version of fseek() modified to fill the file with zeros
- if seeking past the end of it. */
-
-#define ZEROBLKSIZE 4096
-
-char zeros[ZEROBLKSIZE];
-
-int
-mpw_fseek (FILE *fp, int offset, int whence)
-{
-#undef fseek
- int cursize, numleft;
-
- PROGRESS (1);
- if (whence == SEEK_SET)
- {
- fseek (fp, 0, SEEK_END);
- cursize = ftell (fp);
- if (offset > cursize)
- {
- numleft = offset - cursize;
- while (numleft > ZEROBLKSIZE)
- {
- /* This might fail, should check for that. */
- PROGRESS (1);
- fwrite (zeros, 1, ZEROBLKSIZE, fp);
- numleft -= ZEROBLKSIZE;
- }
- PROGRESS (1);
- fwrite (zeros, 1, numleft, fp);
- fflush (fp);
- }
- }
- return fseek (fp, offset, whence);
-}
-
-int
-mpw_fread (char *ptr, int size, int nitems, FILE *stream)
-{
-#undef fread
- int rslt;
-
- PROGRESS (1);
- rslt = fread (ptr, size, nitems, stream);
- PROGRESS (1);
- return rslt;
-}
-
-int
-mpw_fwrite (char *ptr, int size, int nitems, FILE *stream)
-{
-#undef fwrite
- int rslt;
-
- PROGRESS (1);
- rslt = fwrite (ptr, size, nitems, stream);
- PROGRESS (1);
- return rslt;
-}
-
-int
-link ()
-{
- fprintf (stderr, "link not available!\n");
- mpw_abort ();
-}
-
-int
-fork ()
-{
- fprintf (stderr, "fork not available!\n");
- mpw_abort ();
-}
-
-int
-vfork ()
-{
- fprintf (stderr, "vfork not available!\n");
- mpw_abort ();
- return (-1);
-}
-
-int
-pipe (int *fd)
-{
- fprintf (stderr, "pipe not available!\n");
- mpw_abort ();
- return (-1);
-}
-
-#ifndef USE_MW_HEADERS
-int
-execvp (char *file, char **argv)
-{
- fprintf (stderr, "execvp not available!\n");
- mpw_abort ();
- return (-1);
-}
-
-int
-execv (char *path, char **argv)
-{
- fprintf (stderr, "execv not available!\n");
- mpw_abort ();
- return (-1);
-}
-#endif
-
-int
-kill (int pid, int sig)
-{
- fprintf (stderr, "kill not available!\n");
- mpw_abort ();
- return (-1);
-}
-
-int
-wait (int *status)
-{
- *status = 0;
- return 0;
-}
-
-#ifndef USE_MW_HEADERS
-int
-sleep (int seconds)
-{
- unsigned long start_time, now;
-
- time (&start_time);
-
- while (1)
- {
- PROGRESS (1);
- time (&now);
- if (now > start_time + seconds)
- return 0;
- }
-}
-#endif
-
-void
-putenv (char *str)
-{
- /* The GCC driver calls this to do things for collect2, but we
- don't care about collect2. */
-}
-
-int
-chmod (char *path, int mode)
-{
- /* Pretend it was all OK. */
- return 0;
-}
-
-#ifndef USE_MW_HEADERS
-int
-getuid ()
-{
- /* One value is as good as another... */
- return 0;
-}
-
-int
-getgid ()
-{
- /* One value is as good as another... */
- return 0;
-}
-#endif
-
-/* Instead of coredumping, which is not a normal Mac facility, we
- drop into Macsbug. If we then "g" from Macsbug, the program will
- exit cleanly. */
-
-void
-mpw_abort ()
-{
- /* Make sure no output still buffered up, then zap into MacsBug. */
- fflush(stdout);
- fflush(stderr);
- printf("## Abort! ##\n");
-#ifdef MPW_SADE
- SysError(8005);
-#else
- Debugger();
-#endif
- /* "g" in MacsBug will then cause a regular error exit. */
- exit (1);
-}
-
-/* Imitation getrusage based on the ANSI clock() function. */
-
-int
-getrusage (int who, struct rusage *rusage)
-{
- int clk = clock ();
-
-#if 0
- rusage->ru_utime.tv_sec = clk / CLOCKS_PER_SEC;
- rusage->ru_utime.tv_usec = ((clk * 1000) / CLOCKS_PER_SEC) * 1000;
- rusage->ru_stime.tv_sec = 0;
- rusage->ru_stime.tv_usec = 0;
-#endif
-}
-
-int
-sbrk ()
-{
- return 0;
-}
-
-#ifndef USE_MW_HEADERS
-int
-isatty (int fd)
-{
- return 0;
-}
-
-/* This is inherited from Timothy Murray's Posix library. */
-
-#include "utime.h"
-
-int
-utime (char *filename, struct utimbuf *times)
-{
- CInfoPBRec cipbr;
- HFileInfo *fpb = (HFileInfo *) &cipbr;
- DirInfo *dpb = (DirInfo *) &cipbr;
- unsigned char pname[256];
- short err;
-
- strcpy ((char *) pname, filename);
- c2pstr (pname);
-
- dpb->ioDrDirID = 0L;
- fpb->ioNamePtr = pname;
- fpb->ioVRefNum = 0;
- fpb->ioFDirIndex = 0;
- fpb->ioFVersNum = 0;
- err = PBGetCatInfo (&cipbr, 0);
- if (err != noErr) {
- errno = ENOENT;
- return -1;
- }
- dpb->ioDrDirID = 0L;
- fpb->ioFlMdDat = times->modtime;
- fpb->ioFlCrDat = times->actime;
- err = PBSetCatInfo (&cipbr, 0);
- if (err != noErr) {
- errno = EACCES;
- return -1;
- }
- return 0;
-}
-
-int
-mkdir (char *path, int mode)
-{
- errno = ENOSYS;
- return -1;
-}
-
-int
-rmdir ()
-{
- errno = ENOSYS;
- return -1;
-}
-#endif
-
-chown ()
-{
- errno = ENOSYS;
- return -1;
-}
-
-char *myenviron[] = {NULL};
-
-char **environ = myenviron;
-
-#ifndef USE_MW_HEADERS
-
-/* Minimal 'stat' emulation: tells directories from files and
- gives length and mtime.
-
- Derived from code written by Guido van Rossum, CWI, Amsterdam
- and placed by him in the public domain. */
-
-extern int __uid, __gid;
-
-int __uid = 0;
-int __gid = 0;
-
-/* Bits in ioFlAttrib: */
-#define LOCKBIT (1<<0) /* File locked */
-#define DIRBIT (1<<4) /* It's a directory */
-
-/* Macified "stat" in which filename is given relative to a directory,
- specified by long DirID. */
-
-static int
-_stat (char *name, long dirid, struct stat *buf)
-{
- CInfoPBRec cipbr;
- HFileInfo *fpb = (HFileInfo*) &cipbr;
- DirInfo *dpb = (DirInfo*) &cipbr;
- Str255 pname;
- short err;
-
- /* Make a temp copy of the name and pascalize. */
- strcpy ((char *) pname, name);
- c2pstr (pname);
-
- cipbr.dirInfo.ioDrDirID = dirid;
- cipbr.hFileInfo.ioNamePtr = pname;
- cipbr.hFileInfo.ioVRefNum = 0;
- cipbr.hFileInfo.ioFDirIndex = 0;
- cipbr.hFileInfo.ioFVersNum = 0;
- err = PBGetCatInfo (&cipbr, 0);
- if (err != noErr)
- {
- errno = ENOENT;
- return -1;
- }
- /* Mac files are readable if they can be accessed at all. */
- buf->st_mode = 0444;
- /* Mark unlocked files as writeable. */
- if (!(fpb->ioFlAttrib & LOCKBIT))
- buf->st_mode |= 0222;
- if (fpb->ioFlAttrib & DIRBIT)
- {
- /* Mark directories as "executable". */
- buf->st_mode |= 0111 | S_IFDIR;
- buf->st_size = dpb->ioDrNmFls;
- buf->st_rsize = 0;
- }
- else
- {
- buf->st_mode |= S_IFREG;
- /* Mark apps as "executable". */
- if (fpb->ioFlFndrInfo.fdType == 'APPL')
- buf->st_mode |= 0111;
- /* Fill in the sizes of data and resource forks. */
- buf->st_size = fpb->ioFlLgLen;
- buf->st_rsize = fpb->ioFlRLgLen;
- }
- /* Fill in various times. */
- buf->st_atime = fpb->ioFlCrDat;
- buf->st_mtime = fpb->ioFlMdDat;
- buf->st_ctime = fpb->ioFlCrDat;
- /* Set up an imitation inode number. */
- buf->st_ino = (unsigned short) fpb->ioDirID;
- /* Set up an imitation device. */
- GetVRefNum (buf->st_ino, &buf->st_dev);
- buf->st_uid = __uid;
- buf->st_gid = __gid;
-/* buf->st_FlFndrInfo = fpb->ioFlFndrInfo; */
- return 0;
-}
-
-/* stat() sets up an empty dirid. */
-
-int
-stat (char *path, struct stat *buf)
-{
- long rslt, errnum;
- char tmpname[256];
-
- mpwify_filename (path, tmpname);
- if (DebugPI)
- fprintf (stderr, "# stat (%s, %x)", tmpname, buf);
- PROGRESS (1);
- rslt = _stat (tmpname, 0L, buf);
- errnum = errno;
- if (DebugPI)
- {
- fprintf (stderr, " -> %d", rslt);
- if (rslt != 0)
- fprintf (stderr, " (errno is %d)", errnum);
- fprintf (stderr, "\n");
- fflush (stderr);
- }
- if (rslt != 0)
- errno = errnum;
- return rslt;
-}
-
-int
-fstat (int fd, struct stat *buf)
-{
- FCBPBRec fcb;
- FILE *fp;
- Str255 pathname;
- long dirid = 0L, temp;
- long rslt, errnum;
- short err;
-
- if (DebugPI < 0)
- DebugPI = (*(getenv ("DEBUG_PATHNAMES")) == '1' ? 1 : 0);
- if (DebugPI)
- fprintf (stderr, "# fstat (%d, %x)", fd, buf);
- PROGRESS (1);
- pathname[0] = 0;
-#ifdef FIOFNAME
- /* Use an MPW-specific ioctl to get the pathname associated with
- the file descriptor. */
- ioctl (fd, FIOFNAME, (long *) pathname);
-#else
- you lose
-#endif
- if (DebugPI)
- fprintf (stderr, " (name is %s)", pathname);
- dirid = 0L /* fcb.ioFCBParID */ ;
- rslt = _stat ((char *) pathname, dirid, buf);
- errnum = errno;
- if (DebugPI)
- {
- fprintf (stderr, " -> %d", rslt);
- if (rslt != 0)
- fprintf (stderr, " (errno is %d)", errnum);
- fprintf (stderr, "\n");
- fflush (stderr);
- }
- if (rslt != 0)
- errno = errnum;
- return rslt;
-}
-
-#endif /* n USE_MW_HEADERS */
-
-chdir ()
-{
- errno = ENOSYS;
- return (-1);
-}
-
-char *
-getcwd (char *buf, int size)
-{
- if (buf == NULL)
- buf = (char *) malloc (size);
- strcpy(buf, ":");
- return buf;
-}
-
-/* This should probably be more elaborate for MPW. */
-
-char *
-getpwd ()
-{
- return ":";
-}
-
-int
-mpw_open (char *filename, int arg2, int arg3)
-{
-#undef open
- int fd, errnum = 0;
- char tmpname[256];
-
- mpwify_filename (filename, tmpname);
- fd = open (tmpname, arg2);
- errnum = errno;
-
- if (DebugPI)
- {
- fprintf (stderr, "# open (%s, %d, %d)", tmpname, arg2, arg3);
- fprintf (stderr, " -> %d", fd);
- if (fd == -1)
- fprintf (stderr, " (errno is %d)", errnum);
- fprintf (stderr, "\n");
- }
- if (fd == -1)
- errno = errnum;
- return fd;
-}
-
-int
-mpw_access (char *filename, unsigned int cmd)
-{
-#undef access
-
- int rslt, errnum = 0;
- struct stat st;
- char tmpname[256];
-
- mpwify_filename (filename, tmpname);
- if (cmd & R_OK || cmd & X_OK)
- {
- rslt = stat (tmpname, &st);
- errnum = errno;
- if (rslt >= 0)
- {
- if ((((st.st_mode & 004) == 0) && (cmd & R_OK))
- || (((st.st_mode & 002) == 0) && (cmd & W_OK))
- || (((st.st_mode & 001) == 0) && (cmd & X_OK)))
- {
- rslt = -1;
- errnum = EACCES;
- }
- }
- }
- if (DebugPI)
- {
- fprintf (stderr, "# mpw_access (%s, %d)", tmpname, cmd);
- fprintf (stderr, " -> %d", rslt);
- if (rslt != 0)
- fprintf (stderr, " (errno is %d)", errnum);
- fprintf (stderr, "\n");
- }
- if (rslt != 0)
- errno = errnum;
- return rslt;
-}
-
-/* The MPW library creat() has no mode argument. */
-
-int
-mpw_creat (char *path, /* mode_t */ int mode)
-{
-#undef creat
-
-#ifdef USE_MW_HEADERS
- return creat (path, mode);
-#else
- return creat (path);
-#endif
-}
-
-/* This is a hack to get control in an MPW tool before it crashes the
- machine. */
-
-mpw_special_init (name)
- char *name;
-{
- if (strstr (name, "DEBUG"))
- DebugStr("\pat beginning of program");
-}
-
-static int current_umask;
-
-int
-umask(int mask)
-{
- int oldmask = current_umask;
-
- current_umask = mask;
- return oldmask;
-}
-
-/* Cursor-spinning stuff that includes metering of spin rate and delays. */
-
-/* Nonzero when cursor spinning has been set up properly. */
-
-int cursor_inited;
-
-/* Nonzero if spin should be measured and excessive delays reported. */
-
-int measure_spin;
-
-/* Nonzero if spin histogram and rate data should be written out. */
-
-int dump_spin_data;
-
-long warning_threshold = 400000;
-
-long bucket_size = 1024;
-
-long bucket_power = 10;
-
-long numbuckets = 300;
-
-int *delay_counts;
-
-int overflow_count;
-
-char *current_progress;
-
-static UnsignedWide last_microseconds;
-
-static char *last_spin_file = "";
-
-static int last_spin_line;
-
-void
-warn_if_spin_delay (char *file, int line)
-{
- long diff, ix;
- UnsignedWide now;
-
- Microseconds(&now);
-
- diff = now.lo - last_microseconds.lo;
-
- if (diff > warning_threshold)
- fprintf (stderr, "# %s: %ld.%06ld sec delay getting from %s:%d to %s:%d\n",
- (current_progress ? current_progress : ""),
- diff / 1000000, diff % 1000000,
- last_spin_file, last_spin_line, file, line);
- if (dump_spin_data)
- {
- if (diff >= 0)
- {
- ix = diff >> bucket_power;
- if (ix >= 0 && ix < numbuckets && delay_counts != NULL)
- ++delay_counts[ix];
- else
- ++overflow_count;
- }
- else
- fprintf (stderr, "raw diff is %ld (?)\n", diff);
- }
-}
-
-void
-record_for_spin_delay (char *file, int line)
-{
- Microseconds (&last_microseconds);
- last_spin_file = file;
- last_spin_line = line;
-}
-
-void
-mpw_start_progress (char *str, int n, char *file, int line)
-{
- int i;
- char *measure, *threshold;
-
- if (!cursor_inited)
- {
- InitCursorCtl (nil);
- cursor_inited = 1;
- record_for_spin_delay (file, line);
- measure = getenv ("MEASURE_SPIN");
- if (measure != NULL && measure[0] != '\0')
- {
- measure_spin = 1;
- if (strcmp (measure, "all") == 0)
- dump_spin_data = 1;
- }
- threshold = getenv ("SPIN_WARN_THRESHOLD");
- if (threshold != NULL && threshold[0] != '\0')
- warning_threshold = atol (threshold);
- if (dump_spin_data)
- {
- if (delay_counts == NULL)
- delay_counts = (int *) malloc (numbuckets * sizeof (int));
- for (i = 0; i < numbuckets; ++i)
- delay_counts[i] = 0;
- overflow_count = 0;
- }
- }
- current_progress = str;
-
- sys_nerr = errno_max ();
-
- mpw_special_init (str);
-}
-
-void
-mpw_progress (int n)
-{
- SpinCursor (32);
-}
-
-void
-mpw_progress_measured (int n, char *file, int line)
-{
- if (measure_spin)
- warn_if_spin_delay (file, line);
- SpinCursor (32);
- if (measure_spin)
- record_for_spin_delay (file, line);
-}
-
-void
-mpw_end_progress (char *str, char *file, int line)
-{
- long i, delay, count = 0, sum = 0, avgdelay, spinrate;
- long curpower = 0, curgroup = 0;
-
- /* Warn if it's been a while since the last spin. */
- if (measure_spin)
- warn_if_spin_delay (file, line);
-
- /* Dump all the nonzero delay counts and an approximation of the delay. */
- if (dump_spin_data && delay_counts != NULL)
- {
- for (i = 0; i < numbuckets; ++i)
- {
- delay = (i + 1) * bucket_size;
- sum += delay_counts[i] * (i + 1);
- count += delay_counts[i];
- if (delay <= (1 << curpower))
- {
- curgroup += delay_counts[i];
- }
- else
- {
- if (curgroup > 0)
- fprintf (stderr,
- "# %s: %d delays between %ld.%06ld and %ld.%06ld sec\n",
- (str ? str : ""),
- curgroup,
- (1 << curpower) / 1000000,
- (1 << curpower) % 1000000,
- (1 << (curpower + 1)) / 1000000,
- (1 << (curpower + 1)) % 1000000);
- ++curpower;
- curgroup = 0;
- }
- }
- if (count > 0)
- {
- avgdelay = (sum * bucket_size) / count;
- spinrate = 1000000 / avgdelay;
- fprintf (stderr, "# %s: Average spin rate is %d times/sec\n",
- (str ? str : ""), spinrate);
- }
- }
-}
-
-#ifdef PROGRESS_TEST
-
-/* Test program. */
-
-main ()
-{
- int i, j;
- double x = 1.0, y = 2.4;
- long start = Microseconds (), tm; FIXME
-
- START_PROGRESS ("hi", 0);
-
- for (i = 0; i < 1000; ++i)
- {
- PROGRESS (1);
-
- for (j = 0; j < (i * 100); ++j)
- {
- x += (x * y) / j;
- }
- }
-
- END_PROGRESS ("hi");
-
- tm = Microseconds () - start;
-
- printf ("Total time is %d.%d secs\n", tm / 1000000, tm % 1000000);
-}
-
-#endif
-
-#ifdef USE_MW_HEADERS
-/* Empty definitions for Metrowerks' SIOUX console library. */
-
-#ifndef __CONSOLE__
-#include <console.h>
-#endif
-
-short
-InstallConsole(short fd)
-{
-#pragma unused (fd)
- return 0;
-}
-
-void
-RemoveConsole(void)
-{
-}
-
-long
-WriteCharsToConsole(char *buf, long n)
-{
-#pragma unused (buf, n)
- return 0;
-}
-
-long ReadCharsFromConsole(char *buf, long n)
-{
-#pragma unused (buf, n)
- return 0;
-}
-
-extern char *
-__ttyname(long fd)
-{
- static char *__devicename = "null device";
-
- if (fd >= 0 && fd <= 2)
- return (__devicename);
- return NULL;
-}
-
-#endif
diff --git a/libiberty/msdos.c b/libiberty/msdos.c
deleted file mode 100644
index 923e64d..0000000
--- a/libiberty/msdos.c
+++ /dev/null
@@ -1,15 +0,0 @@
-char msg[] = "No vfork available - aborting\n";
-vfork()
-{
- write(1, msg, sizeof(msg));
-}
-
-sigsetmask()
-{
- /* no signals support in go32 (yet) */
-}
-
-waitpid()
-{
- return -1;
-}
diff --git a/libiberty/objalloc.c b/libiberty/objalloc.c
deleted file mode 100644
index 5099569..0000000
--- a/libiberty/objalloc.c
+++ /dev/null
@@ -1,298 +0,0 @@
-/* objalloc.c -- routines to allocate memory for objects
- Copyright 1997 Free Software Foundation, Inc.
- Written by Ian Lance Taylor, Cygnus Solutions.
-
-This program is free software; you can redistribute 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, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-#include "ansidecl.h"
-#include "config.h"
-
-#include "objalloc.h"
-
-/* Get a definition for NULL. */
-#include <stdio.h>
-
-#if VMS
-#include <stdlib.h>
-#include <unixlib.h>
-#else
-
-#ifdef ANSI_PROTOTYPES
-/* Get a definition for size_t. */
-#include <stddef.h>
-#endif
-
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#else
-/* For systems with larger pointers than ints, this must be declared. */
-extern PTR malloc PARAMS ((size_t));
-extern void free PARAMS ((PTR));
-#endif
-
-#endif
-
-/* These routines allocate space for an object. Freeing allocated
- space may or may not free all more recently allocated space.
-
- We handle large and small allocation requests differently. If we
- don't have enough space in the current block, and the allocation
- request is for more than 512 bytes, we simply pass it through to
- malloc. */
-
-/* The objalloc structure is defined in objalloc.h. */
-
-/* This structure appears at the start of each chunk. */
-
-struct objalloc_chunk
-{
- /* Next chunk. */
- struct objalloc_chunk *next;
- /* If this chunk contains large objects, this is the value of
- current_ptr when this chunk was allocated. If this chunk
- contains small objects, this is NULL. */
- char *current_ptr;
-};
-
-/* The aligned size of objalloc_chunk. */
-
-#define CHUNK_HEADER_SIZE \
- ((sizeof (struct objalloc_chunk) + OBJALLOC_ALIGN - 1) \
- &~ (OBJALLOC_ALIGN - 1))
-
-/* We ask for this much memory each time we create a chunk which is to
- hold small objects. */
-
-#define CHUNK_SIZE (4096 - 32)
-
-/* A request for this amount or more is just passed through to malloc. */
-
-#define BIG_REQUEST (512)
-
-/* Create an objalloc structure. */
-
-struct objalloc *
-objalloc_create ()
-{
- struct objalloc *ret;
- struct objalloc_chunk *chunk;
-
- ret = (struct objalloc *) malloc (sizeof *ret);
- if (ret == NULL)
- return NULL;
-
- ret->chunks = (PTR) malloc (CHUNK_SIZE);
- if (ret->chunks == NULL)
- {
- free (ret);
- return NULL;
- }
-
- chunk = (struct objalloc_chunk *) ret->chunks;
- chunk->next = NULL;
- chunk->current_ptr = NULL;
-
- ret->current_ptr = (char *) chunk + CHUNK_HEADER_SIZE;
- ret->current_space = CHUNK_SIZE - CHUNK_HEADER_SIZE;
-
- return ret;
-}
-
-/* Allocate space from an objalloc structure. */
-
-PTR
-_objalloc_alloc (o, len)
- struct objalloc *o;
- unsigned long len;
-{
- /* We avoid confusion from zero sized objects by always allocating
- at least 1 byte. */
- if (len == 0)
- len = 1;
-
- len = (len + OBJALLOC_ALIGN - 1) &~ (OBJALLOC_ALIGN - 1);
-
- if (len <= o->current_space)
- {
- o->current_ptr += len;
- o->current_space -= len;
- return (PTR) (o->current_ptr - len);
- }
-
- if (len >= BIG_REQUEST)
- {
- char *ret;
- struct objalloc_chunk *chunk;
-
- ret = (char *) malloc (CHUNK_HEADER_SIZE + len);
- if (ret == NULL)
- return NULL;
-
- chunk = (struct objalloc_chunk *) ret;
- chunk->next = (struct objalloc_chunk *) o->chunks;
- chunk->current_ptr = o->current_ptr;
-
- o->chunks = (PTR) chunk;
-
- return (PTR) (ret + CHUNK_HEADER_SIZE);
- }
- else
- {
- struct objalloc_chunk *chunk;
-
- chunk = (struct objalloc_chunk *) malloc (CHUNK_SIZE);
- if (chunk == NULL)
- return NULL;
- chunk->next = (struct objalloc_chunk *) o->chunks;
- chunk->current_ptr = NULL;
-
- o->current_ptr = (char *) chunk + CHUNK_HEADER_SIZE;
- o->current_space = CHUNK_SIZE - CHUNK_HEADER_SIZE;
-
- o->chunks = (PTR) chunk;
-
- return objalloc_alloc (o, len);
- }
-}
-
-/* Free an entire objalloc structure. */
-
-void
-objalloc_free (o)
- struct objalloc *o;
-{
- struct objalloc_chunk *l;
-
- l = (struct objalloc_chunk *) o->chunks;
- while (l != NULL)
- {
- struct objalloc_chunk *next;
-
- next = l->next;
- free (l);
- l = next;
- }
-
- free (o);
-}
-
-/* Free a block from an objalloc structure. This also frees all more
- recently allocated blocks. */
-
-void
-objalloc_free_block (o, block)
- struct objalloc *o;
- PTR block;
-{
- struct objalloc_chunk *p, *small;
- char *b = (char *) block;
-
- /* First set P to the chunk which contains the block we are freeing,
- and set Q to the last small object chunk we see before P. */
- small = NULL;
- for (p = (struct objalloc_chunk *) o->chunks; p != NULL; p = p->next)
- {
- if (p->current_ptr == NULL)
- {
- if (b > (char *) p && b < (char *) p + CHUNK_SIZE)
- break;
- small = p;
- }
- else
- {
- if (b == (char *) p + CHUNK_HEADER_SIZE)
- break;
- }
- }
-
- /* If we can't find the chunk, the caller has made a mistake. */
- if (p == NULL)
- abort ();
-
- if (p->current_ptr == NULL)
- {
- struct objalloc_chunk *q;
- struct objalloc_chunk *first;
-
- /* The block is in a chunk containing small objects. We can
- free every chunk through SMALL, because they have certainly
- been allocated more recently. After SMALL, we will not see
- any chunks containing small objects; we can free any big
- chunk if the current_ptr is greater than or equal to B. We
- can then reset the new current_ptr to B. */
-
- first = NULL;
- q = (struct objalloc_chunk *) o->chunks;
- while (q != p)
- {
- struct objalloc_chunk *next;
-
- next = q->next;
- if (small != NULL)
- {
- if (small == q)
- small = NULL;
- free (q);
- }
- else if (q->current_ptr > b)
- free (q);
- else if (first == NULL)
- first = q;
-
- q = next;
- }
-
- if (first == NULL)
- first = p;
- o->chunks = (PTR) first;
-
- /* Now start allocating from this small block again. */
- o->current_ptr = b;
- o->current_space = ((char *) p + CHUNK_SIZE) - b;
- }
- else
- {
- struct objalloc_chunk *q;
- char *current_ptr;
-
- /* This block is in a large chunk by itself. We can free
- everything on the list up to and including this block. We
- then start allocating from the next chunk containing small
- objects, setting current_ptr from the value stored with the
- large chunk we are freeing. */
-
- current_ptr = p->current_ptr;
- p = p->next;
-
- q = (struct objalloc_chunk *) o->chunks;
- while (q != p)
- {
- struct objalloc_chunk *next;
-
- next = q->next;
- free (q);
- q = next;
- }
-
- o->chunks = (PTR) p;
-
- while (p->current_ptr != NULL)
- p = p->next;
-
- o->current_ptr = current_ptr;
- o->current_space = ((char *) p + CHUNK_SIZE) - current_ptr;
- }
-}
diff --git a/libiberty/obstack.c b/libiberty/obstack.c
deleted file mode 100644
index 02560c9..0000000
--- a/libiberty/obstack.c
+++ /dev/null
@@ -1,593 +0,0 @@
-/* obstack.c - subroutines used implicitly by object stack macros
- Copyright (C) 1988,89,90,91,92,93,94,96,97 Free Software Foundation, Inc.
-
-
- NOTE: This source is derived from an old version taken from the GNU C
- Library (glibc).
-
- This program is free software; you can redistribute 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. */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "obstack.h"
-
-/* NOTE BEFORE MODIFYING THIS FILE: This version number must be
- incremented whenever callers compiled using an old obstack.h can no
- longer properly call the functions in this obstack.c. */
-#define OBSTACK_INTERFACE_VERSION 1
-
-/* Comment out all this code if we are using the GNU C Library, and are not
- actually compiling the library itself, and the installed library
- supports the same library interface we do. This code is part of the GNU
- C Library, but also included in many other GNU distributions. Compiling
- and linking in this code is a waste when using the GNU C library
- (especially if it is a shared library). Rather than having every GNU
- program understand `configure --with-gnu-libc' and omit the object
- files, it is simpler to just do this in the source for each such file. */
-
-#include <stdio.h> /* Random thing to get __GNU_LIBRARY__. */
-#if !defined (_LIBC) && defined (__GNU_LIBRARY__) && __GNU_LIBRARY__ > 1
-#include <gnu-versions.h>
-#if _GNU_OBSTACK_INTERFACE_VERSION == OBSTACK_INTERFACE_VERSION
-#define ELIDE_CODE
-#endif
-#endif
-
-
-#ifndef ELIDE_CODE
-
-
-#if defined (__STDC__) && __STDC__
-#define POINTER void *
-#else
-#define POINTER char *
-#endif
-
-/* Determine default alignment. */
-struct fooalign {char x; double d;};
-#define DEFAULT_ALIGNMENT \
- ((PTR_INT_TYPE) ((char *) &((struct fooalign *) 0)->d - (char *) 0))
-/* If malloc were really smart, it would round addresses to DEFAULT_ALIGNMENT.
- But in fact it might be less smart and round addresses to as much as
- DEFAULT_ROUNDING. So we prepare for it to do that. */
-union fooround {long x; double d;};
-#define DEFAULT_ROUNDING (sizeof (union fooround))
-
-/* When we copy a long block of data, this is the unit to do it with.
- On some machines, copying successive ints does not work;
- in such a case, redefine COPYING_UNIT to `long' (if that works)
- or `char' as a last resort. */
-#ifndef COPYING_UNIT
-#define COPYING_UNIT int
-#endif
-
-
-/* The functions allocating more room by calling `obstack_chunk_alloc'
- jump to the handler pointed to by `obstack_alloc_failed_handler'.
- This variable by default points to the internal function
- `print_and_abort'. */
-#if defined (__STDC__) && __STDC__
-static void print_and_abort (void);
-void (*obstack_alloc_failed_handler) (void) = print_and_abort;
-#else
-static void print_and_abort ();
-void (*obstack_alloc_failed_handler) () = print_and_abort;
-#endif
-
-/* Exit value used when `print_and_abort' is used. */
-#if defined __GNU_LIBRARY__ || defined HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#ifndef EXIT_FAILURE
-#define EXIT_FAILURE 1
-#endif
-int obstack_exit_failure = EXIT_FAILURE;
-
-/* The non-GNU-C macros copy the obstack into this global variable
- to avoid multiple evaluation. */
-
-struct obstack *_obstack;
-
-/* Define a macro that either calls functions with the traditional malloc/free
- calling interface, or calls functions with the mmalloc/mfree interface
- (that adds an extra first argument), based on the state of use_extra_arg.
- For free, do not use ?:, since some compilers, like the MIPS compilers,
- do not allow (expr) ? void : void. */
-
-#if defined (__STDC__) && __STDC__
-#define CALL_CHUNKFUN(h, size) \
- (((h) -> use_extra_arg) \
- ? (*(h)->chunkfun) ((h)->extra_arg, (size)) \
- : (*(struct _obstack_chunk *(*) (long)) (h)->chunkfun) ((size)))
-
-#define CALL_FREEFUN(h, old_chunk) \
- do { \
- if ((h) -> use_extra_arg) \
- (*(h)->freefun) ((h)->extra_arg, (old_chunk)); \
- else \
- (*(void (*) (void *)) (h)->freefun) ((old_chunk)); \
- } while (0)
-#else
-#define CALL_CHUNKFUN(h, size) \
- (((h) -> use_extra_arg) \
- ? (*(h)->chunkfun) ((h)->extra_arg, (size)) \
- : (*(struct _obstack_chunk *(*) ()) (h)->chunkfun) ((size)))
-
-#define CALL_FREEFUN(h, old_chunk) \
- do { \
- if ((h) -> use_extra_arg) \
- (*(h)->freefun) ((h)->extra_arg, (old_chunk)); \
- else \
- (*(void (*) ()) (h)->freefun) ((old_chunk)); \
- } while (0)
-#endif
-
-
-/* Initialize an obstack H for use. Specify chunk size SIZE (0 means default).
- Objects start on multiples of ALIGNMENT (0 means use default).
- CHUNKFUN is the function to use to allocate chunks,
- and FREEFUN the function to free them.
-
- Return nonzero if successful, zero if out of memory.
- To recover from an out of memory error,
- free up some memory, then call this again. */
-
-int
-_obstack_begin (h, size, alignment, chunkfun, freefun)
- struct obstack *h;
- int size;
- int alignment;
-#if defined (__STDC__) && __STDC__
- POINTER (*chunkfun) (long);
- void (*freefun) (void *);
-#else
- POINTER (*chunkfun) ();
- void (*freefun) ();
-#endif
-{
- register struct _obstack_chunk *chunk; /* points to new chunk */
-
- if (alignment == 0)
- alignment = (int) DEFAULT_ALIGNMENT;
- if (size == 0)
- /* Default size is what GNU malloc can fit in a 4096-byte block. */
- {
- /* 12 is sizeof (mhead) and 4 is EXTRA from GNU malloc.
- Use the values for range checking, because if range checking is off,
- the extra bytes won't be missed terribly, but if range checking is on
- and we used a larger request, a whole extra 4096 bytes would be
- allocated.
-
- These number are irrelevant to the new GNU malloc. I suspect it is
- less sensitive to the size of the request. */
- int extra = ((((12 + DEFAULT_ROUNDING - 1) & ~(DEFAULT_ROUNDING - 1))
- + 4 + DEFAULT_ROUNDING - 1)
- & ~(DEFAULT_ROUNDING - 1));
- size = 4096 - extra;
- }
-
-#if defined (__STDC__) && __STDC__
- h->chunkfun = (struct _obstack_chunk * (*)(void *, long)) chunkfun;
- h->freefun = (void (*) (void *, struct _obstack_chunk *)) freefun;
-#else
- h->chunkfun = (struct _obstack_chunk * (*)()) chunkfun;
- h->freefun = freefun;
-#endif
- h->chunk_size = size;
- h->alignment_mask = alignment - 1;
- h->use_extra_arg = 0;
-
- chunk = h->chunk = CALL_CHUNKFUN (h, h -> chunk_size);
- if (!chunk)
- (*obstack_alloc_failed_handler) ();
- h->next_free = h->object_base = chunk->contents;
- h->chunk_limit = chunk->limit
- = (char *) chunk + h->chunk_size;
- chunk->prev = 0;
- /* The initial chunk now contains no empty object. */
- h->maybe_empty_object = 0;
- h->alloc_failed = 0;
- return 1;
-}
-
-int
-_obstack_begin_1 (h, size, alignment, chunkfun, freefun, arg)
- struct obstack *h;
- int size;
- int alignment;
-#if defined (__STDC__) && __STDC__
- POINTER (*chunkfun) (POINTER, long);
- void (*freefun) (POINTER, POINTER);
-#else
- POINTER (*chunkfun) ();
- void (*freefun) ();
-#endif
- POINTER arg;
-{
- register struct _obstack_chunk *chunk; /* points to new chunk */
-
- if (alignment == 0)
- alignment = (int) DEFAULT_ALIGNMENT;
- if (size == 0)
- /* Default size is what GNU malloc can fit in a 4096-byte block. */
- {
- /* 12 is sizeof (mhead) and 4 is EXTRA from GNU malloc.
- Use the values for range checking, because if range checking is off,
- the extra bytes won't be missed terribly, but if range checking is on
- and we used a larger request, a whole extra 4096 bytes would be
- allocated.
-
- These number are irrelevant to the new GNU malloc. I suspect it is
- less sensitive to the size of the request. */
- int extra = ((((12 + DEFAULT_ROUNDING - 1) & ~(DEFAULT_ROUNDING - 1))
- + 4 + DEFAULT_ROUNDING - 1)
- & ~(DEFAULT_ROUNDING - 1));
- size = 4096 - extra;
- }
-
-#if defined(__STDC__) && __STDC__
- h->chunkfun = (struct _obstack_chunk * (*)(void *,long)) chunkfun;
- h->freefun = (void (*) (void *, struct _obstack_chunk *)) freefun;
-#else
- h->chunkfun = (struct _obstack_chunk * (*)()) chunkfun;
- h->freefun = freefun;
-#endif
- h->chunk_size = size;
- h->alignment_mask = alignment - 1;
- h->extra_arg = arg;
- h->use_extra_arg = 1;
-
- chunk = h->chunk = CALL_CHUNKFUN (h, h -> chunk_size);
- if (!chunk)
- (*obstack_alloc_failed_handler) ();
- h->next_free = h->object_base = chunk->contents;
- h->chunk_limit = chunk->limit
- = (char *) chunk + h->chunk_size;
- chunk->prev = 0;
- /* The initial chunk now contains no empty object. */
- h->maybe_empty_object = 0;
- h->alloc_failed = 0;
- return 1;
-}
-
-/* Allocate a new current chunk for the obstack *H
- on the assumption that LENGTH bytes need to be added
- to the current object, or a new object of length LENGTH allocated.
- Copies any partial object from the end of the old chunk
- to the beginning of the new one. */
-
-void
-_obstack_newchunk (h, length)
- struct obstack *h;
- int length;
-{
- register struct _obstack_chunk *old_chunk = h->chunk;
- register struct _obstack_chunk *new_chunk;
- register long new_size;
- register long obj_size = h->next_free - h->object_base;
- register long i;
- long already;
-
- /* Compute size for new chunk. */
- new_size = (obj_size + length) + (obj_size >> 3) + 100;
- if (new_size < h->chunk_size)
- new_size = h->chunk_size;
-
- /* Allocate and initialize the new chunk. */
- new_chunk = CALL_CHUNKFUN (h, new_size);
- if (!new_chunk)
- (*obstack_alloc_failed_handler) ();
- h->chunk = new_chunk;
- new_chunk->prev = old_chunk;
- new_chunk->limit = h->chunk_limit = (char *) new_chunk + new_size;
-
- /* Move the existing object to the new chunk.
- Word at a time is fast and is safe if the object
- is sufficiently aligned. */
- if (h->alignment_mask + 1 >= DEFAULT_ALIGNMENT)
- {
- for (i = obj_size / sizeof (COPYING_UNIT) - 1;
- i >= 0; i--)
- ((COPYING_UNIT *)new_chunk->contents)[i]
- = ((COPYING_UNIT *)h->object_base)[i];
- /* We used to copy the odd few remaining bytes as one extra COPYING_UNIT,
- but that can cross a page boundary on a machine
- which does not do strict alignment for COPYING_UNITS. */
- already = obj_size / sizeof (COPYING_UNIT) * sizeof (COPYING_UNIT);
- }
- else
- already = 0;
- /* Copy remaining bytes one by one. */
- for (i = already; i < obj_size; i++)
- new_chunk->contents[i] = h->object_base[i];
-
- /* If the object just copied was the only data in OLD_CHUNK,
- free that chunk and remove it from the chain.
- But not if that chunk might contain an empty object. */
- if (h->object_base == old_chunk->contents && ! h->maybe_empty_object)
- {
- new_chunk->prev = old_chunk->prev;
- CALL_FREEFUN (h, old_chunk);
- }
-
- h->object_base = new_chunk->contents;
- h->next_free = h->object_base + obj_size;
- /* The new chunk certainly contains no empty object yet. */
- h->maybe_empty_object = 0;
-}
-
-/* Return nonzero if object OBJ has been allocated from obstack H.
- This is here for debugging.
- If you use it in a program, you are probably losing. */
-
-#if defined (__STDC__) && __STDC__
-/* Suppress -Wmissing-prototypes warning. We don't want to declare this in
- obstack.h because it is just for debugging. */
-int _obstack_allocated_p (struct obstack *h, POINTER obj);
-#endif
-
-int
-_obstack_allocated_p (h, obj)
- struct obstack *h;
- POINTER obj;
-{
- register struct _obstack_chunk *lp; /* below addr of any objects in this chunk */
- register struct _obstack_chunk *plp; /* point to previous chunk if any */
-
- lp = (h)->chunk;
- /* We use >= rather than > since the object cannot be exactly at
- the beginning of the chunk but might be an empty object exactly
- at the end of an adjacent chunk. */
- while (lp != 0 && ((POINTER) lp >= obj || (POINTER) (lp)->limit < obj))
- {
- plp = lp->prev;
- lp = plp;
- }
- return lp != 0;
-}
-
-/* Free objects in obstack H, including OBJ and everything allocate
- more recently than OBJ. If OBJ is zero, free everything in H. */
-
-#undef obstack_free
-
-/* This function has two names with identical definitions.
- This is the first one, called from non-ANSI code. */
-
-void
-_obstack_free (h, obj)
- struct obstack *h;
- POINTER obj;
-{
- register struct _obstack_chunk *lp; /* below addr of any objects in this chunk */
- register struct _obstack_chunk *plp; /* point to previous chunk if any */
-
- lp = h->chunk;
- /* We use >= because there cannot be an object at the beginning of a chunk.
- But there can be an empty object at that address
- at the end of another chunk. */
- while (lp != 0 && ((POINTER) lp >= obj || (POINTER) (lp)->limit < obj))
- {
- plp = lp->prev;
- CALL_FREEFUN (h, lp);
- lp = plp;
- /* If we switch chunks, we can't tell whether the new current
- chunk contains an empty object, so assume that it may. */
- h->maybe_empty_object = 1;
- }
- if (lp)
- {
- h->object_base = h->next_free = (char *) (obj);
- h->chunk_limit = lp->limit;
- h->chunk = lp;
- }
- else if (obj != 0)
- /* obj is not in any of the chunks! */
- abort ();
-}
-
-/* This function is used from ANSI code. */
-
-void
-obstack_free (h, obj)
- struct obstack *h;
- POINTER obj;
-{
- register struct _obstack_chunk *lp; /* below addr of any objects in this chunk */
- register struct _obstack_chunk *plp; /* point to previous chunk if any */
-
- lp = h->chunk;
- /* We use >= because there cannot be an object at the beginning of a chunk.
- But there can be an empty object at that address
- at the end of another chunk. */
- while (lp != 0 && ((POINTER) lp >= obj || (POINTER) (lp)->limit < obj))
- {
- plp = lp->prev;
- CALL_FREEFUN (h, lp);
- lp = plp;
- /* If we switch chunks, we can't tell whether the new current
- chunk contains an empty object, so assume that it may. */
- h->maybe_empty_object = 1;
- }
- if (lp)
- {
- h->object_base = h->next_free = (char *) (obj);
- h->chunk_limit = lp->limit;
- h->chunk = lp;
- }
- else if (obj != 0)
- /* obj is not in any of the chunks! */
- abort ();
-}
-
-int
-_obstack_memory_used (h)
- struct obstack *h;
-{
- register struct _obstack_chunk* lp;
- register int nbytes = 0;
-
- for (lp = h->chunk; lp != 0; lp = lp->prev)
- {
- nbytes += lp->limit - (char *) lp;
- }
- return nbytes;
-}
-
-/* Define the error handler. */
-#ifndef _
-# if (HAVE_LIBINTL_H && ENABLE_NLS) || defined _LIBC
-# include <libintl.h>
-# ifndef _
-# define _(Str) gettext (Str)
-# endif
-# else
-# define _(Str) (Str)
-# endif
-#endif
-
-static void
-print_and_abort ()
-{
- fputs (_("memory exhausted\n"), stderr);
- exit (obstack_exit_failure);
-}
-
-#if 0
-/* These are now turned off because the applications do not use it
- and it uses bcopy via obstack_grow, which causes trouble on sysV. */
-
-/* Now define the functional versions of the obstack macros.
- Define them to simply use the corresponding macros to do the job. */
-
-#if defined (__STDC__) && __STDC__
-/* These function definitions do not work with non-ANSI preprocessors;
- they won't pass through the macro names in parentheses. */
-
-/* The function names appear in parentheses in order to prevent
- the macro-definitions of the names from being expanded there. */
-
-POINTER (obstack_base) (obstack)
- struct obstack *obstack;
-{
- return obstack_base (obstack);
-}
-
-POINTER (obstack_next_free) (obstack)
- struct obstack *obstack;
-{
- return obstack_next_free (obstack);
-}
-
-int (obstack_object_size) (obstack)
- struct obstack *obstack;
-{
- return obstack_object_size (obstack);
-}
-
-int (obstack_room) (obstack)
- struct obstack *obstack;
-{
- return obstack_room (obstack);
-}
-
-int (obstack_make_room) (obstack, length)
- struct obstack *obstack;
- int length;
-{
- return obstack_make_room (obstack, length);
-}
-
-void (obstack_grow) (obstack, pointer, length)
- struct obstack *obstack;
- POINTER pointer;
- int length;
-{
- obstack_grow (obstack, pointer, length);
-}
-
-void (obstack_grow0) (obstack, pointer, length)
- struct obstack *obstack;
- POINTER pointer;
- int length;
-{
- obstack_grow0 (obstack, pointer, length);
-}
-
-void (obstack_1grow) (obstack, character)
- struct obstack *obstack;
- int character;
-{
- obstack_1grow (obstack, character);
-}
-
-void (obstack_blank) (obstack, length)
- struct obstack *obstack;
- int length;
-{
- obstack_blank (obstack, length);
-}
-
-void (obstack_1grow_fast) (obstack, character)
- struct obstack *obstack;
- int character;
-{
- obstack_1grow_fast (obstack, character);
-}
-
-void (obstack_blank_fast) (obstack, length)
- struct obstack *obstack;
- int length;
-{
- obstack_blank_fast (obstack, length);
-}
-
-POINTER (obstack_finish) (obstack)
- struct obstack *obstack;
-{
- return obstack_finish (obstack);
-}
-
-POINTER (obstack_alloc) (obstack, length)
- struct obstack *obstack;
- int length;
-{
- return obstack_alloc (obstack, length);
-}
-
-POINTER (obstack_copy) (obstack, pointer, length)
- struct obstack *obstack;
- POINTER pointer;
- int length;
-{
- return obstack_copy (obstack, pointer, length);
-}
-
-POINTER (obstack_copy0) (obstack, pointer, length)
- struct obstack *obstack;
- POINTER pointer;
- int length;
-{
- return obstack_copy0 (obstack, pointer, length);
-}
-
-#endif /* __STDC__ */
-
-#endif /* 0 */
-
-#endif /* !ELIDE_CODE */
diff --git a/libiberty/obstacks.texi b/libiberty/obstacks.texi
deleted file mode 100644
index 9bddf7c..0000000
--- a/libiberty/obstacks.texi
+++ /dev/null
@@ -1,758 +0,0 @@
-@node Obstacks,Licenses,Functions,Top
-@chapter Obstacks
-@cindex obstacks
-
-An @dfn{obstack} is a pool of memory containing a stack of objects. You
-can create any number of separate obstacks, and then allocate objects in
-specified obstacks. Within each obstack, the last object allocated must
-always be the first one freed, but distinct obstacks are independent of
-each other.
-
-Aside from this one constraint of order of freeing, obstacks are totally
-general: an obstack can contain any number of objects of any size. They
-are implemented with macros, so allocation is usually very fast as long as
-the objects are usually small. And the only space overhead per object is
-the padding needed to start each object on a suitable boundary.
-
-@menu
-* Creating Obstacks:: How to declare an obstack in your program.
-* Preparing for Obstacks:: Preparations needed before you can
- use obstacks.
-* Allocation in an Obstack:: Allocating objects in an obstack.
-* Freeing Obstack Objects:: Freeing objects in an obstack.
-* Obstack Functions:: The obstack functions are both
- functions and macros.
-* Growing Objects:: Making an object bigger by stages.
-* Extra Fast Growing:: Extra-high-efficiency (though more
- complicated) growing objects.
-* Status of an Obstack:: Inquiries about the status of an obstack.
-* Obstacks Data Alignment:: Controlling alignment of objects in obstacks.
-* Obstack Chunks:: How obstacks obtain and release chunks;
- efficiency considerations.
-* Summary of Obstacks::
-@end menu
-
-@node Creating Obstacks
-@section Creating Obstacks
-
-The utilities for manipulating obstacks are declared in the header
-file @file{obstack.h}.
-@pindex obstack.h
-
-@comment obstack.h
-@comment GNU
-@deftp {Data Type} {struct obstack}
-An obstack is represented by a data structure of type @code{struct
-obstack}. This structure has a small fixed size; it records the status
-of the obstack and how to find the space in which objects are allocated.
-It does not contain any of the objects themselves. You should not try
-to access the contents of the structure directly; use only the functions
-described in this chapter.
-@end deftp
-
-You can declare variables of type @code{struct obstack} and use them as
-obstacks, or you can allocate obstacks dynamically like any other kind
-of object. Dynamic allocation of obstacks allows your program to have a
-variable number of different stacks. (You can even allocate an
-obstack structure in another obstack, but this is rarely useful.)
-
-All the functions that work with obstacks require you to specify which
-obstack to use. You do this with a pointer of type @code{struct obstack
-*}. In the following, we often say ``an obstack'' when strictly
-speaking the object at hand is such a pointer.
-
-The objects in the obstack are packed into large blocks called
-@dfn{chunks}. The @code{struct obstack} structure points to a chain of
-the chunks currently in use.
-
-The obstack library obtains a new chunk whenever you allocate an object
-that won't fit in the previous chunk. Since the obstack library manages
-chunks automatically, you don't need to pay much attention to them, but
-you do need to supply a function which the obstack library should use to
-get a chunk. Usually you supply a function which uses @code{malloc}
-directly or indirectly. You must also supply a function to free a chunk.
-These matters are described in the following section.
-
-@node Preparing for Obstacks
-@section Preparing for Using Obstacks
-
-Each source file in which you plan to use the obstack functions
-must include the header file @file{obstack.h}, like this:
-
-@smallexample
-#include <obstack.h>
-@end smallexample
-
-@findex obstack_chunk_alloc
-@findex obstack_chunk_free
-Also, if the source file uses the macro @code{obstack_init}, it must
-declare or define two functions or macros that will be called by the
-obstack library. One, @code{obstack_chunk_alloc}, is used to allocate
-the chunks of memory into which objects are packed. The other,
-@code{obstack_chunk_free}, is used to return chunks when the objects in
-them are freed. These macros should appear before any use of obstacks
-in the source file.
-
-Usually these are defined to use @code{malloc} via the intermediary
-@code{xmalloc} (@pxref{Unconstrained Allocation, , , libc, The GNU C Library Reference Manual}). This is done with
-the following pair of macro definitions:
-
-@smallexample
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
-@end smallexample
-
-@noindent
-Though the memory you get using obstacks really comes from @code{malloc},
-using obstacks is faster because @code{malloc} is called less often, for
-larger blocks of memory. @xref{Obstack Chunks}, for full details.
-
-At run time, before the program can use a @code{struct obstack} object
-as an obstack, it must initialize the obstack by calling
-@code{obstack_init}.
-
-@comment obstack.h
-@comment GNU
-@deftypefun int obstack_init (struct obstack *@var{obstack-ptr})
-Initialize obstack @var{obstack-ptr} for allocation of objects. This
-function calls the obstack's @code{obstack_chunk_alloc} function. If
-allocation of memory fails, the function pointed to by
-@code{obstack_alloc_failed_handler} is called. The @code{obstack_init}
-function always returns 1 (Compatibility notice: Former versions of
-obstack returned 0 if allocation failed).
-@end deftypefun
-
-Here are two examples of how to allocate the space for an obstack and
-initialize it. First, an obstack that is a static variable:
-
-@smallexample
-static struct obstack myobstack;
-@dots{}
-obstack_init (&myobstack);
-@end smallexample
-
-@noindent
-Second, an obstack that is itself dynamically allocated:
-
-@smallexample
-struct obstack *myobstack_ptr
- = (struct obstack *) xmalloc (sizeof (struct obstack));
-
-obstack_init (myobstack_ptr);
-@end smallexample
-
-@comment obstack.h
-@comment GNU
-@defvar obstack_alloc_failed_handler
-The value of this variable is a pointer to a function that
-@code{obstack} uses when @code{obstack_chunk_alloc} fails to allocate
-memory. The default action is to print a message and abort.
-You should supply a function that either calls @code{exit}
-(@pxref{Program Termination, , , libc, The GNU C Library Reference Manual}) or @code{longjmp} (@pxref{Non-Local
-Exits, , , libc, The GNU C Library Reference Manual}) and doesn't return.
-
-@smallexample
-void my_obstack_alloc_failed (void)
-@dots{}
-obstack_alloc_failed_handler = &my_obstack_alloc_failed;
-@end smallexample
-
-@end defvar
-
-@node Allocation in an Obstack
-@section Allocation in an Obstack
-@cindex allocation (obstacks)
-
-The most direct way to allocate an object in an obstack is with
-@code{obstack_alloc}, which is invoked almost like @code{malloc}.
-
-@comment obstack.h
-@comment GNU
-@deftypefun {void *} obstack_alloc (struct obstack *@var{obstack-ptr}, int @var{size})
-This allocates an uninitialized block of @var{size} bytes in an obstack
-and returns its address. Here @var{obstack-ptr} specifies which obstack
-to allocate the block in; it is the address of the @code{struct obstack}
-object which represents the obstack. Each obstack function or macro
-requires you to specify an @var{obstack-ptr} as the first argument.
-
-This function calls the obstack's @code{obstack_chunk_alloc} function if
-it needs to allocate a new chunk of memory; it calls
-@code{obstack_alloc_failed_handler} if allocation of memory by
-@code{obstack_chunk_alloc} failed.
-@end deftypefun
-
-For example, here is a function that allocates a copy of a string @var{str}
-in a specific obstack, which is in the variable @code{string_obstack}:
-
-@smallexample
-struct obstack string_obstack;
-
-char *
-copystring (char *string)
-@{
- size_t len = strlen (string) + 1;
- char *s = (char *) obstack_alloc (&string_obstack, len);
- memcpy (s, string, len);
- return s;
-@}
-@end smallexample
-
-To allocate a block with specified contents, use the function
-@code{obstack_copy}, declared like this:
-
-@comment obstack.h
-@comment GNU
-@deftypefun {void *} obstack_copy (struct obstack *@var{obstack-ptr}, void *@var{address}, int @var{size})
-This allocates a block and initializes it by copying @var{size}
-bytes of data starting at @var{address}. It calls
-@code{obstack_alloc_failed_handler} if allocation of memory by
-@code{obstack_chunk_alloc} failed.
-@end deftypefun
-
-@comment obstack.h
-@comment GNU
-@deftypefun {void *} obstack_copy0 (struct obstack *@var{obstack-ptr}, void *@var{address}, int @var{size})
-Like @code{obstack_copy}, but appends an extra byte containing a null
-character. This extra byte is not counted in the argument @var{size}.
-@end deftypefun
-
-The @code{obstack_copy0} function is convenient for copying a sequence
-of characters into an obstack as a null-terminated string. Here is an
-example of its use:
-
-@smallexample
-char *
-obstack_savestring (char *addr, int size)
-@{
- return obstack_copy0 (&myobstack, addr, size);
-@}
-@end smallexample
-
-@noindent
-Contrast this with the previous example of @code{savestring} using
-@code{malloc} (@pxref{Basic Allocation, , , libc, The GNU C Library Reference Manual}).
-
-@node Freeing Obstack Objects
-@section Freeing Objects in an Obstack
-@cindex freeing (obstacks)
-
-To free an object allocated in an obstack, use the function
-@code{obstack_free}. Since the obstack is a stack of objects, freeing
-one object automatically frees all other objects allocated more recently
-in the same obstack.
-
-@comment obstack.h
-@comment GNU
-@deftypefun void obstack_free (struct obstack *@var{obstack-ptr}, void *@var{object})
-If @var{object} is a null pointer, everything allocated in the obstack
-is freed. Otherwise, @var{object} must be the address of an object
-allocated in the obstack. Then @var{object} is freed, along with
-everything allocated in @var{obstack} since @var{object}.
-@end deftypefun
-
-Note that if @var{object} is a null pointer, the result is an
-uninitialized obstack. To free all memory in an obstack but leave it
-valid for further allocation, call @code{obstack_free} with the address
-of the first object allocated on the obstack:
-
-@smallexample
-obstack_free (obstack_ptr, first_object_allocated_ptr);
-@end smallexample
-
-Recall that the objects in an obstack are grouped into chunks. When all
-the objects in a chunk become free, the obstack library automatically
-frees the chunk (@pxref{Preparing for Obstacks}). Then other
-obstacks, or non-obstack allocation, can reuse the space of the chunk.
-
-@node Obstack Functions
-@section Obstack Functions and Macros
-@cindex macros
-
-The interfaces for using obstacks may be defined either as functions or
-as macros, depending on the compiler. The obstack facility works with
-all C compilers, including both @w{ISO C} and traditional C, but there are
-precautions you must take if you plan to use compilers other than GNU C.
-
-If you are using an old-fashioned @w{non-ISO C} compiler, all the obstack
-``functions'' are actually defined only as macros. You can call these
-macros like functions, but you cannot use them in any other way (for
-example, you cannot take their address).
-
-Calling the macros requires a special precaution: namely, the first
-operand (the obstack pointer) may not contain any side effects, because
-it may be computed more than once. For example, if you write this:
-
-@smallexample
-obstack_alloc (get_obstack (), 4);
-@end smallexample
-
-@noindent
-you will find that @code{get_obstack} may be called several times.
-If you use @code{*obstack_list_ptr++} as the obstack pointer argument,
-you will get very strange results since the incrementation may occur
-several times.
-
-In @w{ISO C}, each function has both a macro definition and a function
-definition. The function definition is used if you take the address of the
-function without calling it. An ordinary call uses the macro definition by
-default, but you can request the function definition instead by writing the
-function name in parentheses, as shown here:
-
-@smallexample
-char *x;
-void *(*funcp) ();
-/* @r{Use the macro}. */
-x = (char *) obstack_alloc (obptr, size);
-/* @r{Call the function}. */
-x = (char *) (obstack_alloc) (obptr, size);
-/* @r{Take the address of the function}. */
-funcp = obstack_alloc;
-@end smallexample
-
-@noindent
-This is the same situation that exists in @w{ISO C} for the standard library
-functions. @xref{Macro Definitions, , , libc, The GNU C Library Reference Manual}.
-
-@strong{Warning:} When you do use the macros, you must observe the
-precaution of avoiding side effects in the first operand, even in @w{ISO C}.
-
-If you use the GNU C compiler, this precaution is not necessary, because
-various language extensions in GNU C permit defining the macros so as to
-compute each argument only once.
-
-@node Growing Objects
-@section Growing Objects
-@cindex growing objects (in obstacks)
-@cindex changing the size of a block (obstacks)
-
-Because memory in obstack chunks is used sequentially, it is possible to
-build up an object step by step, adding one or more bytes at a time to the
-end of the object. With this technique, you do not need to know how much
-data you will put in the object until you come to the end of it. We call
-this the technique of @dfn{growing objects}. The special functions
-for adding data to the growing object are described in this section.
-
-You don't need to do anything special when you start to grow an object.
-Using one of the functions to add data to the object automatically
-starts it. However, it is necessary to say explicitly when the object is
-finished. This is done with the function @code{obstack_finish}.
-
-The actual address of the object thus built up is not known until the
-object is finished. Until then, it always remains possible that you will
-add so much data that the object must be copied into a new chunk.
-
-While the obstack is in use for a growing object, you cannot use it for
-ordinary allocation of another object. If you try to do so, the space
-already added to the growing object will become part of the other object.
-
-@comment obstack.h
-@comment GNU
-@deftypefun void obstack_blank (struct obstack *@var{obstack-ptr}, int @var{size})
-The most basic function for adding to a growing object is
-@code{obstack_blank}, which adds space without initializing it.
-@end deftypefun
-
-@comment obstack.h
-@comment GNU
-@deftypefun void obstack_grow (struct obstack *@var{obstack-ptr}, void *@var{data}, int @var{size})
-To add a block of initialized space, use @code{obstack_grow}, which is
-the growing-object analogue of @code{obstack_copy}. It adds @var{size}
-bytes of data to the growing object, copying the contents from
-@var{data}.
-@end deftypefun
-
-@comment obstack.h
-@comment GNU
-@deftypefun void obstack_grow0 (struct obstack *@var{obstack-ptr}, void *@var{data}, int @var{size})
-This is the growing-object analogue of @code{obstack_copy0}. It adds
-@var{size} bytes copied from @var{data}, followed by an additional null
-character.
-@end deftypefun
-
-@comment obstack.h
-@comment GNU
-@deftypefun void obstack_1grow (struct obstack *@var{obstack-ptr}, char @var{c})
-To add one character at a time, use the function @code{obstack_1grow}.
-It adds a single byte containing @var{c} to the growing object.
-@end deftypefun
-
-@comment obstack.h
-@comment GNU
-@deftypefun void obstack_ptr_grow (struct obstack *@var{obstack-ptr}, void *@var{data})
-Adding the value of a pointer one can use the function
-@code{obstack_ptr_grow}. It adds @code{sizeof (void *)} bytes
-containing the value of @var{data}.
-@end deftypefun
-
-@comment obstack.h
-@comment GNU
-@deftypefun void obstack_int_grow (struct obstack *@var{obstack-ptr}, int @var{data})
-A single value of type @code{int} can be added by using the
-@code{obstack_int_grow} function. It adds @code{sizeof (int)} bytes to
-the growing object and initializes them with the value of @var{data}.
-@end deftypefun
-
-@comment obstack.h
-@comment GNU
-@deftypefun {void *} obstack_finish (struct obstack *@var{obstack-ptr})
-When you are finished growing the object, use the function
-@code{obstack_finish} to close it off and return its final address.
-
-Once you have finished the object, the obstack is available for ordinary
-allocation or for growing another object.
-
-This function can return a null pointer under the same conditions as
-@code{obstack_alloc} (@pxref{Allocation in an Obstack}).
-@end deftypefun
-
-When you build an object by growing it, you will probably need to know
-afterward how long it became. You need not keep track of this as you grow
-the object, because you can find out the length from the obstack just
-before finishing the object with the function @code{obstack_object_size},
-declared as follows:
-
-@comment obstack.h
-@comment GNU
-@deftypefun int obstack_object_size (struct obstack *@var{obstack-ptr})
-This function returns the current size of the growing object, in bytes.
-Remember to call this function @emph{before} finishing the object.
-After it is finished, @code{obstack_object_size} will return zero.
-@end deftypefun
-
-If you have started growing an object and wish to cancel it, you should
-finish it and then free it, like this:
-
-@smallexample
-obstack_free (obstack_ptr, obstack_finish (obstack_ptr));
-@end smallexample
-
-@noindent
-This has no effect if no object was growing.
-
-@cindex shrinking objects
-You can use @code{obstack_blank} with a negative size argument to make
-the current object smaller. Just don't try to shrink it beyond zero
-length---there's no telling what will happen if you do that.
-
-@node Extra Fast Growing
-@section Extra Fast Growing Objects
-@cindex efficiency and obstacks
-
-The usual functions for growing objects incur overhead for checking
-whether there is room for the new growth in the current chunk. If you
-are frequently constructing objects in small steps of growth, this
-overhead can be significant.
-
-You can reduce the overhead by using special ``fast growth''
-functions that grow the object without checking. In order to have a
-robust program, you must do the checking yourself. If you do this checking
-in the simplest way each time you are about to add data to the object, you
-have not saved anything, because that is what the ordinary growth
-functions do. But if you can arrange to check less often, or check
-more efficiently, then you make the program faster.
-
-The function @code{obstack_room} returns the amount of room available
-in the current chunk. It is declared as follows:
-
-@comment obstack.h
-@comment GNU
-@deftypefun int obstack_room (struct obstack *@var{obstack-ptr})
-This returns the number of bytes that can be added safely to the current
-growing object (or to an object about to be started) in obstack
-@var{obstack} using the fast growth functions.
-@end deftypefun
-
-While you know there is room, you can use these fast growth functions
-for adding data to a growing object:
-
-@comment obstack.h
-@comment GNU
-@deftypefun void obstack_1grow_fast (struct obstack *@var{obstack-ptr}, char @var{c})
-The function @code{obstack_1grow_fast} adds one byte containing the
-character @var{c} to the growing object in obstack @var{obstack-ptr}.
-@end deftypefun
-
-@comment obstack.h
-@comment GNU
-@deftypefun void obstack_ptr_grow_fast (struct obstack *@var{obstack-ptr}, void *@var{data})
-The function @code{obstack_ptr_grow_fast} adds @code{sizeof (void *)}
-bytes containing the value of @var{data} to the growing object in
-obstack @var{obstack-ptr}.
-@end deftypefun
-
-@comment obstack.h
-@comment GNU
-@deftypefun void obstack_int_grow_fast (struct obstack *@var{obstack-ptr}, int @var{data})
-The function @code{obstack_int_grow_fast} adds @code{sizeof (int)} bytes
-containing the value of @var{data} to the growing object in obstack
-@var{obstack-ptr}.
-@end deftypefun
-
-@comment obstack.h
-@comment GNU
-@deftypefun void obstack_blank_fast (struct obstack *@var{obstack-ptr}, int @var{size})
-The function @code{obstack_blank_fast} adds @var{size} bytes to the
-growing object in obstack @var{obstack-ptr} without initializing them.
-@end deftypefun
-
-When you check for space using @code{obstack_room} and there is not
-enough room for what you want to add, the fast growth functions
-are not safe. In this case, simply use the corresponding ordinary
-growth function instead. Very soon this will copy the object to a
-new chunk; then there will be lots of room available again.
-
-So, each time you use an ordinary growth function, check afterward for
-sufficient space using @code{obstack_room}. Once the object is copied
-to a new chunk, there will be plenty of space again, so the program will
-start using the fast growth functions again.
-
-Here is an example:
-
-@smallexample
-@group
-void
-add_string (struct obstack *obstack, const char *ptr, int len)
-@{
- while (len > 0)
- @{
- int room = obstack_room (obstack);
- if (room == 0)
- @{
- /* @r{Not enough room. Add one character slowly,}
- @r{which may copy to a new chunk and make room.} */
- obstack_1grow (obstack, *ptr++);
- len--;
- @}
- else
- @{
- if (room > len)
- room = len;
- /* @r{Add fast as much as we have room for.} */
- len -= room;
- while (room-- > 0)
- obstack_1grow_fast (obstack, *ptr++);
- @}
- @}
-@}
-@end group
-@end smallexample
-
-@node Status of an Obstack
-@section Status of an Obstack
-@cindex obstack status
-@cindex status of obstack
-
-Here are functions that provide information on the current status of
-allocation in an obstack. You can use them to learn about an object while
-still growing it.
-
-@comment obstack.h
-@comment GNU
-@deftypefun {void *} obstack_base (struct obstack *@var{obstack-ptr})
-This function returns the tentative address of the beginning of the
-currently growing object in @var{obstack-ptr}. If you finish the object
-immediately, it will have that address. If you make it larger first, it
-may outgrow the current chunk---then its address will change!
-
-If no object is growing, this value says where the next object you
-allocate will start (once again assuming it fits in the current
-chunk).
-@end deftypefun
-
-@comment obstack.h
-@comment GNU
-@deftypefun {void *} obstack_next_free (struct obstack *@var{obstack-ptr})
-This function returns the address of the first free byte in the current
-chunk of obstack @var{obstack-ptr}. This is the end of the currently
-growing object. If no object is growing, @code{obstack_next_free}
-returns the same value as @code{obstack_base}.
-@end deftypefun
-
-@comment obstack.h
-@comment GNU
-@deftypefun int obstack_object_size (struct obstack *@var{obstack-ptr})
-This function returns the size in bytes of the currently growing object.
-This is equivalent to
-
-@smallexample
-obstack_next_free (@var{obstack-ptr}) - obstack_base (@var{obstack-ptr})
-@end smallexample
-@end deftypefun
-
-@node Obstacks Data Alignment
-@section Alignment of Data in Obstacks
-@cindex alignment (in obstacks)
-
-Each obstack has an @dfn{alignment boundary}; each object allocated in
-the obstack automatically starts on an address that is a multiple of the
-specified boundary. By default, this boundary is 4 bytes.
-
-To access an obstack's alignment boundary, use the macro
-@code{obstack_alignment_mask}, whose function prototype looks like
-this:
-
-@comment obstack.h
-@comment GNU
-@deftypefn Macro int obstack_alignment_mask (struct obstack *@var{obstack-ptr})
-The value is a bit mask; a bit that is 1 indicates that the corresponding
-bit in the address of an object should be 0. The mask value should be one
-less than a power of 2; the effect is that all object addresses are
-multiples of that power of 2. The default value of the mask is 3, so that
-addresses are multiples of 4. A mask value of 0 means an object can start
-on any multiple of 1 (that is, no alignment is required).
-
-The expansion of the macro @code{obstack_alignment_mask} is an lvalue,
-so you can alter the mask by assignment. For example, this statement:
-
-@smallexample
-obstack_alignment_mask (obstack_ptr) = 0;
-@end smallexample
-
-@noindent
-has the effect of turning off alignment processing in the specified obstack.
-@end deftypefn
-
-Note that a change in alignment mask does not take effect until
-@emph{after} the next time an object is allocated or finished in the
-obstack. If you are not growing an object, you can make the new
-alignment mask take effect immediately by calling @code{obstack_finish}.
-This will finish a zero-length object and then do proper alignment for
-the next object.
-
-@node Obstack Chunks
-@section Obstack Chunks
-@cindex efficiency of chunks
-@cindex chunks
-
-Obstacks work by allocating space for themselves in large chunks, and
-then parceling out space in the chunks to satisfy your requests. Chunks
-are normally 4096 bytes long unless you specify a different chunk size.
-The chunk size includes 8 bytes of overhead that are not actually used
-for storing objects. Regardless of the specified size, longer chunks
-will be allocated when necessary for long objects.
-
-The obstack library allocates chunks by calling the function
-@code{obstack_chunk_alloc}, which you must define. When a chunk is no
-longer needed because you have freed all the objects in it, the obstack
-library frees the chunk by calling @code{obstack_chunk_free}, which you
-must also define.
-
-These two must be defined (as macros) or declared (as functions) in each
-source file that uses @code{obstack_init} (@pxref{Creating Obstacks}).
-Most often they are defined as macros like this:
-
-@smallexample
-#define obstack_chunk_alloc malloc
-#define obstack_chunk_free free
-@end smallexample
-
-Note that these are simple macros (no arguments). Macro definitions with
-arguments will not work! It is necessary that @code{obstack_chunk_alloc}
-or @code{obstack_chunk_free}, alone, expand into a function name if it is
-not itself a function name.
-
-If you allocate chunks with @code{malloc}, the chunk size should be a
-power of 2. The default chunk size, 4096, was chosen because it is long
-enough to satisfy many typical requests on the obstack yet short enough
-not to waste too much memory in the portion of the last chunk not yet used.
-
-@comment obstack.h
-@comment GNU
-@deftypefn Macro int obstack_chunk_size (struct obstack *@var{obstack-ptr})
-This returns the chunk size of the given obstack.
-@end deftypefn
-
-Since this macro expands to an lvalue, you can specify a new chunk size by
-assigning it a new value. Doing so does not affect the chunks already
-allocated, but will change the size of chunks allocated for that particular
-obstack in the future. It is unlikely to be useful to make the chunk size
-smaller, but making it larger might improve efficiency if you are
-allocating many objects whose size is comparable to the chunk size. Here
-is how to do so cleanly:
-
-@smallexample
-if (obstack_chunk_size (obstack_ptr) < @var{new-chunk-size})
- obstack_chunk_size (obstack_ptr) = @var{new-chunk-size};
-@end smallexample
-
-@node Summary of Obstacks
-@section Summary of Obstack Functions
-
-Here is a summary of all the functions associated with obstacks. Each
-takes the address of an obstack (@code{struct obstack *}) as its first
-argument.
-
-@table @code
-@item void obstack_init (struct obstack *@var{obstack-ptr})
-Initialize use of an obstack. @xref{Creating Obstacks}.
-
-@item void *obstack_alloc (struct obstack *@var{obstack-ptr}, int @var{size})
-Allocate an object of @var{size} uninitialized bytes.
-@xref{Allocation in an Obstack}.
-
-@item void *obstack_copy (struct obstack *@var{obstack-ptr}, void *@var{address}, int @var{size})
-Allocate an object of @var{size} bytes, with contents copied from
-@var{address}. @xref{Allocation in an Obstack}.
-
-@item void *obstack_copy0 (struct obstack *@var{obstack-ptr}, void *@var{address}, int @var{size})
-Allocate an object of @var{size}+1 bytes, with @var{size} of them copied
-from @var{address}, followed by a null character at the end.
-@xref{Allocation in an Obstack}.
-
-@item void obstack_free (struct obstack *@var{obstack-ptr}, void *@var{object})
-Free @var{object} (and everything allocated in the specified obstack
-more recently than @var{object}). @xref{Freeing Obstack Objects}.
-
-@item void obstack_blank (struct obstack *@var{obstack-ptr}, int @var{size})
-Add @var{size} uninitialized bytes to a growing object.
-@xref{Growing Objects}.
-
-@item void obstack_grow (struct obstack *@var{obstack-ptr}, void *@var{address}, int @var{size})
-Add @var{size} bytes, copied from @var{address}, to a growing object.
-@xref{Growing Objects}.
-
-@item void obstack_grow0 (struct obstack *@var{obstack-ptr}, void *@var{address}, int @var{size})
-Add @var{size} bytes, copied from @var{address}, to a growing object,
-and then add another byte containing a null character. @xref{Growing
-Objects}.
-
-@item void obstack_1grow (struct obstack *@var{obstack-ptr}, char @var{data-char})
-Add one byte containing @var{data-char} to a growing object.
-@xref{Growing Objects}.
-
-@item void *obstack_finish (struct obstack *@var{obstack-ptr})
-Finalize the object that is growing and return its permanent address.
-@xref{Growing Objects}.
-
-@item int obstack_object_size (struct obstack *@var{obstack-ptr})
-Get the current size of the currently growing object. @xref{Growing
-Objects}.
-
-@item void obstack_blank_fast (struct obstack *@var{obstack-ptr}, int @var{size})
-Add @var{size} uninitialized bytes to a growing object without checking
-that there is enough room. @xref{Extra Fast Growing}.
-
-@item void obstack_1grow_fast (struct obstack *@var{obstack-ptr}, char @var{data-char})
-Add one byte containing @var{data-char} to a growing object without
-checking that there is enough room. @xref{Extra Fast Growing}.
-
-@item int obstack_room (struct obstack *@var{obstack-ptr})
-Get the amount of room now available for growing the current object.
-@xref{Extra Fast Growing}.
-
-@item int obstack_alignment_mask (struct obstack *@var{obstack-ptr})
-The mask used for aligning the beginning of an object. This is an
-lvalue. @xref{Obstacks Data Alignment}.
-
-@item int obstack_chunk_size (struct obstack *@var{obstack-ptr})
-The size for allocating chunks. This is an lvalue. @xref{Obstack Chunks}.
-
-@item void *obstack_base (struct obstack *@var{obstack-ptr})
-Tentative starting address of the currently growing object.
-@xref{Status of an Obstack}.
-
-@item void *obstack_next_free (struct obstack *@var{obstack-ptr})
-Address just after the end of the currently growing object.
-@xref{Status of an Obstack}.
-@end table
-
diff --git a/libiberty/partition.c b/libiberty/partition.c
deleted file mode 100644
index 0715472..0000000
--- a/libiberty/partition.c
+++ /dev/null
@@ -1,191 +0,0 @@
-/* List implementation of a partition of consecutive integers.
- Copyright (C) 2000, 2001 Free Software Foundation, Inc.
- Contributed by CodeSourcery, LLC.
-
- 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. */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-
-#include "libiberty.h"
-#include "partition.h"
-
-static int elem_compare PARAMS ((const void *, const void *));
-
-/* Creates a partition of NUM_ELEMENTS elements. Initially each
- element is in a class by itself. */
-
-partition
-partition_new (num_elements)
- int num_elements;
-{
- int e;
-
- partition part = (partition)
- xmalloc (sizeof (struct partition_def) +
- (num_elements - 1) * sizeof (struct partition_elem));
- part->num_elements = num_elements;
- for (e = 0; e < num_elements; ++e)
- {
- part->elements[e].class_element = e;
- part->elements[e].next = &(part->elements[e]);
- part->elements[e].class_count = 1;
- }
-
- return part;
-}
-
-/* Freeds a partition. */
-
-void
-partition_delete (part)
- partition part;
-{
- free (part);
-}
-
-/* Unites the classes containing ELEM1 and ELEM2 into a single class
- of partition PART. If ELEM1 and ELEM2 are already in the same
- class, does nothing. Returns the canonical element of the
- resulting union class. */
-
-int
-partition_union (part, elem1, elem2)
- partition part;
- int elem1;
- int elem2;
-{
- struct partition_elem *elements = part->elements;
- struct partition_elem *e1;
- struct partition_elem *e2;
- struct partition_elem *p;
- struct partition_elem *old_next;
- /* The canonical element of the resulting union class. */
- int class_element = elements[elem1].class_element;
-
- /* If they're already in the same class, do nothing. */
- if (class_element == elements[elem2].class_element)
- return class_element;
-
- /* Make sure ELEM1 is in the larger class of the two. If not, swap
- them. This way we always scan the shorter list. */
- if (elements[elem1].class_count < elements[elem2].class_count)
- {
- int temp = elem1;
- elem1 = elem2;
- elem2 = temp;
- class_element = elements[elem1].class_element;
- }
-
- e1 = &(elements[elem1]);
- e2 = &(elements[elem2]);
-
- /* Keep a count of the number of elements in the list. */
- elements[class_element].class_count
- += elements[e2->class_element].class_count;
-
- /* Update the class fields in elem2's class list. */
- e2->class_element = class_element;
- for (p = e2->next; p != e2; p = p->next)
- p->class_element = class_element;
-
- /* Splice ELEM2's class list into ELEM1's. These are circular
- lists. */
- old_next = e1->next;
- e1->next = e2->next;
- e2->next = old_next;
-
- return class_element;
-}
-
-/* Compare elements ELEM1 and ELEM2 from array of integers, given a
- pointer to each. Used to qsort such an array. */
-
-static int
-elem_compare (elem1, elem2)
- const void *elem1;
- const void *elem2;
-{
- int e1 = * (const int *) elem1;
- int e2 = * (const int *) elem2;
- if (e1 < e2)
- return -1;
- else if (e1 > e2)
- return 1;
- else
- return 0;
-}
-
-/* Prints PART to the file pointer FP. The elements of each
- class are sorted. */
-
-void
-partition_print (part, fp)
- partition part;
- FILE *fp;
-{
- char *done;
- int num_elements = part->num_elements;
- struct partition_elem *elements = part->elements;
- int *class_elements;
- int e;
-
- /* Flag the elements we've already printed. */
- done = (char *) xmalloc (num_elements);
- memset (done, 0, num_elements);
-
- /* A buffer used to sort elements in a class. */
- class_elements = (int *) xmalloc (num_elements * sizeof (int));
-
- fputc ('[', fp);
- for (e = 0; e < num_elements; ++e)
- /* If we haven't printed this element, print its entire class. */
- if (! done[e])
- {
- int c = e;
- int count = elements[elements[e].class_element].class_count;
- int i;
-
- /* Collect the elements in this class. */
- for (i = 0; i < count; ++i) {
- class_elements[i] = c;
- done[c] = 1;
- c = elements[c].next - elements;
- }
- /* Sort them. */
- qsort ((void *) class_elements, count, sizeof (int), elem_compare);
- /* Print them. */
- fputc ('(', fp);
- for (i = 0; i < count; ++i)
- fprintf (fp, i == 0 ? "%d" : " %d", class_elements[i]);
- fputc (')', fp);
- }
- fputc (']', fp);
-
- free (done);
-}
-
diff --git a/libiberty/pexecute.c b/libiberty/pexecute.c
deleted file mode 100644
index 347c4db..0000000
--- a/libiberty/pexecute.c
+++ /dev/null
@@ -1,792 +0,0 @@
-/* Utilities to execute a program in a subprocess (possibly linked by pipes
- with other subprocesses), and wait for it.
- Copyright (C) 1996-2000 Free Software Foundation, Inc.
-
-This file is part of the libiberty library.
-Libiberty is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public
-License as published by the Free Software Foundation; either
-version 2 of the License, or (at your option) any later version.
-
-Libiberty is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with libiberty; see the file COPYING.LIB. If not,
-write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-/* This file exports two functions: pexecute and pwait. */
-
-/* This file lives in at least two places: libiberty and gcc.
- Don't change one without the other. */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdio.h>
-#include <errno.h>
-#ifdef NEED_DECLARATION_ERRNO
-extern int errno;
-#endif
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#ifdef HAVE_SYS_WAIT_H
-#include <sys/wait.h>
-#endif
-
-#include "libiberty.h"
-#include "safe-ctype.h"
-
-/* stdin file number. */
-#define STDIN_FILE_NO 0
-
-/* stdout file number. */
-#define STDOUT_FILE_NO 1
-
-/* value of `pipe': port index for reading. */
-#define READ_PORT 0
-
-/* value of `pipe': port index for writing. */
-#define WRITE_PORT 1
-
-static char *install_error_msg = "installation problem, cannot exec `%s'";
-
-/* pexecute: execute a program.
-
-@deftypefn Extension int pexecute (const char *@var{program}, char * const *@var{argv}, const char *@var{this_pname}, const char *@var{temp_base}, char **@var{errmsg_fmt}, char **@var{errmsg_arg}, int flags)
-
-Executes a program.
-
-@var{program} and @var{argv} are the arguments to
-@code{execv}/@code{execvp}.
-
-@var{this_pname} is name of the calling program (i.e., @code{argv[0]}).
-
-@var{temp_base} is the path name, sans suffix, of a temporary file to
-use if needed. This is currently only needed for MS-DOS ports that
-don't use @code{go32} (do any still exist?). Ports that don't need it
-can pass @code{NULL}.
-
-(@code{@var{flags} & PEXECUTE_SEARCH}) is non-zero if @env{PATH} should be searched
-(??? It's not clear that GCC passes this flag correctly). (@code{@var{flags} &
-PEXECUTE_FIRST}) is nonzero for the first process in chain.
-(@code{@var{flags} & PEXECUTE_FIRST}) is nonzero for the last process
-in chain. The first/last flags could be simplified to only mark the
-last of a chain of processes but that requires the caller to always
-mark the last one (and not give up early if some error occurs).
-It's more robust to require the caller to mark both ends of the chain.
-
-The result is the pid on systems like Unix where we
-@code{fork}/@code{exec} and on systems like WIN32 and OS/2 where we
-use @code{spawn}. It is up to the caller to wait for the child.
-
-The result is the @code{WEXITSTATUS} on systems like MS-DOS where we
-@code{spawn} and wait for the child here.
-
-Upon failure, @var{errmsg_fmt} and @var{errmsg_arg} are set to the
-text of the error message with an optional argument (if not needed,
-@var{errmsg_arg} is set to @code{NULL}), and @minus{}1 is returned.
-@code{errno} is available to the caller to use.
-
-@end deftypefn
-
-@deftypefn Extension int pwait (int @var{pid}, int *@var{status}, int @var{flags})
-
-Waits for a program started by @code{pexecute} to finish.
-
-@var{pid} is the process id of the task to wait for. @var{status} is
-the `status' argument to wait. @var{flags} is currently unused (allows
-future enhancement without breaking upward compatibility). Pass 0 for now.
-
-The result is the pid of the child reaped, or -1 for failure
-(@code{errno} says why).
-
-On systems that don't support waiting for a particular child, @var{pid} is
-ignored. On systems like MS-DOS that don't really multitask @code{pwait}
-is just a mechanism to provide a consistent interface for the caller.
-
-@end deftypefn
-
-@undocumented pfinish
-
- pfinish: finish generation of script
-
- pfinish is necessary for systems like MPW where a script is generated that
- runs the requested programs. */
-
-#ifdef __MSDOS__
-
-/* MSDOS doesn't multitask, but for the sake of a consistent interface
- the code behaves like it does. pexecute runs the program, tucks the
- exit code away, and returns a "pid". pwait must be called to fetch the
- exit code. */
-
-#include <process.h>
-
-/* For communicating information from pexecute to pwait. */
-static int last_pid = 0;
-static int last_status = 0;
-static int last_reaped = 0;
-
-int
-pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
- const char *program;
- char * const *argv;
- const char *this_pname;
- const char *temp_base;
- char **errmsg_fmt, **errmsg_arg;
- int flags;
-{
- int rc;
-
- last_pid++;
- if (last_pid < 0)
- last_pid = 1;
-
- if ((flags & PEXECUTE_ONE) != PEXECUTE_ONE)
- abort ();
-
-#ifdef __DJGPP__
- /* ??? What are the possible return values from spawnv? */
- rc = (flags & PEXECUTE_SEARCH ? spawnvp : spawnv) (P_WAIT, program, argv);
-#else
- char *scmd, *rf;
- FILE *argfile;
- int i, el = flags & PEXECUTE_SEARCH ? 4 : 0;
-
- if (temp_base == 0)
- temp_base = choose_temp_base ();
- scmd = (char *) xmalloc (strlen (program) + strlen (temp_base) + 6 + el);
- rf = scmd + strlen(program) + 2 + el;
- sprintf (scmd, "%s%s @%s.gp", program,
- (flags & PEXECUTE_SEARCH ? ".exe" : ""), temp_base);
- argfile = fopen (rf, "w");
- if (argfile == 0)
- {
- int errno_save = errno;
- free (scmd);
- errno = errno_save;
- *errmsg_fmt = "cannot open `%s.gp'";
- *errmsg_arg = temp_base;
- return -1;
- }
-
- for (i=1; argv[i]; i++)
- {
- char *cp;
- for (cp = argv[i]; *cp; cp++)
- {
- if (*cp == '"' || *cp == '\'' || *cp == '\\' || ISSPACE (*cp))
- fputc ('\\', argfile);
- fputc (*cp, argfile);
- }
- fputc ('\n', argfile);
- }
- fclose (argfile);
-
- rc = system (scmd);
-
- {
- int errno_save = errno;
- remove (rf);
- free (scmd);
- errno = errno_save;
- }
-#endif
-
- if (rc == -1)
- {
- *errmsg_fmt = install_error_msg;
- *errmsg_arg = (char *)program;
- return -1;
- }
-
- /* Tuck the status away for pwait, and return a "pid". */
- last_status = rc << 8;
- return last_pid;
-}
-
-/* Use ECHILD if available, otherwise use EINVAL. */
-#ifdef ECHILD
-#define PWAIT_ERROR ECHILD
-#else
-#define PWAIT_ERROR EINVAL
-#endif
-
-int
-pwait (pid, status, flags)
- int pid;
- int *status;
- int flags;
-{
- /* On MSDOS each pexecute must be followed by it's associated pwait. */
- if (pid != last_pid
- /* Called twice for the same child? */
- || pid == last_reaped)
- {
- errno = PWAIT_ERROR;
- return -1;
- }
- /* ??? Here's an opportunity to canonicalize the values in STATUS.
- Needed? */
-#ifdef __DJGPP__
- *status = (last_status >> 8);
-#else
- *status = last_status;
-#endif
- last_reaped = last_pid;
- return last_pid;
-}
-
-#endif /* MSDOS */
-
-#if defined (_WIN32) && ! defined (_UWIN)
-
-#include <process.h>
-
-#ifdef __CYGWIN__
-
-#define fix_argv(argvec) (argvec)
-
-extern int _spawnv ();
-extern int _spawnvp ();
-
-#else /* ! __CYGWIN__ */
-
-/* This is a kludge to get around the Microsoft C spawn functions' propensity
- to remove the outermost set of double quotes from all arguments. */
-
-static const char * const *
-fix_argv (argvec)
- char **argvec;
-{
- int i;
-
- for (i = 1; argvec[i] != 0; i++)
- {
- int len, j;
- char *temp, *newtemp;
-
- temp = argvec[i];
- len = strlen (temp);
- for (j = 0; j < len; j++)
- {
- if (temp[j] == '"')
- {
- newtemp = xmalloc (len + 2);
- strncpy (newtemp, temp, j);
- newtemp [j] = '\\';
- strncpy (&newtemp [j+1], &temp [j], len-j);
- newtemp [len+1] = 0;
- temp = newtemp;
- len++;
- j++;
- }
- }
-
- argvec[i] = temp;
- }
-
- for (i = 0; argvec[i] != 0; i++)
- {
- if (strpbrk (argvec[i], " \t"))
- {
- int len, trailing_backslash;
- char *temp;
-
- len = strlen (argvec[i]);
- trailing_backslash = 0;
-
- /* There is an added complication when an arg with embedded white
- space ends in a backslash (such as in the case of -iprefix arg
- passed to cpp). The resulting quoted strings gets misinterpreted
- by the command interpreter -- it thinks that the ending quote
- is escaped by the trailing backslash and things get confused.
- We handle this case by escaping the trailing backslash, provided
- it was not escaped in the first place. */
- if (len > 1
- && argvec[i][len-1] == '\\'
- && argvec[i][len-2] != '\\')
- {
- trailing_backslash = 1;
- ++len; /* to escape the final backslash. */
- }
-
- len += 2; /* and for the enclosing quotes. */
-
- temp = xmalloc (len + 1);
- temp[0] = '"';
- strcpy (temp + 1, argvec[i]);
- if (trailing_backslash)
- temp[len-2] = '\\';
- temp[len-1] = '"';
- temp[len] = '\0';
-
- argvec[i] = temp;
- }
- }
-
- return (const char * const *) argvec;
-}
-#endif /* __CYGWIN__ */
-
-#include <io.h>
-#include <fcntl.h>
-#include <signal.h>
-
-/* mingw32 headers may not define the following. */
-
-#ifndef _P_WAIT
-# define _P_WAIT 0
-# define _P_NOWAIT 1
-# define _P_OVERLAY 2
-# define _P_NOWAITO 3
-# define _P_DETACH 4
-
-# define WAIT_CHILD 0
-# define WAIT_GRANDCHILD 1
-#endif
-
-/* Win32 supports pipes */
-int
-pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
- const char *program;
- char * const *argv;
- const char *this_pname;
- const char *temp_base;
- char **errmsg_fmt, **errmsg_arg;
- int flags;
-{
- int pid;
- int pdes[2], org_stdin, org_stdout;
- int input_desc, output_desc;
- int retries, sleep_interval;
-
- /* Pipe waiting from last process, to be used as input for the next one.
- Value is STDIN_FILE_NO if no pipe is waiting
- (i.e. the next command is the first of a group). */
- static int last_pipe_input;
-
- /* If this is the first process, initialize. */
- if (flags & PEXECUTE_FIRST)
- last_pipe_input = STDIN_FILE_NO;
-
- input_desc = last_pipe_input;
-
- /* If this isn't the last process, make a pipe for its output,
- and record it as waiting to be the input to the next process. */
- if (! (flags & PEXECUTE_LAST))
- {
- if (_pipe (pdes, 256, O_BINARY) < 0)
- {
- *errmsg_fmt = "pipe";
- *errmsg_arg = NULL;
- return -1;
- }
- output_desc = pdes[WRITE_PORT];
- last_pipe_input = pdes[READ_PORT];
- }
- else
- {
- /* Last process. */
- output_desc = STDOUT_FILE_NO;
- last_pipe_input = STDIN_FILE_NO;
- }
-
- if (input_desc != STDIN_FILE_NO)
- {
- org_stdin = dup (STDIN_FILE_NO);
- dup2 (input_desc, STDIN_FILE_NO);
- close (input_desc);
- }
-
- if (output_desc != STDOUT_FILE_NO)
- {
- org_stdout = dup (STDOUT_FILE_NO);
- dup2 (output_desc, STDOUT_FILE_NO);
- close (output_desc);
- }
-
- pid = (flags & PEXECUTE_SEARCH ? _spawnvp : _spawnv)
- (_P_NOWAIT, program, fix_argv(argv));
-
- if (input_desc != STDIN_FILE_NO)
- {
- dup2 (org_stdin, STDIN_FILE_NO);
- close (org_stdin);
- }
-
- if (output_desc != STDOUT_FILE_NO)
- {
- dup2 (org_stdout, STDOUT_FILE_NO);
- close (org_stdout);
- }
-
- if (pid == -1)
- {
- *errmsg_fmt = install_error_msg;
- *errmsg_arg = program;
- return -1;
- }
-
- return pid;
-}
-
-/* MS CRTDLL doesn't return enough information in status to decide if the
- child exited due to a signal or not, rather it simply returns an
- integer with the exit code of the child; eg., if the child exited with
- an abort() call and didn't have a handler for SIGABRT, it simply returns
- with status = 3. We fix the status code to conform to the usual WIF*
- macros. Note that WIFSIGNALED will never be true under CRTDLL. */
-
-int
-pwait (pid, status, flags)
- int pid;
- int *status;
- int flags;
-{
-#ifdef __CYGWIN__
- return wait (status);
-#else
- int termstat;
-
- pid = _cwait (&termstat, pid, WAIT_CHILD);
-
- /* ??? Here's an opportunity to canonicalize the values in STATUS.
- Needed? */
-
- /* cwait returns the child process exit code in termstat.
- A value of 3 indicates that the child caught a signal, but not
- which one. Since only SIGABRT, SIGFPE and SIGINT do anything, we
- report SIGABRT. */
- if (termstat == 3)
- *status = SIGABRT;
- else
- *status = (((termstat) & 0xff) << 8);
-
- return pid;
-#endif /* __CYGWIN__ */
-}
-
-#endif /* _WIN32 && ! _UWIN */
-
-#ifdef OS2
-
-/* ??? Does OS2 have process.h? */
-extern int spawnv ();
-extern int spawnvp ();
-
-int
-pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
- const char *program;
- char * const *argv;
- const char *this_pname;
- const char *temp_base;
- char **errmsg_fmt, **errmsg_arg;
- int flags;
-{
- int pid;
-
- if ((flags & PEXECUTE_ONE) != PEXECUTE_ONE)
- abort ();
- /* ??? Presumably 1 == _P_NOWAIT. */
- pid = (flags & PEXECUTE_SEARCH ? spawnvp : spawnv) (1, program, argv);
- if (pid == -1)
- {
- *errmsg_fmt = install_error_msg;
- *errmsg_arg = program;
- return -1;
- }
- return pid;
-}
-
-int
-pwait (pid, status, flags)
- int pid;
- int *status;
- int flags;
-{
- /* ??? Here's an opportunity to canonicalize the values in STATUS.
- Needed? */
- int pid = wait (status);
- return pid;
-}
-
-#endif /* OS2 */
-
-#ifdef MPW
-
-/* MPW pexecute doesn't actually run anything; instead, it writes out
- script commands that, when run, will do the actual executing.
-
- For example, in GCC's case, GCC will write out several script commands:
-
- cpp ...
- cc1 ...
- as ...
- ld ...
-
- and then exit. None of the above programs will have run yet. The task
- that called GCC will then execute the script and cause cpp,etc. to run.
- The caller must invoke pfinish before calling exit. This adds
- the finishing touches to the generated script. */
-
-static int first_time = 1;
-
-int
-pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
- const char *program;
- char * const *argv;
- const char *this_pname;
- const char *temp_base;
- char **errmsg_fmt, **errmsg_arg;
- int flags;
-{
- char tmpprogram[255];
- char *cp, *tmpname;
- int i;
-
- mpwify_filename (program, tmpprogram);
- if (first_time)
- {
- printf ("Set Failed 0\n");
- first_time = 0;
- }
-
- fputs ("If {Failed} == 0\n", stdout);
- /* If being verbose, output a copy of the command. It should be
- accurate enough and escaped enough to be "clickable". */
- if (flags & PEXECUTE_VERBOSE)
- {
- fputs ("\tEcho ", stdout);
- fputc ('\'', stdout);
- fputs (tmpprogram, stdout);
- fputc ('\'', stdout);
- fputc (' ', stdout);
- for (i=1; argv[i]; i++)
- {
- fputc ('\'', stdout);
- /* See if we have an argument that needs fixing. */
- if (strchr(argv[i], '/'))
- {
- tmpname = (char *) xmalloc (256);
- mpwify_filename (argv[i], tmpname);
- argv[i] = tmpname;
- }
- for (cp = argv[i]; *cp; cp++)
- {
- /* Write an Option-d escape char in front of special chars. */
- if (strchr("'+", *cp))
- fputc ('\266', stdout);
- fputc (*cp, stdout);
- }
- fputc ('\'', stdout);
- fputc (' ', stdout);
- }
- fputs ("\n", stdout);
- }
- fputs ("\t", stdout);
- fputs (tmpprogram, stdout);
- fputc (' ', stdout);
-
- for (i=1; argv[i]; i++)
- {
- /* See if we have an argument that needs fixing. */
- if (strchr(argv[i], '/'))
- {
- tmpname = (char *) xmalloc (256);
- mpwify_filename (argv[i], tmpname);
- argv[i] = tmpname;
- }
- if (strchr (argv[i], ' '))
- fputc ('\'', stdout);
- for (cp = argv[i]; *cp; cp++)
- {
- /* Write an Option-d escape char in front of special chars. */
- if (strchr("'+", *cp))
- fputc ('\266', stdout);
- fputc (*cp, stdout);
- }
- if (strchr (argv[i], ' '))
- fputc ('\'', stdout);
- fputc (' ', stdout);
- }
-
- fputs ("\n", stdout);
-
- /* Output commands that arrange to clean up and exit if a failure occurs.
- We have to be careful to collect the status from the program that was
- run, rather than some other script command. Also, we don't exit
- immediately, since necessary cleanups are at the end of the script. */
- fputs ("\tSet TmpStatus {Status}\n", stdout);
- fputs ("\tIf {TmpStatus} != 0\n", stdout);
- fputs ("\t\tSet Failed {TmpStatus}\n", stdout);
- fputs ("\tEnd\n", stdout);
- fputs ("End\n", stdout);
-
- /* We're just composing a script, can't fail here. */
- return 0;
-}
-
-int
-pwait (pid, status, flags)
- int pid;
- int *status;
- int flags;
-{
- *status = 0;
- return 0;
-}
-
-/* Write out commands that will exit with the correct error code
- if something in the script failed. */
-
-void
-pfinish ()
-{
- printf ("\tExit \"{Failed}\"\n");
-}
-
-#endif /* MPW */
-
-/* include for Unix-like environments but not for Dos-like environments */
-#if ! defined (__MSDOS__) && ! defined (OS2) && ! defined (MPW) \
- && ! (defined (_WIN32) && ! defined (_UWIN))
-
-extern int execv ();
-extern int execvp ();
-
-int
-pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
- const char *program;
- char * const *argv;
- const char *this_pname;
- const char *temp_base ATTRIBUTE_UNUSED;
- char **errmsg_fmt, **errmsg_arg;
- int flags;
-{
- int (*func)() = (flags & PEXECUTE_SEARCH ? execvp : execv);
- int pid;
- int pdes[2];
- int input_desc, output_desc;
- int retries, sleep_interval;
- /* Pipe waiting from last process, to be used as input for the next one.
- Value is STDIN_FILE_NO if no pipe is waiting
- (i.e. the next command is the first of a group). */
- static int last_pipe_input;
-
- /* If this is the first process, initialize. */
- if (flags & PEXECUTE_FIRST)
- last_pipe_input = STDIN_FILE_NO;
-
- input_desc = last_pipe_input;
-
- /* If this isn't the last process, make a pipe for its output,
- and record it as waiting to be the input to the next process. */
- if (! (flags & PEXECUTE_LAST))
- {
- if (pipe (pdes) < 0)
- {
- *errmsg_fmt = "pipe";
- *errmsg_arg = NULL;
- return -1;
- }
- output_desc = pdes[WRITE_PORT];
- last_pipe_input = pdes[READ_PORT];
- }
- else
- {
- /* Last process. */
- output_desc = STDOUT_FILE_NO;
- last_pipe_input = STDIN_FILE_NO;
- }
-
- /* Fork a subprocess; wait and retry if it fails. */
- sleep_interval = 1;
- pid = -1;
- for (retries = 0; retries < 4; retries++)
- {
- pid = fork ();
- if (pid >= 0)
- break;
- sleep (sleep_interval);
- sleep_interval *= 2;
- }
-
- switch (pid)
- {
- case -1:
- *errmsg_fmt = "fork";
- *errmsg_arg = NULL;
- return -1;
-
- case 0: /* child */
- /* Move the input and output pipes into place, if necessary. */
- if (input_desc != STDIN_FILE_NO)
- {
- close (STDIN_FILE_NO);
- dup (input_desc);
- close (input_desc);
- }
- if (output_desc != STDOUT_FILE_NO)
- {
- close (STDOUT_FILE_NO);
- dup (output_desc);
- close (output_desc);
- }
-
- /* Close the parent's descs that aren't wanted here. */
- if (last_pipe_input != STDIN_FILE_NO)
- close (last_pipe_input);
-
- /* Exec the program. */
- (*func) (program, argv);
-
- fprintf (stderr, "%s: ", this_pname);
- fprintf (stderr, install_error_msg, program);
- fprintf (stderr, ": %s\n", xstrerror (errno));
- exit (-1);
- /* NOTREACHED */
- return 0;
-
- default:
- /* In the parent, after forking.
- Close the descriptors that we made for this child. */
- if (input_desc != STDIN_FILE_NO)
- close (input_desc);
- if (output_desc != STDOUT_FILE_NO)
- close (output_desc);
-
- /* Return child's process number. */
- return pid;
- }
-}
-
-int
-pwait (pid, status, flags)
- int pid;
- int *status;
- int flags ATTRIBUTE_UNUSED;
-{
- /* ??? Here's an opportunity to canonicalize the values in STATUS.
- Needed? */
-#ifdef VMS
- pid = waitpid (-1, status, 0);
-#else
- pid = wait (status);
-#endif
- return pid;
-}
-
-#endif /* ! __MSDOS__ && ! OS2 && ! MPW && ! (_WIN32 && ! _UWIN) */
diff --git a/libiberty/putenv.c b/libiberty/putenv.c
deleted file mode 100644
index 6d027dc..0000000
--- a/libiberty/putenv.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/* Copyright (C) 1991, 1994, 1995, 1996, 2002 Free Software Foundation, Inc.
- This file based on putenv.c in the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C 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
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-/*
-
-@deftypefn Supplemental int putenv (const char *@var{string})
-
-Uses @code{setenv} or @code{unsetenv} to put @var{string} into
-the environment or remove it. If @var{string} is of the form
-@samp{name=value} the string is added; if no @samp{=} is present the
-name is unset/removed.
-
-@end deftypefn
-
-*/
-
-#if defined (_AIX) && !defined (__GNUC__)
- #pragma alloca
-#endif
-
-#if HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "ansidecl.h"
-
-#define putenv libiberty_putenv
-
-#if HAVE_STDLIB_H
-# include <stdlib.h>
-#endif
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#ifdef HAVE_ALLOCA_H
-# include <alloca.h>
-#else
-# ifndef alloca
-# ifdef __GNUC__
-# define alloca __builtin_alloca
-# else
-extern char *alloca ();
-# endif /* __GNUC__ */
-# endif /* alloca */
-#endif /* HAVE_ALLOCA_H */
-
-#undef putenv
-
-/* Below this point, it's verbatim code from the glibc-2.0 implementation */
-
-
-/* Put STRING, which is of the form "NAME=VALUE", in the environment. */
-int
-putenv (string)
- const char *string;
-{
- const char *const name_end = strchr (string, '=');
-
- if (name_end)
- {
- char *name = (char *) alloca (name_end - string + 1);
- memcpy (name, string, name_end - string);
- name[name_end - string] = '\0';
- return setenv (name, name_end + 1, 1);
- }
-
- unsetenv (string);
- return 0;
-}
diff --git a/libiberty/random.c b/libiberty/random.c
deleted file mode 100644
index 48035f0..0000000
--- a/libiberty/random.c
+++ /dev/null
@@ -1,408 +0,0 @@
-/*
- * Copyright (c) 1983 Regents of the University of California.
- * All rights reserved.
- *
- * 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.
- * 3. [rescinded 22 July 1999]
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * 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 REGENTS 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 is derived from the Berkeley source:
- * @(#)random.c 5.5 (Berkeley) 7/6/88
- * It was reworked for the GNU C Library by Roland McGrath.
- */
-
-/*
-
-@deftypefn Supplement {long int} random (void)
-@deftypefnx Supplement void srandom (unsigned int @var{seed})
-@deftypefnx Supplement void* initstate (unsigned int @var{seed}, void *@var{arg_state}, unsigned long @var{n})
-@deftypefnx Supplement void* setstate (void *@var{arg_state})
-
-Random number functions. @code{random} returns a random number in the
-range 0 to @code{LONG_MAX}. @code{srandom} initializes the random
-number generator to some starting point determined by @var{seed}
-(else, the values returned by @code{random} are always the same for each
-run of the program). @code{initstate} and @code{setstate} allow fine-grained
-control over the state of the random number generator.
-
-@end deftypefn
-
-*/
-
-#include <errno.h>
-
-#if 0
-
-#include <ansidecl.h>
-#include <limits.h>
-#include <stddef.h>
-#include <stdlib.h>
-
-#else
-
-#define ULONG_MAX ((unsigned long)(~0L)) /* 0xFFFFFFFF for 32-bits */
-#define LONG_MAX ((long)(ULONG_MAX >> 1)) /* 0x7FFFFFFF for 32-bits*/
-
-#ifdef __STDC__
-# define PTR void *
-# ifndef NULL
-# define NULL (void *) 0
-# endif
-#else
-# define PTR char *
-# ifndef NULL
-# define NULL (void *) 0
-# endif
-#endif
-
-#endif
-
-long int random ();
-
-/* An improved random number generation package. In addition to the standard
- rand()/srand() like interface, this package also has a special state info
- interface. The initstate() routine is called with a seed, an array of
- bytes, and a count of how many bytes are being passed in; this array is
- then initialized to contain information for random number generation with
- that much state information. Good sizes for the amount of state
- information are 32, 64, 128, and 256 bytes. The state can be switched by
- calling the setstate() function with the same array as was initiallized
- with initstate(). By default, the package runs with 128 bytes of state
- information and generates far better random numbers than a linear
- congruential generator. If the amount of state information is less than
- 32 bytes, a simple linear congruential R.N.G. is used. Internally, the
- state information is treated as an array of longs; the zeroeth element of
- the array is the type of R.N.G. being used (small integer); the remainder
- of the array is the state information for the R.N.G. Thus, 32 bytes of
- state information will give 7 longs worth of state information, which will
- allow a degree seven polynomial. (Note: The zeroeth word of state
- information also has some other information stored in it; see setstate
- for details). The random number generation technique is a linear feedback
- shift register approach, employing trinomials (since there are fewer terms
- to sum up that way). In this approach, the least significant bit of all
- the numbers in the state table will act as a linear feedback shift register,
- and will have period 2^deg - 1 (where deg is the degree of the polynomial
- being used, assuming that the polynomial is irreducible and primitive).
- The higher order bits will have longer periods, since their values are
- also influenced by pseudo-random carries out of the lower bits. The
- total period of the generator is approximately deg*(2**deg - 1); thus
- doubling the amount of state information has a vast influence on the
- period of the generator. Note: The deg*(2**deg - 1) is an approximation
- only good for large deg, when the period of the shift register is the
- dominant factor. With deg equal to seven, the period is actually much
- longer than the 7*(2**7 - 1) predicted by this formula. */
-
-
-
-/* For each of the currently supported random number generators, we have a
- break value on the amount of state information (you need at least thi
- bytes of state info to support this random number generator), a degree for
- the polynomial (actually a trinomial) that the R.N.G. is based on, and
- separation between the two lower order coefficients of the trinomial. */
-
-/* Linear congruential. */
-#define TYPE_0 0
-#define BREAK_0 8
-#define DEG_0 0
-#define SEP_0 0
-
-/* x**7 + x**3 + 1. */
-#define TYPE_1 1
-#define BREAK_1 32
-#define DEG_1 7
-#define SEP_1 3
-
-/* x**15 + x + 1. */
-#define TYPE_2 2
-#define BREAK_2 64
-#define DEG_2 15
-#define SEP_2 1
-
-/* x**31 + x**3 + 1. */
-#define TYPE_3 3
-#define BREAK_3 128
-#define DEG_3 31
-#define SEP_3 3
-
-/* x**63 + x + 1. */
-#define TYPE_4 4
-#define BREAK_4 256
-#define DEG_4 63
-#define SEP_4 1
-
-
-/* Array versions of the above information to make code run faster.
- Relies on fact that TYPE_i == i. */
-
-#define MAX_TYPES 5 /* Max number of types above. */
-
-static int degrees[MAX_TYPES] = { DEG_0, DEG_1, DEG_2, DEG_3, DEG_4 };
-static int seps[MAX_TYPES] = { SEP_0, SEP_1, SEP_2, SEP_3, SEP_4 };
-
-
-
-/* Initially, everything is set up as if from:
- initstate(1, randtbl, 128);
- Note that this initialization takes advantage of the fact that srandom
- advances the front and rear pointers 10*rand_deg times, and hence the
- rear pointer which starts at 0 will also end up at zero; thus the zeroeth
- element of the state information, which contains info about the current
- position of the rear pointer is just
- (MAX_TYPES * (rptr - state)) + TYPE_3 == TYPE_3. */
-
-static long int randtbl[DEG_3 + 1] =
- { TYPE_3,
- 0x9a319039, 0x32d9c024, 0x9b663182, 0x5da1f342,
- 0xde3b81e0, 0xdf0a6fb5, 0xf103bc02, 0x48f340fb,
- 0x7449e56b, 0xbeb1dbb0, 0xab5c5918, 0x946554fd,
- 0x8c2e680f, 0xeb3d799f, 0xb11ee0b7, 0x2d436b86,
- 0xda672e2a, 0x1588ca88, 0xe369735d, 0x904f35f7,
- 0xd7158fd6, 0x6fa6f051, 0x616e6b96, 0xac94efdc,
- 0x36413f93, 0xc622c298, 0xf5a42ab8, 0x8a88d77b,
- 0xf5ad9d0e, 0x8999220b, 0x27fb47b9
- };
-
-/* FPTR and RPTR are two pointers into the state info, a front and a rear
- pointer. These two pointers are always rand_sep places aparts, as they
- cycle through the state information. (Yes, this does mean we could get
- away with just one pointer, but the code for random is more efficient
- this way). The pointers are left positioned as they would be from the call:
- initstate(1, randtbl, 128);
- (The position of the rear pointer, rptr, is really 0 (as explained above
- in the initialization of randtbl) because the state table pointer is set
- to point to randtbl[1] (as explained below).) */
-
-static long int *fptr = &randtbl[SEP_3 + 1];
-static long int *rptr = &randtbl[1];
-
-
-
-/* The following things are the pointer to the state information table,
- the type of the current generator, the degree of the current polynomial
- being used, and the separation between the two pointers.
- Note that for efficiency of random, we remember the first location of
- the state information, not the zeroeth. Hence it is valid to access
- state[-1], which is used to store the type of the R.N.G.
- Also, we remember the last location, since this is more efficient than
- indexing every time to find the address of the last element to see if
- the front and rear pointers have wrapped. */
-
-static long int *state = &randtbl[1];
-
-static int rand_type = TYPE_3;
-static int rand_deg = DEG_3;
-static int rand_sep = SEP_3;
-
-static long int *end_ptr = &randtbl[sizeof(randtbl) / sizeof(randtbl[0])];
-
-/* Initialize the random number generator based on the given seed. If the
- type is the trivial no-state-information type, just remember the seed.
- Otherwise, initializes state[] based on the given "seed" via a linear
- congruential generator. Then, the pointers are set to known locations
- that are exactly rand_sep places apart. Lastly, it cycles the state
- information a given number of times to get rid of any initial dependencies
- introduced by the L.C.R.N.G. Note that the initialization of randtbl[]
- for default usage relies on values produced by this routine. */
-void
-srandom (x)
- unsigned int x;
-{
- state[0] = x;
- if (rand_type != TYPE_0)
- {
- register long int i;
- for (i = 1; i < rand_deg; ++i)
- state[i] = (1103515145 * state[i - 1]) + 12345;
- fptr = &state[rand_sep];
- rptr = &state[0];
- for (i = 0; i < 10 * rand_deg; ++i)
- random();
- }
-}
-
-/* Initialize the state information in the given array of N bytes for
- future random number generation. Based on the number of bytes we
- are given, and the break values for the different R.N.G.'s, we choose
- the best (largest) one we can and set things up for it. srandom is
- then called to initialize the state information. Note that on return
- from srandom, we set state[-1] to be the type multiplexed with the current
- value of the rear pointer; this is so successive calls to initstate won't
- lose this information and will be able to restart with setstate.
- Note: The first thing we do is save the current state, if any, just like
- setstate so that it doesn't matter when initstate is called.
- Returns a pointer to the old state. */
-PTR
-initstate (seed, arg_state, n)
- unsigned int seed;
- PTR arg_state;
- unsigned long n;
-{
- PTR ostate = (PTR) &state[-1];
-
- if (rand_type == TYPE_0)
- state[-1] = rand_type;
- else
- state[-1] = (MAX_TYPES * (rptr - state)) + rand_type;
- if (n < BREAK_1)
- {
- if (n < BREAK_0)
- {
- errno = EINVAL;
- return NULL;
- }
- rand_type = TYPE_0;
- rand_deg = DEG_0;
- rand_sep = SEP_0;
- }
- else if (n < BREAK_2)
- {
- rand_type = TYPE_1;
- rand_deg = DEG_1;
- rand_sep = SEP_1;
- }
- else if (n < BREAK_3)
- {
- rand_type = TYPE_2;
- rand_deg = DEG_2;
- rand_sep = SEP_2;
- }
- else if (n < BREAK_4)
- {
- rand_type = TYPE_3;
- rand_deg = DEG_3;
- rand_sep = SEP_3;
- }
- else
- {
- rand_type = TYPE_4;
- rand_deg = DEG_4;
- rand_sep = SEP_4;
- }
-
- state = &((long int *) arg_state)[1]; /* First location. */
- /* Must set END_PTR before srandom. */
- end_ptr = &state[rand_deg];
- srandom(seed);
- if (rand_type == TYPE_0)
- state[-1] = rand_type;
- else
- state[-1] = (MAX_TYPES * (rptr - state)) + rand_type;
-
- return ostate;
-}
-
-/* Restore the state from the given state array.
- Note: It is important that we also remember the locations of the pointers
- in the current state information, and restore the locations of the pointers
- from the old state information. This is done by multiplexing the pointer
- location into the zeroeth word of the state information. Note that due
- to the order in which things are done, it is OK to call setstate with the
- same state as the current state
- Returns a pointer to the old state information. */
-
-PTR
-setstate (arg_state)
- PTR arg_state;
-{
- register long int *new_state = (long int *) arg_state;
- register int type = new_state[0] % MAX_TYPES;
- register int rear = new_state[0] / MAX_TYPES;
- PTR ostate = (PTR) &state[-1];
-
- if (rand_type == TYPE_0)
- state[-1] = rand_type;
- else
- state[-1] = (MAX_TYPES * (rptr - state)) + rand_type;
-
- switch (type)
- {
- case TYPE_0:
- case TYPE_1:
- case TYPE_2:
- case TYPE_3:
- case TYPE_4:
- rand_type = type;
- rand_deg = degrees[type];
- rand_sep = seps[type];
- break;
- default:
- /* State info munged. */
- errno = EINVAL;
- return NULL;
- }
-
- state = &new_state[1];
- if (rand_type != TYPE_0)
- {
- rptr = &state[rear];
- fptr = &state[(rear + rand_sep) % rand_deg];
- }
- /* Set end_ptr too. */
- end_ptr = &state[rand_deg];
-
- return ostate;
-}
-
-/* If we are using the trivial TYPE_0 R.N.G., just do the old linear
- congruential bit. Otherwise, we do our fancy trinomial stuff, which is the
- same in all ther other cases due to all the global variables that have been
- set up. The basic operation is to add the number at the rear pointer into
- the one at the front pointer. Then both pointers are advanced to the next
- location cyclically in the table. The value returned is the sum generated,
- reduced to 31 bits by throwing away the "least random" low bit.
- Note: The code takes advantage of the fact that both the front and
- rear pointers can't wrap on the same call by not testing the rear
- pointer if the front one has wrapped. Returns a 31-bit random number. */
-
-long int
-random ()
-{
- if (rand_type == TYPE_0)
- {
- state[0] = ((state[0] * 1103515245) + 12345) & LONG_MAX;
- return state[0];
- }
- else
- {
- long int i;
- *fptr += *rptr;
- /* Chucking least random bit. */
- i = (*fptr >> 1) & LONG_MAX;
- ++fptr;
- if (fptr >= end_ptr)
- {
- fptr = state;
- ++rptr;
- }
- else
- {
- ++rptr;
- if (rptr >= end_ptr)
- rptr = state;
- }
- return i;
- }
-}
diff --git a/libiberty/regex.c b/libiberty/regex.c
deleted file mode 100644
index f9d9a4e..0000000
--- a/libiberty/regex.c
+++ /dev/null
@@ -1,8317 +0,0 @@
-/* Extended regular expression matching and search library,
- version 0.12.
- (Implements POSIX draft P1003.2/D11.2, except for some of the
- internationalization features.)
- Copyright (C) 1993-1999, 2000, 2001, 2002 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C 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.
-
- The GNU C 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 the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-/* This file has been modified for usage in libiberty. It includes "xregex.h"
- instead of <regex.h>. The "xregex.h" header file renames all external
- routines with an "x" prefix so they do not collide with the native regex
- routines or with other components regex routines. */
-/* AIX requires this to be the first thing in the file. */
-#if defined _AIX && !defined __GNUC__ && !defined REGEX_MALLOC
- #pragma alloca
-#endif
-
-#undef _GNU_SOURCE
-#define _GNU_SOURCE
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#ifndef PARAMS
-# if defined __GNUC__ || (defined __STDC__ && __STDC__)
-# define PARAMS(args) args
-# else
-# define PARAMS(args) ()
-# endif /* GCC. */
-#endif /* Not PARAMS. */
-
-#ifndef INSIDE_RECURSION
-
-# if defined STDC_HEADERS && !defined emacs
-# include <stddef.h>
-# else
-/* We need this for `regex.h', and perhaps for the Emacs include files. */
-# include <sys/types.h>
-# endif
-
-# define WIDE_CHAR_SUPPORT (HAVE_WCTYPE_H && HAVE_WCHAR_H && HAVE_BTOWC)
-
-/* For platform which support the ISO C amendement 1 functionality we
- support user defined character classes. */
-# if defined _LIBC || WIDE_CHAR_SUPPORT
-/* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>. */
-# include <wchar.h>
-# include <wctype.h>
-# endif
-
-# ifdef _LIBC
-/* We have to keep the namespace clean. */
-# define regfree(preg) __regfree (preg)
-# define regexec(pr, st, nm, pm, ef) __regexec (pr, st, nm, pm, ef)
-# define regcomp(preg, pattern, cflags) __regcomp (preg, pattern, cflags)
-# define regerror(errcode, preg, errbuf, errbuf_size) \
- __regerror(errcode, preg, errbuf, errbuf_size)
-# define re_set_registers(bu, re, nu, st, en) \
- __re_set_registers (bu, re, nu, st, en)
-# define re_match_2(bufp, string1, size1, string2, size2, pos, regs, stop) \
- __re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
-# define re_match(bufp, string, size, pos, regs) \
- __re_match (bufp, string, size, pos, regs)
-# define re_search(bufp, string, size, startpos, range, regs) \
- __re_search (bufp, string, size, startpos, range, regs)
-# define re_compile_pattern(pattern, length, bufp) \
- __re_compile_pattern (pattern, length, bufp)
-# define re_set_syntax(syntax) __re_set_syntax (syntax)
-# define re_search_2(bufp, st1, s1, st2, s2, startpos, range, regs, stop) \
- __re_search_2 (bufp, st1, s1, st2, s2, startpos, range, regs, stop)
-# define re_compile_fastmap(bufp) __re_compile_fastmap (bufp)
-
-# define btowc __btowc
-
-/* We are also using some library internals. */
-# include <locale/localeinfo.h>
-# include <locale/elem-hash.h>
-# include <langinfo.h>
-# include <locale/coll-lookup.h>
-# endif
-
-/* This is for other GNU distributions with internationalized messages. */
-# if (HAVE_LIBINTL_H && ENABLE_NLS) || defined _LIBC
-# include <libintl.h>
-# ifdef _LIBC
-# undef gettext
-# define gettext(msgid) __dcgettext ("libc", msgid, LC_MESSAGES)
-# endif
-# else
-# define gettext(msgid) (msgid)
-# endif
-
-# ifndef gettext_noop
-/* This define is so xgettext can find the internationalizable
- strings. */
-# define gettext_noop(String) String
-# endif
-
-/* The `emacs' switch turns on certain matching commands
- that make sense only in Emacs. */
-# ifdef emacs
-
-# include "lisp.h"
-# include "buffer.h"
-# include "syntax.h"
-
-# else /* not emacs */
-
-/* If we are not linking with Emacs proper,
- we can't use the relocating allocator
- even if config.h says that we can. */
-# undef REL_ALLOC
-
-# if defined STDC_HEADERS || defined _LIBC
-# include <stdlib.h>
-# else
-char *malloc ();
-char *realloc ();
-# endif
-
-/* When used in Emacs's lib-src, we need to get bzero and bcopy somehow.
- If nothing else has been done, use the method below. */
-# ifdef INHIBIT_STRING_HEADER
-# if !(defined HAVE_BZERO && defined HAVE_BCOPY)
-# if !defined bzero && !defined bcopy
-# undef INHIBIT_STRING_HEADER
-# endif
-# endif
-# endif
-
-/* This is the normal way of making sure we have a bcopy and a bzero.
- This is used in most programs--a few other programs avoid this
- by defining INHIBIT_STRING_HEADER. */
-# ifndef INHIBIT_STRING_HEADER
-# if defined HAVE_STRING_H || defined STDC_HEADERS || defined _LIBC
-# include <string.h>
-# ifndef bzero
-# ifndef _LIBC
-# define bzero(s, n) (memset (s, '\0', n), (s))
-# else
-# define bzero(s, n) __bzero (s, n)
-# endif
-# endif
-# else
-# include <strings.h>
-# ifndef memcmp
-# define memcmp(s1, s2, n) bcmp (s1, s2, n)
-# endif
-# ifndef memcpy
-# define memcpy(d, s, n) (bcopy (s, d, n), (d))
-# endif
-# endif
-# endif
-
-/* Define the syntax stuff for \<, \>, etc. */
-
-/* This must be nonzero for the wordchar and notwordchar pattern
- commands in re_match_2. */
-# ifndef Sword
-# define Sword 1
-# endif
-
-# ifdef SWITCH_ENUM_BUG
-# define SWITCH_ENUM_CAST(x) ((int)(x))
-# else
-# define SWITCH_ENUM_CAST(x) (x)
-# endif
-
-# endif /* not emacs */
-
-# if defined _LIBC || HAVE_LIMITS_H
-# include <limits.h>
-# endif
-
-# ifndef MB_LEN_MAX
-# define MB_LEN_MAX 1
-# endif
-
-/* Get the interface, including the syntax bits. */
-# include "xregex.h" /* change for libiberty */
-
-/* isalpha etc. are used for the character classes. */
-# include <ctype.h>
-
-/* Jim Meyering writes:
-
- "... Some ctype macros are valid only for character codes that
- isascii says are ASCII (SGI's IRIX-4.0.5 is one such system --when
- using /bin/cc or gcc but without giving an ansi option). So, all
- ctype uses should be through macros like ISPRINT... If
- STDC_HEADERS is defined, then autoconf has verified that the ctype
- macros don't need to be guarded with references to isascii. ...
- Defining isascii to 1 should let any compiler worth its salt
- eliminate the && through constant folding."
- Solaris defines some of these symbols so we must undefine them first. */
-
-# undef ISASCII
-# if defined STDC_HEADERS || (!defined isascii && !defined HAVE_ISASCII)
-# define ISASCII(c) 1
-# else
-# define ISASCII(c) isascii(c)
-# endif
-
-# ifdef isblank
-# define ISBLANK(c) (ISASCII (c) && isblank (c))
-# else
-# define ISBLANK(c) ((c) == ' ' || (c) == '\t')
-# endif
-# ifdef isgraph
-# define ISGRAPH(c) (ISASCII (c) && isgraph (c))
-# else
-# define ISGRAPH(c) (ISASCII (c) && isprint (c) && !isspace (c))
-# endif
-
-# undef ISPRINT
-# define ISPRINT(c) (ISASCII (c) && isprint (c))
-# define ISDIGIT(c) (ISASCII (c) && isdigit (c))
-# define ISALNUM(c) (ISASCII (c) && isalnum (c))
-# define ISALPHA(c) (ISASCII (c) && isalpha (c))
-# define ISCNTRL(c) (ISASCII (c) && iscntrl (c))
-# define ISLOWER(c) (ISASCII (c) && islower (c))
-# define ISPUNCT(c) (ISASCII (c) && ispunct (c))
-# define ISSPACE(c) (ISASCII (c) && isspace (c))
-# define ISUPPER(c) (ISASCII (c) && isupper (c))
-# define ISXDIGIT(c) (ISASCII (c) && isxdigit (c))
-
-# ifdef _tolower
-# define TOLOWER(c) _tolower(c)
-# else
-# define TOLOWER(c) tolower(c)
-# endif
-
-# ifndef NULL
-# define NULL (void *)0
-# endif
-
-/* We remove any previous definition of `SIGN_EXTEND_CHAR',
- since ours (we hope) works properly with all combinations of
- machines, compilers, `char' and `unsigned char' argument types.
- (Per Bothner suggested the basic approach.) */
-# undef SIGN_EXTEND_CHAR
-# if __STDC__
-# define SIGN_EXTEND_CHAR(c) ((signed char) (c))
-# else /* not __STDC__ */
-/* As in Harbison and Steele. */
-# define SIGN_EXTEND_CHAR(c) ((((unsigned char) (c)) ^ 128) - 128)
-# endif
-
-# ifndef emacs
-/* How many characters in the character set. */
-# define CHAR_SET_SIZE 256
-
-# ifdef SYNTAX_TABLE
-
-extern char *re_syntax_table;
-
-# else /* not SYNTAX_TABLE */
-
-static char re_syntax_table[CHAR_SET_SIZE];
-
-static void init_syntax_once PARAMS ((void));
-
-static void
-init_syntax_once ()
-{
- register int c;
- static int done = 0;
-
- if (done)
- return;
- bzero (re_syntax_table, sizeof re_syntax_table);
-
- for (c = 0; c < CHAR_SET_SIZE; ++c)
- if (ISALNUM (c))
- re_syntax_table[c] = Sword;
-
- re_syntax_table['_'] = Sword;
-
- done = 1;
-}
-
-# endif /* not SYNTAX_TABLE */
-
-# define SYNTAX(c) re_syntax_table[(unsigned char) (c)]
-
-# endif /* emacs */
-
-/* Integer type for pointers. */
-# if !defined _LIBC && !defined HAVE_UINTPTR_T
-typedef unsigned long int uintptr_t;
-# endif
-
-/* Should we use malloc or alloca? If REGEX_MALLOC is not defined, we
- use `alloca' instead of `malloc'. This is because using malloc in
- re_search* or re_match* could cause memory leaks when C-g is used in
- Emacs; also, malloc is slower and causes storage fragmentation. On
- the other hand, malloc is more portable, and easier to debug.
-
- Because we sometimes use alloca, some routines have to be macros,
- not functions -- `alloca'-allocated space disappears at the end of the
- function it is called in. */
-
-# ifdef REGEX_MALLOC
-
-# define REGEX_ALLOCATE malloc
-# define REGEX_REALLOCATE(source, osize, nsize) realloc (source, nsize)
-# define REGEX_FREE free
-
-# else /* not REGEX_MALLOC */
-
-/* Emacs already defines alloca, sometimes. */
-# ifndef alloca
-
-/* Make alloca work the best possible way. */
-# ifdef __GNUC__
-# define alloca __builtin_alloca
-# else /* not __GNUC__ */
-# if HAVE_ALLOCA_H
-# include <alloca.h>
-# endif /* HAVE_ALLOCA_H */
-# endif /* not __GNUC__ */
-
-# endif /* not alloca */
-
-# define REGEX_ALLOCATE alloca
-
-/* Assumes a `char *destination' variable. */
-# define REGEX_REALLOCATE(source, osize, nsize) \
- (destination = (char *) alloca (nsize), \
- memcpy (destination, source, osize))
-
-/* No need to do anything to free, after alloca. */
-# define REGEX_FREE(arg) ((void)0) /* Do nothing! But inhibit gcc warning. */
-
-# endif /* not REGEX_MALLOC */
-
-/* Define how to allocate the failure stack. */
-
-# if defined REL_ALLOC && defined REGEX_MALLOC
-
-# define REGEX_ALLOCATE_STACK(size) \
- r_alloc (&failure_stack_ptr, (size))
-# define REGEX_REALLOCATE_STACK(source, osize, nsize) \
- r_re_alloc (&failure_stack_ptr, (nsize))
-# define REGEX_FREE_STACK(ptr) \
- r_alloc_free (&failure_stack_ptr)
-
-# else /* not using relocating allocator */
-
-# ifdef REGEX_MALLOC
-
-# define REGEX_ALLOCATE_STACK malloc
-# define REGEX_REALLOCATE_STACK(source, osize, nsize) realloc (source, nsize)
-# define REGEX_FREE_STACK free
-
-# else /* not REGEX_MALLOC */
-
-# define REGEX_ALLOCATE_STACK alloca
-
-# define REGEX_REALLOCATE_STACK(source, osize, nsize) \
- REGEX_REALLOCATE (source, osize, nsize)
-/* No need to explicitly free anything. */
-# define REGEX_FREE_STACK(arg)
-
-# endif /* not REGEX_MALLOC */
-# endif /* not using relocating allocator */
-
-
-/* True if `size1' is non-NULL and PTR is pointing anywhere inside
- `string1' or just past its end. This works if PTR is NULL, which is
- a good thing. */
-# define FIRST_STRING_P(ptr) \
- (size1 && string1 <= (ptr) && (ptr) <= string1 + size1)
-
-/* (Re)Allocate N items of type T using malloc, or fail. */
-# define TALLOC(n, t) ((t *) malloc ((n) * sizeof (t)))
-# define RETALLOC(addr, n, t) ((addr) = (t *) realloc (addr, (n) * sizeof (t)))
-# define RETALLOC_IF(addr, n, t) \
- if (addr) RETALLOC((addr), (n), t); else (addr) = TALLOC ((n), t)
-# define REGEX_TALLOC(n, t) ((t *) REGEX_ALLOCATE ((n) * sizeof (t)))
-
-# define BYTEWIDTH 8 /* In bits. */
-
-# define STREQ(s1, s2) ((strcmp (s1, s2) == 0))
-
-# undef MAX
-# undef MIN
-# define MAX(a, b) ((a) > (b) ? (a) : (b))
-# define MIN(a, b) ((a) < (b) ? (a) : (b))
-
-typedef char boolean;
-# define false 0
-# define true 1
-
-static reg_errcode_t byte_regex_compile _RE_ARGS ((const char *pattern, size_t size,
- reg_syntax_t syntax,
- struct re_pattern_buffer *bufp));
-
-static int byte_re_match_2_internal PARAMS ((struct re_pattern_buffer *bufp,
- const char *string1, int size1,
- const char *string2, int size2,
- int pos,
- struct re_registers *regs,
- int stop));
-static int byte_re_search_2 PARAMS ((struct re_pattern_buffer *bufp,
- const char *string1, int size1,
- const char *string2, int size2,
- int startpos, int range,
- struct re_registers *regs, int stop));
-static int byte_re_compile_fastmap PARAMS ((struct re_pattern_buffer *bufp));
-
-#ifdef MBS_SUPPORT
-static reg_errcode_t wcs_regex_compile _RE_ARGS ((const char *pattern, size_t size,
- reg_syntax_t syntax,
- struct re_pattern_buffer *bufp));
-
-
-static int wcs_re_match_2_internal PARAMS ((struct re_pattern_buffer *bufp,
- const char *cstring1, int csize1,
- const char *cstring2, int csize2,
- int pos,
- struct re_registers *regs,
- int stop,
- wchar_t *string1, int size1,
- wchar_t *string2, int size2,
- int *mbs_offset1, int *mbs_offset2));
-static int wcs_re_search_2 PARAMS ((struct re_pattern_buffer *bufp,
- const char *string1, int size1,
- const char *string2, int size2,
- int startpos, int range,
- struct re_registers *regs, int stop));
-static int wcs_re_compile_fastmap PARAMS ((struct re_pattern_buffer *bufp));
-#endif
-
-/* These are the command codes that appear in compiled regular
- expressions. Some opcodes are followed by argument bytes. A
- command code can specify any interpretation whatsoever for its
- arguments. Zero bytes may appear in the compiled regular expression. */
-
-typedef enum
-{
- no_op = 0,
-
- /* Succeed right away--no more backtracking. */
- succeed,
-
- /* Followed by one byte giving n, then by n literal bytes. */
- exactn,
-
-# ifdef MBS_SUPPORT
- /* Same as exactn, but contains binary data. */
- exactn_bin,
-# endif
-
- /* Matches any (more or less) character. */
- anychar,
-
- /* Matches any one char belonging to specified set. First
- following byte is number of bitmap bytes. Then come bytes
- for a bitmap saying which chars are in. Bits in each byte
- are ordered low-bit-first. A character is in the set if its
- bit is 1. A character too large to have a bit in the map is
- automatically not in the set. */
- /* ifdef MBS_SUPPORT, following element is length of character
- classes, length of collating symbols, length of equivalence
- classes, length of character ranges, and length of characters.
- Next, character class element, collating symbols elements,
- equivalence class elements, range elements, and character
- elements follow.
- See regex_compile function. */
- charset,
-
- /* Same parameters as charset, but match any character that is
- not one of those specified. */
- charset_not,
-
- /* Start remembering the text that is matched, for storing in a
- register. Followed by one byte with the register number, in
- the range 0 to one less than the pattern buffer's re_nsub
- field. Then followed by one byte with the number of groups
- inner to this one. (This last has to be part of the
- start_memory only because we need it in the on_failure_jump
- of re_match_2.) */
- start_memory,
-
- /* Stop remembering the text that is matched and store it in a
- memory register. Followed by one byte with the register
- number, in the range 0 to one less than `re_nsub' in the
- pattern buffer, and one byte with the number of inner groups,
- just like `start_memory'. (We need the number of inner
- groups here because we don't have any easy way of finding the
- corresponding start_memory when we're at a stop_memory.) */
- stop_memory,
-
- /* Match a duplicate of something remembered. Followed by one
- byte containing the register number. */
- duplicate,
-
- /* Fail unless at beginning of line. */
- begline,
-
- /* Fail unless at end of line. */
- endline,
-
- /* Succeeds if at beginning of buffer (if emacs) or at beginning
- of string to be matched (if not). */
- begbuf,
-
- /* Analogously, for end of buffer/string. */
- endbuf,
-
- /* Followed by two byte relative address to which to jump. */
- jump,
-
- /* Same as jump, but marks the end of an alternative. */
- jump_past_alt,
-
- /* Followed by two-byte relative address of place to resume at
- in case of failure. */
- /* ifdef MBS_SUPPORT, the size of address is 1. */
- on_failure_jump,
-
- /* Like on_failure_jump, but pushes a placeholder instead of the
- current string position when executed. */
- on_failure_keep_string_jump,
-
- /* Throw away latest failure point and then jump to following
- two-byte relative address. */
- /* ifdef MBS_SUPPORT, the size of address is 1. */
- pop_failure_jump,
-
- /* Change to pop_failure_jump if know won't have to backtrack to
- match; otherwise change to jump. This is used to jump
- back to the beginning of a repeat. If what follows this jump
- clearly won't match what the repeat does, such that we can be
- sure that there is no use backtracking out of repetitions
- already matched, then we change it to a pop_failure_jump.
- Followed by two-byte address. */
- /* ifdef MBS_SUPPORT, the size of address is 1. */
- maybe_pop_jump,
-
- /* Jump to following two-byte address, and push a dummy failure
- point. This failure point will be thrown away if an attempt
- is made to use it for a failure. A `+' construct makes this
- before the first repeat. Also used as an intermediary kind
- of jump when compiling an alternative. */
- /* ifdef MBS_SUPPORT, the size of address is 1. */
- dummy_failure_jump,
-
- /* Push a dummy failure point and continue. Used at the end of
- alternatives. */
- push_dummy_failure,
-
- /* Followed by two-byte relative address and two-byte number n.
- After matching N times, jump to the address upon failure. */
- /* ifdef MBS_SUPPORT, the size of address is 1. */
- succeed_n,
-
- /* Followed by two-byte relative address, and two-byte number n.
- Jump to the address N times, then fail. */
- /* ifdef MBS_SUPPORT, the size of address is 1. */
- jump_n,
-
- /* Set the following two-byte relative address to the
- subsequent two-byte number. The address *includes* the two
- bytes of number. */
- /* ifdef MBS_SUPPORT, the size of address is 1. */
- set_number_at,
-
- wordchar, /* Matches any word-constituent character. */
- notwordchar, /* Matches any char that is not a word-constituent. */
-
- wordbeg, /* Succeeds if at word beginning. */
- wordend, /* Succeeds if at word end. */
-
- wordbound, /* Succeeds if at a word boundary. */
- notwordbound /* Succeeds if not at a word boundary. */
-
-# ifdef emacs
- ,before_dot, /* Succeeds if before point. */
- at_dot, /* Succeeds if at point. */
- after_dot, /* Succeeds if after point. */
-
- /* Matches any character whose syntax is specified. Followed by
- a byte which contains a syntax code, e.g., Sword. */
- syntaxspec,
-
- /* Matches any character whose syntax is not that specified. */
- notsyntaxspec
-# endif /* emacs */
-} re_opcode_t;
-#endif /* not INSIDE_RECURSION */
-
-
-#ifdef BYTE
-# define CHAR_T char
-# define UCHAR_T unsigned char
-# define COMPILED_BUFFER_VAR bufp->buffer
-# define OFFSET_ADDRESS_SIZE 2
-# if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
-# define PREFIX(name) byte_##name
-# else
-# define PREFIX(name) byte_/**/name
-# endif
-# define ARG_PREFIX(name) name
-# define PUT_CHAR(c) putchar (c)
-#else
-# ifdef WCHAR
-# define CHAR_T wchar_t
-# define UCHAR_T wchar_t
-# define COMPILED_BUFFER_VAR wc_buffer
-# define OFFSET_ADDRESS_SIZE 1 /* the size which STORE_NUMBER macro use */
-# define CHAR_CLASS_SIZE ((__alignof__(wctype_t)+sizeof(wctype_t))/sizeof(CHAR_T)+1)
-# if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
-# define PREFIX(name) wcs_##name
-# define ARG_PREFIX(name) c##name
-# else
-# define PREFIX(name) wcs_/**/name
-# define ARG_PREFIX(name) c/**/name
-# endif
-/* Should we use wide stream?? */
-# define PUT_CHAR(c) printf ("%C", c);
-# define TRUE 1
-# define FALSE 0
-# else
-# ifdef MBS_SUPPORT
-# define WCHAR
-# define INSIDE_RECURSION
-# include "regex.c"
-# undef INSIDE_RECURSION
-# endif
-# define BYTE
-# define INSIDE_RECURSION
-# include "regex.c"
-# undef INSIDE_RECURSION
-# endif
-#endif
-
-#ifdef INSIDE_RECURSION
-/* Common operations on the compiled pattern. */
-
-/* Store NUMBER in two contiguous bytes starting at DESTINATION. */
-/* ifdef MBS_SUPPORT, we store NUMBER in 1 element. */
-
-# ifdef WCHAR
-# define STORE_NUMBER(destination, number) \
- do { \
- *(destination) = (UCHAR_T)(number); \
- } while (0)
-# else /* BYTE */
-# define STORE_NUMBER(destination, number) \
- do { \
- (destination)[0] = (number) & 0377; \
- (destination)[1] = (number) >> 8; \
- } while (0)
-# endif /* WCHAR */
-
-/* Same as STORE_NUMBER, except increment DESTINATION to
- the byte after where the number is stored. Therefore, DESTINATION
- must be an lvalue. */
-/* ifdef MBS_SUPPORT, we store NUMBER in 1 element. */
-
-# define STORE_NUMBER_AND_INCR(destination, number) \
- do { \
- STORE_NUMBER (destination, number); \
- (destination) += OFFSET_ADDRESS_SIZE; \
- } while (0)
-
-/* Put into DESTINATION a number stored in two contiguous bytes starting
- at SOURCE. */
-/* ifdef MBS_SUPPORT, we store NUMBER in 1 element. */
-
-# ifdef WCHAR
-# define EXTRACT_NUMBER(destination, source) \
- do { \
- (destination) = *(source); \
- } while (0)
-# else /* BYTE */
-# define EXTRACT_NUMBER(destination, source) \
- do { \
- (destination) = *(source) & 0377; \
- (destination) += SIGN_EXTEND_CHAR (*((source) + 1)) << 8; \
- } while (0)
-# endif
-
-# ifdef DEBUG
-static void PREFIX(extract_number) _RE_ARGS ((int *dest, UCHAR_T *source));
-static void
-PREFIX(extract_number) (dest, source)
- int *dest;
- UCHAR_T *source;
-{
-# ifdef WCHAR
- *dest = *source;
-# else /* BYTE */
- int temp = SIGN_EXTEND_CHAR (*(source + 1));
- *dest = *source & 0377;
- *dest += temp << 8;
-# endif
-}
-
-# ifndef EXTRACT_MACROS /* To debug the macros. */
-# undef EXTRACT_NUMBER
-# define EXTRACT_NUMBER(dest, src) PREFIX(extract_number) (&dest, src)
-# endif /* not EXTRACT_MACROS */
-
-# endif /* DEBUG */
-
-/* Same as EXTRACT_NUMBER, except increment SOURCE to after the number.
- SOURCE must be an lvalue. */
-
-# define EXTRACT_NUMBER_AND_INCR(destination, source) \
- do { \
- EXTRACT_NUMBER (destination, source); \
- (source) += OFFSET_ADDRESS_SIZE; \
- } while (0)
-
-# ifdef DEBUG
-static void PREFIX(extract_number_and_incr) _RE_ARGS ((int *destination,
- UCHAR_T **source));
-static void
-PREFIX(extract_number_and_incr) (destination, source)
- int *destination;
- UCHAR_T **source;
-{
- PREFIX(extract_number) (destination, *source);
- *source += OFFSET_ADDRESS_SIZE;
-}
-
-# ifndef EXTRACT_MACROS
-# undef EXTRACT_NUMBER_AND_INCR
-# define EXTRACT_NUMBER_AND_INCR(dest, src) \
- PREFIX(extract_number_and_incr) (&dest, &src)
-# endif /* not EXTRACT_MACROS */
-
-# endif /* DEBUG */
-
-
-
-/* If DEBUG is defined, Regex prints many voluminous messages about what
- it is doing (if the variable `debug' is nonzero). If linked with the
- main program in `iregex.c', you can enter patterns and strings
- interactively. And if linked with the main program in `main.c' and
- the other test files, you can run the already-written tests. */
-
-# ifdef DEBUG
-
-# ifndef DEFINED_ONCE
-
-/* We use standard I/O for debugging. */
-# include <stdio.h>
-
-/* It is useful to test things that ``must'' be true when debugging. */
-# include <assert.h>
-
-static int debug;
-
-# define DEBUG_STATEMENT(e) e
-# define DEBUG_PRINT1(x) if (debug) printf (x)
-# define DEBUG_PRINT2(x1, x2) if (debug) printf (x1, x2)
-# define DEBUG_PRINT3(x1, x2, x3) if (debug) printf (x1, x2, x3)
-# define DEBUG_PRINT4(x1, x2, x3, x4) if (debug) printf (x1, x2, x3, x4)
-# endif /* not DEFINED_ONCE */
-
-# define DEBUG_PRINT_COMPILED_PATTERN(p, s, e) \
- if (debug) PREFIX(print_partial_compiled_pattern) (s, e)
-# define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2) \
- if (debug) PREFIX(print_double_string) (w, s1, sz1, s2, sz2)
-
-
-/* Print the fastmap in human-readable form. */
-
-# ifndef DEFINED_ONCE
-void
-print_fastmap (fastmap)
- char *fastmap;
-{
- unsigned was_a_range = 0;
- unsigned i = 0;
-
- while (i < (1 << BYTEWIDTH))
- {
- if (fastmap[i++])
- {
- was_a_range = 0;
- putchar (i - 1);
- while (i < (1 << BYTEWIDTH) && fastmap[i])
- {
- was_a_range = 1;
- i++;
- }
- if (was_a_range)
- {
- printf ("-");
- putchar (i - 1);
- }
- }
- }
- putchar ('\n');
-}
-# endif /* not DEFINED_ONCE */
-
-
-/* Print a compiled pattern string in human-readable form, starting at
- the START pointer into it and ending just before the pointer END. */
-
-void
-PREFIX(print_partial_compiled_pattern) (start, end)
- UCHAR_T *start;
- UCHAR_T *end;
-{
- int mcnt, mcnt2;
- UCHAR_T *p1;
- UCHAR_T *p = start;
- UCHAR_T *pend = end;
-
- if (start == NULL)
- {
- printf ("(null)\n");
- return;
- }
-
- /* Loop over pattern commands. */
- while (p < pend)
- {
-# ifdef _LIBC
- printf ("%td:\t", p - start);
-# else
- printf ("%ld:\t", (long int) (p - start));
-# endif
-
- switch ((re_opcode_t) *p++)
- {
- case no_op:
- printf ("/no_op");
- break;
-
- case exactn:
- mcnt = *p++;
- printf ("/exactn/%d", mcnt);
- do
- {
- putchar ('/');
- PUT_CHAR (*p++);
- }
- while (--mcnt);
- break;
-
-# ifdef MBS_SUPPORT
- case exactn_bin:
- mcnt = *p++;
- printf ("/exactn_bin/%d", mcnt);
- do
- {
- printf("/%lx", (long int) *p++);
- }
- while (--mcnt);
- break;
-# endif /* MBS_SUPPORT */
-
- case start_memory:
- mcnt = *p++;
- printf ("/start_memory/%d/%ld", mcnt, (long int) *p++);
- break;
-
- case stop_memory:
- mcnt = *p++;
- printf ("/stop_memory/%d/%ld", mcnt, (long int) *p++);
- break;
-
- case duplicate:
- printf ("/duplicate/%ld", (long int) *p++);
- break;
-
- case anychar:
- printf ("/anychar");
- break;
-
- case charset:
- case charset_not:
- {
-# ifdef WCHAR
- int i, length;
- wchar_t *workp = p;
- printf ("/charset [%s",
- (re_opcode_t) *(workp - 1) == charset_not ? "^" : "");
- p += 5;
- length = *workp++; /* the length of char_classes */
- for (i=0 ; i<length ; i++)
- printf("[:%lx:]", (long int) *p++);
- length = *workp++; /* the length of collating_symbol */
- for (i=0 ; i<length ;)
- {
- printf("[.");
- while(*p != 0)
- PUT_CHAR((i++,*p++));
- i++,p++;
- printf(".]");
- }
- length = *workp++; /* the length of equivalence_class */
- for (i=0 ; i<length ;)
- {
- printf("[=");
- while(*p != 0)
- PUT_CHAR((i++,*p++));
- i++,p++;
- printf("=]");
- }
- length = *workp++; /* the length of char_range */
- for (i=0 ; i<length ; i++)
- {
- wchar_t range_start = *p++;
- wchar_t range_end = *p++;
- printf("%C-%C", range_start, range_end);
- }
- length = *workp++; /* the length of char */
- for (i=0 ; i<length ; i++)
- printf("%C", *p++);
- putchar (']');
-# else
- register int c, last = -100;
- register int in_range = 0;
-
- printf ("/charset [%s",
- (re_opcode_t) *(p - 1) == charset_not ? "^" : "");
-
- assert (p + *p < pend);
-
- for (c = 0; c < 256; c++)
- if (c / 8 < *p
- && (p[1 + (c/8)] & (1 << (c % 8))))
- {
- /* Are we starting a range? */
- if (last + 1 == c && ! in_range)
- {
- putchar ('-');
- in_range = 1;
- }
- /* Have we broken a range? */
- else if (last + 1 != c && in_range)
- {
- putchar (last);
- in_range = 0;
- }
-
- if (! in_range)
- putchar (c);
-
- last = c;
- }
-
- if (in_range)
- putchar (last);
-
- putchar (']');
-
- p += 1 + *p;
-# endif /* WCHAR */
- }
- break;
-
- case begline:
- printf ("/begline");
- break;
-
- case endline:
- printf ("/endline");
- break;
-
- case on_failure_jump:
- PREFIX(extract_number_and_incr) (&mcnt, &p);
-# ifdef _LIBC
- printf ("/on_failure_jump to %td", p + mcnt - start);
-# else
- printf ("/on_failure_jump to %ld", (long int) (p + mcnt - start));
-# endif
- break;
-
- case on_failure_keep_string_jump:
- PREFIX(extract_number_and_incr) (&mcnt, &p);
-# ifdef _LIBC
- printf ("/on_failure_keep_string_jump to %td", p + mcnt - start);
-# else
- printf ("/on_failure_keep_string_jump to %ld",
- (long int) (p + mcnt - start));
-# endif
- break;
-
- case dummy_failure_jump:
- PREFIX(extract_number_and_incr) (&mcnt, &p);
-# ifdef _LIBC
- printf ("/dummy_failure_jump to %td", p + mcnt - start);
-# else
- printf ("/dummy_failure_jump to %ld", (long int) (p + mcnt - start));
-# endif
- break;
-
- case push_dummy_failure:
- printf ("/push_dummy_failure");
- break;
-
- case maybe_pop_jump:
- PREFIX(extract_number_and_incr) (&mcnt, &p);
-# ifdef _LIBC
- printf ("/maybe_pop_jump to %td", p + mcnt - start);
-# else
- printf ("/maybe_pop_jump to %ld", (long int) (p + mcnt - start));
-# endif
- break;
-
- case pop_failure_jump:
- PREFIX(extract_number_and_incr) (&mcnt, &p);
-# ifdef _LIBC
- printf ("/pop_failure_jump to %td", p + mcnt - start);
-# else
- printf ("/pop_failure_jump to %ld", (long int) (p + mcnt - start));
-# endif
- break;
-
- case jump_past_alt:
- PREFIX(extract_number_and_incr) (&mcnt, &p);
-# ifdef _LIBC
- printf ("/jump_past_alt to %td", p + mcnt - start);
-# else
- printf ("/jump_past_alt to %ld", (long int) (p + mcnt - start));
-# endif
- break;
-
- case jump:
- PREFIX(extract_number_and_incr) (&mcnt, &p);
-# ifdef _LIBC
- printf ("/jump to %td", p + mcnt - start);
-# else
- printf ("/jump to %ld", (long int) (p + mcnt - start));
-# endif
- break;
-
- case succeed_n:
- PREFIX(extract_number_and_incr) (&mcnt, &p);
- p1 = p + mcnt;
- PREFIX(extract_number_and_incr) (&mcnt2, &p);
-# ifdef _LIBC
- printf ("/succeed_n to %td, %d times", p1 - start, mcnt2);
-# else
- printf ("/succeed_n to %ld, %d times",
- (long int) (p1 - start), mcnt2);
-# endif
- break;
-
- case jump_n:
- PREFIX(extract_number_and_incr) (&mcnt, &p);
- p1 = p + mcnt;
- PREFIX(extract_number_and_incr) (&mcnt2, &p);
- printf ("/jump_n to %d, %d times", p1 - start, mcnt2);
- break;
-
- case set_number_at:
- PREFIX(extract_number_and_incr) (&mcnt, &p);
- p1 = p + mcnt;
- PREFIX(extract_number_and_incr) (&mcnt2, &p);
-# ifdef _LIBC
- printf ("/set_number_at location %td to %d", p1 - start, mcnt2);
-# else
- printf ("/set_number_at location %ld to %d",
- (long int) (p1 - start), mcnt2);
-# endif
- break;
-
- case wordbound:
- printf ("/wordbound");
- break;
-
- case notwordbound:
- printf ("/notwordbound");
- break;
-
- case wordbeg:
- printf ("/wordbeg");
- break;
-
- case wordend:
- printf ("/wordend");
- break;
-
-# ifdef emacs
- case before_dot:
- printf ("/before_dot");
- break;
-
- case at_dot:
- printf ("/at_dot");
- break;
-
- case after_dot:
- printf ("/after_dot");
- break;
-
- case syntaxspec:
- printf ("/syntaxspec");
- mcnt = *p++;
- printf ("/%d", mcnt);
- break;
-
- case notsyntaxspec:
- printf ("/notsyntaxspec");
- mcnt = *p++;
- printf ("/%d", mcnt);
- break;
-# endif /* emacs */
-
- case wordchar:
- printf ("/wordchar");
- break;
-
- case notwordchar:
- printf ("/notwordchar");
- break;
-
- case begbuf:
- printf ("/begbuf");
- break;
-
- case endbuf:
- printf ("/endbuf");
- break;
-
- default:
- printf ("?%ld", (long int) *(p-1));
- }
-
- putchar ('\n');
- }
-
-# ifdef _LIBC
- printf ("%td:\tend of pattern.\n", p - start);
-# else
- printf ("%ld:\tend of pattern.\n", (long int) (p - start));
-# endif
-}
-
-
-void
-PREFIX(print_compiled_pattern) (bufp)
- struct re_pattern_buffer *bufp;
-{
- UCHAR_T *buffer = (UCHAR_T*) bufp->buffer;
-
- PREFIX(print_partial_compiled_pattern) (buffer, buffer
- + bufp->used / sizeof(UCHAR_T));
- printf ("%ld bytes used/%ld bytes allocated.\n",
- bufp->used, bufp->allocated);
-
- if (bufp->fastmap_accurate && bufp->fastmap)
- {
- printf ("fastmap: ");
- print_fastmap (bufp->fastmap);
- }
-
-# ifdef _LIBC
- printf ("re_nsub: %Zd\t", bufp->re_nsub);
-# else
- printf ("re_nsub: %ld\t", (long int) bufp->re_nsub);
-# endif
- printf ("regs_alloc: %d\t", bufp->regs_allocated);
- printf ("can_be_null: %d\t", bufp->can_be_null);
- printf ("newline_anchor: %d\n", bufp->newline_anchor);
- printf ("no_sub: %d\t", bufp->no_sub);
- printf ("not_bol: %d\t", bufp->not_bol);
- printf ("not_eol: %d\t", bufp->not_eol);
- printf ("syntax: %lx\n", bufp->syntax);
- /* Perhaps we should print the translate table? */
-}
-
-
-void
-PREFIX(print_double_string) (where, string1, size1, string2, size2)
- const CHAR_T *where;
- const CHAR_T *string1;
- const CHAR_T *string2;
- int size1;
- int size2;
-{
- int this_char;
-
- if (where == NULL)
- printf ("(null)");
- else
- {
- int cnt;
-
- if (FIRST_STRING_P (where))
- {
- for (this_char = where - string1; this_char < size1; this_char++)
- PUT_CHAR (string1[this_char]);
-
- where = string2;
- }
-
- cnt = 0;
- for (this_char = where - string2; this_char < size2; this_char++)
- {
- PUT_CHAR (string2[this_char]);
- if (++cnt > 100)
- {
- fputs ("...", stdout);
- break;
- }
- }
- }
-}
-
-# ifndef DEFINED_ONCE
-void
-printchar (c)
- int c;
-{
- putc (c, stderr);
-}
-# endif
-
-# else /* not DEBUG */
-
-# ifndef DEFINED_ONCE
-# undef assert
-# define assert(e)
-
-# define DEBUG_STATEMENT(e)
-# define DEBUG_PRINT1(x)
-# define DEBUG_PRINT2(x1, x2)
-# define DEBUG_PRINT3(x1, x2, x3)
-# define DEBUG_PRINT4(x1, x2, x3, x4)
-# endif /* not DEFINED_ONCE */
-# define DEBUG_PRINT_COMPILED_PATTERN(p, s, e)
-# define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2)
-
-# endif /* not DEBUG */
-
-
-
-# ifdef WCHAR
-/* This convert a multibyte string to a wide character string.
- And write their correspondances to offset_buffer(see below)
- and write whether each wchar_t is binary data to is_binary.
- This assume invalid multibyte sequences as binary data.
- We assume offset_buffer and is_binary is already allocated
- enough space. */
-
-static size_t convert_mbs_to_wcs (CHAR_T *dest, const unsigned char* src,
- size_t len, int *offset_buffer,
- char *is_binary);
-static size_t
-convert_mbs_to_wcs (dest, src, len, offset_buffer, is_binary)
- CHAR_T *dest;
- const unsigned char* src;
- size_t len; /* the length of multibyte string. */
-
- /* It hold correspondances between src(char string) and
- dest(wchar_t string) for optimization.
- e.g. src = "xxxyzz"
- dest = {'X', 'Y', 'Z'}
- (each "xxx", "y" and "zz" represent one multibyte character
- corresponding to 'X', 'Y' and 'Z'.)
- offset_buffer = {0, 0+3("xxx"), 0+3+1("y"), 0+3+1+2("zz")}
- = {0, 3, 4, 6}
- */
- int *offset_buffer;
- char *is_binary;
-{
- wchar_t *pdest = dest;
- const unsigned char *psrc = src;
- size_t wc_count = 0;
-
- mbstate_t mbs;
- int i, consumed;
- size_t mb_remain = len;
- size_t mb_count = 0;
-
- /* Initialize the conversion state. */
- memset (&mbs, 0, sizeof (mbstate_t));
-
- offset_buffer[0] = 0;
- for( ; mb_remain > 0 ; ++wc_count, ++pdest, mb_remain -= consumed,
- psrc += consumed)
- {
-#ifdef _LIBC
- consumed = __mbrtowc (pdest, psrc, mb_remain, &mbs);
-#else
- consumed = mbrtowc (pdest, psrc, mb_remain, &mbs);
-#endif
-
- if (consumed <= 0)
- /* failed to convert. maybe src contains binary data.
- So we consume 1 byte manualy. */
- {
- *pdest = *psrc;
- consumed = 1;
- is_binary[wc_count] = TRUE;
- }
- else
- is_binary[wc_count] = FALSE;
- /* In sjis encoding, we use yen sign as escape character in
- place of reverse solidus. So we convert 0x5c(yen sign in
- sjis) to not 0xa5(yen sign in UCS2) but 0x5c(reverse
- solidus in UCS2). */
- if (consumed == 1 && (int) *psrc == 0x5c && (int) *pdest == 0xa5)
- *pdest = (wchar_t) *psrc;
-
- offset_buffer[wc_count + 1] = mb_count += consumed;
- }
-
- /* Fill remain of the buffer with sentinel. */
- for (i = wc_count + 1 ; i <= len ; i++)
- offset_buffer[i] = mb_count + 1;
-
- return wc_count;
-}
-
-# endif /* WCHAR */
-
-#else /* not INSIDE_RECURSION */
-
-/* Set by `re_set_syntax' to the current regexp syntax to recognize. Can
- also be assigned to arbitrarily: each pattern buffer stores its own
- syntax, so it can be changed between regex compilations. */
-/* This has no initializer because initialized variables in Emacs
- become read-only after dumping. */
-reg_syntax_t re_syntax_options;
-
-
-/* Specify the precise syntax of regexps for compilation. This provides
- for compatibility for various utilities which historically have
- different, incompatible syntaxes.
-
- The argument SYNTAX is a bit mask comprised of the various bits
- defined in regex.h. We return the old syntax. */
-
-reg_syntax_t
-re_set_syntax (syntax)
- reg_syntax_t syntax;
-{
- reg_syntax_t ret = re_syntax_options;
-
- re_syntax_options = syntax;
-# ifdef DEBUG
- if (syntax & RE_DEBUG)
- debug = 1;
- else if (debug) /* was on but now is not */
- debug = 0;
-# endif /* DEBUG */
- return ret;
-}
-# ifdef _LIBC
-weak_alias (__re_set_syntax, re_set_syntax)
-# endif
-
-/* This table gives an error message for each of the error codes listed
- in regex.h. Obviously the order here has to be same as there.
- POSIX doesn't require that we do anything for REG_NOERROR,
- but why not be nice? */
-
-static const char *re_error_msgid[] =
- {
- gettext_noop ("Success"), /* REG_NOERROR */
- gettext_noop ("No match"), /* REG_NOMATCH */
- gettext_noop ("Invalid regular expression"), /* REG_BADPAT */
- gettext_noop ("Invalid collation character"), /* REG_ECOLLATE */
- gettext_noop ("Invalid character class name"), /* REG_ECTYPE */
- gettext_noop ("Trailing backslash"), /* REG_EESCAPE */
- gettext_noop ("Invalid back reference"), /* REG_ESUBREG */
- gettext_noop ("Unmatched [ or [^"), /* REG_EBRACK */
- gettext_noop ("Unmatched ( or \\("), /* REG_EPAREN */
- gettext_noop ("Unmatched \\{"), /* REG_EBRACE */
- gettext_noop ("Invalid content of \\{\\}"), /* REG_BADBR */
- gettext_noop ("Invalid range end"), /* REG_ERANGE */
- gettext_noop ("Memory exhausted"), /* REG_ESPACE */
- gettext_noop ("Invalid preceding regular expression"), /* REG_BADRPT */
- gettext_noop ("Premature end of regular expression"), /* REG_EEND */
- gettext_noop ("Regular expression too big"), /* REG_ESIZE */
- gettext_noop ("Unmatched ) or \\)") /* REG_ERPAREN */
- };
-
-#endif /* INSIDE_RECURSION */
-
-#ifndef DEFINED_ONCE
-/* Avoiding alloca during matching, to placate r_alloc. */
-
-/* Define MATCH_MAY_ALLOCATE unless we need to make sure that the
- searching and matching functions should not call alloca. On some
- systems, alloca is implemented in terms of malloc, and if we're
- using the relocating allocator routines, then malloc could cause a
- relocation, which might (if the strings being searched are in the
- ralloc heap) shift the data out from underneath the regexp
- routines.
-
- Here's another reason to avoid allocation: Emacs
- processes input from X in a signal handler; processing X input may
- call malloc; if input arrives while a matching routine is calling
- malloc, then we're scrod. But Emacs can't just block input while
- calling matching routines; then we don't notice interrupts when
- they come in. So, Emacs blocks input around all regexp calls
- except the matching calls, which it leaves unprotected, in the
- faith that they will not malloc. */
-
-/* Normally, this is fine. */
-# define MATCH_MAY_ALLOCATE
-
-/* When using GNU C, we are not REALLY using the C alloca, no matter
- what config.h may say. So don't take precautions for it. */
-# ifdef __GNUC__
-# undef C_ALLOCA
-# endif
-
-/* The match routines may not allocate if (1) they would do it with malloc
- and (2) it's not safe for them to use malloc.
- Note that if REL_ALLOC is defined, matching would not use malloc for the
- failure stack, but we would still use it for the register vectors;
- so REL_ALLOC should not affect this. */
-# if (defined C_ALLOCA || defined REGEX_MALLOC) && defined emacs
-# undef MATCH_MAY_ALLOCATE
-# endif
-#endif /* not DEFINED_ONCE */
-
-#ifdef INSIDE_RECURSION
-/* Failure stack declarations and macros; both re_compile_fastmap and
- re_match_2 use a failure stack. These have to be macros because of
- REGEX_ALLOCATE_STACK. */
-
-
-/* Number of failure points for which to initially allocate space
- when matching. If this number is exceeded, we allocate more
- space, so it is not a hard limit. */
-# ifndef INIT_FAILURE_ALLOC
-# define INIT_FAILURE_ALLOC 5
-# endif
-
-/* Roughly the maximum number of failure points on the stack. Would be
- exactly that if always used MAX_FAILURE_ITEMS items each time we failed.
- This is a variable only so users of regex can assign to it; we never
- change it ourselves. */
-
-# ifdef INT_IS_16BIT
-
-# ifndef DEFINED_ONCE
-# if defined MATCH_MAY_ALLOCATE
-/* 4400 was enough to cause a crash on Alpha OSF/1,
- whose default stack limit is 2mb. */
-long int re_max_failures = 4000;
-# else
-long int re_max_failures = 2000;
-# endif
-# endif
-
-union PREFIX(fail_stack_elt)
-{
- UCHAR_T *pointer;
- long int integer;
-};
-
-typedef union PREFIX(fail_stack_elt) PREFIX(fail_stack_elt_t);
-
-typedef struct
-{
- PREFIX(fail_stack_elt_t) *stack;
- unsigned long int size;
- unsigned long int avail; /* Offset of next open position. */
-} PREFIX(fail_stack_type);
-
-# else /* not INT_IS_16BIT */
-
-# ifndef DEFINED_ONCE
-# if defined MATCH_MAY_ALLOCATE
-/* 4400 was enough to cause a crash on Alpha OSF/1,
- whose default stack limit is 2mb. */
-int re_max_failures = 4000;
-# else
-int re_max_failures = 2000;
-# endif
-# endif
-
-union PREFIX(fail_stack_elt)
-{
- UCHAR_T *pointer;
- int integer;
-};
-
-typedef union PREFIX(fail_stack_elt) PREFIX(fail_stack_elt_t);
-
-typedef struct
-{
- PREFIX(fail_stack_elt_t) *stack;
- unsigned size;
- unsigned avail; /* Offset of next open position. */
-} PREFIX(fail_stack_type);
-
-# endif /* INT_IS_16BIT */
-
-# ifndef DEFINED_ONCE
-# define FAIL_STACK_EMPTY() (fail_stack.avail == 0)
-# define FAIL_STACK_PTR_EMPTY() (fail_stack_ptr->avail == 0)
-# define FAIL_STACK_FULL() (fail_stack.avail == fail_stack.size)
-# endif
-
-
-/* Define macros to initialize and free the failure stack.
- Do `return -2' if the alloc fails. */
-
-# ifdef MATCH_MAY_ALLOCATE
-# define INIT_FAIL_STACK() \
- do { \
- fail_stack.stack = (PREFIX(fail_stack_elt_t) *) \
- REGEX_ALLOCATE_STACK (INIT_FAILURE_ALLOC * sizeof (PREFIX(fail_stack_elt_t))); \
- \
- if (fail_stack.stack == NULL) \
- return -2; \
- \
- fail_stack.size = INIT_FAILURE_ALLOC; \
- fail_stack.avail = 0; \
- } while (0)
-
-# define RESET_FAIL_STACK() REGEX_FREE_STACK (fail_stack.stack)
-# else
-# define INIT_FAIL_STACK() \
- do { \
- fail_stack.avail = 0; \
- } while (0)
-
-# define RESET_FAIL_STACK()
-# endif
-
-
-/* Double the size of FAIL_STACK, up to approximately `re_max_failures' items.
-
- Return 1 if succeeds, and 0 if either ran out of memory
- allocating space for it or it was already too large.
-
- REGEX_REALLOCATE_STACK requires `destination' be declared. */
-
-# define DOUBLE_FAIL_STACK(fail_stack) \
- ((fail_stack).size > (unsigned) (re_max_failures * MAX_FAILURE_ITEMS) \
- ? 0 \
- : ((fail_stack).stack = (PREFIX(fail_stack_elt_t) *) \
- REGEX_REALLOCATE_STACK ((fail_stack).stack, \
- (fail_stack).size * sizeof (PREFIX(fail_stack_elt_t)), \
- ((fail_stack).size << 1) * sizeof (PREFIX(fail_stack_elt_t))),\
- \
- (fail_stack).stack == NULL \
- ? 0 \
- : ((fail_stack).size <<= 1, \
- 1)))
-
-
-/* Push pointer POINTER on FAIL_STACK.
- Return 1 if was able to do so and 0 if ran out of memory allocating
- space to do so. */
-# define PUSH_PATTERN_OP(POINTER, FAIL_STACK) \
- ((FAIL_STACK_FULL () \
- && !DOUBLE_FAIL_STACK (FAIL_STACK)) \
- ? 0 \
- : ((FAIL_STACK).stack[(FAIL_STACK).avail++].pointer = POINTER, \
- 1))
-
-/* Push a pointer value onto the failure stack.
- Assumes the variable `fail_stack'. Probably should only
- be called from within `PUSH_FAILURE_POINT'. */
-# define PUSH_FAILURE_POINTER(item) \
- fail_stack.stack[fail_stack.avail++].pointer = (UCHAR_T *) (item)
-
-/* This pushes an integer-valued item onto the failure stack.
- Assumes the variable `fail_stack'. Probably should only
- be called from within `PUSH_FAILURE_POINT'. */
-# define PUSH_FAILURE_INT(item) \
- fail_stack.stack[fail_stack.avail++].integer = (item)
-
-/* Push a fail_stack_elt_t value onto the failure stack.
- Assumes the variable `fail_stack'. Probably should only
- be called from within `PUSH_FAILURE_POINT'. */
-# define PUSH_FAILURE_ELT(item) \
- fail_stack.stack[fail_stack.avail++] = (item)
-
-/* These three POP... operations complement the three PUSH... operations.
- All assume that `fail_stack' is nonempty. */
-# define POP_FAILURE_POINTER() fail_stack.stack[--fail_stack.avail].pointer
-# define POP_FAILURE_INT() fail_stack.stack[--fail_stack.avail].integer
-# define POP_FAILURE_ELT() fail_stack.stack[--fail_stack.avail]
-
-/* Used to omit pushing failure point id's when we're not debugging. */
-# ifdef DEBUG
-# define DEBUG_PUSH PUSH_FAILURE_INT
-# define DEBUG_POP(item_addr) *(item_addr) = POP_FAILURE_INT ()
-# else
-# define DEBUG_PUSH(item)
-# define DEBUG_POP(item_addr)
-# endif
-
-
-/* Push the information about the state we will need
- if we ever fail back to it.
-
- Requires variables fail_stack, regstart, regend, reg_info, and
- num_regs_pushed be declared. DOUBLE_FAIL_STACK requires `destination'
- be declared.
-
- Does `return FAILURE_CODE' if runs out of memory. */
-
-# define PUSH_FAILURE_POINT(pattern_place, string_place, failure_code) \
- do { \
- char *destination; \
- /* Must be int, so when we don't save any registers, the arithmetic \
- of 0 + -1 isn't done as unsigned. */ \
- /* Can't be int, since there is not a shred of a guarantee that int \
- is wide enough to hold a value of something to which pointer can \
- be assigned */ \
- active_reg_t this_reg; \
- \
- DEBUG_STATEMENT (failure_id++); \
- DEBUG_STATEMENT (nfailure_points_pushed++); \
- DEBUG_PRINT2 ("\nPUSH_FAILURE_POINT #%u:\n", failure_id); \
- DEBUG_PRINT2 (" Before push, next avail: %d\n", (fail_stack).avail);\
- DEBUG_PRINT2 (" size: %d\n", (fail_stack).size);\
- \
- DEBUG_PRINT2 (" slots needed: %ld\n", NUM_FAILURE_ITEMS); \
- DEBUG_PRINT2 (" available: %d\n", REMAINING_AVAIL_SLOTS); \
- \
- /* Ensure we have enough space allocated for what we will push. */ \
- while (REMAINING_AVAIL_SLOTS < NUM_FAILURE_ITEMS) \
- { \
- if (!DOUBLE_FAIL_STACK (fail_stack)) \
- return failure_code; \
- \
- DEBUG_PRINT2 ("\n Doubled stack; size now: %d\n", \
- (fail_stack).size); \
- DEBUG_PRINT2 (" slots available: %d\n", REMAINING_AVAIL_SLOTS);\
- } \
- \
- /* Push the info, starting with the registers. */ \
- DEBUG_PRINT1 ("\n"); \
- \
- if (1) \
- for (this_reg = lowest_active_reg; this_reg <= highest_active_reg; \
- this_reg++) \
- { \
- DEBUG_PRINT2 (" Pushing reg: %lu\n", this_reg); \
- DEBUG_STATEMENT (num_regs_pushed++); \
- \
- DEBUG_PRINT2 (" start: %p\n", regstart[this_reg]); \
- PUSH_FAILURE_POINTER (regstart[this_reg]); \
- \
- DEBUG_PRINT2 (" end: %p\n", regend[this_reg]); \
- PUSH_FAILURE_POINTER (regend[this_reg]); \
- \
- DEBUG_PRINT2 (" info: %p\n ", \
- reg_info[this_reg].word.pointer); \
- DEBUG_PRINT2 (" match_null=%d", \
- REG_MATCH_NULL_STRING_P (reg_info[this_reg])); \
- DEBUG_PRINT2 (" active=%d", IS_ACTIVE (reg_info[this_reg])); \
- DEBUG_PRINT2 (" matched_something=%d", \
- MATCHED_SOMETHING (reg_info[this_reg])); \
- DEBUG_PRINT2 (" ever_matched=%d", \
- EVER_MATCHED_SOMETHING (reg_info[this_reg])); \
- DEBUG_PRINT1 ("\n"); \
- PUSH_FAILURE_ELT (reg_info[this_reg].word); \
- } \
- \
- DEBUG_PRINT2 (" Pushing low active reg: %ld\n", lowest_active_reg);\
- PUSH_FAILURE_INT (lowest_active_reg); \
- \
- DEBUG_PRINT2 (" Pushing high active reg: %ld\n", highest_active_reg);\
- PUSH_FAILURE_INT (highest_active_reg); \
- \
- DEBUG_PRINT2 (" Pushing pattern %p:\n", pattern_place); \
- DEBUG_PRINT_COMPILED_PATTERN (bufp, pattern_place, pend); \
- PUSH_FAILURE_POINTER (pattern_place); \
- \
- DEBUG_PRINT2 (" Pushing string %p: `", string_place); \
- DEBUG_PRINT_DOUBLE_STRING (string_place, string1, size1, string2, \
- size2); \
- DEBUG_PRINT1 ("'\n"); \
- PUSH_FAILURE_POINTER (string_place); \
- \
- DEBUG_PRINT2 (" Pushing failure id: %u\n", failure_id); \
- DEBUG_PUSH (failure_id); \
- } while (0)
-
-# ifndef DEFINED_ONCE
-/* This is the number of items that are pushed and popped on the stack
- for each register. */
-# define NUM_REG_ITEMS 3
-
-/* Individual items aside from the registers. */
-# ifdef DEBUG
-# define NUM_NONREG_ITEMS 5 /* Includes failure point id. */
-# else
-# define NUM_NONREG_ITEMS 4
-# endif
-
-/* We push at most this many items on the stack. */
-/* We used to use (num_regs - 1), which is the number of registers
- this regexp will save; but that was changed to 5
- to avoid stack overflow for a regexp with lots of parens. */
-# define MAX_FAILURE_ITEMS (5 * NUM_REG_ITEMS + NUM_NONREG_ITEMS)
-
-/* We actually push this many items. */
-# define NUM_FAILURE_ITEMS \
- (((0 \
- ? 0 : highest_active_reg - lowest_active_reg + 1) \
- * NUM_REG_ITEMS) \
- + NUM_NONREG_ITEMS)
-
-/* How many items can still be added to the stack without overflowing it. */
-# define REMAINING_AVAIL_SLOTS ((fail_stack).size - (fail_stack).avail)
-# endif /* not DEFINED_ONCE */
-
-
-/* Pops what PUSH_FAIL_STACK pushes.
-
- We restore into the parameters, all of which should be lvalues:
- STR -- the saved data position.
- PAT -- the saved pattern position.
- LOW_REG, HIGH_REG -- the highest and lowest active registers.
- REGSTART, REGEND -- arrays of string positions.
- REG_INFO -- array of information about each subexpression.
-
- Also assumes the variables `fail_stack' and (if debugging), `bufp',
- `pend', `string1', `size1', `string2', and `size2'. */
-# define POP_FAILURE_POINT(str, pat, low_reg, high_reg, regstart, regend, reg_info)\
-{ \
- DEBUG_STATEMENT (unsigned failure_id;) \
- active_reg_t this_reg; \
- const UCHAR_T *string_temp; \
- \
- assert (!FAIL_STACK_EMPTY ()); \
- \
- /* Remove failure points and point to how many regs pushed. */ \
- DEBUG_PRINT1 ("POP_FAILURE_POINT:\n"); \
- DEBUG_PRINT2 (" Before pop, next avail: %d\n", fail_stack.avail); \
- DEBUG_PRINT2 (" size: %d\n", fail_stack.size); \
- \
- assert (fail_stack.avail >= NUM_NONREG_ITEMS); \
- \
- DEBUG_POP (&failure_id); \
- DEBUG_PRINT2 (" Popping failure id: %u\n", failure_id); \
- \
- /* If the saved string location is NULL, it came from an \
- on_failure_keep_string_jump opcode, and we want to throw away the \
- saved NULL, thus retaining our current position in the string. */ \
- string_temp = POP_FAILURE_POINTER (); \
- if (string_temp != NULL) \
- str = (const CHAR_T *) string_temp; \
- \
- DEBUG_PRINT2 (" Popping string %p: `", str); \
- DEBUG_PRINT_DOUBLE_STRING (str, string1, size1, string2, size2); \
- DEBUG_PRINT1 ("'\n"); \
- \
- pat = (UCHAR_T *) POP_FAILURE_POINTER (); \
- DEBUG_PRINT2 (" Popping pattern %p:\n", pat); \
- DEBUG_PRINT_COMPILED_PATTERN (bufp, pat, pend); \
- \
- /* Restore register info. */ \
- high_reg = (active_reg_t) POP_FAILURE_INT (); \
- DEBUG_PRINT2 (" Popping high active reg: %ld\n", high_reg); \
- \
- low_reg = (active_reg_t) POP_FAILURE_INT (); \
- DEBUG_PRINT2 (" Popping low active reg: %ld\n", low_reg); \
- \
- if (1) \
- for (this_reg = high_reg; this_reg >= low_reg; this_reg--) \
- { \
- DEBUG_PRINT2 (" Popping reg: %ld\n", this_reg); \
- \
- reg_info[this_reg].word = POP_FAILURE_ELT (); \
- DEBUG_PRINT2 (" info: %p\n", \
- reg_info[this_reg].word.pointer); \
- \
- regend[this_reg] = (const CHAR_T *) POP_FAILURE_POINTER (); \
- DEBUG_PRINT2 (" end: %p\n", regend[this_reg]); \
- \
- regstart[this_reg] = (const CHAR_T *) POP_FAILURE_POINTER (); \
- DEBUG_PRINT2 (" start: %p\n", regstart[this_reg]); \
- } \
- else \
- { \
- for (this_reg = highest_active_reg; this_reg > high_reg; this_reg--) \
- { \
- reg_info[this_reg].word.integer = 0; \
- regend[this_reg] = 0; \
- regstart[this_reg] = 0; \
- } \
- highest_active_reg = high_reg; \
- } \
- \
- set_regs_matched_done = 0; \
- DEBUG_STATEMENT (nfailure_points_popped++); \
-} /* POP_FAILURE_POINT */
-
-/* Structure for per-register (a.k.a. per-group) information.
- Other register information, such as the
- starting and ending positions (which are addresses), and the list of
- inner groups (which is a bits list) are maintained in separate
- variables.
-
- We are making a (strictly speaking) nonportable assumption here: that
- the compiler will pack our bit fields into something that fits into
- the type of `word', i.e., is something that fits into one item on the
- failure stack. */
-
-
-/* Declarations and macros for re_match_2. */
-
-typedef union
-{
- PREFIX(fail_stack_elt_t) word;
- struct
- {
- /* This field is one if this group can match the empty string,
- zero if not. If not yet determined, `MATCH_NULL_UNSET_VALUE'. */
-# define MATCH_NULL_UNSET_VALUE 3
- unsigned match_null_string_p : 2;
- unsigned is_active : 1;
- unsigned matched_something : 1;
- unsigned ever_matched_something : 1;
- } bits;
-} PREFIX(register_info_type);
-
-# ifndef DEFINED_ONCE
-# define REG_MATCH_NULL_STRING_P(R) ((R).bits.match_null_string_p)
-# define IS_ACTIVE(R) ((R).bits.is_active)
-# define MATCHED_SOMETHING(R) ((R).bits.matched_something)
-# define EVER_MATCHED_SOMETHING(R) ((R).bits.ever_matched_something)
-
-
-/* Call this when have matched a real character; it sets `matched' flags
- for the subexpressions which we are currently inside. Also records
- that those subexprs have matched. */
-# define SET_REGS_MATCHED() \
- do \
- { \
- if (!set_regs_matched_done) \
- { \
- active_reg_t r; \
- set_regs_matched_done = 1; \
- for (r = lowest_active_reg; r <= highest_active_reg; r++) \
- { \
- MATCHED_SOMETHING (reg_info[r]) \
- = EVER_MATCHED_SOMETHING (reg_info[r]) \
- = 1; \
- } \
- } \
- } \
- while (0)
-# endif /* not DEFINED_ONCE */
-
-/* Registers are set to a sentinel when they haven't yet matched. */
-static CHAR_T PREFIX(reg_unset_dummy);
-# define REG_UNSET_VALUE (&PREFIX(reg_unset_dummy))
-# define REG_UNSET(e) ((e) == REG_UNSET_VALUE)
-
-/* Subroutine declarations and macros for regex_compile. */
-static void PREFIX(store_op1) _RE_ARGS ((re_opcode_t op, UCHAR_T *loc, int arg));
-static void PREFIX(store_op2) _RE_ARGS ((re_opcode_t op, UCHAR_T *loc,
- int arg1, int arg2));
-static void PREFIX(insert_op1) _RE_ARGS ((re_opcode_t op, UCHAR_T *loc,
- int arg, UCHAR_T *end));
-static void PREFIX(insert_op2) _RE_ARGS ((re_opcode_t op, UCHAR_T *loc,
- int arg1, int arg2, UCHAR_T *end));
-static boolean PREFIX(at_begline_loc_p) _RE_ARGS ((const CHAR_T *pattern,
- const CHAR_T *p,
- reg_syntax_t syntax));
-static boolean PREFIX(at_endline_loc_p) _RE_ARGS ((const CHAR_T *p,
- const CHAR_T *pend,
- reg_syntax_t syntax));
-# ifdef WCHAR
-static reg_errcode_t wcs_compile_range _RE_ARGS ((CHAR_T range_start,
- const CHAR_T **p_ptr,
- const CHAR_T *pend,
- char *translate,
- reg_syntax_t syntax,
- UCHAR_T *b,
- CHAR_T *char_set));
-static void insert_space _RE_ARGS ((int num, CHAR_T *loc, CHAR_T *end));
-# else /* BYTE */
-static reg_errcode_t byte_compile_range _RE_ARGS ((unsigned int range_start,
- const char **p_ptr,
- const char *pend,
- char *translate,
- reg_syntax_t syntax,
- unsigned char *b));
-# endif /* WCHAR */
-
-/* Fetch the next character in the uncompiled pattern---translating it
- if necessary. Also cast from a signed character in the constant
- string passed to us by the user to an unsigned char that we can use
- as an array index (in, e.g., `translate'). */
-/* ifdef MBS_SUPPORT, we translate only if character <= 0xff,
- because it is impossible to allocate 4GB array for some encodings
- which have 4 byte character_set like UCS4. */
-# ifndef PATFETCH
-# ifdef WCHAR
-# define PATFETCH(c) \
- do {if (p == pend) return REG_EEND; \
- c = (UCHAR_T) *p++; \
- if (translate && (c <= 0xff)) c = (UCHAR_T) translate[c]; \
- } while (0)
-# else /* BYTE */
-# define PATFETCH(c) \
- do {if (p == pend) return REG_EEND; \
- c = (unsigned char) *p++; \
- if (translate) c = (unsigned char) translate[c]; \
- } while (0)
-# endif /* WCHAR */
-# endif
-
-/* Fetch the next character in the uncompiled pattern, with no
- translation. */
-# define PATFETCH_RAW(c) \
- do {if (p == pend) return REG_EEND; \
- c = (UCHAR_T) *p++; \
- } while (0)
-
-/* Go backwards one character in the pattern. */
-# define PATUNFETCH p--
-
-
-/* If `translate' is non-null, return translate[D], else just D. We
- cast the subscript to translate because some data is declared as
- `char *', to avoid warnings when a string constant is passed. But
- when we use a character as a subscript we must make it unsigned. */
-/* ifdef MBS_SUPPORT, we translate only if character <= 0xff,
- because it is impossible to allocate 4GB array for some encodings
- which have 4 byte character_set like UCS4. */
-
-# ifndef TRANSLATE
-# ifdef WCHAR
-# define TRANSLATE(d) \
- ((translate && ((UCHAR_T) (d)) <= 0xff) \
- ? (char) translate[(unsigned char) (d)] : (d))
-# else /* BYTE */
-# define TRANSLATE(d) \
- (translate ? (char) translate[(unsigned char) (d)] : (d))
-# endif /* WCHAR */
-# endif
-
-
-/* Macros for outputting the compiled pattern into `buffer'. */
-
-/* If the buffer isn't allocated when it comes in, use this. */
-# define INIT_BUF_SIZE (32 * sizeof(UCHAR_T))
-
-/* Make sure we have at least N more bytes of space in buffer. */
-# ifdef WCHAR
-# define GET_BUFFER_SPACE(n) \
- while (((unsigned long)b - (unsigned long)COMPILED_BUFFER_VAR \
- + (n)*sizeof(CHAR_T)) > bufp->allocated) \
- EXTEND_BUFFER ()
-# else /* BYTE */
-# define GET_BUFFER_SPACE(n) \
- while ((unsigned long) (b - bufp->buffer + (n)) > bufp->allocated) \
- EXTEND_BUFFER ()
-# endif /* WCHAR */
-
-/* Make sure we have one more byte of buffer space and then add C to it. */
-# define BUF_PUSH(c) \
- do { \
- GET_BUFFER_SPACE (1); \
- *b++ = (UCHAR_T) (c); \
- } while (0)
-
-
-/* Ensure we have two more bytes of buffer space and then append C1 and C2. */
-# define BUF_PUSH_2(c1, c2) \
- do { \
- GET_BUFFER_SPACE (2); \
- *b++ = (UCHAR_T) (c1); \
- *b++ = (UCHAR_T) (c2); \
- } while (0)
-
-
-/* As with BUF_PUSH_2, except for three bytes. */
-# define BUF_PUSH_3(c1, c2, c3) \
- do { \
- GET_BUFFER_SPACE (3); \
- *b++ = (UCHAR_T) (c1); \
- *b++ = (UCHAR_T) (c2); \
- *b++ = (UCHAR_T) (c3); \
- } while (0)
-
-/* Store a jump with opcode OP at LOC to location TO. We store a
- relative address offset by the three bytes the jump itself occupies. */
-# define STORE_JUMP(op, loc, to) \
- PREFIX(store_op1) (op, loc, (int) ((to) - (loc) - (1 + OFFSET_ADDRESS_SIZE)))
-
-/* Likewise, for a two-argument jump. */
-# define STORE_JUMP2(op, loc, to, arg) \
- PREFIX(store_op2) (op, loc, (int) ((to) - (loc) - (1 + OFFSET_ADDRESS_SIZE)), arg)
-
-/* Like `STORE_JUMP', but for inserting. Assume `b' is the buffer end. */
-# define INSERT_JUMP(op, loc, to) \
- PREFIX(insert_op1) (op, loc, (int) ((to) - (loc) - (1 + OFFSET_ADDRESS_SIZE)), b)
-
-/* Like `STORE_JUMP2', but for inserting. Assume `b' is the buffer end. */
-# define INSERT_JUMP2(op, loc, to, arg) \
- PREFIX(insert_op2) (op, loc, (int) ((to) - (loc) - (1 + OFFSET_ADDRESS_SIZE)),\
- arg, b)
-
-/* This is not an arbitrary limit: the arguments which represent offsets
- into the pattern are two bytes long. So if 2^16 bytes turns out to
- be too small, many things would have to change. */
-/* Any other compiler which, like MSC, has allocation limit below 2^16
- bytes will have to use approach similar to what was done below for
- MSC and drop MAX_BUF_SIZE a bit. Otherwise you may end up
- reallocating to 0 bytes. Such thing is not going to work too well.
- You have been warned!! */
-# ifndef DEFINED_ONCE
-# if defined _MSC_VER && !defined WIN32
-/* Microsoft C 16-bit versions limit malloc to approx 65512 bytes.
- The REALLOC define eliminates a flurry of conversion warnings,
- but is not required. */
-# define MAX_BUF_SIZE 65500L
-# define REALLOC(p,s) realloc ((p), (size_t) (s))
-# else
-# define MAX_BUF_SIZE (1L << 16)
-# define REALLOC(p,s) realloc ((p), (s))
-# endif
-
-/* Extend the buffer by twice its current size via realloc and
- reset the pointers that pointed into the old block to point to the
- correct places in the new one. If extending the buffer results in it
- being larger than MAX_BUF_SIZE, then flag memory exhausted. */
-# if __BOUNDED_POINTERS__
-# define SET_HIGH_BOUND(P) (__ptrhigh (P) = __ptrlow (P) + bufp->allocated)
-# define MOVE_BUFFER_POINTER(P) \
- (__ptrlow (P) += incr, SET_HIGH_BOUND (P), __ptrvalue (P) += incr)
-# define ELSE_EXTEND_BUFFER_HIGH_BOUND \
- else \
- { \
- SET_HIGH_BOUND (b); \
- SET_HIGH_BOUND (begalt); \
- if (fixup_alt_jump) \
- SET_HIGH_BOUND (fixup_alt_jump); \
- if (laststart) \
- SET_HIGH_BOUND (laststart); \
- if (pending_exact) \
- SET_HIGH_BOUND (pending_exact); \
- }
-# else
-# define MOVE_BUFFER_POINTER(P) (P) += incr
-# define ELSE_EXTEND_BUFFER_HIGH_BOUND
-# endif
-# endif /* not DEFINED_ONCE */
-
-# ifdef WCHAR
-# define EXTEND_BUFFER() \
- do { \
- UCHAR_T *old_buffer = COMPILED_BUFFER_VAR; \
- int wchar_count; \
- if (bufp->allocated + sizeof(UCHAR_T) > MAX_BUF_SIZE) \
- return REG_ESIZE; \
- bufp->allocated <<= 1; \
- if (bufp->allocated > MAX_BUF_SIZE) \
- bufp->allocated = MAX_BUF_SIZE; \
- /* How many characters the new buffer can have? */ \
- wchar_count = bufp->allocated / sizeof(UCHAR_T); \
- if (wchar_count == 0) wchar_count = 1; \
- /* Truncate the buffer to CHAR_T align. */ \
- bufp->allocated = wchar_count * sizeof(UCHAR_T); \
- RETALLOC (COMPILED_BUFFER_VAR, wchar_count, UCHAR_T); \
- bufp->buffer = (char*)COMPILED_BUFFER_VAR; \
- if (COMPILED_BUFFER_VAR == NULL) \
- return REG_ESPACE; \
- /* If the buffer moved, move all the pointers into it. */ \
- if (old_buffer != COMPILED_BUFFER_VAR) \
- { \
- int incr = COMPILED_BUFFER_VAR - old_buffer; \
- MOVE_BUFFER_POINTER (b); \
- MOVE_BUFFER_POINTER (begalt); \
- if (fixup_alt_jump) \
- MOVE_BUFFER_POINTER (fixup_alt_jump); \
- if (laststart) \
- MOVE_BUFFER_POINTER (laststart); \
- if (pending_exact) \
- MOVE_BUFFER_POINTER (pending_exact); \
- } \
- ELSE_EXTEND_BUFFER_HIGH_BOUND \
- } while (0)
-# else /* BYTE */
-# define EXTEND_BUFFER() \
- do { \
- UCHAR_T *old_buffer = COMPILED_BUFFER_VAR; \
- if (bufp->allocated == MAX_BUF_SIZE) \
- return REG_ESIZE; \
- bufp->allocated <<= 1; \
- if (bufp->allocated > MAX_BUF_SIZE) \
- bufp->allocated = MAX_BUF_SIZE; \
- bufp->buffer = (UCHAR_T *) REALLOC (COMPILED_BUFFER_VAR, \
- bufp->allocated); \
- if (COMPILED_BUFFER_VAR == NULL) \
- return REG_ESPACE; \
- /* If the buffer moved, move all the pointers into it. */ \
- if (old_buffer != COMPILED_BUFFER_VAR) \
- { \
- int incr = COMPILED_BUFFER_VAR - old_buffer; \
- MOVE_BUFFER_POINTER (b); \
- MOVE_BUFFER_POINTER (begalt); \
- if (fixup_alt_jump) \
- MOVE_BUFFER_POINTER (fixup_alt_jump); \
- if (laststart) \
- MOVE_BUFFER_POINTER (laststart); \
- if (pending_exact) \
- MOVE_BUFFER_POINTER (pending_exact); \
- } \
- ELSE_EXTEND_BUFFER_HIGH_BOUND \
- } while (0)
-# endif /* WCHAR */
-
-# ifndef DEFINED_ONCE
-/* Since we have one byte reserved for the register number argument to
- {start,stop}_memory, the maximum number of groups we can report
- things about is what fits in that byte. */
-# define MAX_REGNUM 255
-
-/* But patterns can have more than `MAX_REGNUM' registers. We just
- ignore the excess. */
-typedef unsigned regnum_t;
-
-
-/* Macros for the compile stack. */
-
-/* Since offsets can go either forwards or backwards, this type needs to
- be able to hold values from -(MAX_BUF_SIZE - 1) to MAX_BUF_SIZE - 1. */
-/* int may be not enough when sizeof(int) == 2. */
-typedef long pattern_offset_t;
-
-typedef struct
-{
- pattern_offset_t begalt_offset;
- pattern_offset_t fixup_alt_jump;
- pattern_offset_t inner_group_offset;
- pattern_offset_t laststart_offset;
- regnum_t regnum;
-} compile_stack_elt_t;
-
-
-typedef struct
-{
- compile_stack_elt_t *stack;
- unsigned size;
- unsigned avail; /* Offset of next open position. */
-} compile_stack_type;
-
-
-# define INIT_COMPILE_STACK_SIZE 32
-
-# define COMPILE_STACK_EMPTY (compile_stack.avail == 0)
-# define COMPILE_STACK_FULL (compile_stack.avail == compile_stack.size)
-
-/* The next available element. */
-# define COMPILE_STACK_TOP (compile_stack.stack[compile_stack.avail])
-
-# endif /* not DEFINED_ONCE */
-
-/* Set the bit for character C in a list. */
-# ifndef DEFINED_ONCE
-# define SET_LIST_BIT(c) \
- (b[((unsigned char) (c)) / BYTEWIDTH] \
- |= 1 << (((unsigned char) c) % BYTEWIDTH))
-# endif /* DEFINED_ONCE */
-
-/* Get the next unsigned number in the uncompiled pattern. */
-# define GET_UNSIGNED_NUMBER(num) \
- { \
- while (p != pend) \
- { \
- PATFETCH (c); \
- if (c < '0' || c > '9') \
- break; \
- if (num <= RE_DUP_MAX) \
- { \
- if (num < 0) \
- num = 0; \
- num = num * 10 + c - '0'; \
- } \
- } \
- }
-
-# ifndef DEFINED_ONCE
-# if defined _LIBC || WIDE_CHAR_SUPPORT
-/* The GNU C library provides support for user-defined character classes
- and the functions from ISO C amendement 1. */
-# ifdef CHARCLASS_NAME_MAX
-# define CHAR_CLASS_MAX_LENGTH CHARCLASS_NAME_MAX
-# else
-/* This shouldn't happen but some implementation might still have this
- problem. Use a reasonable default value. */
-# define CHAR_CLASS_MAX_LENGTH 256
-# endif
-
-# ifdef _LIBC
-# define IS_CHAR_CLASS(string) __wctype (string)
-# else
-# define IS_CHAR_CLASS(string) wctype (string)
-# endif
-# else
-# define CHAR_CLASS_MAX_LENGTH 6 /* Namely, `xdigit'. */
-
-# define IS_CHAR_CLASS(string) \
- (STREQ (string, "alpha") || STREQ (string, "upper") \
- || STREQ (string, "lower") || STREQ (string, "digit") \
- || STREQ (string, "alnum") || STREQ (string, "xdigit") \
- || STREQ (string, "space") || STREQ (string, "print") \
- || STREQ (string, "punct") || STREQ (string, "graph") \
- || STREQ (string, "cntrl") || STREQ (string, "blank"))
-# endif
-# endif /* DEFINED_ONCE */
-
-# ifndef MATCH_MAY_ALLOCATE
-
-/* If we cannot allocate large objects within re_match_2_internal,
- we make the fail stack and register vectors global.
- The fail stack, we grow to the maximum size when a regexp
- is compiled.
- The register vectors, we adjust in size each time we
- compile a regexp, according to the number of registers it needs. */
-
-static PREFIX(fail_stack_type) fail_stack;
-
-/* Size with which the following vectors are currently allocated.
- That is so we can make them bigger as needed,
- but never make them smaller. */
-# ifdef DEFINED_ONCE
-static int regs_allocated_size;
-
-static const char ** regstart, ** regend;
-static const char ** old_regstart, ** old_regend;
-static const char **best_regstart, **best_regend;
-static const char **reg_dummy;
-# endif /* DEFINED_ONCE */
-
-static PREFIX(register_info_type) *PREFIX(reg_info);
-static PREFIX(register_info_type) *PREFIX(reg_info_dummy);
-
-/* Make the register vectors big enough for NUM_REGS registers,
- but don't make them smaller. */
-
-static void
-PREFIX(regex_grow_registers) (num_regs)
- int num_regs;
-{
- if (num_regs > regs_allocated_size)
- {
- RETALLOC_IF (regstart, num_regs, const char *);
- RETALLOC_IF (regend, num_regs, const char *);
- RETALLOC_IF (old_regstart, num_regs, const char *);
- RETALLOC_IF (old_regend, num_regs, const char *);
- RETALLOC_IF (best_regstart, num_regs, const char *);
- RETALLOC_IF (best_regend, num_regs, const char *);
- RETALLOC_IF (PREFIX(reg_info), num_regs, PREFIX(register_info_type));
- RETALLOC_IF (reg_dummy, num_regs, const char *);
- RETALLOC_IF (PREFIX(reg_info_dummy), num_regs, PREFIX(register_info_type));
-
- regs_allocated_size = num_regs;
- }
-}
-
-# endif /* not MATCH_MAY_ALLOCATE */
-
-# ifndef DEFINED_ONCE
-static boolean group_in_compile_stack _RE_ARGS ((compile_stack_type
- compile_stack,
- regnum_t regnum));
-# endif /* not DEFINED_ONCE */
-
-/* `regex_compile' compiles PATTERN (of length SIZE) according to SYNTAX.
- Returns one of error codes defined in `regex.h', or zero for success.
-
- Assumes the `allocated' (and perhaps `buffer') and `translate'
- fields are set in BUFP on entry.
-
- If it succeeds, results are put in BUFP (if it returns an error, the
- contents of BUFP are undefined):
- `buffer' is the compiled pattern;
- `syntax' is set to SYNTAX;
- `used' is set to the length of the compiled pattern;
- `fastmap_accurate' is zero;
- `re_nsub' is the number of subexpressions in PATTERN;
- `not_bol' and `not_eol' are zero;
-
- The `fastmap' and `newline_anchor' fields are neither
- examined nor set. */
-
-/* Return, freeing storage we allocated. */
-# ifdef WCHAR
-# define FREE_STACK_RETURN(value) \
- return (free(pattern), free(mbs_offset), free(is_binary), free (compile_stack.stack), value)
-# else
-# define FREE_STACK_RETURN(value) \
- return (free (compile_stack.stack), value)
-# endif /* WCHAR */
-
-static reg_errcode_t
-PREFIX(regex_compile) (ARG_PREFIX(pattern), ARG_PREFIX(size), syntax, bufp)
- const char *ARG_PREFIX(pattern);
- size_t ARG_PREFIX(size);
- reg_syntax_t syntax;
- struct re_pattern_buffer *bufp;
-{
- /* We fetch characters from PATTERN here. Even though PATTERN is
- `char *' (i.e., signed), we declare these variables as unsigned, so
- they can be reliably used as array indices. */
- register UCHAR_T c, c1;
-
-#ifdef WCHAR
- /* A temporary space to keep wchar_t pattern and compiled pattern. */
- CHAR_T *pattern, *COMPILED_BUFFER_VAR;
- size_t size;
- /* offset buffer for optimization. See convert_mbs_to_wc. */
- int *mbs_offset = NULL;
- /* It hold whether each wchar_t is binary data or not. */
- char *is_binary = NULL;
- /* A flag whether exactn is handling binary data or not. */
- char is_exactn_bin = FALSE;
-#endif /* WCHAR */
-
- /* A random temporary spot in PATTERN. */
- const CHAR_T *p1;
-
- /* Points to the end of the buffer, where we should append. */
- register UCHAR_T *b;
-
- /* Keeps track of unclosed groups. */
- compile_stack_type compile_stack;
-
- /* Points to the current (ending) position in the pattern. */
-#ifdef WCHAR
- const CHAR_T *p;
- const CHAR_T *pend;
-#else /* BYTE */
- const CHAR_T *p = pattern;
- const CHAR_T *pend = pattern + size;
-#endif /* WCHAR */
-
- /* How to translate the characters in the pattern. */
- RE_TRANSLATE_TYPE translate = bufp->translate;
-
- /* Address of the count-byte of the most recently inserted `exactn'
- command. This makes it possible to tell if a new exact-match
- character can be added to that command or if the character requires
- a new `exactn' command. */
- UCHAR_T *pending_exact = 0;
-
- /* Address of start of the most recently finished expression.
- This tells, e.g., postfix * where to find the start of its
- operand. Reset at the beginning of groups and alternatives. */
- UCHAR_T *laststart = 0;
-
- /* Address of beginning of regexp, or inside of last group. */
- UCHAR_T *begalt;
-
- /* Address of the place where a forward jump should go to the end of
- the containing expression. Each alternative of an `or' -- except the
- last -- ends with a forward jump of this sort. */
- UCHAR_T *fixup_alt_jump = 0;
-
- /* Counts open-groups as they are encountered. Remembered for the
- matching close-group on the compile stack, so the same register
- number is put in the stop_memory as the start_memory. */
- regnum_t regnum = 0;
-
-#ifdef WCHAR
- /* Initialize the wchar_t PATTERN and offset_buffer. */
- p = pend = pattern = TALLOC(csize + 1, CHAR_T);
- mbs_offset = TALLOC(csize + 1, int);
- is_binary = TALLOC(csize + 1, char);
- if (pattern == NULL || mbs_offset == NULL || is_binary == NULL)
- {
- free(pattern);
- free(mbs_offset);
- free(is_binary);
- return REG_ESPACE;
- }
- pattern[csize] = L'\0'; /* sentinel */
- size = convert_mbs_to_wcs(pattern, cpattern, csize, mbs_offset, is_binary);
- pend = p + size;
- if (size < 0)
- {
- free(pattern);
- free(mbs_offset);
- free(is_binary);
- return REG_BADPAT;
- }
-#endif
-
-#ifdef DEBUG
- DEBUG_PRINT1 ("\nCompiling pattern: ");
- if (debug)
- {
- unsigned debug_count;
-
- for (debug_count = 0; debug_count < size; debug_count++)
- PUT_CHAR (pattern[debug_count]);
- putchar ('\n');
- }
-#endif /* DEBUG */
-
- /* Initialize the compile stack. */
- compile_stack.stack = TALLOC (INIT_COMPILE_STACK_SIZE, compile_stack_elt_t);
- if (compile_stack.stack == NULL)
- {
-#ifdef WCHAR
- free(pattern);
- free(mbs_offset);
- free(is_binary);
-#endif
- return REG_ESPACE;
- }
-
- compile_stack.size = INIT_COMPILE_STACK_SIZE;
- compile_stack.avail = 0;
-
- /* Initialize the pattern buffer. */
- bufp->syntax = syntax;
- bufp->fastmap_accurate = 0;
- bufp->not_bol = bufp->not_eol = 0;
-
- /* Set `used' to zero, so that if we return an error, the pattern
- printer (for debugging) will think there's no pattern. We reset it
- at the end. */
- bufp->used = 0;
-
- /* Always count groups, whether or not bufp->no_sub is set. */
- bufp->re_nsub = 0;
-
-#if !defined emacs && !defined SYNTAX_TABLE
- /* Initialize the syntax table. */
- init_syntax_once ();
-#endif
-
- if (bufp->allocated == 0)
- {
- if (bufp->buffer)
- { /* If zero allocated, but buffer is non-null, try to realloc
- enough space. This loses if buffer's address is bogus, but
- that is the user's responsibility. */
-#ifdef WCHAR
- /* Free bufp->buffer and allocate an array for wchar_t pattern
- buffer. */
- free(bufp->buffer);
- COMPILED_BUFFER_VAR = TALLOC (INIT_BUF_SIZE/sizeof(UCHAR_T),
- UCHAR_T);
-#else
- RETALLOC (COMPILED_BUFFER_VAR, INIT_BUF_SIZE, UCHAR_T);
-#endif /* WCHAR */
- }
- else
- { /* Caller did not allocate a buffer. Do it for them. */
- COMPILED_BUFFER_VAR = TALLOC (INIT_BUF_SIZE / sizeof(UCHAR_T),
- UCHAR_T);
- }
-
- if (!COMPILED_BUFFER_VAR) FREE_STACK_RETURN (REG_ESPACE);
-#ifdef WCHAR
- bufp->buffer = (char*)COMPILED_BUFFER_VAR;
-#endif /* WCHAR */
- bufp->allocated = INIT_BUF_SIZE;
- }
-#ifdef WCHAR
- else
- COMPILED_BUFFER_VAR = (UCHAR_T*) bufp->buffer;
-#endif
-
- begalt = b = COMPILED_BUFFER_VAR;
-
- /* Loop through the uncompiled pattern until we're at the end. */
- while (p != pend)
- {
- PATFETCH (c);
-
- switch (c)
- {
- case '^':
- {
- if ( /* If at start of pattern, it's an operator. */
- p == pattern + 1
- /* If context independent, it's an operator. */
- || syntax & RE_CONTEXT_INDEP_ANCHORS
- /* Otherwise, depends on what's come before. */
- || PREFIX(at_begline_loc_p) (pattern, p, syntax))
- BUF_PUSH (begline);
- else
- goto normal_char;
- }
- break;
-
-
- case '$':
- {
- if ( /* If at end of pattern, it's an operator. */
- p == pend
- /* If context independent, it's an operator. */
- || syntax & RE_CONTEXT_INDEP_ANCHORS
- /* Otherwise, depends on what's next. */
- || PREFIX(at_endline_loc_p) (p, pend, syntax))
- BUF_PUSH (endline);
- else
- goto normal_char;
- }
- break;
-
-
- case '+':
- case '?':
- if ((syntax & RE_BK_PLUS_QM)
- || (syntax & RE_LIMITED_OPS))
- goto normal_char;
- handle_plus:
- case '*':
- /* If there is no previous pattern... */
- if (!laststart)
- {
- if (syntax & RE_CONTEXT_INVALID_OPS)
- FREE_STACK_RETURN (REG_BADRPT);
- else if (!(syntax & RE_CONTEXT_INDEP_OPS))
- goto normal_char;
- }
-
- {
- /* Are we optimizing this jump? */
- boolean keep_string_p = false;
-
- /* 1 means zero (many) matches is allowed. */
- char zero_times_ok = 0, many_times_ok = 0;
-
- /* If there is a sequence of repetition chars, collapse it
- down to just one (the right one). We can't combine
- interval operators with these because of, e.g., `a{2}*',
- which should only match an even number of `a's. */
-
- for (;;)
- {
- zero_times_ok |= c != '+';
- many_times_ok |= c != '?';
-
- if (p == pend)
- break;
-
- PATFETCH (c);
-
- if (c == '*'
- || (!(syntax & RE_BK_PLUS_QM) && (c == '+' || c == '?')))
- ;
-
- else if (syntax & RE_BK_PLUS_QM && c == '\\')
- {
- if (p == pend) FREE_STACK_RETURN (REG_EESCAPE);
-
- PATFETCH (c1);
- if (!(c1 == '+' || c1 == '?'))
- {
- PATUNFETCH;
- PATUNFETCH;
- break;
- }
-
- c = c1;
- }
- else
- {
- PATUNFETCH;
- break;
- }
-
- /* If we get here, we found another repeat character. */
- }
-
- /* Star, etc. applied to an empty pattern is equivalent
- to an empty pattern. */
- if (!laststart)
- break;
-
- /* Now we know whether or not zero matches is allowed
- and also whether or not two or more matches is allowed. */
- if (many_times_ok)
- { /* More than one repetition is allowed, so put in at the
- end a backward relative jump from `b' to before the next
- jump we're going to put in below (which jumps from
- laststart to after this jump).
-
- But if we are at the `*' in the exact sequence `.*\n',
- insert an unconditional jump backwards to the .,
- instead of the beginning of the loop. This way we only
- push a failure point once, instead of every time
- through the loop. */
- assert (p - 1 > pattern);
-
- /* Allocate the space for the jump. */
- GET_BUFFER_SPACE (1 + OFFSET_ADDRESS_SIZE);
-
- /* We know we are not at the first character of the pattern,
- because laststart was nonzero. And we've already
- incremented `p', by the way, to be the character after
- the `*'. Do we have to do something analogous here
- for null bytes, because of RE_DOT_NOT_NULL? */
- if (TRANSLATE (*(p - 2)) == TRANSLATE ('.')
- && zero_times_ok
- && p < pend && TRANSLATE (*p) == TRANSLATE ('\n')
- && !(syntax & RE_DOT_NEWLINE))
- { /* We have .*\n. */
- STORE_JUMP (jump, b, laststart);
- keep_string_p = true;
- }
- else
- /* Anything else. */
- STORE_JUMP (maybe_pop_jump, b, laststart -
- (1 + OFFSET_ADDRESS_SIZE));
-
- /* We've added more stuff to the buffer. */
- b += 1 + OFFSET_ADDRESS_SIZE;
- }
-
- /* On failure, jump from laststart to b + 3, which will be the
- end of the buffer after this jump is inserted. */
- /* ifdef WCHAR, 'b + 1 + OFFSET_ADDRESS_SIZE' instead of
- 'b + 3'. */
- GET_BUFFER_SPACE (1 + OFFSET_ADDRESS_SIZE);
- INSERT_JUMP (keep_string_p ? on_failure_keep_string_jump
- : on_failure_jump,
- laststart, b + 1 + OFFSET_ADDRESS_SIZE);
- pending_exact = 0;
- b += 1 + OFFSET_ADDRESS_SIZE;
-
- if (!zero_times_ok)
- {
- /* At least one repetition is required, so insert a
- `dummy_failure_jump' before the initial
- `on_failure_jump' instruction of the loop. This
- effects a skip over that instruction the first time
- we hit that loop. */
- GET_BUFFER_SPACE (1 + OFFSET_ADDRESS_SIZE);
- INSERT_JUMP (dummy_failure_jump, laststart, laststart +
- 2 + 2 * OFFSET_ADDRESS_SIZE);
- b += 1 + OFFSET_ADDRESS_SIZE;
- }
- }
- break;
-
-
- case '.':
- laststart = b;
- BUF_PUSH (anychar);
- break;
-
-
- case '[':
- {
- boolean had_char_class = false;
-#ifdef WCHAR
- CHAR_T range_start = 0xffffffff;
-#else
- unsigned int range_start = 0xffffffff;
-#endif
- if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
-
-#ifdef WCHAR
- /* We assume a charset(_not) structure as a wchar_t array.
- charset[0] = (re_opcode_t) charset(_not)
- charset[1] = l (= length of char_classes)
- charset[2] = m (= length of collating_symbols)
- charset[3] = n (= length of equivalence_classes)
- charset[4] = o (= length of char_ranges)
- charset[5] = p (= length of chars)
-
- charset[6] = char_class (wctype_t)
- charset[6+CHAR_CLASS_SIZE] = char_class (wctype_t)
- ...
- charset[l+5] = char_class (wctype_t)
-
- charset[l+6] = collating_symbol (wchar_t)
- ...
- charset[l+m+5] = collating_symbol (wchar_t)
- ifdef _LIBC we use the index if
- _NL_COLLATE_SYMB_EXTRAMB instead of
- wchar_t string.
-
- charset[l+m+6] = equivalence_classes (wchar_t)
- ...
- charset[l+m+n+5] = equivalence_classes (wchar_t)
- ifdef _LIBC we use the index in
- _NL_COLLATE_WEIGHT instead of
- wchar_t string.
-
- charset[l+m+n+6] = range_start
- charset[l+m+n+7] = range_end
- ...
- charset[l+m+n+2o+4] = range_start
- charset[l+m+n+2o+5] = range_end
- ifdef _LIBC we use the value looked up
- in _NL_COLLATE_COLLSEQ instead of
- wchar_t character.
-
- charset[l+m+n+2o+6] = char
- ...
- charset[l+m+n+2o+p+5] = char
-
- */
-
- /* We need at least 6 spaces: the opcode, the length of
- char_classes, the length of collating_symbols, the length of
- equivalence_classes, the length of char_ranges, the length of
- chars. */
- GET_BUFFER_SPACE (6);
-
- /* Save b as laststart. And We use laststart as the pointer
- to the first element of the charset here.
- In other words, laststart[i] indicates charset[i]. */
- laststart = b;
-
- /* We test `*p == '^' twice, instead of using an if
- statement, so we only need one BUF_PUSH. */
- BUF_PUSH (*p == '^' ? charset_not : charset);
- if (*p == '^')
- p++;
-
- /* Push the length of char_classes, the length of
- collating_symbols, the length of equivalence_classes, the
- length of char_ranges and the length of chars. */
- BUF_PUSH_3 (0, 0, 0);
- BUF_PUSH_2 (0, 0);
-
- /* Remember the first position in the bracket expression. */
- p1 = p;
-
- /* charset_not matches newline according to a syntax bit. */
- if ((re_opcode_t) b[-6] == charset_not
- && (syntax & RE_HAT_LISTS_NOT_NEWLINE))
- {
- BUF_PUSH('\n');
- laststart[5]++; /* Update the length of characters */
- }
-
- /* Read in characters and ranges, setting map bits. */
- for (;;)
- {
- if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
-
- PATFETCH (c);
-
- /* \ might escape characters inside [...] and [^...]. */
- if ((syntax & RE_BACKSLASH_ESCAPE_IN_LISTS) && c == '\\')
- {
- if (p == pend) FREE_STACK_RETURN (REG_EESCAPE);
-
- PATFETCH (c1);
- BUF_PUSH(c1);
- laststart[5]++; /* Update the length of chars */
- range_start = c1;
- continue;
- }
-
- /* Could be the end of the bracket expression. If it's
- not (i.e., when the bracket expression is `[]' so
- far), the ']' character bit gets set way below. */
- if (c == ']' && p != p1 + 1)
- break;
-
- /* Look ahead to see if it's a range when the last thing
- was a character class. */
- if (had_char_class && c == '-' && *p != ']')
- FREE_STACK_RETURN (REG_ERANGE);
-
- /* Look ahead to see if it's a range when the last thing
- was a character: if this is a hyphen not at the
- beginning or the end of a list, then it's the range
- operator. */
- if (c == '-'
- && !(p - 2 >= pattern && p[-2] == '[')
- && !(p - 3 >= pattern && p[-3] == '[' && p[-2] == '^')
- && *p != ']')
- {
- reg_errcode_t ret;
- /* Allocate the space for range_start and range_end. */
- GET_BUFFER_SPACE (2);
- /* Update the pointer to indicate end of buffer. */
- b += 2;
- ret = wcs_compile_range (range_start, &p, pend, translate,
- syntax, b, laststart);
- if (ret != REG_NOERROR) FREE_STACK_RETURN (ret);
- range_start = 0xffffffff;
- }
- else if (p[0] == '-' && p[1] != ']')
- { /* This handles ranges made up of characters only. */
- reg_errcode_t ret;
-
- /* Move past the `-'. */
- PATFETCH (c1);
- /* Allocate the space for range_start and range_end. */
- GET_BUFFER_SPACE (2);
- /* Update the pointer to indicate end of buffer. */
- b += 2;
- ret = wcs_compile_range (c, &p, pend, translate, syntax, b,
- laststart);
- if (ret != REG_NOERROR) FREE_STACK_RETURN (ret);
- range_start = 0xffffffff;
- }
-
- /* See if we're at the beginning of a possible character
- class. */
- else if (syntax & RE_CHAR_CLASSES && c == '[' && *p == ':')
- { /* Leave room for the null. */
- char str[CHAR_CLASS_MAX_LENGTH + 1];
-
- PATFETCH (c);
- c1 = 0;
-
- /* If pattern is `[[:'. */
- if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
-
- for (;;)
- {
- PATFETCH (c);
- if ((c == ':' && *p == ']') || p == pend)
- break;
- if (c1 < CHAR_CLASS_MAX_LENGTH)
- str[c1++] = c;
- else
- /* This is in any case an invalid class name. */
- str[0] = '\0';
- }
- str[c1] = '\0';
-
- /* If isn't a word bracketed by `[:' and `:]':
- undo the ending character, the letters, and leave
- the leading `:' and `[' (but store them as character). */
- if (c == ':' && *p == ']')
- {
- wctype_t wt;
- uintptr_t alignedp;
-
- /* Query the character class as wctype_t. */
- wt = IS_CHAR_CLASS (str);
- if (wt == 0)
- FREE_STACK_RETURN (REG_ECTYPE);
-
- /* Throw away the ] at the end of the character
- class. */
- PATFETCH (c);
-
- if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
-
- /* Allocate the space for character class. */
- GET_BUFFER_SPACE(CHAR_CLASS_SIZE);
- /* Update the pointer to indicate end of buffer. */
- b += CHAR_CLASS_SIZE;
- /* Move data which follow character classes
- not to violate the data. */
- insert_space(CHAR_CLASS_SIZE,
- laststart + 6 + laststart[1],
- b - 1);
- alignedp = ((uintptr_t)(laststart + 6 + laststart[1])
- + __alignof__(wctype_t) - 1)
- & ~(uintptr_t)(__alignof__(wctype_t) - 1);
- /* Store the character class. */
- *((wctype_t*)alignedp) = wt;
- /* Update length of char_classes */
- laststart[1] += CHAR_CLASS_SIZE;
-
- had_char_class = true;
- }
- else
- {
- c1++;
- while (c1--)
- PATUNFETCH;
- BUF_PUSH ('[');
- BUF_PUSH (':');
- laststart[5] += 2; /* Update the length of characters */
- range_start = ':';
- had_char_class = false;
- }
- }
- else if (syntax & RE_CHAR_CLASSES && c == '[' && (*p == '='
- || *p == '.'))
- {
- CHAR_T str[128]; /* Should be large enough. */
- CHAR_T delim = *p; /* '=' or '.' */
-# ifdef _LIBC
- uint32_t nrules =
- _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
-# endif
- PATFETCH (c);
- c1 = 0;
-
- /* If pattern is `[[=' or '[[.'. */
- if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
-
- for (;;)
- {
- PATFETCH (c);
- if ((c == delim && *p == ']') || p == pend)
- break;
- if (c1 < sizeof (str) - 1)
- str[c1++] = c;
- else
- /* This is in any case an invalid class name. */
- str[0] = '\0';
- }
- str[c1] = '\0';
-
- if (c == delim && *p == ']' && str[0] != '\0')
- {
- unsigned int i, offset;
- /* If we have no collation data we use the default
- collation in which each character is in a class
- by itself. It also means that ASCII is the
- character set and therefore we cannot have character
- with more than one byte in the multibyte
- representation. */
-
- /* If not defined _LIBC, we push the name and
- `\0' for the sake of matching performance. */
- int datasize = c1 + 1;
-
-# ifdef _LIBC
- int32_t idx = 0;
- if (nrules == 0)
-# endif
- {
- if (c1 != 1)
- FREE_STACK_RETURN (REG_ECOLLATE);
- }
-# ifdef _LIBC
- else
- {
- const int32_t *table;
- const int32_t *weights;
- const int32_t *extra;
- const int32_t *indirect;
- wint_t *cp;
-
- /* This #include defines a local function! */
-# include <locale/weightwc.h>
-
- if(delim == '=')
- {
- /* We push the index for equivalence class. */
- cp = (wint_t*)str;
-
- table = (const int32_t *)
- _NL_CURRENT (LC_COLLATE,
- _NL_COLLATE_TABLEWC);
- weights = (const int32_t *)
- _NL_CURRENT (LC_COLLATE,
- _NL_COLLATE_WEIGHTWC);
- extra = (const int32_t *)
- _NL_CURRENT (LC_COLLATE,
- _NL_COLLATE_EXTRAWC);
- indirect = (const int32_t *)
- _NL_CURRENT (LC_COLLATE,
- _NL_COLLATE_INDIRECTWC);
-
- idx = findidx ((const wint_t**)&cp);
- if (idx == 0 || cp < (wint_t*) str + c1)
- /* This is no valid character. */
- FREE_STACK_RETURN (REG_ECOLLATE);
-
- str[0] = (wchar_t)idx;
- }
- else /* delim == '.' */
- {
- /* We push collation sequence value
- for collating symbol. */
- int32_t table_size;
- const int32_t *symb_table;
- const unsigned char *extra;
- int32_t idx;
- int32_t elem;
- int32_t second;
- int32_t hash;
- char char_str[c1];
-
- /* We have to convert the name to a single-byte
- string. This is possible since the names
- consist of ASCII characters and the internal
- representation is UCS4. */
- for (i = 0; i < c1; ++i)
- char_str[i] = str[i];
-
- table_size =
- _NL_CURRENT_WORD (LC_COLLATE,
- _NL_COLLATE_SYMB_HASH_SIZEMB);
- symb_table = (const int32_t *)
- _NL_CURRENT (LC_COLLATE,
- _NL_COLLATE_SYMB_TABLEMB);
- extra = (const unsigned char *)
- _NL_CURRENT (LC_COLLATE,
- _NL_COLLATE_SYMB_EXTRAMB);
-
- /* Locate the character in the hashing table. */
- hash = elem_hash (char_str, c1);
-
- idx = 0;
- elem = hash % table_size;
- second = hash % (table_size - 2);
- while (symb_table[2 * elem] != 0)
- {
- /* First compare the hashing value. */
- if (symb_table[2 * elem] == hash
- && c1 == extra[symb_table[2 * elem + 1]]
- && memcmp (char_str,
- &extra[symb_table[2 * elem + 1]
- + 1], c1) == 0)
- {
- /* Yep, this is the entry. */
- idx = symb_table[2 * elem + 1];
- idx += 1 + extra[idx];
- break;
- }
-
- /* Next entry. */
- elem += second;
- }
-
- if (symb_table[2 * elem] != 0)
- {
- /* Compute the index of the byte sequence
- in the table. */
- idx += 1 + extra[idx];
- /* Adjust for the alignment. */
- idx = (idx + 3) & ~3;
-
- str[0] = (wchar_t) idx + 4;
- }
- else if (symb_table[2 * elem] == 0 && c1 == 1)
- {
- /* No valid character. Match it as a
- single byte character. */
- had_char_class = false;
- BUF_PUSH(str[0]);
- /* Update the length of characters */
- laststart[5]++;
- range_start = str[0];
-
- /* Throw away the ] at the end of the
- collating symbol. */
- PATFETCH (c);
- /* exit from the switch block. */
- continue;
- }
- else
- FREE_STACK_RETURN (REG_ECOLLATE);
- }
- datasize = 1;
- }
-# endif
- /* Throw away the ] at the end of the equivalence
- class (or collating symbol). */
- PATFETCH (c);
-
- /* Allocate the space for the equivalence class
- (or collating symbol) (and '\0' if needed). */
- GET_BUFFER_SPACE(datasize);
- /* Update the pointer to indicate end of buffer. */
- b += datasize;
-
- if (delim == '=')
- { /* equivalence class */
- /* Calculate the offset of char_ranges,
- which is next to equivalence_classes. */
- offset = laststart[1] + laststart[2]
- + laststart[3] +6;
- /* Insert space. */
- insert_space(datasize, laststart + offset, b - 1);
-
- /* Write the equivalence_class and \0. */
- for (i = 0 ; i < datasize ; i++)
- laststart[offset + i] = str[i];
-
- /* Update the length of equivalence_classes. */
- laststart[3] += datasize;
- had_char_class = true;
- }
- else /* delim == '.' */
- { /* collating symbol */
- /* Calculate the offset of the equivalence_classes,
- which is next to collating_symbols. */
- offset = laststart[1] + laststart[2] + 6;
- /* Insert space and write the collationg_symbol
- and \0. */
- insert_space(datasize, laststart + offset, b-1);
- for (i = 0 ; i < datasize ; i++)
- laststart[offset + i] = str[i];
-
- /* In re_match_2_internal if range_start < -1, we
- assume -range_start is the offset of the
- collating symbol which is specified as
- the character of the range start. So we assign
- -(laststart[1] + laststart[2] + 6) to
- range_start. */
- range_start = -(laststart[1] + laststart[2] + 6);
- /* Update the length of collating_symbol. */
- laststart[2] += datasize;
- had_char_class = false;
- }
- }
- else
- {
- c1++;
- while (c1--)
- PATUNFETCH;
- BUF_PUSH ('[');
- BUF_PUSH (delim);
- laststart[5] += 2; /* Update the length of characters */
- range_start = delim;
- had_char_class = false;
- }
- }
- else
- {
- had_char_class = false;
- BUF_PUSH(c);
- laststart[5]++; /* Update the length of characters */
- range_start = c;
- }
- }
-
-#else /* BYTE */
- /* Ensure that we have enough space to push a charset: the
- opcode, the length count, and the bitset; 34 bytes in all. */
- GET_BUFFER_SPACE (34);
-
- laststart = b;
-
- /* We test `*p == '^' twice, instead of using an if
- statement, so we only need one BUF_PUSH. */
- BUF_PUSH (*p == '^' ? charset_not : charset);
- if (*p == '^')
- p++;
-
- /* Remember the first position in the bracket expression. */
- p1 = p;
-
- /* Push the number of bytes in the bitmap. */
- BUF_PUSH ((1 << BYTEWIDTH) / BYTEWIDTH);
-
- /* Clear the whole map. */
- bzero (b, (1 << BYTEWIDTH) / BYTEWIDTH);
-
- /* charset_not matches newline according to a syntax bit. */
- if ((re_opcode_t) b[-2] == charset_not
- && (syntax & RE_HAT_LISTS_NOT_NEWLINE))
- SET_LIST_BIT ('\n');
-
- /* Read in characters and ranges, setting map bits. */
- for (;;)
- {
- if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
-
- PATFETCH (c);
-
- /* \ might escape characters inside [...] and [^...]. */
- if ((syntax & RE_BACKSLASH_ESCAPE_IN_LISTS) && c == '\\')
- {
- if (p == pend) FREE_STACK_RETURN (REG_EESCAPE);
-
- PATFETCH (c1);
- SET_LIST_BIT (c1);
- range_start = c1;
- continue;
- }
-
- /* Could be the end of the bracket expression. If it's
- not (i.e., when the bracket expression is `[]' so
- far), the ']' character bit gets set way below. */
- if (c == ']' && p != p1 + 1)
- break;
-
- /* Look ahead to see if it's a range when the last thing
- was a character class. */
- if (had_char_class && c == '-' && *p != ']')
- FREE_STACK_RETURN (REG_ERANGE);
-
- /* Look ahead to see if it's a range when the last thing
- was a character: if this is a hyphen not at the
- beginning or the end of a list, then it's the range
- operator. */
- if (c == '-'
- && !(p - 2 >= pattern && p[-2] == '[')
- && !(p - 3 >= pattern && p[-3] == '[' && p[-2] == '^')
- && *p != ']')
- {
- reg_errcode_t ret
- = byte_compile_range (range_start, &p, pend, translate,
- syntax, b);
- if (ret != REG_NOERROR) FREE_STACK_RETURN (ret);
- range_start = 0xffffffff;
- }
-
- else if (p[0] == '-' && p[1] != ']')
- { /* This handles ranges made up of characters only. */
- reg_errcode_t ret;
-
- /* Move past the `-'. */
- PATFETCH (c1);
-
- ret = byte_compile_range (c, &p, pend, translate, syntax, b);
- if (ret != REG_NOERROR) FREE_STACK_RETURN (ret);
- range_start = 0xffffffff;
- }
-
- /* See if we're at the beginning of a possible character
- class. */
-
- else if (syntax & RE_CHAR_CLASSES && c == '[' && *p == ':')
- { /* Leave room for the null. */
- char str[CHAR_CLASS_MAX_LENGTH + 1];
-
- PATFETCH (c);
- c1 = 0;
-
- /* If pattern is `[[:'. */
- if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
-
- for (;;)
- {
- PATFETCH (c);
- if ((c == ':' && *p == ']') || p == pend)
- break;
- if (c1 < CHAR_CLASS_MAX_LENGTH)
- str[c1++] = c;
- else
- /* This is in any case an invalid class name. */
- str[0] = '\0';
- }
- str[c1] = '\0';
-
- /* If isn't a word bracketed by `[:' and `:]':
- undo the ending character, the letters, and leave
- the leading `:' and `[' (but set bits for them). */
- if (c == ':' && *p == ']')
- {
-# if defined _LIBC || WIDE_CHAR_SUPPORT
- boolean is_lower = STREQ (str, "lower");
- boolean is_upper = STREQ (str, "upper");
- wctype_t wt;
- int ch;
-
- wt = IS_CHAR_CLASS (str);
- if (wt == 0)
- FREE_STACK_RETURN (REG_ECTYPE);
-
- /* Throw away the ] at the end of the character
- class. */
- PATFETCH (c);
-
- if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
-
- for (ch = 0; ch < 1 << BYTEWIDTH; ++ch)
- {
-# ifdef _LIBC
- if (__iswctype (__btowc (ch), wt))
- SET_LIST_BIT (ch);
-# else
- if (iswctype (btowc (ch), wt))
- SET_LIST_BIT (ch);
-# endif
-
- if (translate && (is_upper || is_lower)
- && (ISUPPER (ch) || ISLOWER (ch)))
- SET_LIST_BIT (ch);
- }
-
- had_char_class = true;
-# else
- int ch;
- boolean is_alnum = STREQ (str, "alnum");
- boolean is_alpha = STREQ (str, "alpha");
- boolean is_blank = STREQ (str, "blank");
- boolean is_cntrl = STREQ (str, "cntrl");
- boolean is_digit = STREQ (str, "digit");
- boolean is_graph = STREQ (str, "graph");
- boolean is_lower = STREQ (str, "lower");
- boolean is_print = STREQ (str, "print");
- boolean is_punct = STREQ (str, "punct");
- boolean is_space = STREQ (str, "space");
- boolean is_upper = STREQ (str, "upper");
- boolean is_xdigit = STREQ (str, "xdigit");
-
- if (!IS_CHAR_CLASS (str))
- FREE_STACK_RETURN (REG_ECTYPE);
-
- /* Throw away the ] at the end of the character
- class. */
- PATFETCH (c);
-
- if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
-
- for (ch = 0; ch < 1 << BYTEWIDTH; ch++)
- {
- /* This was split into 3 if's to
- avoid an arbitrary limit in some compiler. */
- if ( (is_alnum && ISALNUM (ch))
- || (is_alpha && ISALPHA (ch))
- || (is_blank && ISBLANK (ch))
- || (is_cntrl && ISCNTRL (ch)))
- SET_LIST_BIT (ch);
- if ( (is_digit && ISDIGIT (ch))
- || (is_graph && ISGRAPH (ch))
- || (is_lower && ISLOWER (ch))
- || (is_print && ISPRINT (ch)))
- SET_LIST_BIT (ch);
- if ( (is_punct && ISPUNCT (ch))
- || (is_space && ISSPACE (ch))
- || (is_upper && ISUPPER (ch))
- || (is_xdigit && ISXDIGIT (ch)))
- SET_LIST_BIT (ch);
- if ( translate && (is_upper || is_lower)
- && (ISUPPER (ch) || ISLOWER (ch)))
- SET_LIST_BIT (ch);
- }
- had_char_class = true;
-# endif /* libc || wctype.h */
- }
- else
- {
- c1++;
- while (c1--)
- PATUNFETCH;
- SET_LIST_BIT ('[');
- SET_LIST_BIT (':');
- range_start = ':';
- had_char_class = false;
- }
- }
- else if (syntax & RE_CHAR_CLASSES && c == '[' && *p == '=')
- {
- unsigned char str[MB_LEN_MAX + 1];
-# ifdef _LIBC
- uint32_t nrules =
- _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
-# endif
-
- PATFETCH (c);
- c1 = 0;
-
- /* If pattern is `[[='. */
- if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
-
- for (;;)
- {
- PATFETCH (c);
- if ((c == '=' && *p == ']') || p == pend)
- break;
- if (c1 < MB_LEN_MAX)
- str[c1++] = c;
- else
- /* This is in any case an invalid class name. */
- str[0] = '\0';
- }
- str[c1] = '\0';
-
- if (c == '=' && *p == ']' && str[0] != '\0')
- {
- /* If we have no collation data we use the default
- collation in which each character is in a class
- by itself. It also means that ASCII is the
- character set and therefore we cannot have character
- with more than one byte in the multibyte
- representation. */
-# ifdef _LIBC
- if (nrules == 0)
-# endif
- {
- if (c1 != 1)
- FREE_STACK_RETURN (REG_ECOLLATE);
-
- /* Throw away the ] at the end of the equivalence
- class. */
- PATFETCH (c);
-
- /* Set the bit for the character. */
- SET_LIST_BIT (str[0]);
- }
-# ifdef _LIBC
- else
- {
- /* Try to match the byte sequence in `str' against
- those known to the collate implementation.
- First find out whether the bytes in `str' are
- actually from exactly one character. */
- const int32_t *table;
- const unsigned char *weights;
- const unsigned char *extra;
- const int32_t *indirect;
- int32_t idx;
- const unsigned char *cp = str;
- int ch;
-
- /* This #include defines a local function! */
-# include <locale/weight.h>
-
- table = (const int32_t *)
- _NL_CURRENT (LC_COLLATE, _NL_COLLATE_TABLEMB);
- weights = (const unsigned char *)
- _NL_CURRENT (LC_COLLATE, _NL_COLLATE_WEIGHTMB);
- extra = (const unsigned char *)
- _NL_CURRENT (LC_COLLATE, _NL_COLLATE_EXTRAMB);
- indirect = (const int32_t *)
- _NL_CURRENT (LC_COLLATE, _NL_COLLATE_INDIRECTMB);
-
- idx = findidx (&cp);
- if (idx == 0 || cp < str + c1)
- /* This is no valid character. */
- FREE_STACK_RETURN (REG_ECOLLATE);
-
- /* Throw away the ] at the end of the equivalence
- class. */
- PATFETCH (c);
-
- /* Now we have to go throught the whole table
- and find all characters which have the same
- first level weight.
-
- XXX Note that this is not entirely correct.
- we would have to match multibyte sequences
- but this is not possible with the current
- implementation. */
- for (ch = 1; ch < 256; ++ch)
- /* XXX This test would have to be changed if we
- would allow matching multibyte sequences. */
- if (table[ch] > 0)
- {
- int32_t idx2 = table[ch];
- size_t len = weights[idx2];
-
- /* Test whether the lenghts match. */
- if (weights[idx] == len)
- {
- /* They do. New compare the bytes of
- the weight. */
- size_t cnt = 0;
-
- while (cnt < len
- && (weights[idx + 1 + cnt]
- == weights[idx2 + 1 + cnt]))
- ++cnt;
-
- if (cnt == len)
- /* They match. Mark the character as
- acceptable. */
- SET_LIST_BIT (ch);
- }
- }
- }
-# endif
- had_char_class = true;
- }
- else
- {
- c1++;
- while (c1--)
- PATUNFETCH;
- SET_LIST_BIT ('[');
- SET_LIST_BIT ('=');
- range_start = '=';
- had_char_class = false;
- }
- }
- else if (syntax & RE_CHAR_CLASSES && c == '[' && *p == '.')
- {
- unsigned char str[128]; /* Should be large enough. */
-# ifdef _LIBC
- uint32_t nrules =
- _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
-# endif
-
- PATFETCH (c);
- c1 = 0;
-
- /* If pattern is `[[.'. */
- if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
-
- for (;;)
- {
- PATFETCH (c);
- if ((c == '.' && *p == ']') || p == pend)
- break;
- if (c1 < sizeof (str))
- str[c1++] = c;
- else
- /* This is in any case an invalid class name. */
- str[0] = '\0';
- }
- str[c1] = '\0';
-
- if (c == '.' && *p == ']' && str[0] != '\0')
- {
- /* If we have no collation data we use the default
- collation in which each character is the name
- for its own class which contains only the one
- character. It also means that ASCII is the
- character set and therefore we cannot have character
- with more than one byte in the multibyte
- representation. */
-# ifdef _LIBC
- if (nrules == 0)
-# endif
- {
- if (c1 != 1)
- FREE_STACK_RETURN (REG_ECOLLATE);
-
- /* Throw away the ] at the end of the equivalence
- class. */
- PATFETCH (c);
-
- /* Set the bit for the character. */
- SET_LIST_BIT (str[0]);
- range_start = ((const unsigned char *) str)[0];
- }
-# ifdef _LIBC
- else
- {
- /* Try to match the byte sequence in `str' against
- those known to the collate implementation.
- First find out whether the bytes in `str' are
- actually from exactly one character. */
- int32_t table_size;
- const int32_t *symb_table;
- const unsigned char *extra;
- int32_t idx;
- int32_t elem;
- int32_t second;
- int32_t hash;
-
- table_size =
- _NL_CURRENT_WORD (LC_COLLATE,
- _NL_COLLATE_SYMB_HASH_SIZEMB);
- symb_table = (const int32_t *)
- _NL_CURRENT (LC_COLLATE,
- _NL_COLLATE_SYMB_TABLEMB);
- extra = (const unsigned char *)
- _NL_CURRENT (LC_COLLATE,
- _NL_COLLATE_SYMB_EXTRAMB);
-
- /* Locate the character in the hashing table. */
- hash = elem_hash (str, c1);
-
- idx = 0;
- elem = hash % table_size;
- second = hash % (table_size - 2);
- while (symb_table[2 * elem] != 0)
- {
- /* First compare the hashing value. */
- if (symb_table[2 * elem] == hash
- && c1 == extra[symb_table[2 * elem + 1]]
- && memcmp (str,
- &extra[symb_table[2 * elem + 1]
- + 1],
- c1) == 0)
- {
- /* Yep, this is the entry. */
- idx = symb_table[2 * elem + 1];
- idx += 1 + extra[idx];
- break;
- }
-
- /* Next entry. */
- elem += second;
- }
-
- if (symb_table[2 * elem] == 0)
- /* This is no valid character. */
- FREE_STACK_RETURN (REG_ECOLLATE);
-
- /* Throw away the ] at the end of the equivalence
- class. */
- PATFETCH (c);
-
- /* Now add the multibyte character(s) we found
- to the accept list.
-
- XXX Note that this is not entirely correct.
- we would have to match multibyte sequences
- but this is not possible with the current
- implementation. Also, we have to match
- collating symbols, which expand to more than
- one file, as a whole and not allow the
- individual bytes. */
- c1 = extra[idx++];
- if (c1 == 1)
- range_start = extra[idx];
- while (c1-- > 0)
- {
- SET_LIST_BIT (extra[idx]);
- ++idx;
- }
- }
-# endif
- had_char_class = false;
- }
- else
- {
- c1++;
- while (c1--)
- PATUNFETCH;
- SET_LIST_BIT ('[');
- SET_LIST_BIT ('.');
- range_start = '.';
- had_char_class = false;
- }
- }
- else
- {
- had_char_class = false;
- SET_LIST_BIT (c);
- range_start = c;
- }
- }
-
- /* Discard any (non)matching list bytes that are all 0 at the
- end of the map. Decrease the map-length byte too. */
- while ((int) b[-1] > 0 && b[b[-1] - 1] == 0)
- b[-1]--;
- b += b[-1];
-#endif /* WCHAR */
- }
- break;
-
-
- case '(':
- if (syntax & RE_NO_BK_PARENS)
- goto handle_open;
- else
- goto normal_char;
-
-
- case ')':
- if (syntax & RE_NO_BK_PARENS)
- goto handle_close;
- else
- goto normal_char;
-
-
- case '\n':
- if (syntax & RE_NEWLINE_ALT)
- goto handle_alt;
- else
- goto normal_char;
-
-
- case '|':
- if (syntax & RE_NO_BK_VBAR)
- goto handle_alt;
- else
- goto normal_char;
-
-
- case '{':
- if (syntax & RE_INTERVALS && syntax & RE_NO_BK_BRACES)
- goto handle_interval;
- else
- goto normal_char;
-
-
- case '\\':
- if (p == pend) FREE_STACK_RETURN (REG_EESCAPE);
-
- /* Do not translate the character after the \, so that we can
- distinguish, e.g., \B from \b, even if we normally would
- translate, e.g., B to b. */
- PATFETCH_RAW (c);
-
- switch (c)
- {
- case '(':
- if (syntax & RE_NO_BK_PARENS)
- goto normal_backslash;
-
- handle_open:
- bufp->re_nsub++;
- regnum++;
-
- if (COMPILE_STACK_FULL)
- {
- RETALLOC (compile_stack.stack, compile_stack.size << 1,
- compile_stack_elt_t);
- if (compile_stack.stack == NULL) return REG_ESPACE;
-
- compile_stack.size <<= 1;
- }
-
- /* These are the values to restore when we hit end of this
- group. They are all relative offsets, so that if the
- whole pattern moves because of realloc, they will still
- be valid. */
- COMPILE_STACK_TOP.begalt_offset = begalt - COMPILED_BUFFER_VAR;
- COMPILE_STACK_TOP.fixup_alt_jump
- = fixup_alt_jump ? fixup_alt_jump - COMPILED_BUFFER_VAR + 1 : 0;
- COMPILE_STACK_TOP.laststart_offset = b - COMPILED_BUFFER_VAR;
- COMPILE_STACK_TOP.regnum = regnum;
-
- /* We will eventually replace the 0 with the number of
- groups inner to this one. But do not push a
- start_memory for groups beyond the last one we can
- represent in the compiled pattern. */
- if (regnum <= MAX_REGNUM)
- {
- COMPILE_STACK_TOP.inner_group_offset = b
- - COMPILED_BUFFER_VAR + 2;
- BUF_PUSH_3 (start_memory, regnum, 0);
- }
-
- compile_stack.avail++;
-
- fixup_alt_jump = 0;
- laststart = 0;
- begalt = b;
- /* If we've reached MAX_REGNUM groups, then this open
- won't actually generate any code, so we'll have to
- clear pending_exact explicitly. */
- pending_exact = 0;
- break;
-
-
- case ')':
- if (syntax & RE_NO_BK_PARENS) goto normal_backslash;
-
- if (COMPILE_STACK_EMPTY)
- {
- if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD)
- goto normal_backslash;
- else
- FREE_STACK_RETURN (REG_ERPAREN);
- }
-
- handle_close:
- if (fixup_alt_jump)
- { /* Push a dummy failure point at the end of the
- alternative for a possible future
- `pop_failure_jump' to pop. See comments at
- `push_dummy_failure' in `re_match_2'. */
- BUF_PUSH (push_dummy_failure);
-
- /* We allocated space for this jump when we assigned
- to `fixup_alt_jump', in the `handle_alt' case below. */
- STORE_JUMP (jump_past_alt, fixup_alt_jump, b - 1);
- }
-
- /* See similar code for backslashed left paren above. */
- if (COMPILE_STACK_EMPTY)
- {
- if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD)
- goto normal_char;
- else
- FREE_STACK_RETURN (REG_ERPAREN);
- }
-
- /* Since we just checked for an empty stack above, this
- ``can't happen''. */
- assert (compile_stack.avail != 0);
- {
- /* We don't just want to restore into `regnum', because
- later groups should continue to be numbered higher,
- as in `(ab)c(de)' -- the second group is #2. */
- regnum_t this_group_regnum;
-
- compile_stack.avail--;
- begalt = COMPILED_BUFFER_VAR + COMPILE_STACK_TOP.begalt_offset;
- fixup_alt_jump
- = COMPILE_STACK_TOP.fixup_alt_jump
- ? COMPILED_BUFFER_VAR + COMPILE_STACK_TOP.fixup_alt_jump - 1
- : 0;
- laststart = COMPILED_BUFFER_VAR + COMPILE_STACK_TOP.laststart_offset;
- this_group_regnum = COMPILE_STACK_TOP.regnum;
- /* If we've reached MAX_REGNUM groups, then this open
- won't actually generate any code, so we'll have to
- clear pending_exact explicitly. */
- pending_exact = 0;
-
- /* We're at the end of the group, so now we know how many
- groups were inside this one. */
- if (this_group_regnum <= MAX_REGNUM)
- {
- UCHAR_T *inner_group_loc
- = COMPILED_BUFFER_VAR + COMPILE_STACK_TOP.inner_group_offset;
-
- *inner_group_loc = regnum - this_group_regnum;
- BUF_PUSH_3 (stop_memory, this_group_regnum,
- regnum - this_group_regnum);
- }
- }
- break;
-
-
- case '|': /* `\|'. */
- if (syntax & RE_LIMITED_OPS || syntax & RE_NO_BK_VBAR)
- goto normal_backslash;
- handle_alt:
- if (syntax & RE_LIMITED_OPS)
- goto normal_char;
-
- /* Insert before the previous alternative a jump which
- jumps to this alternative if the former fails. */
- GET_BUFFER_SPACE (1 + OFFSET_ADDRESS_SIZE);
- INSERT_JUMP (on_failure_jump, begalt,
- b + 2 + 2 * OFFSET_ADDRESS_SIZE);
- pending_exact = 0;
- b += 1 + OFFSET_ADDRESS_SIZE;
-
- /* The alternative before this one has a jump after it
- which gets executed if it gets matched. Adjust that
- jump so it will jump to this alternative's analogous
- jump (put in below, which in turn will jump to the next
- (if any) alternative's such jump, etc.). The last such
- jump jumps to the correct final destination. A picture:
- _____ _____
- | | | |
- | v | v
- a | b | c
-
- If we are at `b', then fixup_alt_jump right now points to a
- three-byte space after `a'. We'll put in the jump, set
- fixup_alt_jump to right after `b', and leave behind three
- bytes which we'll fill in when we get to after `c'. */
-
- if (fixup_alt_jump)
- STORE_JUMP (jump_past_alt, fixup_alt_jump, b);
-
- /* Mark and leave space for a jump after this alternative,
- to be filled in later either by next alternative or
- when know we're at the end of a series of alternatives. */
- fixup_alt_jump = b;
- GET_BUFFER_SPACE (1 + OFFSET_ADDRESS_SIZE);
- b += 1 + OFFSET_ADDRESS_SIZE;
-
- laststart = 0;
- begalt = b;
- break;
-
-
- case '{':
- /* If \{ is a literal. */
- if (!(syntax & RE_INTERVALS)
- /* If we're at `\{' and it's not the open-interval
- operator. */
- || (syntax & RE_NO_BK_BRACES))
- goto normal_backslash;
-
- handle_interval:
- {
- /* If got here, then the syntax allows intervals. */
-
- /* At least (most) this many matches must be made. */
- int lower_bound = -1, upper_bound = -1;
-
- /* Place in the uncompiled pattern (i.e., just after
- the '{') to go back to if the interval is invalid. */
- const CHAR_T *beg_interval = p;
-
- if (p == pend)
- goto invalid_interval;
-
- GET_UNSIGNED_NUMBER (lower_bound);
-
- if (c == ',')
- {
- GET_UNSIGNED_NUMBER (upper_bound);
- if (upper_bound < 0)
- upper_bound = RE_DUP_MAX;
- }
- else
- /* Interval such as `{1}' => match exactly once. */
- upper_bound = lower_bound;
-
- if (! (0 <= lower_bound && lower_bound <= upper_bound))
- goto invalid_interval;
-
- if (!(syntax & RE_NO_BK_BRACES))
- {
- if (c != '\\' || p == pend)
- goto invalid_interval;
- PATFETCH (c);
- }
-
- if (c != '}')
- goto invalid_interval;
-
- /* If it's invalid to have no preceding re. */
- if (!laststart)
- {
- if (syntax & RE_CONTEXT_INVALID_OPS
- && !(syntax & RE_INVALID_INTERVAL_ORD))
- FREE_STACK_RETURN (REG_BADRPT);
- else if (syntax & RE_CONTEXT_INDEP_OPS)
- laststart = b;
- else
- goto unfetch_interval;
- }
-
- /* We just parsed a valid interval. */
-
- if (RE_DUP_MAX < upper_bound)
- FREE_STACK_RETURN (REG_BADBR);
-
- /* If the upper bound is zero, don't want to succeed at
- all; jump from `laststart' to `b + 3', which will be
- the end of the buffer after we insert the jump. */
- /* ifdef WCHAR, 'b + 1 + OFFSET_ADDRESS_SIZE'
- instead of 'b + 3'. */
- if (upper_bound == 0)
- {
- GET_BUFFER_SPACE (1 + OFFSET_ADDRESS_SIZE);
- INSERT_JUMP (jump, laststart, b + 1
- + OFFSET_ADDRESS_SIZE);
- b += 1 + OFFSET_ADDRESS_SIZE;
- }
-
- /* Otherwise, we have a nontrivial interval. When
- we're all done, the pattern will look like:
- set_number_at <jump count> <upper bound>
- set_number_at <succeed_n count> <lower bound>
- succeed_n <after jump addr> <succeed_n count>
- <body of loop>
- jump_n <succeed_n addr> <jump count>
- (The upper bound and `jump_n' are omitted if
- `upper_bound' is 1, though.) */
- else
- { /* If the upper bound is > 1, we need to insert
- more at the end of the loop. */
- unsigned nbytes = 2 + 4 * OFFSET_ADDRESS_SIZE +
- (upper_bound > 1) * (2 + 4 * OFFSET_ADDRESS_SIZE);
-
- GET_BUFFER_SPACE (nbytes);
-
- /* Initialize lower bound of the `succeed_n', even
- though it will be set during matching by its
- attendant `set_number_at' (inserted next),
- because `re_compile_fastmap' needs to know.
- Jump to the `jump_n' we might insert below. */
- INSERT_JUMP2 (succeed_n, laststart,
- b + 1 + 2 * OFFSET_ADDRESS_SIZE
- + (upper_bound > 1) * (1 + 2 * OFFSET_ADDRESS_SIZE)
- , lower_bound);
- b += 1 + 2 * OFFSET_ADDRESS_SIZE;
-
- /* Code to initialize the lower bound. Insert
- before the `succeed_n'. The `5' is the last two
- bytes of this `set_number_at', plus 3 bytes of
- the following `succeed_n'. */
- /* ifdef WCHAR, The '1+2*OFFSET_ADDRESS_SIZE'
- is the 'set_number_at', plus '1+OFFSET_ADDRESS_SIZE'
- of the following `succeed_n'. */
- PREFIX(insert_op2) (set_number_at, laststart, 1
- + 2 * OFFSET_ADDRESS_SIZE, lower_bound, b);
- b += 1 + 2 * OFFSET_ADDRESS_SIZE;
-
- if (upper_bound > 1)
- { /* More than one repetition is allowed, so
- append a backward jump to the `succeed_n'
- that starts this interval.
-
- When we've reached this during matching,
- we'll have matched the interval once, so
- jump back only `upper_bound - 1' times. */
- STORE_JUMP2 (jump_n, b, laststart
- + 2 * OFFSET_ADDRESS_SIZE + 1,
- upper_bound - 1);
- b += 1 + 2 * OFFSET_ADDRESS_SIZE;
-
- /* The location we want to set is the second
- parameter of the `jump_n'; that is `b-2' as
- an absolute address. `laststart' will be
- the `set_number_at' we're about to insert;
- `laststart+3' the number to set, the source
- for the relative address. But we are
- inserting into the middle of the pattern --
- so everything is getting moved up by 5.
- Conclusion: (b - 2) - (laststart + 3) + 5,
- i.e., b - laststart.
-
- We insert this at the beginning of the loop
- so that if we fail during matching, we'll
- reinitialize the bounds. */
- PREFIX(insert_op2) (set_number_at, laststart,
- b - laststart,
- upper_bound - 1, b);
- b += 1 + 2 * OFFSET_ADDRESS_SIZE;
- }
- }
- pending_exact = 0;
- break;
-
- invalid_interval:
- if (!(syntax & RE_INVALID_INTERVAL_ORD))
- FREE_STACK_RETURN (p == pend ? REG_EBRACE : REG_BADBR);
- unfetch_interval:
- /* Match the characters as literals. */
- p = beg_interval;
- c = '{';
- if (syntax & RE_NO_BK_BRACES)
- goto normal_char;
- else
- goto normal_backslash;
- }
-
-#ifdef emacs
- /* There is no way to specify the before_dot and after_dot
- operators. rms says this is ok. --karl */
- case '=':
- BUF_PUSH (at_dot);
- break;
-
- case 's':
- laststart = b;
- PATFETCH (c);
- BUF_PUSH_2 (syntaxspec, syntax_spec_code[c]);
- break;
-
- case 'S':
- laststart = b;
- PATFETCH (c);
- BUF_PUSH_2 (notsyntaxspec, syntax_spec_code[c]);
- break;
-#endif /* emacs */
-
-
- case 'w':
- if (syntax & RE_NO_GNU_OPS)
- goto normal_char;
- laststart = b;
- BUF_PUSH (wordchar);
- break;
-
-
- case 'W':
- if (syntax & RE_NO_GNU_OPS)
- goto normal_char;
- laststart = b;
- BUF_PUSH (notwordchar);
- break;
-
-
- case '<':
- if (syntax & RE_NO_GNU_OPS)
- goto normal_char;
- BUF_PUSH (wordbeg);
- break;
-
- case '>':
- if (syntax & RE_NO_GNU_OPS)
- goto normal_char;
- BUF_PUSH (wordend);
- break;
-
- case 'b':
- if (syntax & RE_NO_GNU_OPS)
- goto normal_char;
- BUF_PUSH (wordbound);
- break;
-
- case 'B':
- if (syntax & RE_NO_GNU_OPS)
- goto normal_char;
- BUF_PUSH (notwordbound);
- break;
-
- case '`':
- if (syntax & RE_NO_GNU_OPS)
- goto normal_char;
- BUF_PUSH (begbuf);
- break;
-
- case '\'':
- if (syntax & RE_NO_GNU_OPS)
- goto normal_char;
- BUF_PUSH (endbuf);
- break;
-
- case '1': case '2': case '3': case '4': case '5':
- case '6': case '7': case '8': case '9':
- if (syntax & RE_NO_BK_REFS)
- goto normal_char;
-
- c1 = c - '0';
-
- if (c1 > regnum)
- FREE_STACK_RETURN (REG_ESUBREG);
-
- /* Can't back reference to a subexpression if inside of it. */
- if (group_in_compile_stack (compile_stack, (regnum_t) c1))
- goto normal_char;
-
- laststart = b;
- BUF_PUSH_2 (duplicate, c1);
- break;
-
-
- case '+':
- case '?':
- if (syntax & RE_BK_PLUS_QM)
- goto handle_plus;
- else
- goto normal_backslash;
-
- default:
- normal_backslash:
- /* You might think it would be useful for \ to mean
- not to translate; but if we don't translate it
- it will never match anything. */
- c = TRANSLATE (c);
- goto normal_char;
- }
- break;
-
-
- default:
- /* Expects the character in `c'. */
- normal_char:
- /* If no exactn currently being built. */
- if (!pending_exact
-#ifdef WCHAR
- /* If last exactn handle binary(or character) and
- new exactn handle character(or binary). */
- || is_exactn_bin != is_binary[p - 1 - pattern]
-#endif /* WCHAR */
-
- /* If last exactn not at current position. */
- || pending_exact + *pending_exact + 1 != b
-
- /* We have only one byte following the exactn for the count. */
- || *pending_exact == (1 << BYTEWIDTH) - 1
-
- /* If followed by a repetition operator. */
- || *p == '*' || *p == '^'
- || ((syntax & RE_BK_PLUS_QM)
- ? *p == '\\' && (p[1] == '+' || p[1] == '?')
- : (*p == '+' || *p == '?'))
- || ((syntax & RE_INTERVALS)
- && ((syntax & RE_NO_BK_BRACES)
- ? *p == '{'
- : (p[0] == '\\' && p[1] == '{'))))
- {
- /* Start building a new exactn. */
-
- laststart = b;
-
-#ifdef WCHAR
- /* Is this exactn binary data or character? */
- is_exactn_bin = is_binary[p - 1 - pattern];
- if (is_exactn_bin)
- BUF_PUSH_2 (exactn_bin, 0);
- else
- BUF_PUSH_2 (exactn, 0);
-#else
- BUF_PUSH_2 (exactn, 0);
-#endif /* WCHAR */
- pending_exact = b - 1;
- }
-
- BUF_PUSH (c);
- (*pending_exact)++;
- break;
- } /* switch (c) */
- } /* while p != pend */
-
-
- /* Through the pattern now. */
-
- if (fixup_alt_jump)
- STORE_JUMP (jump_past_alt, fixup_alt_jump, b);
-
- if (!COMPILE_STACK_EMPTY)
- FREE_STACK_RETURN (REG_EPAREN);
-
- /* If we don't want backtracking, force success
- the first time we reach the end of the compiled pattern. */
- if (syntax & RE_NO_POSIX_BACKTRACKING)
- BUF_PUSH (succeed);
-
-#ifdef WCHAR
- free (pattern);
- free (mbs_offset);
- free (is_binary);
-#endif
- free (compile_stack.stack);
-
- /* We have succeeded; set the length of the buffer. */
-#ifdef WCHAR
- bufp->used = (uintptr_t) b - (uintptr_t) COMPILED_BUFFER_VAR;
-#else
- bufp->used = b - bufp->buffer;
-#endif
-
-#ifdef DEBUG
- if (debug)
- {
- DEBUG_PRINT1 ("\nCompiled pattern: \n");
- PREFIX(print_compiled_pattern) (bufp);
- }
-#endif /* DEBUG */
-
-#ifndef MATCH_MAY_ALLOCATE
- /* Initialize the failure stack to the largest possible stack. This
- isn't necessary unless we're trying to avoid calling alloca in
- the search and match routines. */
- {
- int num_regs = bufp->re_nsub + 1;
-
- /* Since DOUBLE_FAIL_STACK refuses to double only if the current size
- is strictly greater than re_max_failures, the largest possible stack
- is 2 * re_max_failures failure points. */
- if (fail_stack.size < (2 * re_max_failures * MAX_FAILURE_ITEMS))
- {
- fail_stack.size = (2 * re_max_failures * MAX_FAILURE_ITEMS);
-
-# ifdef emacs
- if (! fail_stack.stack)
- fail_stack.stack
- = (PREFIX(fail_stack_elt_t) *) xmalloc (fail_stack.size
- * sizeof (PREFIX(fail_stack_elt_t)));
- else
- fail_stack.stack
- = (PREFIX(fail_stack_elt_t) *) xrealloc (fail_stack.stack,
- (fail_stack.size
- * sizeof (PREFIX(fail_stack_elt_t))));
-# else /* not emacs */
- if (! fail_stack.stack)
- fail_stack.stack
- = (PREFIX(fail_stack_elt_t) *) malloc (fail_stack.size
- * sizeof (PREFIX(fail_stack_elt_t)));
- else
- fail_stack.stack
- = (PREFIX(fail_stack_elt_t) *) realloc (fail_stack.stack,
- (fail_stack.size
- * sizeof (PREFIX(fail_stack_elt_t))));
-# endif /* not emacs */
- }
-
- PREFIX(regex_grow_registers) (num_regs);
- }
-#endif /* not MATCH_MAY_ALLOCATE */
-
- return REG_NOERROR;
-} /* regex_compile */
-
-/* Subroutines for `regex_compile'. */
-
-/* Store OP at LOC followed by two-byte integer parameter ARG. */
-/* ifdef WCHAR, integer parameter is 1 wchar_t. */
-
-static void
-PREFIX(store_op1) (op, loc, arg)
- re_opcode_t op;
- UCHAR_T *loc;
- int arg;
-{
- *loc = (UCHAR_T) op;
- STORE_NUMBER (loc + 1, arg);
-}
-
-
-/* Like `store_op1', but for two two-byte parameters ARG1 and ARG2. */
-/* ifdef WCHAR, integer parameter is 1 wchar_t. */
-
-static void
-PREFIX(store_op2) (op, loc, arg1, arg2)
- re_opcode_t op;
- UCHAR_T *loc;
- int arg1, arg2;
-{
- *loc = (UCHAR_T) op;
- STORE_NUMBER (loc + 1, arg1);
- STORE_NUMBER (loc + 1 + OFFSET_ADDRESS_SIZE, arg2);
-}
-
-
-/* Copy the bytes from LOC to END to open up three bytes of space at LOC
- for OP followed by two-byte integer parameter ARG. */
-/* ifdef WCHAR, integer parameter is 1 wchar_t. */
-
-static void
-PREFIX(insert_op1) (op, loc, arg, end)
- re_opcode_t op;
- UCHAR_T *loc;
- int arg;
- UCHAR_T *end;
-{
- register UCHAR_T *pfrom = end;
- register UCHAR_T *pto = end + 1 + OFFSET_ADDRESS_SIZE;
-
- while (pfrom != loc)
- *--pto = *--pfrom;
-
- PREFIX(store_op1) (op, loc, arg);
-}
-
-
-/* Like `insert_op1', but for two two-byte parameters ARG1 and ARG2. */
-/* ifdef WCHAR, integer parameter is 1 wchar_t. */
-
-static void
-PREFIX(insert_op2) (op, loc, arg1, arg2, end)
- re_opcode_t op;
- UCHAR_T *loc;
- int arg1, arg2;
- UCHAR_T *end;
-{
- register UCHAR_T *pfrom = end;
- register UCHAR_T *pto = end + 1 + 2 * OFFSET_ADDRESS_SIZE;
-
- while (pfrom != loc)
- *--pto = *--pfrom;
-
- PREFIX(store_op2) (op, loc, arg1, arg2);
-}
-
-
-/* P points to just after a ^ in PATTERN. Return true if that ^ comes
- after an alternative or a begin-subexpression. We assume there is at
- least one character before the ^. */
-
-static boolean
-PREFIX(at_begline_loc_p) (pattern, p, syntax)
- const CHAR_T *pattern, *p;
- reg_syntax_t syntax;
-{
- const CHAR_T *prev = p - 2;
- boolean prev_prev_backslash = prev > pattern && prev[-1] == '\\';
-
- return
- /* After a subexpression? */
- (*prev == '(' && (syntax & RE_NO_BK_PARENS || prev_prev_backslash))
- /* After an alternative? */
- || (*prev == '|' && (syntax & RE_NO_BK_VBAR || prev_prev_backslash));
-}
-
-
-/* The dual of at_begline_loc_p. This one is for $. We assume there is
- at least one character after the $, i.e., `P < PEND'. */
-
-static boolean
-PREFIX(at_endline_loc_p) (p, pend, syntax)
- const CHAR_T *p, *pend;
- reg_syntax_t syntax;
-{
- const CHAR_T *next = p;
- boolean next_backslash = *next == '\\';
- const CHAR_T *next_next = p + 1 < pend ? p + 1 : 0;
-
- return
- /* Before a subexpression? */
- (syntax & RE_NO_BK_PARENS ? *next == ')'
- : next_backslash && next_next && *next_next == ')')
- /* Before an alternative? */
- || (syntax & RE_NO_BK_VBAR ? *next == '|'
- : next_backslash && next_next && *next_next == '|');
-}
-
-#else /* not INSIDE_RECURSION */
-
-/* Returns true if REGNUM is in one of COMPILE_STACK's elements and
- false if it's not. */
-
-static boolean
-group_in_compile_stack (compile_stack, regnum)
- compile_stack_type compile_stack;
- regnum_t regnum;
-{
- int this_element;
-
- for (this_element = compile_stack.avail - 1;
- this_element >= 0;
- this_element--)
- if (compile_stack.stack[this_element].regnum == regnum)
- return true;
-
- return false;
-}
-#endif /* not INSIDE_RECURSION */
-
-#ifdef INSIDE_RECURSION
-
-#ifdef WCHAR
-/* This insert space, which size is "num", into the pattern at "loc".
- "end" must point the end of the allocated buffer. */
-static void
-insert_space (num, loc, end)
- int num;
- CHAR_T *loc;
- CHAR_T *end;
-{
- register CHAR_T *pto = end;
- register CHAR_T *pfrom = end - num;
-
- while (pfrom >= loc)
- *pto-- = *pfrom--;
-}
-#endif /* WCHAR */
-
-#ifdef WCHAR
-static reg_errcode_t
-wcs_compile_range (range_start_char, p_ptr, pend, translate, syntax, b,
- char_set)
- CHAR_T range_start_char;
- const CHAR_T **p_ptr, *pend;
- CHAR_T *char_set, *b;
- RE_TRANSLATE_TYPE translate;
- reg_syntax_t syntax;
-{
- const CHAR_T *p = *p_ptr;
- CHAR_T range_start, range_end;
- reg_errcode_t ret;
-# ifdef _LIBC
- uint32_t nrules;
- uint32_t start_val, end_val;
-# endif
- if (p == pend)
- return REG_ERANGE;
-
-# ifdef _LIBC
- nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
- if (nrules != 0)
- {
- const char *collseq = (const char *) _NL_CURRENT(LC_COLLATE,
- _NL_COLLATE_COLLSEQWC);
- const unsigned char *extra = (const unsigned char *)
- _NL_CURRENT (LC_COLLATE, _NL_COLLATE_SYMB_EXTRAMB);
-
- if (range_start_char < -1)
- {
- /* range_start is a collating symbol. */
- int32_t *wextra;
- /* Retreive the index and get collation sequence value. */
- wextra = (int32_t*)(extra + char_set[-range_start_char]);
- start_val = wextra[1 + *wextra];
- }
- else
- start_val = collseq_table_lookup(collseq, TRANSLATE(range_start_char));
-
- end_val = collseq_table_lookup (collseq, TRANSLATE (p[0]));
-
- /* Report an error if the range is empty and the syntax prohibits
- this. */
- ret = ((syntax & RE_NO_EMPTY_RANGES)
- && (start_val > end_val))? REG_ERANGE : REG_NOERROR;
-
- /* Insert space to the end of the char_ranges. */
- insert_space(2, b - char_set[5] - 2, b - 1);
- *(b - char_set[5] - 2) = (wchar_t)start_val;
- *(b - char_set[5] - 1) = (wchar_t)end_val;
- char_set[4]++; /* ranges_index */
- }
- else
-# endif
- {
- range_start = (range_start_char >= 0)? TRANSLATE (range_start_char):
- range_start_char;
- range_end = TRANSLATE (p[0]);
- /* Report an error if the range is empty and the syntax prohibits
- this. */
- ret = ((syntax & RE_NO_EMPTY_RANGES)
- && (range_start > range_end))? REG_ERANGE : REG_NOERROR;
-
- /* Insert space to the end of the char_ranges. */
- insert_space(2, b - char_set[5] - 2, b - 1);
- *(b - char_set[5] - 2) = range_start;
- *(b - char_set[5] - 1) = range_end;
- char_set[4]++; /* ranges_index */
- }
- /* Have to increment the pointer into the pattern string, so the
- caller isn't still at the ending character. */
- (*p_ptr)++;
-
- return ret;
-}
-#else /* BYTE */
-/* Read the ending character of a range (in a bracket expression) from the
- uncompiled pattern *P_PTR (which ends at PEND). We assume the
- starting character is in `P[-2]'. (`P[-1]' is the character `-'.)
- Then we set the translation of all bits between the starting and
- ending characters (inclusive) in the compiled pattern B.
-
- Return an error code.
-
- We use these short variable names so we can use the same macros as
- `regex_compile' itself. */
-
-static reg_errcode_t
-byte_compile_range (range_start_char, p_ptr, pend, translate, syntax, b)
- unsigned int range_start_char;
- const char **p_ptr, *pend;
- RE_TRANSLATE_TYPE translate;
- reg_syntax_t syntax;
- unsigned char *b;
-{
- unsigned this_char;
- const char *p = *p_ptr;
- reg_errcode_t ret;
-# if _LIBC
- const unsigned char *collseq;
- unsigned int start_colseq;
- unsigned int end_colseq;
-# else
- unsigned end_char;
-# endif
-
- if (p == pend)
- return REG_ERANGE;
-
- /* Have to increment the pointer into the pattern string, so the
- caller isn't still at the ending character. */
- (*p_ptr)++;
-
- /* Report an error if the range is empty and the syntax prohibits this. */
- ret = syntax & RE_NO_EMPTY_RANGES ? REG_ERANGE : REG_NOERROR;
-
-# if _LIBC
- collseq = (const unsigned char *) _NL_CURRENT (LC_COLLATE,
- _NL_COLLATE_COLLSEQMB);
-
- start_colseq = collseq[(unsigned char) TRANSLATE (range_start_char)];
- end_colseq = collseq[(unsigned char) TRANSLATE (p[0])];
- for (this_char = 0; this_char <= (unsigned char) -1; ++this_char)
- {
- unsigned int this_colseq = collseq[(unsigned char) TRANSLATE (this_char)];
-
- if (start_colseq <= this_colseq && this_colseq <= end_colseq)
- {
- SET_LIST_BIT (TRANSLATE (this_char));
- ret = REG_NOERROR;
- }
- }
-# else
- /* Here we see why `this_char' has to be larger than an `unsigned
- char' -- we would otherwise go into an infinite loop, since all
- characters <= 0xff. */
- range_start_char = TRANSLATE (range_start_char);
- /* TRANSLATE(p[0]) is casted to char (not unsigned char) in TRANSLATE,
- and some compilers cast it to int implicitly, so following for_loop
- may fall to (almost) infinite loop.
- e.g. If translate[p[0]] = 0xff, end_char may equals to 0xffffffff.
- To avoid this, we cast p[0] to unsigned int and truncate it. */
- end_char = ((unsigned)TRANSLATE(p[0]) & ((1 << BYTEWIDTH) - 1));
-
- for (this_char = range_start_char; this_char <= end_char; ++this_char)
- {
- SET_LIST_BIT (TRANSLATE (this_char));
- ret = REG_NOERROR;
- }
-# endif
-
- return ret;
-}
-#endif /* WCHAR */
-
-/* re_compile_fastmap computes a ``fastmap'' for the compiled pattern in
- BUFP. A fastmap records which of the (1 << BYTEWIDTH) possible
- characters can start a string that matches the pattern. This fastmap
- is used by re_search to skip quickly over impossible starting points.
-
- The caller must supply the address of a (1 << BYTEWIDTH)-byte data
- area as BUFP->fastmap.
-
- We set the `fastmap', `fastmap_accurate', and `can_be_null' fields in
- the pattern buffer.
-
- Returns 0 if we succeed, -2 if an internal error. */
-
-#ifdef WCHAR
-/* local function for re_compile_fastmap.
- truncate wchar_t character to char. */
-static unsigned char truncate_wchar (CHAR_T c);
-
-static unsigned char
-truncate_wchar (c)
- CHAR_T c;
-{
- unsigned char buf[MB_CUR_MAX];
- mbstate_t state;
- int retval;
- memset (&state, '\0', sizeof (state));
-# ifdef _LIBC
- retval = __wcrtomb (buf, c, &state);
-# else
- retval = wcrtomb (buf, c, &state);
-# endif
- return retval > 0 ? buf[0] : (unsigned char) c;
-}
-#endif /* WCHAR */
-
-static int
-PREFIX(re_compile_fastmap) (bufp)
- struct re_pattern_buffer *bufp;
-{
- int j, k;
-#ifdef MATCH_MAY_ALLOCATE
- PREFIX(fail_stack_type) fail_stack;
-#endif
-#ifndef REGEX_MALLOC
- char *destination;
-#endif
-
- register char *fastmap = bufp->fastmap;
-
-#ifdef WCHAR
- /* We need to cast pattern to (wchar_t*), because we casted this compiled
- pattern to (char*) in regex_compile. */
- UCHAR_T *pattern = (UCHAR_T*)bufp->buffer;
- register UCHAR_T *pend = (UCHAR_T*) (bufp->buffer + bufp->used);
-#else /* BYTE */
- UCHAR_T *pattern = bufp->buffer;
- register UCHAR_T *pend = pattern + bufp->used;
-#endif /* WCHAR */
- UCHAR_T *p = pattern;
-
-#ifdef REL_ALLOC
- /* This holds the pointer to the failure stack, when
- it is allocated relocatably. */
- fail_stack_elt_t *failure_stack_ptr;
-#endif
-
- /* Assume that each path through the pattern can be null until
- proven otherwise. We set this false at the bottom of switch
- statement, to which we get only if a particular path doesn't
- match the empty string. */
- boolean path_can_be_null = true;
-
- /* We aren't doing a `succeed_n' to begin with. */
- boolean succeed_n_p = false;
-
- assert (fastmap != NULL && p != NULL);
-
- INIT_FAIL_STACK ();
- bzero (fastmap, 1 << BYTEWIDTH); /* Assume nothing's valid. */
- bufp->fastmap_accurate = 1; /* It will be when we're done. */
- bufp->can_be_null = 0;
-
- while (1)
- {
- if (p == pend || *p == (UCHAR_T) succeed)
- {
- /* We have reached the (effective) end of pattern. */
- if (!FAIL_STACK_EMPTY ())
- {
- bufp->can_be_null |= path_can_be_null;
-
- /* Reset for next path. */
- path_can_be_null = true;
-
- p = fail_stack.stack[--fail_stack.avail].pointer;
-
- continue;
- }
- else
- break;
- }
-
- /* We should never be about to go beyond the end of the pattern. */
- assert (p < pend);
-
- switch (SWITCH_ENUM_CAST ((re_opcode_t) *p++))
- {
-
- /* I guess the idea here is to simply not bother with a fastmap
- if a backreference is used, since it's too hard to figure out
- the fastmap for the corresponding group. Setting
- `can_be_null' stops `re_search_2' from using the fastmap, so
- that is all we do. */
- case duplicate:
- bufp->can_be_null = 1;
- goto done;
-
-
- /* Following are the cases which match a character. These end
- with `break'. */
-
-#ifdef WCHAR
- case exactn:
- fastmap[truncate_wchar(p[1])] = 1;
- break;
-#else /* BYTE */
- case exactn:
- fastmap[p[1]] = 1;
- break;
-#endif /* WCHAR */
-#ifdef MBS_SUPPORT
- case exactn_bin:
- fastmap[p[1]] = 1;
- break;
-#endif
-
-#ifdef WCHAR
- /* It is hard to distinguish fastmap from (multi byte) characters
- which depends on current locale. */
- case charset:
- case charset_not:
- case wordchar:
- case notwordchar:
- bufp->can_be_null = 1;
- goto done;
-#else /* BYTE */
- case charset:
- for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--)
- if (p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH)))
- fastmap[j] = 1;
- break;
-
-
- case charset_not:
- /* Chars beyond end of map must be allowed. */
- for (j = *p * BYTEWIDTH; j < (1 << BYTEWIDTH); j++)
- fastmap[j] = 1;
-
- for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--)
- if (!(p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH))))
- fastmap[j] = 1;
- break;
-
-
- case wordchar:
- for (j = 0; j < (1 << BYTEWIDTH); j++)
- if (SYNTAX (j) == Sword)
- fastmap[j] = 1;
- break;
-
-
- case notwordchar:
- for (j = 0; j < (1 << BYTEWIDTH); j++)
- if (SYNTAX (j) != Sword)
- fastmap[j] = 1;
- break;
-#endif /* WCHAR */
-
- case anychar:
- {
- int fastmap_newline = fastmap['\n'];
-
- /* `.' matches anything ... */
- for (j = 0; j < (1 << BYTEWIDTH); j++)
- fastmap[j] = 1;
-
- /* ... except perhaps newline. */
- if (!(bufp->syntax & RE_DOT_NEWLINE))
- fastmap['\n'] = fastmap_newline;
-
- /* Return if we have already set `can_be_null'; if we have,
- then the fastmap is irrelevant. Something's wrong here. */
- else if (bufp->can_be_null)
- goto done;
-
- /* Otherwise, have to check alternative paths. */
- break;
- }
-
-#ifdef emacs
- case syntaxspec:
- k = *p++;
- for (j = 0; j < (1 << BYTEWIDTH); j++)
- if (SYNTAX (j) == (enum syntaxcode) k)
- fastmap[j] = 1;
- break;
-
-
- case notsyntaxspec:
- k = *p++;
- for (j = 0; j < (1 << BYTEWIDTH); j++)
- if (SYNTAX (j) != (enum syntaxcode) k)
- fastmap[j] = 1;
- break;
-
-
- /* All cases after this match the empty string. These end with
- `continue'. */
-
-
- case before_dot:
- case at_dot:
- case after_dot:
- continue;
-#endif /* emacs */
-
-
- case no_op:
- case begline:
- case endline:
- case begbuf:
- case endbuf:
- case wordbound:
- case notwordbound:
- case wordbeg:
- case wordend:
- case push_dummy_failure:
- continue;
-
-
- case jump_n:
- case pop_failure_jump:
- case maybe_pop_jump:
- case jump:
- case jump_past_alt:
- case dummy_failure_jump:
- EXTRACT_NUMBER_AND_INCR (j, p);
- p += j;
- if (j > 0)
- continue;
-
- /* Jump backward implies we just went through the body of a
- loop and matched nothing. Opcode jumped to should be
- `on_failure_jump' or `succeed_n'. Just treat it like an
- ordinary jump. For a * loop, it has pushed its failure
- point already; if so, discard that as redundant. */
- if ((re_opcode_t) *p != on_failure_jump
- && (re_opcode_t) *p != succeed_n)
- continue;
-
- p++;
- EXTRACT_NUMBER_AND_INCR (j, p);
- p += j;
-
- /* If what's on the stack is where we are now, pop it. */
- if (!FAIL_STACK_EMPTY ()
- && fail_stack.stack[fail_stack.avail - 1].pointer == p)
- fail_stack.avail--;
-
- continue;
-
-
- case on_failure_jump:
- case on_failure_keep_string_jump:
- handle_on_failure_jump:
- EXTRACT_NUMBER_AND_INCR (j, p);
-
- /* For some patterns, e.g., `(a?)?', `p+j' here points to the
- end of the pattern. We don't want to push such a point,
- since when we restore it above, entering the switch will
- increment `p' past the end of the pattern. We don't need
- to push such a point since we obviously won't find any more
- fastmap entries beyond `pend'. Such a pattern can match
- the null string, though. */
- if (p + j < pend)
- {
- if (!PUSH_PATTERN_OP (p + j, fail_stack))
- {
- RESET_FAIL_STACK ();
- return -2;
- }
- }
- else
- bufp->can_be_null = 1;
-
- if (succeed_n_p)
- {
- EXTRACT_NUMBER_AND_INCR (k, p); /* Skip the n. */
- succeed_n_p = false;
- }
-
- continue;
-
-
- case succeed_n:
- /* Get to the number of times to succeed. */
- p += OFFSET_ADDRESS_SIZE;
-
- /* Increment p past the n for when k != 0. */
- EXTRACT_NUMBER_AND_INCR (k, p);
- if (k == 0)
- {
- p -= 2 * OFFSET_ADDRESS_SIZE;
- succeed_n_p = true; /* Spaghetti code alert. */
- goto handle_on_failure_jump;
- }
- continue;
-
-
- case set_number_at:
- p += 2 * OFFSET_ADDRESS_SIZE;
- continue;
-
-
- case start_memory:
- case stop_memory:
- p += 2;
- continue;
-
-
- default:
- abort (); /* We have listed all the cases. */
- } /* switch *p++ */
-
- /* Getting here means we have found the possible starting
- characters for one path of the pattern -- and that the empty
- string does not match. We need not follow this path further.
- Instead, look at the next alternative (remembered on the
- stack), or quit if no more. The test at the top of the loop
- does these things. */
- path_can_be_null = false;
- p = pend;
- } /* while p */
-
- /* Set `can_be_null' for the last path (also the first path, if the
- pattern is empty). */
- bufp->can_be_null |= path_can_be_null;
-
- done:
- RESET_FAIL_STACK ();
- return 0;
-}
-
-#else /* not INSIDE_RECURSION */
-
-int
-re_compile_fastmap (bufp)
- struct re_pattern_buffer *bufp;
-{
-# ifdef MBS_SUPPORT
- if (MB_CUR_MAX != 1)
- return wcs_re_compile_fastmap(bufp);
- else
-# endif
- return byte_re_compile_fastmap(bufp);
-} /* re_compile_fastmap */
-#ifdef _LIBC
-weak_alias (__re_compile_fastmap, re_compile_fastmap)
-#endif
-
-
-/* Set REGS to hold NUM_REGS registers, storing them in STARTS and
- ENDS. Subsequent matches using PATTERN_BUFFER and REGS will use
- this memory for recording register information. STARTS and ENDS
- must be allocated using the malloc library routine, and must each
- be at least NUM_REGS * sizeof (regoff_t) bytes long.
-
- If NUM_REGS == 0, then subsequent matches should allocate their own
- register data.
-
- Unless this function is called, the first search or match using
- PATTERN_BUFFER will allocate its own register data, without
- freeing the old data. */
-
-void
-re_set_registers (bufp, regs, num_regs, starts, ends)
- struct re_pattern_buffer *bufp;
- struct re_registers *regs;
- unsigned num_regs;
- regoff_t *starts, *ends;
-{
- if (num_regs)
- {
- bufp->regs_allocated = REGS_REALLOCATE;
- regs->num_regs = num_regs;
- regs->start = starts;
- regs->end = ends;
- }
- else
- {
- bufp->regs_allocated = REGS_UNALLOCATED;
- regs->num_regs = 0;
- regs->start = regs->end = (regoff_t *) 0;
- }
-}
-#ifdef _LIBC
-weak_alias (__re_set_registers, re_set_registers)
-#endif
-
-/* Searching routines. */
-
-/* Like re_search_2, below, but only one string is specified, and
- doesn't let you say where to stop matching. */
-
-int
-re_search (bufp, string, size, startpos, range, regs)
- struct re_pattern_buffer *bufp;
- const char *string;
- int size, startpos, range;
- struct re_registers *regs;
-{
- return re_search_2 (bufp, NULL, 0, string, size, startpos, range,
- regs, size);
-}
-#ifdef _LIBC
-weak_alias (__re_search, re_search)
-#endif
-
-
-/* Using the compiled pattern in BUFP->buffer, first tries to match the
- virtual concatenation of STRING1 and STRING2, starting first at index
- STARTPOS, then at STARTPOS + 1, and so on.
-
- STRING1 and STRING2 have length SIZE1 and SIZE2, respectively.
-
- RANGE is how far to scan while trying to match. RANGE = 0 means try
- only at STARTPOS; in general, the last start tried is STARTPOS +
- RANGE.
-
- In REGS, return the indices of the virtual concatenation of STRING1
- and STRING2 that matched the entire BUFP->buffer and its contained
- subexpressions.
-
- Do not consider matching one past the index STOP in the virtual
- concatenation of STRING1 and STRING2.
-
- We return either the position in the strings at which the match was
- found, -1 if no match, or -2 if error (such as failure
- stack overflow). */
-
-int
-re_search_2 (bufp, string1, size1, string2, size2, startpos, range, regs, stop)
- struct re_pattern_buffer *bufp;
- const char *string1, *string2;
- int size1, size2;
- int startpos;
- int range;
- struct re_registers *regs;
- int stop;
-{
-# ifdef MBS_SUPPORT
- if (MB_CUR_MAX != 1)
- return wcs_re_search_2 (bufp, string1, size1, string2, size2, startpos,
- range, regs, stop);
- else
-# endif
- return byte_re_search_2 (bufp, string1, size1, string2, size2, startpos,
- range, regs, stop);
-} /* re_search_2 */
-#ifdef _LIBC
-weak_alias (__re_search_2, re_search_2)
-#endif
-
-#endif /* not INSIDE_RECURSION */
-
-#ifdef INSIDE_RECURSION
-
-#ifdef MATCH_MAY_ALLOCATE
-# define FREE_VAR(var) if (var) REGEX_FREE (var); var = NULL
-#else
-# define FREE_VAR(var) if (var) free (var); var = NULL
-#endif
-
-#ifdef WCHAR
-# define MAX_ALLOCA_SIZE 2000
-
-# define FREE_WCS_BUFFERS() \
- do { \
- if (size1 > MAX_ALLOCA_SIZE) \
- { \
- free (wcs_string1); \
- free (mbs_offset1); \
- } \
- else \
- { \
- FREE_VAR (wcs_string1); \
- FREE_VAR (mbs_offset1); \
- } \
- if (size2 > MAX_ALLOCA_SIZE) \
- { \
- free (wcs_string2); \
- free (mbs_offset2); \
- } \
- else \
- { \
- FREE_VAR (wcs_string2); \
- FREE_VAR (mbs_offset2); \
- } \
- } while (0)
-
-#endif
-
-
-static int
-PREFIX(re_search_2) (bufp, string1, size1, string2, size2, startpos, range,
- regs, stop)
- struct re_pattern_buffer *bufp;
- const char *string1, *string2;
- int size1, size2;
- int startpos;
- int range;
- struct re_registers *regs;
- int stop;
-{
- int val;
- register char *fastmap = bufp->fastmap;
- register RE_TRANSLATE_TYPE translate = bufp->translate;
- int total_size = size1 + size2;
- int endpos = startpos + range;
-#ifdef WCHAR
- /* We need wchar_t* buffers correspond to cstring1, cstring2. */
- wchar_t *wcs_string1 = NULL, *wcs_string2 = NULL;
- /* We need the size of wchar_t buffers correspond to csize1, csize2. */
- int wcs_size1 = 0, wcs_size2 = 0;
- /* offset buffer for optimizatoin. See convert_mbs_to_wc. */
- int *mbs_offset1 = NULL, *mbs_offset2 = NULL;
- /* They hold whether each wchar_t is binary data or not. */
- char *is_binary = NULL;
-#endif /* WCHAR */
-
- /* Check for out-of-range STARTPOS. */
- if (startpos < 0 || startpos > total_size)
- return -1;
-
- /* Fix up RANGE if it might eventually take us outside
- the virtual concatenation of STRING1 and STRING2.
- Make sure we won't move STARTPOS below 0 or above TOTAL_SIZE. */
- if (endpos < 0)
- range = 0 - startpos;
- else if (endpos > total_size)
- range = total_size - startpos;
-
- /* If the search isn't to be a backwards one, don't waste time in a
- search for a pattern that must be anchored. */
- if (bufp->used > 0 && range > 0
- && ((re_opcode_t) bufp->buffer[0] == begbuf
- /* `begline' is like `begbuf' if it cannot match at newlines. */
- || ((re_opcode_t) bufp->buffer[0] == begline
- && !bufp->newline_anchor)))
- {
- if (startpos > 0)
- return -1;
- else
- range = 1;
- }
-
-#ifdef emacs
- /* In a forward search for something that starts with \=.
- don't keep searching past point. */
- if (bufp->used > 0 && (re_opcode_t) bufp->buffer[0] == at_dot && range > 0)
- {
- range = PT - startpos;
- if (range <= 0)
- return -1;
- }
-#endif /* emacs */
-
- /* Update the fastmap now if not correct already. */
- if (fastmap && !bufp->fastmap_accurate)
- if (re_compile_fastmap (bufp) == -2)
- return -2;
-
-#ifdef WCHAR
- /* Allocate wchar_t array for wcs_string1 and wcs_string2 and
- fill them with converted string. */
- if (size1 != 0)
- {
- if (size1 > MAX_ALLOCA_SIZE)
- {
- wcs_string1 = TALLOC (size1 + 1, CHAR_T);
- mbs_offset1 = TALLOC (size1 + 1, int);
- is_binary = TALLOC (size1 + 1, char);
- }
- else
- {
- wcs_string1 = REGEX_TALLOC (size1 + 1, CHAR_T);
- mbs_offset1 = REGEX_TALLOC (size1 + 1, int);
- is_binary = REGEX_TALLOC (size1 + 1, char);
- }
- if (!wcs_string1 || !mbs_offset1 || !is_binary)
- {
- if (size1 > MAX_ALLOCA_SIZE)
- {
- free (wcs_string1);
- free (mbs_offset1);
- free (is_binary);
- }
- else
- {
- FREE_VAR (wcs_string1);
- FREE_VAR (mbs_offset1);
- FREE_VAR (is_binary);
- }
- return -2;
- }
- wcs_size1 = convert_mbs_to_wcs(wcs_string1, string1, size1,
- mbs_offset1, is_binary);
- wcs_string1[wcs_size1] = L'\0'; /* for a sentinel */
- if (size1 > MAX_ALLOCA_SIZE)
- free (is_binary);
- else
- FREE_VAR (is_binary);
- }
- if (size2 != 0)
- {
- if (size2 > MAX_ALLOCA_SIZE)
- {
- wcs_string2 = TALLOC (size2 + 1, CHAR_T);
- mbs_offset2 = TALLOC (size2 + 1, int);
- is_binary = TALLOC (size2 + 1, char);
- }
- else
- {
- wcs_string2 = REGEX_TALLOC (size2 + 1, CHAR_T);
- mbs_offset2 = REGEX_TALLOC (size2 + 1, int);
- is_binary = REGEX_TALLOC (size2 + 1, char);
- }
- if (!wcs_string2 || !mbs_offset2 || !is_binary)
- {
- FREE_WCS_BUFFERS ();
- if (size2 > MAX_ALLOCA_SIZE)
- free (is_binary);
- else
- FREE_VAR (is_binary);
- return -2;
- }
- wcs_size2 = convert_mbs_to_wcs(wcs_string2, string2, size2,
- mbs_offset2, is_binary);
- wcs_string2[wcs_size2] = L'\0'; /* for a sentinel */
- if (size2 > MAX_ALLOCA_SIZE)
- free (is_binary);
- else
- FREE_VAR (is_binary);
- }
-#endif /* WCHAR */
-
-
- /* Loop through the string, looking for a place to start matching. */
- for (;;)
- {
- /* If a fastmap is supplied, skip quickly over characters that
- cannot be the start of a match. If the pattern can match the
- null string, however, we don't need to skip characters; we want
- the first null string. */
- if (fastmap && startpos < total_size && !bufp->can_be_null)
- {
- if (range > 0) /* Searching forwards. */
- {
- register const char *d;
- register int lim = 0;
- int irange = range;
-
- if (startpos < size1 && startpos + range >= size1)
- lim = range - (size1 - startpos);
-
- d = (startpos >= size1 ? string2 - size1 : string1) + startpos;
-
- /* Written out as an if-else to avoid testing `translate'
- inside the loop. */
- if (translate)
- while (range > lim
- && !fastmap[(unsigned char)
- translate[(unsigned char) *d++]])
- range--;
- else
- while (range > lim && !fastmap[(unsigned char) *d++])
- range--;
-
- startpos += irange - range;
- }
- else /* Searching backwards. */
- {
- register CHAR_T c = (size1 == 0 || startpos >= size1
- ? string2[startpos - size1]
- : string1[startpos]);
-
- if (!fastmap[(unsigned char) TRANSLATE (c)])
- goto advance;
- }
- }
-
- /* If can't match the null string, and that's all we have left, fail. */
- if (range >= 0 && startpos == total_size && fastmap
- && !bufp->can_be_null)
- {
-#ifdef WCHAR
- FREE_WCS_BUFFERS ();
-#endif
- return -1;
- }
-
-#ifdef WCHAR
- val = wcs_re_match_2_internal (bufp, string1, size1, string2,
- size2, startpos, regs, stop,
- wcs_string1, wcs_size1,
- wcs_string2, wcs_size2,
- mbs_offset1, mbs_offset2);
-#else /* BYTE */
- val = byte_re_match_2_internal (bufp, string1, size1, string2,
- size2, startpos, regs, stop);
-#endif /* BYTE */
-
-#ifndef REGEX_MALLOC
-# ifdef C_ALLOCA
- alloca (0);
-# endif
-#endif
-
- if (val >= 0)
- {
-#ifdef WCHAR
- FREE_WCS_BUFFERS ();
-#endif
- return startpos;
- }
-
- if (val == -2)
- {
-#ifdef WCHAR
- FREE_WCS_BUFFERS ();
-#endif
- return -2;
- }
-
- advance:
- if (!range)
- break;
- else if (range > 0)
- {
- range--;
- startpos++;
- }
- else
- {
- range++;
- startpos--;
- }
- }
-#ifdef WCHAR
- FREE_WCS_BUFFERS ();
-#endif
- return -1;
-}
-
-#ifdef WCHAR
-/* This converts PTR, a pointer into one of the search wchar_t strings
- `string1' and `string2' into an multibyte string offset from the
- beginning of that string. We use mbs_offset to optimize.
- See convert_mbs_to_wcs. */
-# define POINTER_TO_OFFSET(ptr) \
- (FIRST_STRING_P (ptr) \
- ? ((regoff_t)(mbs_offset1 != NULL? mbs_offset1[(ptr)-string1] : 0)) \
- : ((regoff_t)((mbs_offset2 != NULL? mbs_offset2[(ptr)-string2] : 0) \
- + csize1)))
-#else /* BYTE */
-/* This converts PTR, a pointer into one of the search strings `string1'
- and `string2' into an offset from the beginning of that string. */
-# define POINTER_TO_OFFSET(ptr) \
- (FIRST_STRING_P (ptr) \
- ? ((regoff_t) ((ptr) - string1)) \
- : ((regoff_t) ((ptr) - string2 + size1)))
-#endif /* WCHAR */
-
-/* Macros for dealing with the split strings in re_match_2. */
-
-#define MATCHING_IN_FIRST_STRING (dend == end_match_1)
-
-/* Call before fetching a character with *d. This switches over to
- string2 if necessary. */
-#define PREFETCH() \
- while (d == dend) \
- { \
- /* End of string2 => fail. */ \
- if (dend == end_match_2) \
- goto fail; \
- /* End of string1 => advance to string2. */ \
- d = string2; \
- dend = end_match_2; \
- }
-
-/* Test if at very beginning or at very end of the virtual concatenation
- of `string1' and `string2'. If only one string, it's `string2'. */
-#define AT_STRINGS_BEG(d) ((d) == (size1 ? string1 : string2) || !size2)
-#define AT_STRINGS_END(d) ((d) == end2)
-
-
-/* Test if D points to a character which is word-constituent. We have
- two special cases to check for: if past the end of string1, look at
- the first character in string2; and if before the beginning of
- string2, look at the last character in string1. */
-#ifdef WCHAR
-/* Use internationalized API instead of SYNTAX. */
-# define WORDCHAR_P(d) \
- (iswalnum ((wint_t)((d) == end1 ? *string2 \
- : (d) == string2 - 1 ? *(end1 - 1) : *(d))) != 0 \
- || ((d) == end1 ? *string2 \
- : (d) == string2 - 1 ? *(end1 - 1) : *(d)) == L'_')
-#else /* BYTE */
-# define WORDCHAR_P(d) \
- (SYNTAX ((d) == end1 ? *string2 \
- : (d) == string2 - 1 ? *(end1 - 1) : *(d)) \
- == Sword)
-#endif /* WCHAR */
-
-/* Disabled due to a compiler bug -- see comment at case wordbound */
-#if 0
-/* Test if the character before D and the one at D differ with respect
- to being word-constituent. */
-#define AT_WORD_BOUNDARY(d) \
- (AT_STRINGS_BEG (d) || AT_STRINGS_END (d) \
- || WORDCHAR_P (d - 1) != WORDCHAR_P (d))
-#endif
-
-/* Free everything we malloc. */
-#ifdef MATCH_MAY_ALLOCATE
-# ifdef WCHAR
-# define FREE_VARIABLES() \
- do { \
- REGEX_FREE_STACK (fail_stack.stack); \
- FREE_VAR (regstart); \
- FREE_VAR (regend); \
- FREE_VAR (old_regstart); \
- FREE_VAR (old_regend); \
- FREE_VAR (best_regstart); \
- FREE_VAR (best_regend); \
- FREE_VAR (reg_info); \
- FREE_VAR (reg_dummy); \
- FREE_VAR (reg_info_dummy); \
- if (!cant_free_wcs_buf) \
- { \
- FREE_VAR (string1); \
- FREE_VAR (string2); \
- FREE_VAR (mbs_offset1); \
- FREE_VAR (mbs_offset2); \
- } \
- } while (0)
-# else /* BYTE */
-# define FREE_VARIABLES() \
- do { \
- REGEX_FREE_STACK (fail_stack.stack); \
- FREE_VAR (regstart); \
- FREE_VAR (regend); \
- FREE_VAR (old_regstart); \
- FREE_VAR (old_regend); \
- FREE_VAR (best_regstart); \
- FREE_VAR (best_regend); \
- FREE_VAR (reg_info); \
- FREE_VAR (reg_dummy); \
- FREE_VAR (reg_info_dummy); \
- } while (0)
-# endif /* WCHAR */
-#else
-# ifdef WCHAR
-# define FREE_VARIABLES() \
- do { \
- if (!cant_free_wcs_buf) \
- { \
- FREE_VAR (string1); \
- FREE_VAR (string2); \
- FREE_VAR (mbs_offset1); \
- FREE_VAR (mbs_offset2); \
- } \
- } while (0)
-# else /* BYTE */
-# define FREE_VARIABLES() ((void)0) /* Do nothing! But inhibit gcc warning. */
-# endif /* WCHAR */
-#endif /* not MATCH_MAY_ALLOCATE */
-
-/* These values must meet several constraints. They must not be valid
- register values; since we have a limit of 255 registers (because
- we use only one byte in the pattern for the register number), we can
- use numbers larger than 255. They must differ by 1, because of
- NUM_FAILURE_ITEMS above. And the value for the lowest register must
- be larger than the value for the highest register, so we do not try
- to actually save any registers when none are active. */
-#define NO_HIGHEST_ACTIVE_REG (1 << BYTEWIDTH)
-#define NO_LOWEST_ACTIVE_REG (NO_HIGHEST_ACTIVE_REG + 1)
-
-#else /* not INSIDE_RECURSION */
-/* Matching routines. */
-
-#ifndef emacs /* Emacs never uses this. */
-/* re_match is like re_match_2 except it takes only a single string. */
-
-int
-re_match (bufp, string, size, pos, regs)
- struct re_pattern_buffer *bufp;
- const char *string;
- int size, pos;
- struct re_registers *regs;
-{
- int result;
-# ifdef MBS_SUPPORT
- if (MB_CUR_MAX != 1)
- result = wcs_re_match_2_internal (bufp, NULL, 0, string, size,
- pos, regs, size,
- NULL, 0, NULL, 0, NULL, NULL);
- else
-# endif
- result = byte_re_match_2_internal (bufp, NULL, 0, string, size,
- pos, regs, size);
-# ifndef REGEX_MALLOC
-# ifdef C_ALLOCA
- alloca (0);
-# endif
-# endif
- return result;
-}
-# ifdef _LIBC
-weak_alias (__re_match, re_match)
-# endif
-#endif /* not emacs */
-
-#endif /* not INSIDE_RECURSION */
-
-#ifdef INSIDE_RECURSION
-static boolean PREFIX(group_match_null_string_p) _RE_ARGS ((UCHAR_T **p,
- UCHAR_T *end,
- PREFIX(register_info_type) *reg_info));
-static boolean PREFIX(alt_match_null_string_p) _RE_ARGS ((UCHAR_T *p,
- UCHAR_T *end,
- PREFIX(register_info_type) *reg_info));
-static boolean PREFIX(common_op_match_null_string_p) _RE_ARGS ((UCHAR_T **p,
- UCHAR_T *end,
- PREFIX(register_info_type) *reg_info));
-static int PREFIX(bcmp_translate) _RE_ARGS ((const CHAR_T *s1, const CHAR_T *s2,
- int len, char *translate));
-#else /* not INSIDE_RECURSION */
-
-/* re_match_2 matches the compiled pattern in BUFP against the
- the (virtual) concatenation of STRING1 and STRING2 (of length SIZE1
- and SIZE2, respectively). We start matching at POS, and stop
- matching at STOP.
-
- If REGS is non-null and the `no_sub' field of BUFP is nonzero, we
- store offsets for the substring each group matched in REGS. See the
- documentation for exactly how many groups we fill.
-
- We return -1 if no match, -2 if an internal error (such as the
- failure stack overflowing). Otherwise, we return the length of the
- matched substring. */
-
-int
-re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
- struct re_pattern_buffer *bufp;
- const char *string1, *string2;
- int size1, size2;
- int pos;
- struct re_registers *regs;
- int stop;
-{
- int result;
-# ifdef MBS_SUPPORT
- if (MB_CUR_MAX != 1)
- result = wcs_re_match_2_internal (bufp, string1, size1, string2, size2,
- pos, regs, stop,
- NULL, 0, NULL, 0, NULL, NULL);
- else
-# endif
- result = byte_re_match_2_internal (bufp, string1, size1, string2, size2,
- pos, regs, stop);
-
-#ifndef REGEX_MALLOC
-# ifdef C_ALLOCA
- alloca (0);
-# endif
-#endif
- return result;
-}
-#ifdef _LIBC
-weak_alias (__re_match_2, re_match_2)
-#endif
-
-#endif /* not INSIDE_RECURSION */
-
-#ifdef INSIDE_RECURSION
-
-#ifdef WCHAR
-static int count_mbs_length PARAMS ((int *, int));
-
-/* This check the substring (from 0, to length) of the multibyte string,
- to which offset_buffer correspond. And count how many wchar_t_characters
- the substring occupy. We use offset_buffer to optimization.
- See convert_mbs_to_wcs. */
-
-static int
-count_mbs_length(offset_buffer, length)
- int *offset_buffer;
- int length;
-{
- int upper, lower;
-
- /* Check whether the size is valid. */
- if (length < 0)
- return -1;
-
- if (offset_buffer == NULL)
- return 0;
-
- /* If there are no multibyte character, offset_buffer[i] == i.
- Optmize for this case. */
- if (offset_buffer[length] == length)
- return length;
-
- /* Set up upper with length. (because for all i, offset_buffer[i] >= i) */
- upper = length;
- lower = 0;
-
- while (true)
- {
- int middle = (lower + upper) / 2;
- if (middle == lower || middle == upper)
- break;
- if (offset_buffer[middle] > length)
- upper = middle;
- else if (offset_buffer[middle] < length)
- lower = middle;
- else
- return middle;
- }
-
- return -1;
-}
-#endif /* WCHAR */
-
-/* This is a separate function so that we can force an alloca cleanup
- afterwards. */
-#ifdef WCHAR
-static int
-wcs_re_match_2_internal (bufp, cstring1, csize1, cstring2, csize2, pos,
- regs, stop, string1, size1, string2, size2,
- mbs_offset1, mbs_offset2)
- struct re_pattern_buffer *bufp;
- const char *cstring1, *cstring2;
- int csize1, csize2;
- int pos;
- struct re_registers *regs;
- int stop;
- /* string1 == string2 == NULL means string1/2, size1/2 and
- mbs_offset1/2 need seting up in this function. */
- /* We need wchar_t* buffers correspond to cstring1, cstring2. */
- wchar_t *string1, *string2;
- /* We need the size of wchar_t buffers correspond to csize1, csize2. */
- int size1, size2;
- /* offset buffer for optimizatoin. See convert_mbs_to_wc. */
- int *mbs_offset1, *mbs_offset2;
-#else /* BYTE */
-static int
-byte_re_match_2_internal (bufp, string1, size1,string2, size2, pos,
- regs, stop)
- struct re_pattern_buffer *bufp;
- const char *string1, *string2;
- int size1, size2;
- int pos;
- struct re_registers *regs;
- int stop;
-#endif /* BYTE */
-{
- /* General temporaries. */
- int mcnt;
- UCHAR_T *p1;
-#ifdef WCHAR
- /* They hold whether each wchar_t is binary data or not. */
- char *is_binary = NULL;
- /* If true, we can't free string1/2, mbs_offset1/2. */
- int cant_free_wcs_buf = 1;
-#endif /* WCHAR */
-
- /* Just past the end of the corresponding string. */
- const CHAR_T *end1, *end2;
-
- /* Pointers into string1 and string2, just past the last characters in
- each to consider matching. */
- const CHAR_T *end_match_1, *end_match_2;
-
- /* Where we are in the data, and the end of the current string. */
- const CHAR_T *d, *dend;
-
- /* Where we are in the pattern, and the end of the pattern. */
-#ifdef WCHAR
- UCHAR_T *pattern, *p;
- register UCHAR_T *pend;
-#else /* BYTE */
- UCHAR_T *p = bufp->buffer;
- register UCHAR_T *pend = p + bufp->used;
-#endif /* WCHAR */
-
- /* Mark the opcode just after a start_memory, so we can test for an
- empty subpattern when we get to the stop_memory. */
- UCHAR_T *just_past_start_mem = 0;
-
- /* We use this to map every character in the string. */
- RE_TRANSLATE_TYPE translate = bufp->translate;
-
- /* Failure point stack. Each place that can handle a failure further
- down the line pushes a failure point on this stack. It consists of
- restart, regend, and reg_info for all registers corresponding to
- the subexpressions we're currently inside, plus the number of such
- registers, and, finally, two char *'s. The first char * is where
- to resume scanning the pattern; the second one is where to resume
- scanning the strings. If the latter is zero, the failure point is
- a ``dummy''; if a failure happens and the failure point is a dummy,
- it gets discarded and the next next one is tried. */
-#ifdef MATCH_MAY_ALLOCATE /* otherwise, this is global. */
- PREFIX(fail_stack_type) fail_stack;
-#endif
-#ifdef DEBUG
- static unsigned failure_id;
- unsigned nfailure_points_pushed = 0, nfailure_points_popped = 0;
-#endif
-
-#ifdef REL_ALLOC
- /* This holds the pointer to the failure stack, when
- it is allocated relocatably. */
- fail_stack_elt_t *failure_stack_ptr;
-#endif
-
- /* We fill all the registers internally, independent of what we
- return, for use in backreferences. The number here includes
- an element for register zero. */
- size_t num_regs = bufp->re_nsub + 1;
-
- /* The currently active registers. */
- active_reg_t lowest_active_reg = NO_LOWEST_ACTIVE_REG;
- active_reg_t highest_active_reg = NO_HIGHEST_ACTIVE_REG;
-
- /* Information on the contents of registers. These are pointers into
- the input strings; they record just what was matched (on this
- attempt) by a subexpression part of the pattern, that is, the
- regnum-th regstart pointer points to where in the pattern we began
- matching and the regnum-th regend points to right after where we
- stopped matching the regnum-th subexpression. (The zeroth register
- keeps track of what the whole pattern matches.) */
-#ifdef MATCH_MAY_ALLOCATE /* otherwise, these are global. */
- const CHAR_T **regstart, **regend;
-#endif
-
- /* If a group that's operated upon by a repetition operator fails to
- match anything, then the register for its start will need to be
- restored because it will have been set to wherever in the string we
- are when we last see its open-group operator. Similarly for a
- register's end. */
-#ifdef MATCH_MAY_ALLOCATE /* otherwise, these are global. */
- const CHAR_T **old_regstart, **old_regend;
-#endif
-
- /* The is_active field of reg_info helps us keep track of which (possibly
- nested) subexpressions we are currently in. The matched_something
- field of reg_info[reg_num] helps us tell whether or not we have
- matched any of the pattern so far this time through the reg_num-th
- subexpression. These two fields get reset each time through any
- loop their register is in. */
-#ifdef MATCH_MAY_ALLOCATE /* otherwise, this is global. */
- PREFIX(register_info_type) *reg_info;
-#endif
-
- /* The following record the register info as found in the above
- variables when we find a match better than any we've seen before.
- This happens as we backtrack through the failure points, which in
- turn happens only if we have not yet matched the entire string. */
- unsigned best_regs_set = false;
-#ifdef MATCH_MAY_ALLOCATE /* otherwise, these are global. */
- const CHAR_T **best_regstart, **best_regend;
-#endif
-
- /* Logically, this is `best_regend[0]'. But we don't want to have to
- allocate space for that if we're not allocating space for anything
- else (see below). Also, we never need info about register 0 for
- any of the other register vectors, and it seems rather a kludge to
- treat `best_regend' differently than the rest. So we keep track of
- the end of the best match so far in a separate variable. We
- initialize this to NULL so that when we backtrack the first time
- and need to test it, it's not garbage. */
- const CHAR_T *match_end = NULL;
-
- /* This helps SET_REGS_MATCHED avoid doing redundant work. */
- int set_regs_matched_done = 0;
-
- /* Used when we pop values we don't care about. */
-#ifdef MATCH_MAY_ALLOCATE /* otherwise, these are global. */
- const CHAR_T **reg_dummy;
- PREFIX(register_info_type) *reg_info_dummy;
-#endif
-
-#ifdef DEBUG
- /* Counts the total number of registers pushed. */
- unsigned num_regs_pushed = 0;
-#endif
-
- DEBUG_PRINT1 ("\n\nEntering re_match_2.\n");
-
- INIT_FAIL_STACK ();
-
-#ifdef MATCH_MAY_ALLOCATE
- /* Do not bother to initialize all the register variables if there are
- no groups in the pattern, as it takes a fair amount of time. If
- there are groups, we include space for register 0 (the whole
- pattern), even though we never use it, since it simplifies the
- array indexing. We should fix this. */
- if (bufp->re_nsub)
- {
- regstart = REGEX_TALLOC (num_regs, const CHAR_T *);
- regend = REGEX_TALLOC (num_regs, const CHAR_T *);
- old_regstart = REGEX_TALLOC (num_regs, const CHAR_T *);
- old_regend = REGEX_TALLOC (num_regs, const CHAR_T *);
- best_regstart = REGEX_TALLOC (num_regs, const CHAR_T *);
- best_regend = REGEX_TALLOC (num_regs, const CHAR_T *);
- reg_info = REGEX_TALLOC (num_regs, PREFIX(register_info_type));
- reg_dummy = REGEX_TALLOC (num_regs, const CHAR_T *);
- reg_info_dummy = REGEX_TALLOC (num_regs, PREFIX(register_info_type));
-
- if (!(regstart && regend && old_regstart && old_regend && reg_info
- && best_regstart && best_regend && reg_dummy && reg_info_dummy))
- {
- FREE_VARIABLES ();
- return -2;
- }
- }
- else
- {
- /* We must initialize all our variables to NULL, so that
- `FREE_VARIABLES' doesn't try to free them. */
- regstart = regend = old_regstart = old_regend = best_regstart
- = best_regend = reg_dummy = NULL;
- reg_info = reg_info_dummy = (PREFIX(register_info_type) *) NULL;
- }
-#endif /* MATCH_MAY_ALLOCATE */
-
- /* The starting position is bogus. */
-#ifdef WCHAR
- if (pos < 0 || pos > csize1 + csize2)
-#else /* BYTE */
- if (pos < 0 || pos > size1 + size2)
-#endif
- {
- FREE_VARIABLES ();
- return -1;
- }
-
-#ifdef WCHAR
- /* Allocate wchar_t array for string1 and string2 and
- fill them with converted string. */
- if (string1 == NULL && string2 == NULL)
- {
- /* We need seting up buffers here. */
-
- /* We must free wcs buffers in this function. */
- cant_free_wcs_buf = 0;
-
- if (csize1 != 0)
- {
- string1 = REGEX_TALLOC (csize1 + 1, CHAR_T);
- mbs_offset1 = REGEX_TALLOC (csize1 + 1, int);
- is_binary = REGEX_TALLOC (csize1 + 1, char);
- if (!string1 || !mbs_offset1 || !is_binary)
- {
- FREE_VAR (string1);
- FREE_VAR (mbs_offset1);
- FREE_VAR (is_binary);
- return -2;
- }
- }
- if (csize2 != 0)
- {
- string2 = REGEX_TALLOC (csize2 + 1, CHAR_T);
- mbs_offset2 = REGEX_TALLOC (csize2 + 1, int);
- is_binary = REGEX_TALLOC (csize2 + 1, char);
- if (!string2 || !mbs_offset2 || !is_binary)
- {
- FREE_VAR (string1);
- FREE_VAR (mbs_offset1);
- FREE_VAR (string2);
- FREE_VAR (mbs_offset2);
- FREE_VAR (is_binary);
- return -2;
- }
- size2 = convert_mbs_to_wcs(string2, cstring2, csize2,
- mbs_offset2, is_binary);
- string2[size2] = L'\0'; /* for a sentinel */
- FREE_VAR (is_binary);
- }
- }
-
- /* We need to cast pattern to (wchar_t*), because we casted this compiled
- pattern to (char*) in regex_compile. */
- p = pattern = (CHAR_T*)bufp->buffer;
- pend = (CHAR_T*)(bufp->buffer + bufp->used);
-
-#endif /* WCHAR */
-
- /* Initialize subexpression text positions to -1 to mark ones that no
- start_memory/stop_memory has been seen for. Also initialize the
- register information struct. */
- for (mcnt = 1; (unsigned) mcnt < num_regs; mcnt++)
- {
- regstart[mcnt] = regend[mcnt]
- = old_regstart[mcnt] = old_regend[mcnt] = REG_UNSET_VALUE;
-
- REG_MATCH_NULL_STRING_P (reg_info[mcnt]) = MATCH_NULL_UNSET_VALUE;
- IS_ACTIVE (reg_info[mcnt]) = 0;
- MATCHED_SOMETHING (reg_info[mcnt]) = 0;
- EVER_MATCHED_SOMETHING (reg_info[mcnt]) = 0;
- }
-
- /* We move `string1' into `string2' if the latter's empty -- but not if
- `string1' is null. */
- if (size2 == 0 && string1 != NULL)
- {
- string2 = string1;
- size2 = size1;
- string1 = 0;
- size1 = 0;
-#ifdef WCHAR
- mbs_offset2 = mbs_offset1;
- csize2 = csize1;
- mbs_offset1 = NULL;
- csize1 = 0;
-#endif
- }
- end1 = string1 + size1;
- end2 = string2 + size2;
-
- /* Compute where to stop matching, within the two strings. */
-#ifdef WCHAR
- if (stop <= csize1)
- {
- mcnt = count_mbs_length(mbs_offset1, stop);
- end_match_1 = string1 + mcnt;
- end_match_2 = string2;
- }
- else
- {
- if (stop > csize1 + csize2)
- stop = csize1 + csize2;
- end_match_1 = end1;
- mcnt = count_mbs_length(mbs_offset2, stop-csize1);
- end_match_2 = string2 + mcnt;
- }
- if (mcnt < 0)
- { /* count_mbs_length return error. */
- FREE_VARIABLES ();
- return -1;
- }
-#else
- if (stop <= size1)
- {
- end_match_1 = string1 + stop;
- end_match_2 = string2;
- }
- else
- {
- end_match_1 = end1;
- end_match_2 = string2 + stop - size1;
- }
-#endif /* WCHAR */
-
- /* `p' scans through the pattern as `d' scans through the data.
- `dend' is the end of the input string that `d' points within. `d'
- is advanced into the following input string whenever necessary, but
- this happens before fetching; therefore, at the beginning of the
- loop, `d' can be pointing at the end of a string, but it cannot
- equal `string2'. */
-#ifdef WCHAR
- if (size1 > 0 && pos <= csize1)
- {
- mcnt = count_mbs_length(mbs_offset1, pos);
- d = string1 + mcnt;
- dend = end_match_1;
- }
- else
- {
- mcnt = count_mbs_length(mbs_offset2, pos-csize1);
- d = string2 + mcnt;
- dend = end_match_2;
- }
-
- if (mcnt < 0)
- { /* count_mbs_length return error. */
- FREE_VARIABLES ();
- return -1;
- }
-#else
- if (size1 > 0 && pos <= size1)
- {
- d = string1 + pos;
- dend = end_match_1;
- }
- else
- {
- d = string2 + pos - size1;
- dend = end_match_2;
- }
-#endif /* WCHAR */
-
- DEBUG_PRINT1 ("The compiled pattern is:\n");
- DEBUG_PRINT_COMPILED_PATTERN (bufp, p, pend);
- DEBUG_PRINT1 ("The string to match is: `");
- DEBUG_PRINT_DOUBLE_STRING (d, string1, size1, string2, size2);
- DEBUG_PRINT1 ("'\n");
-
- /* This loops over pattern commands. It exits by returning from the
- function if the match is complete, or it drops through if the match
- fails at this starting point in the input data. */
- for (;;)
- {
-#ifdef _LIBC
- DEBUG_PRINT2 ("\n%p: ", p);
-#else
- DEBUG_PRINT2 ("\n0x%x: ", p);
-#endif
-
- if (p == pend)
- { /* End of pattern means we might have succeeded. */
- DEBUG_PRINT1 ("end of pattern ... ");
-
- /* If we haven't matched the entire string, and we want the
- longest match, try backtracking. */
- if (d != end_match_2)
- {
- /* 1 if this match ends in the same string (string1 or string2)
- as the best previous match. */
- boolean same_str_p = (FIRST_STRING_P (match_end)
- == MATCHING_IN_FIRST_STRING);
- /* 1 if this match is the best seen so far. */
- boolean best_match_p;
-
- /* AIX compiler got confused when this was combined
- with the previous declaration. */
- if (same_str_p)
- best_match_p = d > match_end;
- else
- best_match_p = !MATCHING_IN_FIRST_STRING;
-
- DEBUG_PRINT1 ("backtracking.\n");
-
- if (!FAIL_STACK_EMPTY ())
- { /* More failure points to try. */
-
- /* If exceeds best match so far, save it. */
- if (!best_regs_set || best_match_p)
- {
- best_regs_set = true;
- match_end = d;
-
- DEBUG_PRINT1 ("\nSAVING match as best so far.\n");
-
- for (mcnt = 1; (unsigned) mcnt < num_regs; mcnt++)
- {
- best_regstart[mcnt] = regstart[mcnt];
- best_regend[mcnt] = regend[mcnt];
- }
- }
- goto fail;
- }
-
- /* If no failure points, don't restore garbage. And if
- last match is real best match, don't restore second
- best one. */
- else if (best_regs_set && !best_match_p)
- {
- restore_best_regs:
- /* Restore best match. It may happen that `dend ==
- end_match_1' while the restored d is in string2.
- For example, the pattern `x.*y.*z' against the
- strings `x-' and `y-z-', if the two strings are
- not consecutive in memory. */
- DEBUG_PRINT1 ("Restoring best registers.\n");
-
- d = match_end;
- dend = ((d >= string1 && d <= end1)
- ? end_match_1 : end_match_2);
-
- for (mcnt = 1; (unsigned) mcnt < num_regs; mcnt++)
- {
- regstart[mcnt] = best_regstart[mcnt];
- regend[mcnt] = best_regend[mcnt];
- }
- }
- } /* d != end_match_2 */
-
- succeed_label:
- DEBUG_PRINT1 ("Accepting match.\n");
- /* If caller wants register contents data back, do it. */
- if (regs && !bufp->no_sub)
- {
- /* Have the register data arrays been allocated? */
- if (bufp->regs_allocated == REGS_UNALLOCATED)
- { /* No. So allocate them with malloc. We need one
- extra element beyond `num_regs' for the `-1' marker
- GNU code uses. */
- regs->num_regs = MAX (RE_NREGS, num_regs + 1);
- regs->start = TALLOC (regs->num_regs, regoff_t);
- regs->end = TALLOC (regs->num_regs, regoff_t);
- if (regs->start == NULL || regs->end == NULL)
- {
- FREE_VARIABLES ();
- return -2;
- }
- bufp->regs_allocated = REGS_REALLOCATE;
- }
- else if (bufp->regs_allocated == REGS_REALLOCATE)
- { /* Yes. If we need more elements than were already
- allocated, reallocate them. If we need fewer, just
- leave it alone. */
- if (regs->num_regs < num_regs + 1)
- {
- regs->num_regs = num_regs + 1;
- RETALLOC (regs->start, regs->num_regs, regoff_t);
- RETALLOC (regs->end, regs->num_regs, regoff_t);
- if (regs->start == NULL || regs->end == NULL)
- {
- FREE_VARIABLES ();
- return -2;
- }
- }
- }
- else
- {
- /* These braces fend off a "empty body in an else-statement"
- warning under GCC when assert expands to nothing. */
- assert (bufp->regs_allocated == REGS_FIXED);
- }
-
- /* Convert the pointer data in `regstart' and `regend' to
- indices. Register zero has to be set differently,
- since we haven't kept track of any info for it. */
- if (regs->num_regs > 0)
- {
- regs->start[0] = pos;
-#ifdef WCHAR
- if (MATCHING_IN_FIRST_STRING)
- regs->end[0] = mbs_offset1 != NULL ?
- mbs_offset1[d-string1] : 0;
- else
- regs->end[0] = csize1 + (mbs_offset2 != NULL ?
- mbs_offset2[d-string2] : 0);
-#else
- regs->end[0] = (MATCHING_IN_FIRST_STRING
- ? ((regoff_t) (d - string1))
- : ((regoff_t) (d - string2 + size1)));
-#endif /* WCHAR */
- }
-
- /* Go through the first `min (num_regs, regs->num_regs)'
- registers, since that is all we initialized. */
- for (mcnt = 1; (unsigned) mcnt < MIN (num_regs, regs->num_regs);
- mcnt++)
- {
- if (REG_UNSET (regstart[mcnt]) || REG_UNSET (regend[mcnt]))
- regs->start[mcnt] = regs->end[mcnt] = -1;
- else
- {
- regs->start[mcnt]
- = (regoff_t) POINTER_TO_OFFSET (regstart[mcnt]);
- regs->end[mcnt]
- = (regoff_t) POINTER_TO_OFFSET (regend[mcnt]);
- }
- }
-
- /* If the regs structure we return has more elements than
- were in the pattern, set the extra elements to -1. If
- we (re)allocated the registers, this is the case,
- because we always allocate enough to have at least one
- -1 at the end. */
- for (mcnt = num_regs; (unsigned) mcnt < regs->num_regs; mcnt++)
- regs->start[mcnt] = regs->end[mcnt] = -1;
- } /* regs && !bufp->no_sub */
-
- DEBUG_PRINT4 ("%u failure points pushed, %u popped (%u remain).\n",
- nfailure_points_pushed, nfailure_points_popped,
- nfailure_points_pushed - nfailure_points_popped);
- DEBUG_PRINT2 ("%u registers pushed.\n", num_regs_pushed);
-
-#ifdef WCHAR
- if (MATCHING_IN_FIRST_STRING)
- mcnt = mbs_offset1 != NULL ? mbs_offset1[d-string1] : 0;
- else
- mcnt = (mbs_offset2 != NULL ? mbs_offset2[d-string2] : 0) +
- csize1;
- mcnt -= pos;
-#else
- mcnt = d - pos - (MATCHING_IN_FIRST_STRING
- ? string1
- : string2 - size1);
-#endif /* WCHAR */
-
- DEBUG_PRINT2 ("Returning %d from re_match_2.\n", mcnt);
-
- FREE_VARIABLES ();
- return mcnt;
- }
-
- /* Otherwise match next pattern command. */
- switch (SWITCH_ENUM_CAST ((re_opcode_t) *p++))
- {
- /* Ignore these. Used to ignore the n of succeed_n's which
- currently have n == 0. */
- case no_op:
- DEBUG_PRINT1 ("EXECUTING no_op.\n");
- break;
-
- case succeed:
- DEBUG_PRINT1 ("EXECUTING succeed.\n");
- goto succeed_label;
-
- /* Match the next n pattern characters exactly. The following
- byte in the pattern defines n, and the n bytes after that
- are the characters to match. */
- case exactn:
-#ifdef MBS_SUPPORT
- case exactn_bin:
-#endif
- mcnt = *p++;
- DEBUG_PRINT2 ("EXECUTING exactn %d.\n", mcnt);
-
- /* This is written out as an if-else so we don't waste time
- testing `translate' inside the loop. */
- if (translate)
- {
- do
- {
- PREFETCH ();
-#ifdef WCHAR
- if (*d <= 0xff)
- {
- if ((UCHAR_T) translate[(unsigned char) *d++]
- != (UCHAR_T) *p++)
- goto fail;
- }
- else
- {
- if (*d++ != (CHAR_T) *p++)
- goto fail;
- }
-#else
- if ((UCHAR_T) translate[(unsigned char) *d++]
- != (UCHAR_T) *p++)
- goto fail;
-#endif /* WCHAR */
- }
- while (--mcnt);
- }
- else
- {
- do
- {
- PREFETCH ();
- if (*d++ != (CHAR_T) *p++) goto fail;
- }
- while (--mcnt);
- }
- SET_REGS_MATCHED ();
- break;
-
-
- /* Match any character except possibly a newline or a null. */
- case anychar:
- DEBUG_PRINT1 ("EXECUTING anychar.\n");
-
- PREFETCH ();
-
- if ((!(bufp->syntax & RE_DOT_NEWLINE) && TRANSLATE (*d) == '\n')
- || (bufp->syntax & RE_DOT_NOT_NULL && TRANSLATE (*d) == '\000'))
- goto fail;
-
- SET_REGS_MATCHED ();
- DEBUG_PRINT2 (" Matched `%ld'.\n", (long int) *d);
- d++;
- break;
-
-
- case charset:
- case charset_not:
- {
- register UCHAR_T c;
-#ifdef WCHAR
- unsigned int i, char_class_length, coll_symbol_length,
- equiv_class_length, ranges_length, chars_length, length;
- CHAR_T *workp, *workp2, *charset_top;
-#define WORK_BUFFER_SIZE 128
- CHAR_T str_buf[WORK_BUFFER_SIZE];
-# ifdef _LIBC
- uint32_t nrules;
-# endif /* _LIBC */
-#endif /* WCHAR */
- boolean not = (re_opcode_t) *(p - 1) == charset_not;
-
- DEBUG_PRINT2 ("EXECUTING charset%s.\n", not ? "_not" : "");
- PREFETCH ();
- c = TRANSLATE (*d); /* The character to match. */
-#ifdef WCHAR
-# ifdef _LIBC
- nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
-# endif /* _LIBC */
- charset_top = p - 1;
- char_class_length = *p++;
- coll_symbol_length = *p++;
- equiv_class_length = *p++;
- ranges_length = *p++;
- chars_length = *p++;
- /* p points charset[6], so the address of the next instruction
- (charset[l+m+n+2o+k+p']) equals p[l+m+n+2*o+p'],
- where l=length of char_classes, m=length of collating_symbol,
- n=equivalence_class, o=length of char_range,
- p'=length of character. */
- workp = p;
- /* Update p to indicate the next instruction. */
- p += char_class_length + coll_symbol_length+ equiv_class_length +
- 2*ranges_length + chars_length;
-
- /* match with char_class? */
- for (i = 0; i < char_class_length ; i += CHAR_CLASS_SIZE)
- {
- wctype_t wctype;
- uintptr_t alignedp = ((uintptr_t)workp
- + __alignof__(wctype_t) - 1)
- & ~(uintptr_t)(__alignof__(wctype_t) - 1);
- wctype = *((wctype_t*)alignedp);
- workp += CHAR_CLASS_SIZE;
-# ifdef _LIBC
- if (__iswctype((wint_t)c, wctype))
- goto char_set_matched;
-# else
- if (iswctype((wint_t)c, wctype))
- goto char_set_matched;
-# endif
- }
-
- /* match with collating_symbol? */
-# ifdef _LIBC
- if (nrules != 0)
- {
- const unsigned char *extra = (const unsigned char *)
- _NL_CURRENT (LC_COLLATE, _NL_COLLATE_SYMB_EXTRAMB);
-
- for (workp2 = workp + coll_symbol_length ; workp < workp2 ;
- workp++)
- {
- int32_t *wextra;
- wextra = (int32_t*)(extra + *workp++);
- for (i = 0; i < *wextra; ++i)
- if (TRANSLATE(d[i]) != wextra[1 + i])
- break;
-
- if (i == *wextra)
- {
- /* Update d, however d will be incremented at
- char_set_matched:, we decrement d here. */
- d += i - 1;
- goto char_set_matched;
- }
- }
- }
- else /* (nrules == 0) */
-# endif
- /* If we can't look up collation data, we use wcscoll
- instead. */
- {
- for (workp2 = workp + coll_symbol_length ; workp < workp2 ;)
- {
- const CHAR_T *backup_d = d, *backup_dend = dend;
-# ifdef _LIBC
- length = __wcslen (workp);
-# else
- length = wcslen (workp);
-# endif
-
- /* If wcscoll(the collating symbol, whole string) > 0,
- any substring of the string never match with the
- collating symbol. */
-# ifdef _LIBC
- if (__wcscoll (workp, d) > 0)
-# else
- if (wcscoll (workp, d) > 0)
-# endif
- {
- workp += length + 1;
- continue;
- }
-
- /* First, we compare the collating symbol with
- the first character of the string.
- If it don't match, we add the next character to
- the compare buffer in turn. */
- for (i = 0 ; i < WORK_BUFFER_SIZE-1 ; i++, d++)
- {
- int match;
- if (d == dend)
- {
- if (dend == end_match_2)
- break;
- d = string2;
- dend = end_match_2;
- }
-
- /* add next character to the compare buffer. */
- str_buf[i] = TRANSLATE(*d);
- str_buf[i+1] = '\0';
-
-# ifdef _LIBC
- match = __wcscoll (workp, str_buf);
-# else
- match = wcscoll (workp, str_buf);
-# endif
- if (match == 0)
- goto char_set_matched;
-
- if (match < 0)
- /* (str_buf > workp) indicate (str_buf + X > workp),
- because for all X (str_buf + X > str_buf).
- So we don't need continue this loop. */
- break;
-
- /* Otherwise(str_buf < workp),
- (str_buf+next_character) may equals (workp).
- So we continue this loop. */
- }
- /* not matched */
- d = backup_d;
- dend = backup_dend;
- workp += length + 1;
- }
- }
- /* match with equivalence_class? */
-# ifdef _LIBC
- if (nrules != 0)
- {
- const CHAR_T *backup_d = d, *backup_dend = dend;
- /* Try to match the equivalence class against
- those known to the collate implementation. */
- const int32_t *table;
- const int32_t *weights;
- const int32_t *extra;
- const int32_t *indirect;
- int32_t idx, idx2;
- wint_t *cp;
- size_t len;
-
- /* This #include defines a local function! */
-# include <locale/weightwc.h>
-
- table = (const int32_t *)
- _NL_CURRENT (LC_COLLATE, _NL_COLLATE_TABLEWC);
- weights = (const wint_t *)
- _NL_CURRENT (LC_COLLATE, _NL_COLLATE_WEIGHTWC);
- extra = (const wint_t *)
- _NL_CURRENT (LC_COLLATE, _NL_COLLATE_EXTRAWC);
- indirect = (const int32_t *)
- _NL_CURRENT (LC_COLLATE, _NL_COLLATE_INDIRECTWC);
-
- /* Write 1 collating element to str_buf, and
- get its index. */
- idx2 = 0;
-
- for (i = 0 ; idx2 == 0 && i < WORK_BUFFER_SIZE - 1; i++)
- {
- cp = (wint_t*)str_buf;
- if (d == dend)
- {
- if (dend == end_match_2)
- break;
- d = string2;
- dend = end_match_2;
- }
- str_buf[i] = TRANSLATE(*(d+i));
- str_buf[i+1] = '\0'; /* sentinel */
- idx2 = findidx ((const wint_t**)&cp);
- }
-
- /* Update d, however d will be incremented at
- char_set_matched:, we decrement d here. */
- d = backup_d + ((wchar_t*)cp - (wchar_t*)str_buf - 1);
- if (d >= dend)
- {
- if (dend == end_match_2)
- d = dend;
- else
- {
- d = string2;
- dend = end_match_2;
- }
- }
-
- len = weights[idx2];
-
- for (workp2 = workp + equiv_class_length ; workp < workp2 ;
- workp++)
- {
- idx = (int32_t)*workp;
- /* We already checked idx != 0 in regex_compile. */
-
- if (idx2 != 0 && len == weights[idx])
- {
- int cnt = 0;
- while (cnt < len && (weights[idx + 1 + cnt]
- == weights[idx2 + 1 + cnt]))
- ++cnt;
-
- if (cnt == len)
- goto char_set_matched;
- }
- }
- /* not matched */
- d = backup_d;
- dend = backup_dend;
- }
- else /* (nrules == 0) */
-# endif
- /* If we can't look up collation data, we use wcscoll
- instead. */
- {
- for (workp2 = workp + equiv_class_length ; workp < workp2 ;)
- {
- const CHAR_T *backup_d = d, *backup_dend = dend;
-# ifdef _LIBC
- length = __wcslen (workp);
-# else
- length = wcslen (workp);
-# endif
-
- /* If wcscoll(the collating symbol, whole string) > 0,
- any substring of the string never match with the
- collating symbol. */
-# ifdef _LIBC
- if (__wcscoll (workp, d) > 0)
-# else
- if (wcscoll (workp, d) > 0)
-# endif
- {
- workp += length + 1;
- break;
- }
-
- /* First, we compare the equivalence class with
- the first character of the string.
- If it don't match, we add the next character to
- the compare buffer in turn. */
- for (i = 0 ; i < WORK_BUFFER_SIZE - 1 ; i++, d++)
- {
- int match;
- if (d == dend)
- {
- if (dend == end_match_2)
- break;
- d = string2;
- dend = end_match_2;
- }
-
- /* add next character to the compare buffer. */
- str_buf[i] = TRANSLATE(*d);
- str_buf[i+1] = '\0';
-
-# ifdef _LIBC
- match = __wcscoll (workp, str_buf);
-# else
- match = wcscoll (workp, str_buf);
-# endif
-
- if (match == 0)
- goto char_set_matched;
-
- if (match < 0)
- /* (str_buf > workp) indicate (str_buf + X > workp),
- because for all X (str_buf + X > str_buf).
- So we don't need continue this loop. */
- break;
-
- /* Otherwise(str_buf < workp),
- (str_buf+next_character) may equals (workp).
- So we continue this loop. */
- }
- /* not matched */
- d = backup_d;
- dend = backup_dend;
- workp += length + 1;
- }
- }
-
- /* match with char_range? */
-# ifdef _LIBC
- if (nrules != 0)
- {
- uint32_t collseqval;
- const char *collseq = (const char *)
- _NL_CURRENT(LC_COLLATE, _NL_COLLATE_COLLSEQWC);
-
- collseqval = collseq_table_lookup (collseq, c);
-
- for (; workp < p - chars_length ;)
- {
- uint32_t start_val, end_val;
-
- /* We already compute the collation sequence value
- of the characters (or collating symbols). */
- start_val = (uint32_t) *workp++; /* range_start */
- end_val = (uint32_t) *workp++; /* range_end */
-
- if (start_val <= collseqval && collseqval <= end_val)
- goto char_set_matched;
- }
- }
- else
-# endif
- {
- /* We set range_start_char at str_buf[0], range_end_char
- at str_buf[4], and compared char at str_buf[2]. */
- str_buf[1] = 0;
- str_buf[2] = c;
- str_buf[3] = 0;
- str_buf[5] = 0;
- for (; workp < p - chars_length ;)
- {
- wchar_t *range_start_char, *range_end_char;
-
- /* match if (range_start_char <= c <= range_end_char). */
-
- /* If range_start(or end) < 0, we assume -range_start(end)
- is the offset of the collating symbol which is specified
- as the character of the range start(end). */
-
- /* range_start */
- if (*workp < 0)
- range_start_char = charset_top - (*workp++);
- else
- {
- str_buf[0] = *workp++;
- range_start_char = str_buf;
- }
-
- /* range_end */
- if (*workp < 0)
- range_end_char = charset_top - (*workp++);
- else
- {
- str_buf[4] = *workp++;
- range_end_char = str_buf + 4;
- }
-
-# ifdef _LIBC
- if (__wcscoll (range_start_char, str_buf+2) <= 0
- && __wcscoll (str_buf+2, range_end_char) <= 0)
-# else
- if (wcscoll (range_start_char, str_buf+2) <= 0
- && wcscoll (str_buf+2, range_end_char) <= 0)
-# endif
- goto char_set_matched;
- }
- }
-
- /* match with char? */
- for (; workp < p ; workp++)
- if (c == *workp)
- goto char_set_matched;
-
- not = !not;
-
- char_set_matched:
- if (not) goto fail;
-#else
- /* Cast to `unsigned' instead of `unsigned char' in case the
- bit list is a full 32 bytes long. */
- if (c < (unsigned) (*p * BYTEWIDTH)
- && p[1 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH)))
- not = !not;
-
- p += 1 + *p;
-
- if (!not) goto fail;
-#undef WORK_BUFFER_SIZE
-#endif /* WCHAR */
- SET_REGS_MATCHED ();
- d++;
- break;
- }
-
-
- /* The beginning of a group is represented by start_memory.
- The arguments are the register number in the next byte, and the
- number of groups inner to this one in the next. The text
- matched within the group is recorded (in the internal
- registers data structure) under the register number. */
- case start_memory:
- DEBUG_PRINT3 ("EXECUTING start_memory %ld (%ld):\n",
- (long int) *p, (long int) p[1]);
-
- /* Find out if this group can match the empty string. */
- p1 = p; /* To send to group_match_null_string_p. */
-
- if (REG_MATCH_NULL_STRING_P (reg_info[*p]) == MATCH_NULL_UNSET_VALUE)
- REG_MATCH_NULL_STRING_P (reg_info[*p])
- = PREFIX(group_match_null_string_p) (&p1, pend, reg_info);
-
- /* Save the position in the string where we were the last time
- we were at this open-group operator in case the group is
- operated upon by a repetition operator, e.g., with `(a*)*b'
- against `ab'; then we want to ignore where we are now in
- the string in case this attempt to match fails. */
- old_regstart[*p] = REG_MATCH_NULL_STRING_P (reg_info[*p])
- ? REG_UNSET (regstart[*p]) ? d : regstart[*p]
- : regstart[*p];
- DEBUG_PRINT2 (" old_regstart: %d\n",
- POINTER_TO_OFFSET (old_regstart[*p]));
-
- regstart[*p] = d;
- DEBUG_PRINT2 (" regstart: %d\n", POINTER_TO_OFFSET (regstart[*p]));
-
- IS_ACTIVE (reg_info[*p]) = 1;
- MATCHED_SOMETHING (reg_info[*p]) = 0;
-
- /* Clear this whenever we change the register activity status. */
- set_regs_matched_done = 0;
-
- /* This is the new highest active register. */
- highest_active_reg = *p;
-
- /* If nothing was active before, this is the new lowest active
- register. */
- if (lowest_active_reg == NO_LOWEST_ACTIVE_REG)
- lowest_active_reg = *p;
-
- /* Move past the register number and inner group count. */
- p += 2;
- just_past_start_mem = p;
-
- break;
-
-
- /* The stop_memory opcode represents the end of a group. Its
- arguments are the same as start_memory's: the register
- number, and the number of inner groups. */
- case stop_memory:
- DEBUG_PRINT3 ("EXECUTING stop_memory %ld (%ld):\n",
- (long int) *p, (long int) p[1]);
-
- /* We need to save the string position the last time we were at
- this close-group operator in case the group is operated
- upon by a repetition operator, e.g., with `((a*)*(b*)*)*'
- against `aba'; then we want to ignore where we are now in
- the string in case this attempt to match fails. */
- old_regend[*p] = REG_MATCH_NULL_STRING_P (reg_info[*p])
- ? REG_UNSET (regend[*p]) ? d : regend[*p]
- : regend[*p];
- DEBUG_PRINT2 (" old_regend: %d\n",
- POINTER_TO_OFFSET (old_regend[*p]));
-
- regend[*p] = d;
- DEBUG_PRINT2 (" regend: %d\n", POINTER_TO_OFFSET (regend[*p]));
-
- /* This register isn't active anymore. */
- IS_ACTIVE (reg_info[*p]) = 0;
-
- /* Clear this whenever we change the register activity status. */
- set_regs_matched_done = 0;
-
- /* If this was the only register active, nothing is active
- anymore. */
- if (lowest_active_reg == highest_active_reg)
- {
- lowest_active_reg = NO_LOWEST_ACTIVE_REG;
- highest_active_reg = NO_HIGHEST_ACTIVE_REG;
- }
- else
- { /* We must scan for the new highest active register, since
- it isn't necessarily one less than now: consider
- (a(b)c(d(e)f)g). When group 3 ends, after the f), the
- new highest active register is 1. */
- UCHAR_T r = *p - 1;
- while (r > 0 && !IS_ACTIVE (reg_info[r]))
- r--;
-
- /* If we end up at register zero, that means that we saved
- the registers as the result of an `on_failure_jump', not
- a `start_memory', and we jumped to past the innermost
- `stop_memory'. For example, in ((.)*) we save
- registers 1 and 2 as a result of the *, but when we pop
- back to the second ), we are at the stop_memory 1.
- Thus, nothing is active. */
- if (r == 0)
- {
- lowest_active_reg = NO_LOWEST_ACTIVE_REG;
- highest_active_reg = NO_HIGHEST_ACTIVE_REG;
- }
- else
- highest_active_reg = r;
- }
-
- /* If just failed to match something this time around with a
- group that's operated on by a repetition operator, try to
- force exit from the ``loop'', and restore the register
- information for this group that we had before trying this
- last match. */
- if ((!MATCHED_SOMETHING (reg_info[*p])
- || just_past_start_mem == p - 1)
- && (p + 2) < pend)
- {
- boolean is_a_jump_n = false;
-
- p1 = p + 2;
- mcnt = 0;
- switch ((re_opcode_t) *p1++)
- {
- case jump_n:
- is_a_jump_n = true;
- case pop_failure_jump:
- case maybe_pop_jump:
- case jump:
- case dummy_failure_jump:
- EXTRACT_NUMBER_AND_INCR (mcnt, p1);
- if (is_a_jump_n)
- p1 += OFFSET_ADDRESS_SIZE;
- break;
-
- default:
- /* do nothing */ ;
- }
- p1 += mcnt;
-
- /* If the next operation is a jump backwards in the pattern
- to an on_failure_jump right before the start_memory
- corresponding to this stop_memory, exit from the loop
- by forcing a failure after pushing on the stack the
- on_failure_jump's jump in the pattern, and d. */
- if (mcnt < 0 && (re_opcode_t) *p1 == on_failure_jump
- && (re_opcode_t) p1[1+OFFSET_ADDRESS_SIZE] == start_memory
- && p1[2+OFFSET_ADDRESS_SIZE] == *p)
- {
- /* If this group ever matched anything, then restore
- what its registers were before trying this last
- failed match, e.g., with `(a*)*b' against `ab' for
- regstart[1], and, e.g., with `((a*)*(b*)*)*'
- against `aba' for regend[3].
-
- Also restore the registers for inner groups for,
- e.g., `((a*)(b*))*' against `aba' (register 3 would
- otherwise get trashed). */
-
- if (EVER_MATCHED_SOMETHING (reg_info[*p]))
- {
- unsigned r;
-
- EVER_MATCHED_SOMETHING (reg_info[*p]) = 0;
-
- /* Restore this and inner groups' (if any) registers. */
- for (r = *p; r < (unsigned) *p + (unsigned) *(p + 1);
- r++)
- {
- regstart[r] = old_regstart[r];
-
- /* xx why this test? */
- if (old_regend[r] >= regstart[r])
- regend[r] = old_regend[r];
- }
- }
- p1++;
- EXTRACT_NUMBER_AND_INCR (mcnt, p1);
- PUSH_FAILURE_POINT (p1 + mcnt, d, -2);
-
- goto fail;
- }
- }
-
- /* Move past the register number and the inner group count. */
- p += 2;
- break;
-
-
- /* \<digit> has been turned into a `duplicate' command which is
- followed by the numeric value of <digit> as the register number. */
- case duplicate:
- {
- register const CHAR_T *d2, *dend2;
- int regno = *p++; /* Get which register to match against. */
- DEBUG_PRINT2 ("EXECUTING duplicate %d.\n", regno);
-
- /* Can't back reference a group which we've never matched. */
- if (REG_UNSET (regstart[regno]) || REG_UNSET (regend[regno]))
- goto fail;
-
- /* Where in input to try to start matching. */
- d2 = regstart[regno];
-
- /* Where to stop matching; if both the place to start and
- the place to stop matching are in the same string, then
- set to the place to stop, otherwise, for now have to use
- the end of the first string. */
-
- dend2 = ((FIRST_STRING_P (regstart[regno])
- == FIRST_STRING_P (regend[regno]))
- ? regend[regno] : end_match_1);
- for (;;)
- {
- /* If necessary, advance to next segment in register
- contents. */
- while (d2 == dend2)
- {
- if (dend2 == end_match_2) break;
- if (dend2 == regend[regno]) break;
-
- /* End of string1 => advance to string2. */
- d2 = string2;
- dend2 = regend[regno];
- }
- /* At end of register contents => success */
- if (d2 == dend2) break;
-
- /* If necessary, advance to next segment in data. */
- PREFETCH ();
-
- /* How many characters left in this segment to match. */
- mcnt = dend - d;
-
- /* Want how many consecutive characters we can match in
- one shot, so, if necessary, adjust the count. */
- if (mcnt > dend2 - d2)
- mcnt = dend2 - d2;
-
- /* Compare that many; failure if mismatch, else move
- past them. */
- if (translate
- ? PREFIX(bcmp_translate) (d, d2, mcnt, translate)
- : memcmp (d, d2, mcnt*sizeof(UCHAR_T)))
- goto fail;
- d += mcnt, d2 += mcnt;
-
- /* Do this because we've match some characters. */
- SET_REGS_MATCHED ();
- }
- }
- break;
-
-
- /* begline matches the empty string at the beginning of the string
- (unless `not_bol' is set in `bufp'), and, if
- `newline_anchor' is set, after newlines. */
- case begline:
- DEBUG_PRINT1 ("EXECUTING begline.\n");
-
- if (AT_STRINGS_BEG (d))
- {
- if (!bufp->not_bol) break;
- }
- else if (d[-1] == '\n' && bufp->newline_anchor)
- {
- break;
- }
- /* In all other cases, we fail. */
- goto fail;
-
-
- /* endline is the dual of begline. */
- case endline:
- DEBUG_PRINT1 ("EXECUTING endline.\n");
-
- if (AT_STRINGS_END (d))
- {
- if (!bufp->not_eol) break;
- }
-
- /* We have to ``prefetch'' the next character. */
- else if ((d == end1 ? *string2 : *d) == '\n'
- && bufp->newline_anchor)
- {
- break;
- }
- goto fail;
-
-
- /* Match at the very beginning of the data. */
- case begbuf:
- DEBUG_PRINT1 ("EXECUTING begbuf.\n");
- if (AT_STRINGS_BEG (d))
- break;
- goto fail;
-
-
- /* Match at the very end of the data. */
- case endbuf:
- DEBUG_PRINT1 ("EXECUTING endbuf.\n");
- if (AT_STRINGS_END (d))
- break;
- goto fail;
-
-
- /* on_failure_keep_string_jump is used to optimize `.*\n'. It
- pushes NULL as the value for the string on the stack. Then
- `pop_failure_point' will keep the current value for the
- string, instead of restoring it. To see why, consider
- matching `foo\nbar' against `.*\n'. The .* matches the foo;
- then the . fails against the \n. But the next thing we want
- to do is match the \n against the \n; if we restored the
- string value, we would be back at the foo.
-
- Because this is used only in specific cases, we don't need to
- check all the things that `on_failure_jump' does, to make
- sure the right things get saved on the stack. Hence we don't
- share its code. The only reason to push anything on the
- stack at all is that otherwise we would have to change
- `anychar's code to do something besides goto fail in this
- case; that seems worse than this. */
- case on_failure_keep_string_jump:
- DEBUG_PRINT1 ("EXECUTING on_failure_keep_string_jump");
-
- EXTRACT_NUMBER_AND_INCR (mcnt, p);
-#ifdef _LIBC
- DEBUG_PRINT3 (" %d (to %p):\n", mcnt, p + mcnt);
-#else
- DEBUG_PRINT3 (" %d (to 0x%x):\n", mcnt, p + mcnt);
-#endif
-
- PUSH_FAILURE_POINT (p + mcnt, NULL, -2);
- break;
-
-
- /* Uses of on_failure_jump:
-
- Each alternative starts with an on_failure_jump that points
- to the beginning of the next alternative. Each alternative
- except the last ends with a jump that in effect jumps past
- the rest of the alternatives. (They really jump to the
- ending jump of the following alternative, because tensioning
- these jumps is a hassle.)
-
- Repeats start with an on_failure_jump that points past both
- the repetition text and either the following jump or
- pop_failure_jump back to this on_failure_jump. */
- case on_failure_jump:
- on_failure:
- DEBUG_PRINT1 ("EXECUTING on_failure_jump");
-
- EXTRACT_NUMBER_AND_INCR (mcnt, p);
-#ifdef _LIBC
- DEBUG_PRINT3 (" %d (to %p)", mcnt, p + mcnt);
-#else
- DEBUG_PRINT3 (" %d (to 0x%x)", mcnt, p + mcnt);
-#endif
-
- /* If this on_failure_jump comes right before a group (i.e.,
- the original * applied to a group), save the information
- for that group and all inner ones, so that if we fail back
- to this point, the group's information will be correct.
- For example, in \(a*\)*\1, we need the preceding group,
- and in \(zz\(a*\)b*\)\2, we need the inner group. */
-
- /* We can't use `p' to check ahead because we push
- a failure point to `p + mcnt' after we do this. */
- p1 = p;
-
- /* We need to skip no_op's before we look for the
- start_memory in case this on_failure_jump is happening as
- the result of a completed succeed_n, as in \(a\)\{1,3\}b\1
- against aba. */
- while (p1 < pend && (re_opcode_t) *p1 == no_op)
- p1++;
-
- if (p1 < pend && (re_opcode_t) *p1 == start_memory)
- {
- /* We have a new highest active register now. This will
- get reset at the start_memory we are about to get to,
- but we will have saved all the registers relevant to
- this repetition op, as described above. */
- highest_active_reg = *(p1 + 1) + *(p1 + 2);
- if (lowest_active_reg == NO_LOWEST_ACTIVE_REG)
- lowest_active_reg = *(p1 + 1);
- }
-
- DEBUG_PRINT1 (":\n");
- PUSH_FAILURE_POINT (p + mcnt, d, -2);
- break;
-
-
- /* A smart repeat ends with `maybe_pop_jump'.
- We change it to either `pop_failure_jump' or `jump'. */
- case maybe_pop_jump:
- EXTRACT_NUMBER_AND_INCR (mcnt, p);
- DEBUG_PRINT2 ("EXECUTING maybe_pop_jump %d.\n", mcnt);
- {
- register UCHAR_T *p2 = p;
-
- /* Compare the beginning of the repeat with what in the
- pattern follows its end. If we can establish that there
- is nothing that they would both match, i.e., that we
- would have to backtrack because of (as in, e.g., `a*a')
- then we can change to pop_failure_jump, because we'll
- never have to backtrack.
-
- This is not true in the case of alternatives: in
- `(a|ab)*' we do need to backtrack to the `ab' alternative
- (e.g., if the string was `ab'). But instead of trying to
- detect that here, the alternative has put on a dummy
- failure point which is what we will end up popping. */
-
- /* Skip over open/close-group commands.
- If what follows this loop is a ...+ construct,
- look at what begins its body, since we will have to
- match at least one of that. */
- while (1)
- {
- if (p2 + 2 < pend
- && ((re_opcode_t) *p2 == stop_memory
- || (re_opcode_t) *p2 == start_memory))
- p2 += 3;
- else if (p2 + 2 + 2 * OFFSET_ADDRESS_SIZE < pend
- && (re_opcode_t) *p2 == dummy_failure_jump)
- p2 += 2 + 2 * OFFSET_ADDRESS_SIZE;
- else
- break;
- }
-
- p1 = p + mcnt;
- /* p1[0] ... p1[2] are the `on_failure_jump' corresponding
- to the `maybe_finalize_jump' of this case. Examine what
- follows. */
-
- /* If we're at the end of the pattern, we can change. */
- if (p2 == pend)
- {
- /* Consider what happens when matching ":\(.*\)"
- against ":/". I don't really understand this code
- yet. */
- p[-(1+OFFSET_ADDRESS_SIZE)] = (UCHAR_T)
- pop_failure_jump;
- DEBUG_PRINT1
- (" End of pattern: change to `pop_failure_jump'.\n");
- }
-
- else if ((re_opcode_t) *p2 == exactn
-#ifdef MBS_SUPPORT
- || (re_opcode_t) *p2 == exactn_bin
-#endif
- || (bufp->newline_anchor && (re_opcode_t) *p2 == endline))
- {
- register UCHAR_T c
- = *p2 == (UCHAR_T) endline ? '\n' : p2[2];
-
- if (((re_opcode_t) p1[1+OFFSET_ADDRESS_SIZE] == exactn
-#ifdef MBS_SUPPORT
- || (re_opcode_t) p1[1+OFFSET_ADDRESS_SIZE] == exactn_bin
-#endif
- ) && p1[3+OFFSET_ADDRESS_SIZE] != c)
- {
- p[-(1+OFFSET_ADDRESS_SIZE)] = (UCHAR_T)
- pop_failure_jump;
-#ifdef WCHAR
- DEBUG_PRINT3 (" %C != %C => pop_failure_jump.\n",
- (wint_t) c,
- (wint_t) p1[3+OFFSET_ADDRESS_SIZE]);
-#else
- DEBUG_PRINT3 (" %c != %c => pop_failure_jump.\n",
- (char) c,
- (char) p1[3+OFFSET_ADDRESS_SIZE]);
-#endif
- }
-
-#ifndef WCHAR
- else if ((re_opcode_t) p1[3] == charset
- || (re_opcode_t) p1[3] == charset_not)
- {
- int not = (re_opcode_t) p1[3] == charset_not;
-
- if (c < (unsigned) (p1[4] * BYTEWIDTH)
- && p1[5 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH)))
- not = !not;
-
- /* `not' is equal to 1 if c would match, which means
- that we can't change to pop_failure_jump. */
- if (!not)
- {
- p[-3] = (unsigned char) pop_failure_jump;
- DEBUG_PRINT1 (" No match => pop_failure_jump.\n");
- }
- }
-#endif /* not WCHAR */
- }
-#ifndef WCHAR
- else if ((re_opcode_t) *p2 == charset)
- {
- /* We win if the first character of the loop is not part
- of the charset. */
- if ((re_opcode_t) p1[3] == exactn
- && ! ((int) p2[1] * BYTEWIDTH > (int) p1[5]
- && (p2[2 + p1[5] / BYTEWIDTH]
- & (1 << (p1[5] % BYTEWIDTH)))))
- {
- p[-3] = (unsigned char) pop_failure_jump;
- DEBUG_PRINT1 (" No match => pop_failure_jump.\n");
- }
-
- else if ((re_opcode_t) p1[3] == charset_not)
- {
- int idx;
- /* We win if the charset_not inside the loop
- lists every character listed in the charset after. */
- for (idx = 0; idx < (int) p2[1]; idx++)
- if (! (p2[2 + idx] == 0
- || (idx < (int) p1[4]
- && ((p2[2 + idx] & ~ p1[5 + idx]) == 0))))
- break;
-
- if (idx == p2[1])
- {
- p[-3] = (unsigned char) pop_failure_jump;
- DEBUG_PRINT1 (" No match => pop_failure_jump.\n");
- }
- }
- else if ((re_opcode_t) p1[3] == charset)
- {
- int idx;
- /* We win if the charset inside the loop
- has no overlap with the one after the loop. */
- for (idx = 0;
- idx < (int) p2[1] && idx < (int) p1[4];
- idx++)
- if ((p2[2 + idx] & p1[5 + idx]) != 0)
- break;
-
- if (idx == p2[1] || idx == p1[4])
- {
- p[-3] = (unsigned char) pop_failure_jump;
- DEBUG_PRINT1 (" No match => pop_failure_jump.\n");
- }
- }
- }
-#endif /* not WCHAR */
- }
- p -= OFFSET_ADDRESS_SIZE; /* Point at relative address again. */
- if ((re_opcode_t) p[-1] != pop_failure_jump)
- {
- p[-1] = (UCHAR_T) jump;
- DEBUG_PRINT1 (" Match => jump.\n");
- goto unconditional_jump;
- }
- /* Note fall through. */
-
-
- /* The end of a simple repeat has a pop_failure_jump back to
- its matching on_failure_jump, where the latter will push a
- failure point. The pop_failure_jump takes off failure
- points put on by this pop_failure_jump's matching
- on_failure_jump; we got through the pattern to here from the
- matching on_failure_jump, so didn't fail. */
- case pop_failure_jump:
- {
- /* We need to pass separate storage for the lowest and
- highest registers, even though we don't care about the
- actual values. Otherwise, we will restore only one
- register from the stack, since lowest will == highest in
- `pop_failure_point'. */
- active_reg_t dummy_low_reg, dummy_high_reg;
- UCHAR_T *pdummy = NULL;
- const CHAR_T *sdummy = NULL;
-
- DEBUG_PRINT1 ("EXECUTING pop_failure_jump.\n");
- POP_FAILURE_POINT (sdummy, pdummy,
- dummy_low_reg, dummy_high_reg,
- reg_dummy, reg_dummy, reg_info_dummy);
- }
- /* Note fall through. */
-
- unconditional_jump:
-#ifdef _LIBC
- DEBUG_PRINT2 ("\n%p: ", p);
-#else
- DEBUG_PRINT2 ("\n0x%x: ", p);
-#endif
- /* Note fall through. */
-
- /* Unconditionally jump (without popping any failure points). */
- case jump:
- EXTRACT_NUMBER_AND_INCR (mcnt, p); /* Get the amount to jump. */
- DEBUG_PRINT2 ("EXECUTING jump %d ", mcnt);
- p += mcnt; /* Do the jump. */
-#ifdef _LIBC
- DEBUG_PRINT2 ("(to %p).\n", p);
-#else
- DEBUG_PRINT2 ("(to 0x%x).\n", p);
-#endif
- break;
-
-
- /* We need this opcode so we can detect where alternatives end
- in `group_match_null_string_p' et al. */
- case jump_past_alt:
- DEBUG_PRINT1 ("EXECUTING jump_past_alt.\n");
- goto unconditional_jump;
-
-
- /* Normally, the on_failure_jump pushes a failure point, which
- then gets popped at pop_failure_jump. We will end up at
- pop_failure_jump, also, and with a pattern of, say, `a+', we
- are skipping over the on_failure_jump, so we have to push
- something meaningless for pop_failure_jump to pop. */
- case dummy_failure_jump:
- DEBUG_PRINT1 ("EXECUTING dummy_failure_jump.\n");
- /* It doesn't matter what we push for the string here. What
- the code at `fail' tests is the value for the pattern. */
- PUSH_FAILURE_POINT (NULL, NULL, -2);
- goto unconditional_jump;
-
-
- /* At the end of an alternative, we need to push a dummy failure
- point in case we are followed by a `pop_failure_jump', because
- we don't want the failure point for the alternative to be
- popped. For example, matching `(a|ab)*' against `aab'
- requires that we match the `ab' alternative. */
- case push_dummy_failure:
- DEBUG_PRINT1 ("EXECUTING push_dummy_failure.\n");
- /* See comments just above at `dummy_failure_jump' about the
- two zeroes. */
- PUSH_FAILURE_POINT (NULL, NULL, -2);
- break;
-
- /* Have to succeed matching what follows at least n times.
- After that, handle like `on_failure_jump'. */
- case succeed_n:
- EXTRACT_NUMBER (mcnt, p + OFFSET_ADDRESS_SIZE);
- DEBUG_PRINT2 ("EXECUTING succeed_n %d.\n", mcnt);
-
- assert (mcnt >= 0);
- /* Originally, this is how many times we HAVE to succeed. */
- if (mcnt > 0)
- {
- mcnt--;
- p += OFFSET_ADDRESS_SIZE;
- STORE_NUMBER_AND_INCR (p, mcnt);
-#ifdef _LIBC
- DEBUG_PRINT3 (" Setting %p to %d.\n", p - OFFSET_ADDRESS_SIZE
- , mcnt);
-#else
- DEBUG_PRINT3 (" Setting 0x%x to %d.\n", p - OFFSET_ADDRESS_SIZE
- , mcnt);
-#endif
- }
- else if (mcnt == 0)
- {
-#ifdef _LIBC
- DEBUG_PRINT2 (" Setting two bytes from %p to no_op.\n",
- p + OFFSET_ADDRESS_SIZE);
-#else
- DEBUG_PRINT2 (" Setting two bytes from 0x%x to no_op.\n",
- p + OFFSET_ADDRESS_SIZE);
-#endif /* _LIBC */
-
-#ifdef WCHAR
- p[1] = (UCHAR_T) no_op;
-#else
- p[2] = (UCHAR_T) no_op;
- p[3] = (UCHAR_T) no_op;
-#endif /* WCHAR */
- goto on_failure;
- }
- break;
-
- case jump_n:
- EXTRACT_NUMBER (mcnt, p + OFFSET_ADDRESS_SIZE);
- DEBUG_PRINT2 ("EXECUTING jump_n %d.\n", mcnt);
-
- /* Originally, this is how many times we CAN jump. */
- if (mcnt)
- {
- mcnt--;
- STORE_NUMBER (p + OFFSET_ADDRESS_SIZE, mcnt);
-
-#ifdef _LIBC
- DEBUG_PRINT3 (" Setting %p to %d.\n", p + OFFSET_ADDRESS_SIZE,
- mcnt);
-#else
- DEBUG_PRINT3 (" Setting 0x%x to %d.\n", p + OFFSET_ADDRESS_SIZE,
- mcnt);
-#endif /* _LIBC */
- goto unconditional_jump;
- }
- /* If don't have to jump any more, skip over the rest of command. */
- else
- p += 2 * OFFSET_ADDRESS_SIZE;
- break;
-
- case set_number_at:
- {
- DEBUG_PRINT1 ("EXECUTING set_number_at.\n");
-
- EXTRACT_NUMBER_AND_INCR (mcnt, p);
- p1 = p + mcnt;
- EXTRACT_NUMBER_AND_INCR (mcnt, p);
-#ifdef _LIBC
- DEBUG_PRINT3 (" Setting %p to %d.\n", p1, mcnt);
-#else
- DEBUG_PRINT3 (" Setting 0x%x to %d.\n", p1, mcnt);
-#endif
- STORE_NUMBER (p1, mcnt);
- break;
- }
-
-#if 0
- /* The DEC Alpha C compiler 3.x generates incorrect code for the
- test WORDCHAR_P (d - 1) != WORDCHAR_P (d) in the expansion of
- AT_WORD_BOUNDARY, so this code is disabled. Expanding the
- macro and introducing temporary variables works around the bug. */
-
- case wordbound:
- DEBUG_PRINT1 ("EXECUTING wordbound.\n");
- if (AT_WORD_BOUNDARY (d))
- break;
- goto fail;
-
- case notwordbound:
- DEBUG_PRINT1 ("EXECUTING notwordbound.\n");
- if (AT_WORD_BOUNDARY (d))
- goto fail;
- break;
-#else
- case wordbound:
- {
- boolean prevchar, thischar;
-
- DEBUG_PRINT1 ("EXECUTING wordbound.\n");
- if (AT_STRINGS_BEG (d) || AT_STRINGS_END (d))
- break;
-
- prevchar = WORDCHAR_P (d - 1);
- thischar = WORDCHAR_P (d);
- if (prevchar != thischar)
- break;
- goto fail;
- }
-
- case notwordbound:
- {
- boolean prevchar, thischar;
-
- DEBUG_PRINT1 ("EXECUTING notwordbound.\n");
- if (AT_STRINGS_BEG (d) || AT_STRINGS_END (d))
- goto fail;
-
- prevchar = WORDCHAR_P (d - 1);
- thischar = WORDCHAR_P (d);
- if (prevchar != thischar)
- goto fail;
- break;
- }
-#endif
-
- case wordbeg:
- DEBUG_PRINT1 ("EXECUTING wordbeg.\n");
- if (!AT_STRINGS_END (d) && WORDCHAR_P (d)
- && (AT_STRINGS_BEG (d) || !WORDCHAR_P (d - 1)))
- break;
- goto fail;
-
- case wordend:
- DEBUG_PRINT1 ("EXECUTING wordend.\n");
- if (!AT_STRINGS_BEG (d) && WORDCHAR_P (d - 1)
- && (AT_STRINGS_END (d) || !WORDCHAR_P (d)))
- break;
- goto fail;
-
-#ifdef emacs
- case before_dot:
- DEBUG_PRINT1 ("EXECUTING before_dot.\n");
- if (PTR_CHAR_POS ((unsigned char *) d) >= point)
- goto fail;
- break;
-
- case at_dot:
- DEBUG_PRINT1 ("EXECUTING at_dot.\n");
- if (PTR_CHAR_POS ((unsigned char *) d) != point)
- goto fail;
- break;
-
- case after_dot:
- DEBUG_PRINT1 ("EXECUTING after_dot.\n");
- if (PTR_CHAR_POS ((unsigned char *) d) <= point)
- goto fail;
- break;
-
- case syntaxspec:
- DEBUG_PRINT2 ("EXECUTING syntaxspec %d.\n", mcnt);
- mcnt = *p++;
- goto matchsyntax;
-
- case wordchar:
- DEBUG_PRINT1 ("EXECUTING Emacs wordchar.\n");
- mcnt = (int) Sword;
- matchsyntax:
- PREFETCH ();
- /* Can't use *d++ here; SYNTAX may be an unsafe macro. */
- d++;
- if (SYNTAX (d[-1]) != (enum syntaxcode) mcnt)
- goto fail;
- SET_REGS_MATCHED ();
- break;
-
- case notsyntaxspec:
- DEBUG_PRINT2 ("EXECUTING notsyntaxspec %d.\n", mcnt);
- mcnt = *p++;
- goto matchnotsyntax;
-
- case notwordchar:
- DEBUG_PRINT1 ("EXECUTING Emacs notwordchar.\n");
- mcnt = (int) Sword;
- matchnotsyntax:
- PREFETCH ();
- /* Can't use *d++ here; SYNTAX may be an unsafe macro. */
- d++;
- if (SYNTAX (d[-1]) == (enum syntaxcode) mcnt)
- goto fail;
- SET_REGS_MATCHED ();
- break;
-
-#else /* not emacs */
- case wordchar:
- DEBUG_PRINT1 ("EXECUTING non-Emacs wordchar.\n");
- PREFETCH ();
- if (!WORDCHAR_P (d))
- goto fail;
- SET_REGS_MATCHED ();
- d++;
- break;
-
- case notwordchar:
- DEBUG_PRINT1 ("EXECUTING non-Emacs notwordchar.\n");
- PREFETCH ();
- if (WORDCHAR_P (d))
- goto fail;
- SET_REGS_MATCHED ();
- d++;
- break;
-#endif /* not emacs */
-
- default:
- abort ();
- }
- continue; /* Successfully executed one pattern command; keep going. */
-
-
- /* We goto here if a matching operation fails. */
- fail:
- if (!FAIL_STACK_EMPTY ())
- { /* A restart point is known. Restore to that state. */
- DEBUG_PRINT1 ("\nFAIL:\n");
- POP_FAILURE_POINT (d, p,
- lowest_active_reg, highest_active_reg,
- regstart, regend, reg_info);
-
- /* If this failure point is a dummy, try the next one. */
- if (!p)
- goto fail;
-
- /* If we failed to the end of the pattern, don't examine *p. */
- assert (p <= pend);
- if (p < pend)
- {
- boolean is_a_jump_n = false;
-
- /* If failed to a backwards jump that's part of a repetition
- loop, need to pop this failure point and use the next one. */
- switch ((re_opcode_t) *p)
- {
- case jump_n:
- is_a_jump_n = true;
- case maybe_pop_jump:
- case pop_failure_jump:
- case jump:
- p1 = p + 1;
- EXTRACT_NUMBER_AND_INCR (mcnt, p1);
- p1 += mcnt;
-
- if ((is_a_jump_n && (re_opcode_t) *p1 == succeed_n)
- || (!is_a_jump_n
- && (re_opcode_t) *p1 == on_failure_jump))
- goto fail;
- break;
- default:
- /* do nothing */ ;
- }
- }
-
- if (d >= string1 && d <= end1)
- dend = end_match_1;
- }
- else
- break; /* Matching at this starting point really fails. */
- } /* for (;;) */
-
- if (best_regs_set)
- goto restore_best_regs;
-
- FREE_VARIABLES ();
-
- return -1; /* Failure to match. */
-} /* re_match_2 */
-
-/* Subroutine definitions for re_match_2. */
-
-
-/* We are passed P pointing to a register number after a start_memory.
-
- Return true if the pattern up to the corresponding stop_memory can
- match the empty string, and false otherwise.
-
- If we find the matching stop_memory, sets P to point to one past its number.
- Otherwise, sets P to an undefined byte less than or equal to END.
-
- We don't handle duplicates properly (yet). */
-
-static boolean
-PREFIX(group_match_null_string_p) (p, end, reg_info)
- UCHAR_T **p, *end;
- PREFIX(register_info_type) *reg_info;
-{
- int mcnt;
- /* Point to after the args to the start_memory. */
- UCHAR_T *p1 = *p + 2;
-
- while (p1 < end)
- {
- /* Skip over opcodes that can match nothing, and return true or
- false, as appropriate, when we get to one that can't, or to the
- matching stop_memory. */
-
- switch ((re_opcode_t) *p1)
- {
- /* Could be either a loop or a series of alternatives. */
- case on_failure_jump:
- p1++;
- EXTRACT_NUMBER_AND_INCR (mcnt, p1);
-
- /* If the next operation is not a jump backwards in the
- pattern. */
-
- if (mcnt >= 0)
- {
- /* Go through the on_failure_jumps of the alternatives,
- seeing if any of the alternatives cannot match nothing.
- The last alternative starts with only a jump,
- whereas the rest start with on_failure_jump and end
- with a jump, e.g., here is the pattern for `a|b|c':
-
- /on_failure_jump/0/6/exactn/1/a/jump_past_alt/0/6
- /on_failure_jump/0/6/exactn/1/b/jump_past_alt/0/3
- /exactn/1/c
-
- So, we have to first go through the first (n-1)
- alternatives and then deal with the last one separately. */
-
-
- /* Deal with the first (n-1) alternatives, which start
- with an on_failure_jump (see above) that jumps to right
- past a jump_past_alt. */
-
- while ((re_opcode_t) p1[mcnt-(1+OFFSET_ADDRESS_SIZE)] ==
- jump_past_alt)
- {
- /* `mcnt' holds how many bytes long the alternative
- is, including the ending `jump_past_alt' and
- its number. */
-
- if (!PREFIX(alt_match_null_string_p) (p1, p1 + mcnt -
- (1 + OFFSET_ADDRESS_SIZE),
- reg_info))
- return false;
-
- /* Move to right after this alternative, including the
- jump_past_alt. */
- p1 += mcnt;
-
- /* Break if it's the beginning of an n-th alternative
- that doesn't begin with an on_failure_jump. */
- if ((re_opcode_t) *p1 != on_failure_jump)
- break;
-
- /* Still have to check that it's not an n-th
- alternative that starts with an on_failure_jump. */
- p1++;
- EXTRACT_NUMBER_AND_INCR (mcnt, p1);
- if ((re_opcode_t) p1[mcnt-(1+OFFSET_ADDRESS_SIZE)] !=
- jump_past_alt)
- {
- /* Get to the beginning of the n-th alternative. */
- p1 -= 1 + OFFSET_ADDRESS_SIZE;
- break;
- }
- }
-
- /* Deal with the last alternative: go back and get number
- of the `jump_past_alt' just before it. `mcnt' contains
- the length of the alternative. */
- EXTRACT_NUMBER (mcnt, p1 - OFFSET_ADDRESS_SIZE);
-
- if (!PREFIX(alt_match_null_string_p) (p1, p1 + mcnt, reg_info))
- return false;
-
- p1 += mcnt; /* Get past the n-th alternative. */
- } /* if mcnt > 0 */
- break;
-
-
- case stop_memory:
- assert (p1[1] == **p);
- *p = p1 + 2;
- return true;
-
-
- default:
- if (!PREFIX(common_op_match_null_string_p) (&p1, end, reg_info))
- return false;
- }
- } /* while p1 < end */
-
- return false;
-} /* group_match_null_string_p */
-
-
-/* Similar to group_match_null_string_p, but doesn't deal with alternatives:
- It expects P to be the first byte of a single alternative and END one
- byte past the last. The alternative can contain groups. */
-
-static boolean
-PREFIX(alt_match_null_string_p) (p, end, reg_info)
- UCHAR_T *p, *end;
- PREFIX(register_info_type) *reg_info;
-{
- int mcnt;
- UCHAR_T *p1 = p;
-
- while (p1 < end)
- {
- /* Skip over opcodes that can match nothing, and break when we get
- to one that can't. */
-
- switch ((re_opcode_t) *p1)
- {
- /* It's a loop. */
- case on_failure_jump:
- p1++;
- EXTRACT_NUMBER_AND_INCR (mcnt, p1);
- p1 += mcnt;
- break;
-
- default:
- if (!PREFIX(common_op_match_null_string_p) (&p1, end, reg_info))
- return false;
- }
- } /* while p1 < end */
-
- return true;
-} /* alt_match_null_string_p */
-
-
-/* Deals with the ops common to group_match_null_string_p and
- alt_match_null_string_p.
-
- Sets P to one after the op and its arguments, if any. */
-
-static boolean
-PREFIX(common_op_match_null_string_p) (p, end, reg_info)
- UCHAR_T **p, *end;
- PREFIX(register_info_type) *reg_info;
-{
- int mcnt;
- boolean ret;
- int reg_no;
- UCHAR_T *p1 = *p;
-
- switch ((re_opcode_t) *p1++)
- {
- case no_op:
- case begline:
- case endline:
- case begbuf:
- case endbuf:
- case wordbeg:
- case wordend:
- case wordbound:
- case notwordbound:
-#ifdef emacs
- case before_dot:
- case at_dot:
- case after_dot:
-#endif
- break;
-
- case start_memory:
- reg_no = *p1;
- assert (reg_no > 0 && reg_no <= MAX_REGNUM);
- ret = PREFIX(group_match_null_string_p) (&p1, end, reg_info);
-
- /* Have to set this here in case we're checking a group which
- contains a group and a back reference to it. */
-
- if (REG_MATCH_NULL_STRING_P (reg_info[reg_no]) == MATCH_NULL_UNSET_VALUE)
- REG_MATCH_NULL_STRING_P (reg_info[reg_no]) = ret;
-
- if (!ret)
- return false;
- break;
-
- /* If this is an optimized succeed_n for zero times, make the jump. */
- case jump:
- EXTRACT_NUMBER_AND_INCR (mcnt, p1);
- if (mcnt >= 0)
- p1 += mcnt;
- else
- return false;
- break;
-
- case succeed_n:
- /* Get to the number of times to succeed. */
- p1 += OFFSET_ADDRESS_SIZE;
- EXTRACT_NUMBER_AND_INCR (mcnt, p1);
-
- if (mcnt == 0)
- {
- p1 -= 2 * OFFSET_ADDRESS_SIZE;
- EXTRACT_NUMBER_AND_INCR (mcnt, p1);
- p1 += mcnt;
- }
- else
- return false;
- break;
-
- case duplicate:
- if (!REG_MATCH_NULL_STRING_P (reg_info[*p1]))
- return false;
- break;
-
- case set_number_at:
- p1 += 2 * OFFSET_ADDRESS_SIZE;
-
- default:
- /* All other opcodes mean we cannot match the empty string. */
- return false;
- }
-
- *p = p1;
- return true;
-} /* common_op_match_null_string_p */
-
-
-/* Return zero if TRANSLATE[S1] and TRANSLATE[S2] are identical for LEN
- bytes; nonzero otherwise. */
-
-static int
-PREFIX(bcmp_translate) (s1, s2, len, translate)
- const CHAR_T *s1, *s2;
- register int len;
- RE_TRANSLATE_TYPE translate;
-{
- register const UCHAR_T *p1 = (const UCHAR_T *) s1;
- register const UCHAR_T *p2 = (const UCHAR_T *) s2;
- while (len)
- {
-#ifdef WCHAR
- if (((*p1<=0xff)?translate[*p1++]:*p1++)
- != ((*p2<=0xff)?translate[*p2++]:*p2++))
- return 1;
-#else /* BYTE */
- if (translate[*p1++] != translate[*p2++]) return 1;
-#endif /* WCHAR */
- len--;
- }
- return 0;
-}
-
-
-#else /* not INSIDE_RECURSION */
-
-/* Entry points for GNU code. */
-
-/* re_compile_pattern is the GNU regular expression compiler: it
- compiles PATTERN (of length SIZE) and puts the result in BUFP.
- Returns 0 if the pattern was valid, otherwise an error string.
-
- Assumes the `allocated' (and perhaps `buffer') and `translate' fields
- are set in BUFP on entry.
-
- We call regex_compile to do the actual compilation. */
-
-const char *
-re_compile_pattern (pattern, length, bufp)
- const char *pattern;
- size_t length;
- struct re_pattern_buffer *bufp;
-{
- reg_errcode_t ret;
-
- /* GNU code is written to assume at least RE_NREGS registers will be set
- (and at least one extra will be -1). */
- bufp->regs_allocated = REGS_UNALLOCATED;
-
- /* And GNU code determines whether or not to get register information
- by passing null for the REGS argument to re_match, etc., not by
- setting no_sub. */
- bufp->no_sub = 0;
-
- /* Match anchors at newline. */
- bufp->newline_anchor = 1;
-
-# ifdef MBS_SUPPORT
- if (MB_CUR_MAX != 1)
- ret = wcs_regex_compile (pattern, length, re_syntax_options, bufp);
- else
-# endif
- ret = byte_regex_compile (pattern, length, re_syntax_options, bufp);
-
- if (!ret)
- return NULL;
- return gettext (re_error_msgid[(int) ret]);
-}
-#ifdef _LIBC
-weak_alias (__re_compile_pattern, re_compile_pattern)
-#endif
-
-/* Entry points compatible with 4.2 BSD regex library. We don't define
- them unless specifically requested. */
-
-#if defined _REGEX_RE_COMP || defined _LIBC
-
-/* BSD has one and only one pattern buffer. */
-static struct re_pattern_buffer re_comp_buf;
-
-char *
-#ifdef _LIBC
-/* Make these definitions weak in libc, so POSIX programs can redefine
- these names if they don't use our functions, and still use
- regcomp/regexec below without link errors. */
-weak_function
-#endif
-re_comp (s)
- const char *s;
-{
- reg_errcode_t ret;
-
- if (!s)
- {
- if (!re_comp_buf.buffer)
- return gettext ("No previous regular expression");
- return 0;
- }
-
- if (!re_comp_buf.buffer)
- {
- re_comp_buf.buffer = (unsigned char *) malloc (200);
- if (re_comp_buf.buffer == NULL)
- return (char *) gettext (re_error_msgid[(int) REG_ESPACE]);
- re_comp_buf.allocated = 200;
-
- re_comp_buf.fastmap = (char *) malloc (1 << BYTEWIDTH);
- if (re_comp_buf.fastmap == NULL)
- return (char *) gettext (re_error_msgid[(int) REG_ESPACE]);
- }
-
- /* Since `re_exec' always passes NULL for the `regs' argument, we
- don't need to initialize the pattern buffer fields which affect it. */
-
- /* Match anchors at newlines. */
- re_comp_buf.newline_anchor = 1;
-
-# ifdef MBS_SUPPORT
- if (MB_CUR_MAX != 1)
- ret = wcs_regex_compile (s, strlen (s), re_syntax_options, &re_comp_buf);
- else
-# endif
- ret = byte_regex_compile (s, strlen (s), re_syntax_options, &re_comp_buf);
-
- if (!ret)
- return NULL;
-
- /* Yes, we're discarding `const' here if !HAVE_LIBINTL. */
- return (char *) gettext (re_error_msgid[(int) ret]);
-}
-
-
-int
-#ifdef _LIBC
-weak_function
-#endif
-re_exec (s)
- const char *s;
-{
- const int len = strlen (s);
- return
- 0 <= re_search (&re_comp_buf, s, len, 0, len, (struct re_registers *) 0);
-}
-
-#endif /* _REGEX_RE_COMP */
-
-/* POSIX.2 functions. Don't define these for Emacs. */
-
-#ifndef emacs
-
-/* regcomp takes a regular expression as a string and compiles it.
-
- PREG is a regex_t *. We do not expect any fields to be initialized,
- since POSIX says we shouldn't. Thus, we set
-
- `buffer' to the compiled pattern;
- `used' to the length of the compiled pattern;
- `syntax' to RE_SYNTAX_POSIX_EXTENDED if the
- REG_EXTENDED bit in CFLAGS is set; otherwise, to
- RE_SYNTAX_POSIX_BASIC;
- `newline_anchor' to REG_NEWLINE being set in CFLAGS;
- `fastmap' to an allocated space for the fastmap;
- `fastmap_accurate' to zero;
- `re_nsub' to the number of subexpressions in PATTERN.
-
- PATTERN is the address of the pattern string.
-
- CFLAGS is a series of bits which affect compilation.
-
- If REG_EXTENDED is set, we use POSIX extended syntax; otherwise, we
- use POSIX basic syntax.
-
- If REG_NEWLINE is set, then . and [^...] don't match newline.
- Also, regexec will try a match beginning after every newline.
-
- If REG_ICASE is set, then we considers upper- and lowercase
- versions of letters to be equivalent when matching.
-
- If REG_NOSUB is set, then when PREG is passed to regexec, that
- routine will report only success or failure, and nothing about the
- registers.
-
- It returns 0 if it succeeds, nonzero if it doesn't. (See regex.h for
- the return codes and their meanings.) */
-
-int
-regcomp (preg, pattern, cflags)
- regex_t *preg;
- const char *pattern;
- int cflags;
-{
- reg_errcode_t ret;
- reg_syntax_t syntax
- = (cflags & REG_EXTENDED) ?
- RE_SYNTAX_POSIX_EXTENDED : RE_SYNTAX_POSIX_BASIC;
-
- /* regex_compile will allocate the space for the compiled pattern. */
- preg->buffer = 0;
- preg->allocated = 0;
- preg->used = 0;
-
- /* Try to allocate space for the fastmap. */
- preg->fastmap = (char *) malloc (1 << BYTEWIDTH);
-
- if (cflags & REG_ICASE)
- {
- unsigned i;
-
- preg->translate
- = (RE_TRANSLATE_TYPE) malloc (CHAR_SET_SIZE
- * sizeof (*(RE_TRANSLATE_TYPE)0));
- if (preg->translate == NULL)
- return (int) REG_ESPACE;
-
- /* Map uppercase characters to corresponding lowercase ones. */
- for (i = 0; i < CHAR_SET_SIZE; i++)
- preg->translate[i] = ISUPPER (i) ? TOLOWER (i) : i;
- }
- else
- preg->translate = NULL;
-
- /* If REG_NEWLINE is set, newlines are treated differently. */
- if (cflags & REG_NEWLINE)
- { /* REG_NEWLINE implies neither . nor [^...] match newline. */
- syntax &= ~RE_DOT_NEWLINE;
- syntax |= RE_HAT_LISTS_NOT_NEWLINE;
- /* It also changes the matching behavior. */
- preg->newline_anchor = 1;
- }
- else
- preg->newline_anchor = 0;
-
- preg->no_sub = !!(cflags & REG_NOSUB);
-
- /* POSIX says a null character in the pattern terminates it, so we
- can use strlen here in compiling the pattern. */
-# ifdef MBS_SUPPORT
- if (MB_CUR_MAX != 1)
- ret = wcs_regex_compile (pattern, strlen (pattern), syntax, preg);
- else
-# endif
- ret = byte_regex_compile (pattern, strlen (pattern), syntax, preg);
-
- /* POSIX doesn't distinguish between an unmatched open-group and an
- unmatched close-group: both are REG_EPAREN. */
- if (ret == REG_ERPAREN) ret = REG_EPAREN;
-
- if (ret == REG_NOERROR && preg->fastmap)
- {
- /* Compute the fastmap now, since regexec cannot modify the pattern
- buffer. */
- if (re_compile_fastmap (preg) == -2)
- {
- /* Some error occurred while computing the fastmap, just forget
- about it. */
- free (preg->fastmap);
- preg->fastmap = NULL;
- }
- }
-
- return (int) ret;
-}
-#ifdef _LIBC
-weak_alias (__regcomp, regcomp)
-#endif
-
-
-/* regexec searches for a given pattern, specified by PREG, in the
- string STRING.
-
- If NMATCH is zero or REG_NOSUB was set in the cflags argument to
- `regcomp', we ignore PMATCH. Otherwise, we assume PMATCH has at
- least NMATCH elements, and we set them to the offsets of the
- corresponding matched substrings.
-
- EFLAGS specifies `execution flags' which affect matching: if
- REG_NOTBOL is set, then ^ does not match at the beginning of the
- string; if REG_NOTEOL is set, then $ does not match at the end.
-
- We return 0 if we find a match and REG_NOMATCH if not. */
-
-int
-regexec (preg, string, nmatch, pmatch, eflags)
- const regex_t *preg;
- const char *string;
- size_t nmatch;
- regmatch_t pmatch[];
- int eflags;
-{
- int ret;
- struct re_registers regs;
- regex_t private_preg;
- int len = strlen (string);
- boolean want_reg_info = !preg->no_sub && nmatch > 0;
-
- private_preg = *preg;
-
- private_preg.not_bol = !!(eflags & REG_NOTBOL);
- private_preg.not_eol = !!(eflags & REG_NOTEOL);
-
- /* The user has told us exactly how many registers to return
- information about, via `nmatch'. We have to pass that on to the
- matching routines. */
- private_preg.regs_allocated = REGS_FIXED;
-
- if (want_reg_info)
- {
- regs.num_regs = nmatch;
- regs.start = TALLOC (nmatch * 2, regoff_t);
- if (regs.start == NULL)
- return (int) REG_NOMATCH;
- regs.end = regs.start + nmatch;
- }
-
- /* Perform the searching operation. */
- ret = re_search (&private_preg, string, len,
- /* start: */ 0, /* range: */ len,
- want_reg_info ? &regs : (struct re_registers *) 0);
-
- /* Copy the register information to the POSIX structure. */
- if (want_reg_info)
- {
- if (ret >= 0)
- {
- unsigned r;
-
- for (r = 0; r < nmatch; r++)
- {
- pmatch[r].rm_so = regs.start[r];
- pmatch[r].rm_eo = regs.end[r];
- }
- }
-
- /* If we needed the temporary register info, free the space now. */
- free (regs.start);
- }
-
- /* We want zero return to mean success, unlike `re_search'. */
- return ret >= 0 ? (int) REG_NOERROR : (int) REG_NOMATCH;
-}
-#ifdef _LIBC
-weak_alias (__regexec, regexec)
-#endif
-
-
-/* Returns a message corresponding to an error code, ERRCODE, returned
- from either regcomp or regexec. We don't use PREG here. */
-
-size_t
-regerror (errcode, preg, errbuf, errbuf_size)
- int errcode;
- const regex_t *preg;
- char *errbuf;
- size_t errbuf_size;
-{
- const char *msg;
- size_t msg_size;
-
- if (errcode < 0
- || errcode >= (int) (sizeof (re_error_msgid)
- / sizeof (re_error_msgid[0])))
- /* Only error codes returned by the rest of the code should be passed
- to this routine. If we are given anything else, or if other regex
- code generates an invalid error code, then the program has a bug.
- Dump core so we can fix it. */
- abort ();
-
- msg = gettext (re_error_msgid[errcode]);
-
- msg_size = strlen (msg) + 1; /* Includes the null. */
-
- if (errbuf_size != 0)
- {
- if (msg_size > errbuf_size)
- {
-#if defined HAVE_MEMPCPY || defined _LIBC
- *((char *) __mempcpy (errbuf, msg, errbuf_size - 1)) = '\0';
-#else
- memcpy (errbuf, msg, errbuf_size - 1);
- errbuf[errbuf_size - 1] = 0;
-#endif
- }
- else
- memcpy (errbuf, msg, msg_size);
- }
-
- return msg_size;
-}
-#ifdef _LIBC
-weak_alias (__regerror, regerror)
-#endif
-
-
-/* Free dynamically allocated space used by PREG. */
-
-void
-regfree (preg)
- regex_t *preg;
-{
- if (preg->buffer != NULL)
- free (preg->buffer);
- preg->buffer = NULL;
-
- preg->allocated = 0;
- preg->used = 0;
-
- if (preg->fastmap != NULL)
- free (preg->fastmap);
- preg->fastmap = NULL;
- preg->fastmap_accurate = 0;
-
- if (preg->translate != NULL)
- free (preg->translate);
- preg->translate = NULL;
-}
-#ifdef _LIBC
-weak_alias (__regfree, regfree)
-#endif
-
-#endif /* not emacs */
-
-#endif /* not INSIDE_RECURSION */
-
-
-#undef STORE_NUMBER
-#undef STORE_NUMBER_AND_INCR
-#undef EXTRACT_NUMBER
-#undef EXTRACT_NUMBER_AND_INCR
-
-#undef DEBUG_PRINT_COMPILED_PATTERN
-#undef DEBUG_PRINT_DOUBLE_STRING
-
-#undef INIT_FAIL_STACK
-#undef RESET_FAIL_STACK
-#undef DOUBLE_FAIL_STACK
-#undef PUSH_PATTERN_OP
-#undef PUSH_FAILURE_POINTER
-#undef PUSH_FAILURE_INT
-#undef PUSH_FAILURE_ELT
-#undef POP_FAILURE_POINTER
-#undef POP_FAILURE_INT
-#undef POP_FAILURE_ELT
-#undef DEBUG_PUSH
-#undef DEBUG_POP
-#undef PUSH_FAILURE_POINT
-#undef POP_FAILURE_POINT
-
-#undef REG_UNSET_VALUE
-#undef REG_UNSET
-
-#undef PATFETCH
-#undef PATFETCH_RAW
-#undef PATUNFETCH
-#undef TRANSLATE
-
-#undef INIT_BUF_SIZE
-#undef GET_BUFFER_SPACE
-#undef BUF_PUSH
-#undef BUF_PUSH_2
-#undef BUF_PUSH_3
-#undef STORE_JUMP
-#undef STORE_JUMP2
-#undef INSERT_JUMP
-#undef INSERT_JUMP2
-#undef EXTEND_BUFFER
-#undef GET_UNSIGNED_NUMBER
-#undef FREE_STACK_RETURN
-
-# undef POINTER_TO_OFFSET
-# undef MATCHING_IN_FRST_STRING
-# undef PREFETCH
-# undef AT_STRINGS_BEG
-# undef AT_STRINGS_END
-# undef WORDCHAR_P
-# undef FREE_VAR
-# undef FREE_VARIABLES
-# undef NO_HIGHEST_ACTIVE_REG
-# undef NO_LOWEST_ACTIVE_REG
-
-# undef CHAR_T
-# undef UCHAR_T
-# undef COMPILED_BUFFER_VAR
-# undef OFFSET_ADDRESS_SIZE
-# undef CHAR_CLASS_SIZE
-# undef PREFIX
-# undef ARG_PREFIX
-# undef PUT_CHAR
-# undef BYTE
-# undef WCHAR
-
-# define DEFINED_ONCE
diff --git a/libiberty/rename.c b/libiberty/rename.c
deleted file mode 100644
index 0563062..0000000
--- a/libiberty/rename.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* rename -- rename a file
- This function is in the public domain. */
-
-/*
-
-@deftypefn Supplemental int rename (const char *@var{old}, const char *@var{new})
-
-Renames a file from @var{old} to @var{new}. If @var{new} already
-exists, it is removed.
-
-@end deftypefn
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include <errno.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-int
-rename (zfrom, zto)
- char *zfrom;
- char *zto;
-{
- if (link (zfrom, zto) < 0)
- {
- if (errno != EEXIST)
- return -1;
- if (unlink (zto) < 0
- || link (zfrom, zto) < 0)
- return -1;
- }
- return unlink (zfrom);
-}
diff --git a/libiberty/rindex.c b/libiberty/rindex.c
deleted file mode 100644
index ef9cdc5..0000000
--- a/libiberty/rindex.c
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Stub implementation of (obsolete) rindex(). */
-
-/*
-
-@deftypefn Supplemental char* rindex (const char *@var{s}, int @var{c})
-
-Returns a pointer to the last occurrence of the character @var{c} in
-the string @var{s}, or @code{NULL} if not found. The use of @code{rindex} is
-deprecated in new programs in favor of @code{strrchr}.
-
-@end deftypefn
-
-*/
-
-extern char *strrchr ();
-
-char *
-rindex (s, c)
- char *s;
- int c;
-{
- return strrchr (s, c);
-}
diff --git a/libiberty/safe-ctype.c b/libiberty/safe-ctype.c
deleted file mode 100644
index 3bac84b..0000000
--- a/libiberty/safe-ctype.c
+++ /dev/null
@@ -1,163 +0,0 @@
-/* <ctype.h> replacement macros.
-
- Copyright (C) 2000 Free Software Foundation, Inc.
- Contributed by Zack Weinberg <zackw@stanford.edu>.
-
-This file is part of the libiberty library.
-Libiberty is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public
-License as published by the Free Software Foundation; either
-version 2 of the License, or (at your option) any later version.
-
-Libiberty is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with libiberty; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-/* This is a compatible replacement of the standard C library's <ctype.h>
- with the following properties:
-
- - Implements all isxxx() macros required by C99.
- - Also implements some character classes useful when
- parsing C-like languages.
- - Does not change behavior depending on the current locale.
- - Behaves properly for all values in the range of a signed or
- unsigned char. */
-
-#include "ansidecl.h"
-#include <safe-ctype.h>
-#include <stdio.h> /* for EOF */
-
-/* Shorthand */
-#define bl _sch_isblank
-#define cn _sch_iscntrl
-#define di _sch_isdigit
-#define is _sch_isidst
-#define lo _sch_islower
-#define nv _sch_isnvsp
-#define pn _sch_ispunct
-#define pr _sch_isprint
-#define sp _sch_isspace
-#define up _sch_isupper
-#define vs _sch_isvsp
-#define xd _sch_isxdigit
-
-/* Masks. */
-#define L (const unsigned short) (lo|is |pr) /* lower case letter */
-#define XL (const unsigned short) (lo|is|xd|pr) /* lowercase hex digit */
-#define U (const unsigned short) (up|is |pr) /* upper case letter */
-#define XU (const unsigned short) (up|is|xd|pr) /* uppercase hex digit */
-#define D (const unsigned short) (di |xd|pr) /* decimal digit */
-#define P (const unsigned short) (pn |pr) /* punctuation */
-#define _ (const unsigned short) (pn|is |pr) /* underscore */
-
-#define C (const unsigned short) ( cn) /* control character */
-#define Z (const unsigned short) (nv |cn) /* NUL */
-#define M (const unsigned short) (nv|sp |cn) /* cursor movement: \f \v */
-#define V (const unsigned short) (vs|sp |cn) /* vertical space: \r \n */
-#define T (const unsigned short) (nv|sp|bl|cn) /* tab */
-#define S (const unsigned short) (nv|sp|bl|pr) /* space */
-
-/* Are we ASCII? */
-#if '\n' == 0x0A && ' ' == 0x20 && '0' == 0x30 \
- && 'A' == 0x41 && 'a' == 0x61 && '!' == 0x21 \
- && EOF == -1
-
-const unsigned short _sch_istable[256] =
-{
- Z, C, C, C, C, C, C, C, /* NUL SOH STX ETX EOT ENQ ACK BEL */
- C, T, V, M, M, V, C, C, /* BS HT LF VT FF CR SO SI */
- C, C, C, C, C, C, C, C, /* DLE DC1 DC2 DC3 DC4 NAK SYN ETB */
- C, C, C, C, C, C, C, C, /* CAN EM SUB ESC FS GS RS US */
- S, P, P, P, P, P, P, P, /* SP ! " # $ % & ' */
- P, P, P, P, P, P, P, P, /* ( ) * + , - . / */
- D, D, D, D, D, D, D, D, /* 0 1 2 3 4 5 6 7 */
- D, D, P, P, P, P, P, P, /* 8 9 : ; < = > ? */
- P, XU, XU, XU, XU, XU, XU, U, /* @ A B C D E F G */
- U, U, U, U, U, U, U, U, /* H I J K L M N O */
- U, U, U, U, U, U, U, U, /* P Q R S T U V W */
- U, U, U, P, P, P, P, _, /* X Y Z [ \ ] ^ _ */
- P, XL, XL, XL, XL, XL, XL, L, /* ` a b c d e f g */
- L, L, L, L, L, L, L, L, /* h i j k l m n o */
- L, L, L, L, L, L, L, L, /* p q r s t u v w */
- L, L, L, P, P, P, P, C, /* x y z { | } ~ DEL */
-
- /* high half of unsigned char is locale-specific, so all tests are
- false in "C" locale */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-};
-
-const unsigned char _sch_tolower[256] =
-{
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
- 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
- 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
- 64,
-
- 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
- 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
-
- 91, 92, 93, 94, 95, 96,
-
- 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
- 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
-
- 123,124,125,126,127,
-
- 128,129,130,131, 132,133,134,135, 136,137,138,139, 140,141,142,143,
- 144,145,146,147, 148,149,150,151, 152,153,154,155, 156,157,158,159,
- 160,161,162,163, 164,165,166,167, 168,169,170,171, 172,173,174,175,
- 176,177,178,179, 180,181,182,183, 184,185,186,187, 188,189,190,191,
-
- 192,193,194,195, 196,197,198,199, 200,201,202,203, 204,205,206,207,
- 208,209,210,211, 212,213,214,215, 216,217,218,219, 220,221,222,223,
- 224,225,226,227, 228,229,230,231, 232,233,234,235, 236,237,238,239,
- 240,241,242,243, 244,245,246,247, 248,249,250,251, 252,253,254,255,
-};
-
-const unsigned char _sch_toupper[256] =
-{
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
- 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
- 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
- 64,
-
- 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
- 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
-
- 91, 92, 93, 94, 95, 96,
-
- 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
- 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
-
- 123,124,125,126,127,
-
- 128,129,130,131, 132,133,134,135, 136,137,138,139, 140,141,142,143,
- 144,145,146,147, 148,149,150,151, 152,153,154,155, 156,157,158,159,
- 160,161,162,163, 164,165,166,167, 168,169,170,171, 172,173,174,175,
- 176,177,178,179, 180,181,182,183, 184,185,186,187, 188,189,190,191,
-
- 192,193,194,195, 196,197,198,199, 200,201,202,203, 204,205,206,207,
- 208,209,210,211, 212,213,214,215, 216,217,218,219, 220,221,222,223,
- 224,225,226,227, 228,229,230,231, 232,233,234,235, 236,237,238,239,
- 240,241,242,243, 244,245,246,247, 248,249,250,251, 252,253,254,255,
-};
-
-#else
- #error "Unsupported host character set"
-#endif /* not ASCII */
diff --git a/libiberty/setenv.c b/libiberty/setenv.c
deleted file mode 100644
index 8394faf..0000000
--- a/libiberty/setenv.c
+++ /dev/null
@@ -1,187 +0,0 @@
-/* Copyright (C) 1992, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
- This file based on setenv.c in the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C 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
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-
-/*
-
-@deftypefn Supplemental int setenv (const char *@var{name}, const char *@var{value}, int @var{overwrite})
-@deftypefnx Supplemental void unsetenv (const char *@var{name})
-
-@code{setenv} adds @var{name} to the environment with value
-@var{value}. If the name was already present in the environment,
-the new value will be stored only if @var{overwrite} is nonzero.
-The companion @code{unsetenv} function removes @var{name} from the
-environment. This implementation is not safe for multithreaded code.
-
-@end deftypefn
-
-*/
-
-#if HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#define setenv libiberty_setenv
-#define unsetenv libiberty_unsetenv
-
-#include "ansidecl.h"
-#include <sys/types.h> /* For `size_t' */
-#include <stdio.h> /* For `NULL' */
-
-#include <errno.h>
-#if !defined(errno) && !defined(HAVE_ERRNO_DECL)
-extern int errno;
-#endif
-#define __set_errno(ev) ((errno) = (ev))
-
-#if HAVE_STDLIB_H
-# include <stdlib.h>
-#endif
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#define __environ environ
-#ifndef HAVE_ENVIRON_DECL
-extern char **environ;
-#endif
-
-#undef setenv
-#undef unsetenv
-
-/* LOCK and UNLOCK are defined as no-ops. This makes the libiberty
- * implementation MT-Unsafe. */
-#define LOCK
-#define UNLOCK
-
-/* Below this point, it's verbatim code from the glibc-2.0 implementation */
-
-/* If this variable is not a null pointer we allocated the current
- environment. */
-static char **last_environ;
-
-
-int
-setenv (name, value, replace)
- const char *name;
- const char *value;
- int replace;
-{
- register char **ep = 0;
- register size_t size;
- const size_t namelen = strlen (name);
- const size_t vallen = strlen (value) + 1;
-
- LOCK;
-
- size = 0;
- if (__environ != NULL)
- {
- for (ep = __environ; *ep != NULL; ++ep)
- if (!strncmp (*ep, name, namelen) && (*ep)[namelen] == '=')
- break;
- else
- ++size;
- }
-
- if (__environ == NULL || *ep == NULL)
- {
- char **new_environ;
- if (__environ == last_environ && __environ != NULL)
- /* We allocated this space; we can extend it. */
- new_environ = (char **) realloc (last_environ,
- (size + 2) * sizeof (char *));
- else
- new_environ = (char **) malloc ((size + 2) * sizeof (char *));
-
- if (new_environ == NULL)
- {
- UNLOCK;
- return -1;
- }
-
- new_environ[size] = malloc (namelen + 1 + vallen);
- if (new_environ[size] == NULL)
- {
- free ((char *) new_environ);
- __set_errno (ENOMEM);
- UNLOCK;
- return -1;
- }
-
- if (__environ != last_environ)
- memcpy ((char *) new_environ, (char *) __environ,
- size * sizeof (char *));
-
- memcpy (new_environ[size], name, namelen);
- new_environ[size][namelen] = '=';
- memcpy (&new_environ[size][namelen + 1], value, vallen);
-
- new_environ[size + 1] = NULL;
-
- last_environ = __environ = new_environ;
- }
- else if (replace)
- {
- size_t len = strlen (*ep);
- if (len + 1 < namelen + 1 + vallen)
- {
- /* The existing string is too short; malloc a new one. */
- char *new = malloc (namelen + 1 + vallen);
- if (new == NULL)
- {
- UNLOCK;
- return -1;
- }
- *ep = new;
- }
- memcpy (*ep, name, namelen);
- (*ep)[namelen] = '=';
- memcpy (&(*ep)[namelen + 1], value, vallen);
- }
-
- UNLOCK;
-
- return 0;
-}
-
-void
-unsetenv (name)
- const char *name;
-{
- const size_t len = strlen (name);
- char **ep;
-
- LOCK;
-
- for (ep = __environ; *ep; ++ep)
- if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
- {
- /* Found it. Remove this pointer by moving later ones back. */
- char **dp = ep;
- do
- dp[0] = dp[1];
- while (*dp++);
- /* Continue the loop in case NAME appears again. */
- }
-
- UNLOCK;
-}
diff --git a/libiberty/sigsetmask.c b/libiberty/sigsetmask.c
deleted file mode 100644
index f705fbb..0000000
--- a/libiberty/sigsetmask.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Version of sigsetmask.c
- Written by Steve Chamberlain (sac@cygnus.com).
- Contributed by Cygnus Support.
- This file is in the public doamin. */
-
-/*
-
-@deftypefn Supplemental int sigsetmask (int @var{set})
-
-Sets the signal mask to the one provided in @var{set} and returns
-the old mask (which, for libiberty's implementation, will always
-be the value @code{1}).
-
-@end deftypefn
-
-*/
-
-#define _POSIX_SOURCE
-#include <ansidecl.h>
-/* Including <sys/types.h> seems to be needed by ISC. */
-#include <sys/types.h>
-#include <signal.h>
-
-extern void abort PARAMS ((void)) ATTRIBUTE_NORETURN;
-
-#ifdef SIG_SETMASK
-int
-DEFUN(sigsetmask,(set),
- int set)
-{
- sigset_t new;
- sigset_t old;
-
- sigemptyset (&new);
- if (set != 0) {
- abort(); /* FIXME, we don't know how to translate old mask to new */
- }
- sigprocmask(SIG_SETMASK, &new, &old);
- return 1; /* FIXME, we always return 1 as old value. */
-}
-#endif
diff --git a/libiberty/sort.c b/libiberty/sort.c
deleted file mode 100644
index 90c97e0..0000000
--- a/libiberty/sort.c
+++ /dev/null
@@ -1,190 +0,0 @@
-/* Sorting algorithms.
- Copyright (C) 2000 Free Software Foundation, Inc.
- Contributed by Mark Mitchell <mark@codesourcery.com>.
-
-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. */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include "libiberty.h"
-#include "sort.h"
-#ifdef HAVE_LIMITS_H
-#include <limits.h>
-#endif
-#ifdef HAVE_SYS_PARAM_H
-#include <sys/param.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-
-#ifndef UCHAR_MAX
-#define UCHAR_MAX ((unsigned char)(-1))
-#endif
-
-/* POINTERS and WORK are both arrays of N pointers. When this
- function returns POINTERS will be sorted in ascending order. */
-
-void sort_pointers (n, pointers, work)
- size_t n;
- void **pointers;
- void **work;
-{
- /* The type of a single digit. This can be any unsigned integral
- type. When changing this, DIGIT_MAX should be changed as
- well. */
- typedef unsigned char digit_t;
-
- /* The maximum value a single digit can have. */
-#define DIGIT_MAX (UCHAR_MAX + 1)
-
- /* The Ith entry is the number of elements in *POINTERSP that have I
- in the digit on which we are currently sorting. */
- unsigned int count[DIGIT_MAX];
- /* Nonzero if we are running on a big-endian machine. */
- int big_endian_p;
- size_t i;
- size_t j;
-
- /* The algorithm used here is radix sort which takes time linear in
- the number of elements in the array. */
-
- /* The algorithm here depends on being able to swap the two arrays
- an even number of times. */
- if ((sizeof (void *) / sizeof (digit_t)) % 2 != 0)
- abort ();
-
- /* Figure out the endianness of the machine. */
- for (i = 0, j = 0; i < sizeof (size_t); ++i)
- {
- j *= (UCHAR_MAX + 1);
- j += i;
- }
- big_endian_p = (((char *)&j)[0] == 0);
-
- /* Move through the pointer values from least significant to most
- significant digits. */
- for (i = 0; i < sizeof (void *) / sizeof (digit_t); ++i)
- {
- digit_t *digit;
- digit_t *bias;
- digit_t *top;
- unsigned int *countp;
- void **pointerp;
-
- /* The offset from the start of the pointer will depend on the
- endianness of the machine. */
- if (big_endian_p)
- j = sizeof (void *) / sizeof (digit_t) - i;
- else
- j = i;
-
- /* Now, perform a stable sort on this digit. We use counting
- sort. */
- memset (count, 0, DIGIT_MAX * sizeof (unsigned int));
-
- /* Compute the address of the appropriate digit in the first and
- one-past-the-end elements of the array. On a little-endian
- machine, the least-significant digit is closest to the front. */
- bias = ((digit_t *) pointers) + j;
- top = ((digit_t *) (pointers + n)) + j;
-
- /* Count how many there are of each value. At the end of this
- loop, COUNT[K] will contain the number of pointers whose Ith
- digit is K. */
- for (digit = bias;
- digit < top;
- digit += sizeof (void *) / sizeof (digit_t))
- ++count[*digit];
-
- /* Now, make COUNT[K] contain the number of pointers whose Ith
- digit is less than or equal to K. */
- for (countp = count + 1; countp < count + DIGIT_MAX; ++countp)
- *countp += countp[-1];
-
- /* Now, drop the pointers into their correct locations. */
- for (pointerp = pointers + n - 1; pointerp >= pointers; --pointerp)
- work[--count[((digit_t *) pointerp)[j]]] = *pointerp;
-
- /* Swap WORK and POINTERS so that POINTERS contains the sorted
- array. */
- pointerp = pointers;
- pointers = work;
- work = pointerp;
- }
-}
-
-/* Everything below here is a unit test for the routines in this
- file. */
-
-#ifdef UNIT_TEST
-
-#include <stdio.h>
-
-void *xmalloc (n)
- size_t n;
-{
- return malloc (n);
-}
-
-int main (int argc, char **argv)
-{
- int k;
- int result;
- size_t i;
- void **pointers;
- void **work;
-
- if (argc > 1)
- k = atoi (argv[1]);
- else
- k = 10;
-
- pointers = xmalloc (k * sizeof (void *));
- work = xmalloc (k * sizeof (void *));
-
- for (i = 0; i < k; ++i)
- {
- pointers[i] = (void *) random ();
- printf ("%x\n", pointers[i]);
- }
-
- sort_pointers (k, pointers, work);
-
- printf ("\nSorted\n\n");
-
- result = 0;
-
- for (i = 0; i < k; ++i)
- {
- printf ("%x\n", pointers[i]);
- if (i > 0 && (char*) pointers[i] < (char*) pointers[i - 1])
- result = 1;
- }
-
- free (pointers);
- free (work);
-
- return result;
-}
-
-#endif
diff --git a/libiberty/spaces.c b/libiberty/spaces.c
deleted file mode 100644
index bfead7ed..0000000
--- a/libiberty/spaces.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/* Allocate memory region filled with spaces.
- Copyright (C) 1991 Free Software Foundation, Inc.
-
-This file is part of the libiberty library.
-Libiberty is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public
-License as published by the Free Software Foundation; either
-version 2 of the License, or (at your option) any later version.
-
-Libiberty is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with libiberty; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-/*
-
-@deftypefn Extension char* spaces (int @var{count})
-
-Returns a pointer to a memory region filled with the specified
-number of spaces and null terminated. The returned pointer is
-valid until at least the next call.
-
-@end deftypefn
-
-*/
-
-#include "ansidecl.h"
-#include "libiberty.h"
-
-#if VMS
-#include <stdlib.h>
-#include <unixlib.h>
-#else
-/* For systems with larger pointers than ints, these must be declared. */
-extern PTR malloc PARAMS ((size_t));
-extern void free PARAMS ((PTR));
-#endif
-
-const char *
-spaces (count)
- int count;
-{
- register char *t;
- static char *buf;
- static int maxsize;
-
- if (count > maxsize)
- {
- if (buf)
- {
- free (buf);
- }
- buf = malloc (count + 1);
- if (buf == (char *) 0)
- return 0;
- for (t = buf + count ; t != buf ; )
- {
- *--t = ' ';
- }
- maxsize = count;
- buf[count] = '\0';
- }
- return (const char *) (buf + maxsize - count);
-}
-
diff --git a/libiberty/splay-tree.c b/libiberty/splay-tree.c
deleted file mode 100644
index 6f90fde..0000000
--- a/libiberty/splay-tree.c
+++ /dev/null
@@ -1,559 +0,0 @@
-/* A splay-tree datatype.
- Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
- Contributed by Mark Mitchell (mark@markmitchell.com).
-
-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. */
-
-/* For an easily readable description of splay-trees, see:
-
- Lewis, Harry R. and Denenberg, Larry. Data Structures and Their
- Algorithms. Harper-Collins, Inc. 1991. */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-
-#include <stdio.h>
-
-#include "libiberty.h"
-#include "splay-tree.h"
-
-static void splay_tree_delete_helper PARAMS((splay_tree,
- splay_tree_node));
-static void splay_tree_splay PARAMS((splay_tree,
- splay_tree_key));
-static splay_tree_node splay_tree_splay_helper
- PARAMS((splay_tree,
- splay_tree_key,
- splay_tree_node*,
- splay_tree_node*,
- splay_tree_node*));
-static int splay_tree_foreach_helper PARAMS((splay_tree,
- splay_tree_node,
- splay_tree_foreach_fn,
- void*));
-
-/* Deallocate NODE (a member of SP), and all its sub-trees. */
-
-static void
-splay_tree_delete_helper (sp, node)
- splay_tree sp;
- splay_tree_node node;
-{
- if (!node)
- return;
-
- splay_tree_delete_helper (sp, node->left);
- splay_tree_delete_helper (sp, node->right);
-
- if (sp->delete_key)
- (*sp->delete_key)(node->key);
- if (sp->delete_value)
- (*sp->delete_value)(node->value);
-
- (*sp->deallocate) ((char*) node, sp->allocate_data);
-}
-
-/* Help splay SP around KEY. PARENT and GRANDPARENT are the parent
- and grandparent, respectively, of NODE. */
-
-static splay_tree_node
-splay_tree_splay_helper (sp, key, node, parent, grandparent)
- splay_tree sp;
- splay_tree_key key;
- splay_tree_node *node;
- splay_tree_node *parent;
- splay_tree_node *grandparent;
-{
- splay_tree_node *next;
- splay_tree_node n;
- int comparison;
-
- n = *node;
-
- if (!n)
- return *parent;
-
- comparison = (*sp->comp) (key, n->key);
-
- if (comparison == 0)
- /* We've found the target. */
- next = 0;
- else if (comparison < 0)
- /* The target is to the left. */
- next = &n->left;
- else
- /* The target is to the right. */
- next = &n->right;
-
- if (next)
- {
- /* Continue down the tree. */
- n = splay_tree_splay_helper (sp, key, next, node, parent);
-
- /* The recursive call will change the place to which NODE
- points. */
- if (*node != n)
- return n;
- }
-
- if (!parent)
- /* NODE is the root. We are done. */
- return n;
-
- /* First, handle the case where there is no grandparent (i.e.,
- *PARENT is the root of the tree.) */
- if (!grandparent)
- {
- if (n == (*parent)->left)
- {
- *node = n->right;
- n->right = *parent;
- }
- else
- {
- *node = n->left;
- n->left = *parent;
- }
- *parent = n;
- return n;
- }
-
- /* Next handle the cases where both N and *PARENT are left children,
- or where both are right children. */
- if (n == (*parent)->left && *parent == (*grandparent)->left)
- {
- splay_tree_node p = *parent;
-
- (*grandparent)->left = p->right;
- p->right = *grandparent;
- p->left = n->right;
- n->right = p;
- *grandparent = n;
- return n;
- }
- else if (n == (*parent)->right && *parent == (*grandparent)->right)
- {
- splay_tree_node p = *parent;
-
- (*grandparent)->right = p->left;
- p->left = *grandparent;
- p->right = n->left;
- n->left = p;
- *grandparent = n;
- return n;
- }
-
- /* Finally, deal with the case where N is a left child, but *PARENT
- is a right child, or vice versa. */
- if (n == (*parent)->left)
- {
- (*parent)->left = n->right;
- n->right = *parent;
- (*grandparent)->right = n->left;
- n->left = *grandparent;
- *grandparent = n;
- return n;
- }
- else
- {
- (*parent)->right = n->left;
- n->left = *parent;
- (*grandparent)->left = n->right;
- n->right = *grandparent;
- *grandparent = n;
- return n;
- }
-}
-
-/* Splay SP around KEY. */
-
-static void
-splay_tree_splay (sp, key)
- splay_tree sp;
- splay_tree_key key;
-{
- if (sp->root == 0)
- return;
-
- splay_tree_splay_helper (sp, key, &sp->root,
- /*grandparent=*/0, /*parent=*/0);
-}
-
-/* Call FN, passing it the DATA, for every node below NODE, all of
- which are from SP, following an in-order traversal. If FN every
- returns a non-zero value, the iteration ceases immediately, and the
- value is returned. Otherwise, this function returns 0. */
-
-static int
-splay_tree_foreach_helper (sp, node, fn, data)
- splay_tree sp;
- splay_tree_node node;
- splay_tree_foreach_fn fn;
- void* data;
-{
- int val;
-
- if (!node)
- return 0;
-
- val = splay_tree_foreach_helper (sp, node->left, fn, data);
- if (val)
- return val;
-
- val = (*fn)(node, data);
- if (val)
- return val;
-
- return splay_tree_foreach_helper (sp, node->right, fn, data);
-}
-
-
-/* An allocator and deallocator based on xmalloc. */
-static void *
-splay_tree_xmalloc_allocate (size, data)
- int size;
- void *data ATTRIBUTE_UNUSED;
-{
- return (void *) xmalloc (size);
-}
-
-static void
-splay_tree_xmalloc_deallocate (object, data)
- void *object;
- void *data ATTRIBUTE_UNUSED;
-{
- free (object);
-}
-
-
-/* Allocate a new splay tree, using COMPARE_FN to compare nodes,
- DELETE_KEY_FN to deallocate keys, and DELETE_VALUE_FN to deallocate
- values. Use xmalloc to allocate the splay tree structure, and any
- nodes added. */
-
-splay_tree
-splay_tree_new (compare_fn, delete_key_fn, delete_value_fn)
- splay_tree_compare_fn compare_fn;
- splay_tree_delete_key_fn delete_key_fn;
- splay_tree_delete_value_fn delete_value_fn;
-{
- return (splay_tree_new_with_allocator
- (compare_fn, delete_key_fn, delete_value_fn,
- splay_tree_xmalloc_allocate, splay_tree_xmalloc_deallocate, 0));
-}
-
-
-/* Allocate a new splay tree, using COMPARE_FN to compare nodes,
- DELETE_KEY_FN to deallocate keys, and DELETE_VALUE_FN to deallocate
- values. */
-
-splay_tree
-splay_tree_new_with_allocator (compare_fn, delete_key_fn, delete_value_fn,
- allocate_fn, deallocate_fn, allocate_data)
- splay_tree_compare_fn compare_fn;
- splay_tree_delete_key_fn delete_key_fn;
- splay_tree_delete_value_fn delete_value_fn;
- splay_tree_allocate_fn allocate_fn;
- splay_tree_deallocate_fn deallocate_fn;
- void *allocate_data;
-{
- splay_tree sp = (splay_tree) (*allocate_fn) (sizeof (struct splay_tree_s),
- allocate_data);
- sp->root = 0;
- sp->comp = compare_fn;
- sp->delete_key = delete_key_fn;
- sp->delete_value = delete_value_fn;
- sp->allocate = allocate_fn;
- sp->deallocate = deallocate_fn;
- sp->allocate_data = allocate_data;
-
- return sp;
-}
-
-/* Deallocate SP. */
-
-void
-splay_tree_delete (sp)
- splay_tree sp;
-{
- splay_tree_delete_helper (sp, sp->root);
- (*sp->deallocate) ((char*) sp, sp->allocate_data);
-}
-
-/* Insert a new node (associating KEY with DATA) into SP. If a
- previous node with the indicated KEY exists, its data is replaced
- with the new value. Returns the new node. */
-
-splay_tree_node
-splay_tree_insert (sp, key, value)
- splay_tree sp;
- splay_tree_key key;
- splay_tree_value value;
-{
- int comparison = 0;
-
- splay_tree_splay (sp, key);
-
- if (sp->root)
- comparison = (*sp->comp)(sp->root->key, key);
-
- if (sp->root && comparison == 0)
- {
- /* If the root of the tree already has the indicated KEY, just
- replace the value with VALUE. */
- if (sp->delete_value)
- (*sp->delete_value)(sp->root->value);
- sp->root->value = value;
- }
- else
- {
- /* Create a new node, and insert it at the root. */
- splay_tree_node node;
-
- node = ((splay_tree_node)
- (*sp->allocate) (sizeof (struct splay_tree_node_s),
- sp->allocate_data));
- node->key = key;
- node->value = value;
-
- if (!sp->root)
- node->left = node->right = 0;
- else if (comparison < 0)
- {
- node->left = sp->root;
- node->right = node->left->right;
- node->left->right = 0;
- }
- else
- {
- node->right = sp->root;
- node->left = node->right->left;
- node->right->left = 0;
- }
-
- sp->root = node;
- }
-
- return sp->root;
-}
-
-/* Remove KEY from SP. It is not an error if it did not exist. */
-
-void
-splay_tree_remove (sp, key)
- splay_tree sp;
- splay_tree_key key;
-{
- splay_tree_splay (sp, key);
-
- if (sp->root && (*sp->comp) (sp->root->key, key) == 0)
- {
- splay_tree_node left, right;
-
- left = sp->root->left;
- right = sp->root->right;
-
- /* Delete the root node itself. */
- if (sp->delete_value)
- (*sp->delete_value) (sp->root->value);
- (*sp->deallocate) (sp->root, sp->allocate_data);
-
- /* One of the children is now the root. Doesn't matter much
- which, so long as we preserve the properties of the tree. */
- if (left)
- {
- sp->root = left;
-
- /* If there was a right child as well, hang it off the
- right-most leaf of the left child. */
- if (right)
- {
- while (left->right)
- left = left->right;
- left->right = right;
- }
- }
- else
- sp->root = right;
- }
-}
-
-/* Lookup KEY in SP, returning VALUE if present, and NULL
- otherwise. */
-
-splay_tree_node
-splay_tree_lookup (sp, key)
- splay_tree sp;
- splay_tree_key key;
-{
- splay_tree_splay (sp, key);
-
- if (sp->root && (*sp->comp)(sp->root->key, key) == 0)
- return sp->root;
- else
- return 0;
-}
-
-/* Return the node in SP with the greatest key. */
-
-splay_tree_node
-splay_tree_max (sp)
- splay_tree sp;
-{
- splay_tree_node n = sp->root;
-
- if (!n)
- return NULL;
-
- while (n->right)
- n = n->right;
-
- return n;
-}
-
-/* Return the node in SP with the smallest key. */
-
-splay_tree_node
-splay_tree_min (sp)
- splay_tree sp;
-{
- splay_tree_node n = sp->root;
-
- if (!n)
- return NULL;
-
- while (n->left)
- n = n->left;
-
- return n;
-}
-
-/* Return the immediate predecessor KEY, or NULL if there is no
- predecessor. KEY need not be present in the tree. */
-
-splay_tree_node
-splay_tree_predecessor (sp, key)
- splay_tree sp;
- splay_tree_key key;
-{
- int comparison;
- splay_tree_node node;
-
- /* If the tree is empty, there is certainly no predecessor. */
- if (!sp->root)
- return NULL;
-
- /* Splay the tree around KEY. That will leave either the KEY
- itself, its predecessor, or its successor at the root. */
- splay_tree_splay (sp, key);
- comparison = (*sp->comp)(sp->root->key, key);
-
- /* If the predecessor is at the root, just return it. */
- if (comparison < 0)
- return sp->root;
-
- /* Otherwise, find the leftmost element of the right subtree. */
- node = sp->root->left;
- if (node)
- while (node->right)
- node = node->right;
-
- return node;
-}
-
-/* Return the immediate successor KEY, or NULL if there is no
- successor. KEY need not be present in the tree. */
-
-splay_tree_node
-splay_tree_successor (sp, key)
- splay_tree sp;
- splay_tree_key key;
-{
- int comparison;
- splay_tree_node node;
-
- /* If the tree is empty, there is certainly no successor. */
- if (!sp->root)
- return NULL;
-
- /* Splay the tree around KEY. That will leave either the KEY
- itself, its predecessor, or its successor at the root. */
- splay_tree_splay (sp, key);
- comparison = (*sp->comp)(sp->root->key, key);
-
- /* If the successor is at the root, just return it. */
- if (comparison > 0)
- return sp->root;
-
- /* Otherwise, find the rightmost element of the left subtree. */
- node = sp->root->right;
- if (node)
- while (node->left)
- node = node->left;
-
- return node;
-}
-
-/* Call FN, passing it the DATA, for every node in SP, following an
- in-order traversal. If FN every returns a non-zero value, the
- iteration ceases immediately, and the value is returned.
- Otherwise, this function returns 0. */
-
-int
-splay_tree_foreach (sp, fn, data)
- splay_tree sp;
- splay_tree_foreach_fn fn;
- void *data;
-{
- return splay_tree_foreach_helper (sp, sp->root, fn, data);
-}
-
-/* Splay-tree comparison function, treating the keys as ints. */
-
-int
-splay_tree_compare_ints (k1, k2)
- splay_tree_key k1;
- splay_tree_key k2;
-{
- if ((int) k1 < (int) k2)
- return -1;
- else if ((int) k1 > (int) k2)
- return 1;
- else
- return 0;
-}
-
-/* Splay-tree comparison function, treating the keys as pointers. */
-
-int
-splay_tree_compare_pointers (k1, k2)
- splay_tree_key k1;
- splay_tree_key k2;
-{
- if ((char*) k1 < (char*) k2)
- return -1;
- else if ((char*) k1 > (char*) k2)
- return 1;
- else
- return 0;
-}
diff --git a/libiberty/strcasecmp.c b/libiberty/strcasecmp.c
deleted file mode 100644
index 4bfe650..0000000
--- a/libiberty/strcasecmp.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 1987 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that this notice is preserved and that due credit is given
- * to the University of California at Berkeley. The name of the University
- * may not be used to endorse or promote products derived from this
- * software without specific written prior permission. This software
- * is provided ``as is'' without express or implied warranty.
- */
-
-/*
-
-@deftypefn Supplemental int strcasecmp (const char *@var{s1}, const char *@var{s2})
-
-A case-insensitive @code{strcmp}.
-
-@end deftypefn
-
-*/
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strcasecmp.c 5.5 (Berkeley) 11/24/87";
-#endif /* LIBC_SCCS and not lint */
-
-#include <ansidecl.h>
-#ifdef __STDC__
-#include <stddef.h>
-#else
-#define size_t unsigned long
-#endif
-
-/*
- * This array is designed for mapping upper and lower case letter
- * together for a case independent comparison. The mappings are
- * based upon ascii character sequences.
- */
-typedef unsigned char uc;
-static const unsigned char charmap[] = {
- (uc)'\000',(uc)'\001',(uc)'\002',(uc)'\003',(uc)'\004',(uc)'\005',(uc)'\006',(uc)'\007',
- (uc)'\010',(uc)'\011',(uc)'\012',(uc)'\013',(uc)'\014',(uc)'\015',(uc)'\016',(uc)'\017',
- (uc)'\020',(uc)'\021',(uc)'\022',(uc)'\023',(uc)'\024',(uc)'\025',(uc)'\026',(uc)'\027',
- (uc)'\030',(uc)'\031',(uc)'\032',(uc)'\033',(uc)'\034',(uc)'\035',(uc)'\036',(uc)'\037',
- (uc)'\040',(uc)'\041',(uc)'\042',(uc)'\043',(uc)'\044',(uc)'\045',(uc)'\046',(uc)'\047',
- (uc)'\050',(uc)'\051',(uc)'\052',(uc)'\053',(uc)'\054',(uc)'\055',(uc)'\056',(uc)'\057',
- (uc)'\060',(uc)'\061',(uc)'\062',(uc)'\063',(uc)'\064',(uc)'\065',(uc)'\066',(uc)'\067',
- (uc)'\070',(uc)'\071',(uc)'\072',(uc)'\073',(uc)'\074',(uc)'\075',(uc)'\076',(uc)'\077',
- (uc)'\100',(uc)'\141',(uc)'\142',(uc)'\143',(uc)'\144',(uc)'\145',(uc)'\146',(uc)'\147',
- (uc)'\150',(uc)'\151',(uc)'\152',(uc)'\153',(uc)'\154',(uc)'\155',(uc)'\156',(uc)'\157',
- (uc)'\160',(uc)'\161',(uc)'\162',(uc)'\163',(uc)'\164',(uc)'\165',(uc)'\166',(uc)'\167',
- (uc)'\170',(uc)'\171',(uc)'\172',(uc)'\133',(uc)'\134',(uc)'\135',(uc)'\136',(uc)'\137',
- (uc)'\140',(uc)'\141',(uc)'\142',(uc)'\143',(uc)'\144',(uc)'\145',(uc)'\146',(uc)'\147',
- (uc)'\150',(uc)'\151',(uc)'\152',(uc)'\153',(uc)'\154',(uc)'\155',(uc)'\156',(uc)'\157',
- (uc)'\160',(uc)'\161',(uc)'\162',(uc)'\163',(uc)'\164',(uc)'\165',(uc)'\166',(uc)'\167',
- (uc)'\170',(uc)'\171',(uc)'\172',(uc)'\173',(uc)'\174',(uc)'\175',(uc)'\176',(uc)'\177',
- (uc)'\200',(uc)'\201',(uc)'\202',(uc)'\203',(uc)'\204',(uc)'\205',(uc)'\206',(uc)'\207',
- (uc)'\210',(uc)'\211',(uc)'\212',(uc)'\213',(uc)'\214',(uc)'\215',(uc)'\216',(uc)'\217',
- (uc)'\220',(uc)'\221',(uc)'\222',(uc)'\223',(uc)'\224',(uc)'\225',(uc)'\226',(uc)'\227',
- (uc)'\230',(uc)'\231',(uc)'\232',(uc)'\233',(uc)'\234',(uc)'\235',(uc)'\236',(uc)'\237',
- (uc)'\240',(uc)'\241',(uc)'\242',(uc)'\243',(uc)'\244',(uc)'\245',(uc)'\246',(uc)'\247',
- (uc)'\250',(uc)'\251',(uc)'\252',(uc)'\253',(uc)'\254',(uc)'\255',(uc)'\256',(uc)'\257',
- (uc)'\260',(uc)'\261',(uc)'\262',(uc)'\263',(uc)'\264',(uc)'\265',(uc)'\266',(uc)'\267',
- (uc)'\270',(uc)'\271',(uc)'\272',(uc)'\273',(uc)'\274',(uc)'\275',(uc)'\276',(uc)'\277',
- (uc)'\300',(uc)'\341',(uc)'\342',(uc)'\343',(uc)'\344',(uc)'\345',(uc)'\346',(uc)'\347',
- (uc)'\350',(uc)'\351',(uc)'\352',(uc)'\353',(uc)'\354',(uc)'\355',(uc)'\356',(uc)'\357',
- (uc)'\360',(uc)'\361',(uc)'\362',(uc)'\363',(uc)'\364',(uc)'\365',(uc)'\366',(uc)'\367',
- (uc)'\370',(uc)'\371',(uc)'\372',(uc)'\333',(uc)'\334',(uc)'\335',(uc)'\336',(uc)'\337',
- (uc)'\340',(uc)'\341',(uc)'\342',(uc)'\343',(uc)'\344',(uc)'\345',(uc)'\346',(uc)'\347',
- (uc)'\350',(uc)'\351',(uc)'\352',(uc)'\353',(uc)'\354',(uc)'\355',(uc)'\356',(uc)'\357',
- (uc)'\360',(uc)'\361',(uc)'\362',(uc)'\363',(uc)'\364',(uc)'\365',(uc)'\366',(uc)'\367',
- (uc)'\370',(uc)'\371',(uc)'\372',(uc)'\373',(uc)'\374',(uc)'\375',(uc)'\376',(uc)'\377',
-};
-
-int
-strcasecmp(s1, s2)
- const char *s1, *s2;
-{
- register unsigned char u1, u2;
-
- for (;;) {
- u1 = (unsigned char) *s1++;
- u2 = (unsigned char) *s2++;
- if (charmap[u1] != charmap[u2]) {
- return charmap[u1] - charmap[u2];
- }
- if (u1 == '\0') {
- return 0;
- }
- }
-}
-
diff --git a/libiberty/strchr.c b/libiberty/strchr.c
deleted file mode 100644
index 1f71c51..0000000
--- a/libiberty/strchr.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Portable version of strchr()
- This function is in the public domain. */
-
-/*
-
-@deftypefn Supplemental char* strchr (const char *@var{s}, int @var{c})
-
-Returns a pointer to the first occurrence of the character @var{c} in
-the string @var{s}, or @code{NULL} if not found. If @var{c} is itself the
-null character, the results are undefined.
-
-@end deftypefn
-
-*/
-
-#include <ansidecl.h>
-
-char *
-strchr (s, c)
- register const char *s;
- int c;
-{
- do {
- if (*s == c)
- {
- return (char*)s;
- }
- } while (*s++);
- return (0);
-}
diff --git a/libiberty/strdup.c b/libiberty/strdup.c
deleted file mode 100644
index 49233ba..0000000
--- a/libiberty/strdup.c
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
-
-@deftypefn Supplemental char* strdup (const char *@var{s})
-
-Returns a pointer to a copy of @var{s} in memory obtained from
-@code{malloc}, or @code{NULL} if insufficient memory was available.
-
-@end deftypefn
-
-*/
-
-char *
-strdup(s)
- char *s;
-{
- char *result = (char*)malloc(strlen(s) + 1);
- if (result == (char*)0)
- return (char*)0;
- strcpy(result, s);
- return result;
-}
diff --git a/libiberty/strerror.c b/libiberty/strerror.c
deleted file mode 100644
index 18050c2..0000000
--- a/libiberty/strerror.c
+++ /dev/null
@@ -1,811 +0,0 @@
-/* Extended support for using errno values.
- Written by Fred Fish. fnf@cygnus.com
- This file is in the public domain. --Per Bothner. */
-
-#include "ansidecl.h"
-#include "libiberty.h"
-
-#include "config.h"
-
-#ifdef HAVE_SYS_ERRLIST
-/* Note that errno.h (not sure what OS) or stdio.h (BSD 4.4, at least)
- might declare sys_errlist in a way that the compiler might consider
- incompatible with our later declaration, perhaps by using const
- attributes. So we hide the declaration in errno.h (if any) using a
- macro. */
-#define sys_nerr sys_nerr__
-#define sys_errlist sys_errlist__
-#endif
-
-#include <stdio.h>
-#include <errno.h>
-
-#ifdef HAVE_SYS_ERRLIST
-#undef sys_nerr
-#undef sys_errlist
-#endif
-
-/* Routines imported from standard C runtime libraries. */
-
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#else
-extern PTR malloc ();
-#endif
-
-#ifdef HAVE_STRING_H
-#include <string.h>
-#else
-extern PTR memset ();
-#endif
-
-#ifndef MAX
-# define MAX(a,b) ((a) > (b) ? (a) : (b))
-#endif
-
-static void init_error_tables PARAMS ((void));
-
-/* Translation table for errno values. See intro(2) in most UNIX systems
- Programmers Reference Manuals.
-
- Note that this table is generally only accessed when it is used at runtime
- to initialize errno name and message tables that are indexed by errno
- value.
-
- Not all of these errnos will exist on all systems. This table is the only
- thing that should have to be updated as new error numbers are introduced.
- It's sort of ugly, but at least its portable. */
-
-struct error_info
-{
- const int value; /* The numeric value from <errno.h> */
- const char *const name; /* The equivalent symbolic value */
-#ifndef HAVE_SYS_ERRLIST
- const char *const msg; /* Short message about this value */
-#endif
-};
-
-#ifndef HAVE_SYS_ERRLIST
-# define ENTRY(value, name, msg) {value, name, msg}
-#else
-# define ENTRY(value, name, msg) {value, name}
-#endif
-
-static const struct error_info error_table[] =
-{
-#if defined (EPERM)
- ENTRY(EPERM, "EPERM", "Not owner"),
-#endif
-#if defined (ENOENT)
- ENTRY(ENOENT, "ENOENT", "No such file or directory"),
-#endif
-#if defined (ESRCH)
- ENTRY(ESRCH, "ESRCH", "No such process"),
-#endif
-#if defined (EINTR)
- ENTRY(EINTR, "EINTR", "Interrupted system call"),
-#endif
-#if defined (EIO)
- ENTRY(EIO, "EIO", "I/O error"),
-#endif
-#if defined (ENXIO)
- ENTRY(ENXIO, "ENXIO", "No such device or address"),
-#endif
-#if defined (E2BIG)
- ENTRY(E2BIG, "E2BIG", "Arg list too long"),
-#endif
-#if defined (ENOEXEC)
- ENTRY(ENOEXEC, "ENOEXEC", "Exec format error"),
-#endif
-#if defined (EBADF)
- ENTRY(EBADF, "EBADF", "Bad file number"),
-#endif
-#if defined (ECHILD)
- ENTRY(ECHILD, "ECHILD", "No child processes"),
-#endif
-#if defined (EWOULDBLOCK) /* Put before EAGAIN, sometimes aliased */
- ENTRY(EWOULDBLOCK, "EWOULDBLOCK", "Operation would block"),
-#endif
-#if defined (EAGAIN)
- ENTRY(EAGAIN, "EAGAIN", "No more processes"),
-#endif
-#if defined (ENOMEM)
- ENTRY(ENOMEM, "ENOMEM", "Not enough space"),
-#endif
-#if defined (EACCES)
- ENTRY(EACCES, "EACCES", "Permission denied"),
-#endif
-#if defined (EFAULT)
- ENTRY(EFAULT, "EFAULT", "Bad address"),
-#endif
-#if defined (ENOTBLK)
- ENTRY(ENOTBLK, "ENOTBLK", "Block device required"),
-#endif
-#if defined (EBUSY)
- ENTRY(EBUSY, "EBUSY", "Device busy"),
-#endif
-#if defined (EEXIST)
- ENTRY(EEXIST, "EEXIST", "File exists"),
-#endif
-#if defined (EXDEV)
- ENTRY(EXDEV, "EXDEV", "Cross-device link"),
-#endif
-#if defined (ENODEV)
- ENTRY(ENODEV, "ENODEV", "No such device"),
-#endif
-#if defined (ENOTDIR)
- ENTRY(ENOTDIR, "ENOTDIR", "Not a directory"),
-#endif
-#if defined (EISDIR)
- ENTRY(EISDIR, "EISDIR", "Is a directory"),
-#endif
-#if defined (EINVAL)
- ENTRY(EINVAL, "EINVAL", "Invalid argument"),
-#endif
-#if defined (ENFILE)
- ENTRY(ENFILE, "ENFILE", "File table overflow"),
-#endif
-#if defined (EMFILE)
- ENTRY(EMFILE, "EMFILE", "Too many open files"),
-#endif
-#if defined (ENOTTY)
- ENTRY(ENOTTY, "ENOTTY", "Not a typewriter"),
-#endif
-#if defined (ETXTBSY)
- ENTRY(ETXTBSY, "ETXTBSY", "Text file busy"),
-#endif
-#if defined (EFBIG)
- ENTRY(EFBIG, "EFBIG", "File too large"),
-#endif
-#if defined (ENOSPC)
- ENTRY(ENOSPC, "ENOSPC", "No space left on device"),
-#endif
-#if defined (ESPIPE)
- ENTRY(ESPIPE, "ESPIPE", "Illegal seek"),
-#endif
-#if defined (EROFS)
- ENTRY(EROFS, "EROFS", "Read-only file system"),
-#endif
-#if defined (EMLINK)
- ENTRY(EMLINK, "EMLINK", "Too many links"),
-#endif
-#if defined (EPIPE)
- ENTRY(EPIPE, "EPIPE", "Broken pipe"),
-#endif
-#if defined (EDOM)
- ENTRY(EDOM, "EDOM", "Math argument out of domain of func"),
-#endif
-#if defined (ERANGE)
- ENTRY(ERANGE, "ERANGE", "Math result not representable"),
-#endif
-#if defined (ENOMSG)
- ENTRY(ENOMSG, "ENOMSG", "No message of desired type"),
-#endif
-#if defined (EIDRM)
- ENTRY(EIDRM, "EIDRM", "Identifier removed"),
-#endif
-#if defined (ECHRNG)
- ENTRY(ECHRNG, "ECHRNG", "Channel number out of range"),
-#endif
-#if defined (EL2NSYNC)
- ENTRY(EL2NSYNC, "EL2NSYNC", "Level 2 not synchronized"),
-#endif
-#if defined (EL3HLT)
- ENTRY(EL3HLT, "EL3HLT", "Level 3 halted"),
-#endif
-#if defined (EL3RST)
- ENTRY(EL3RST, "EL3RST", "Level 3 reset"),
-#endif
-#if defined (ELNRNG)
- ENTRY(ELNRNG, "ELNRNG", "Link number out of range"),
-#endif
-#if defined (EUNATCH)
- ENTRY(EUNATCH, "EUNATCH", "Protocol driver not attached"),
-#endif
-#if defined (ENOCSI)
- ENTRY(ENOCSI, "ENOCSI", "No CSI structure available"),
-#endif
-#if defined (EL2HLT)
- ENTRY(EL2HLT, "EL2HLT", "Level 2 halted"),
-#endif
-#if defined (EDEADLK)
- ENTRY(EDEADLK, "EDEADLK", "Deadlock condition"),
-#endif
-#if defined (ENOLCK)
- ENTRY(ENOLCK, "ENOLCK", "No record locks available"),
-#endif
-#if defined (EBADE)
- ENTRY(EBADE, "EBADE", "Invalid exchange"),
-#endif
-#if defined (EBADR)
- ENTRY(EBADR, "EBADR", "Invalid request descriptor"),
-#endif
-#if defined (EXFULL)
- ENTRY(EXFULL, "EXFULL", "Exchange full"),
-#endif
-#if defined (ENOANO)
- ENTRY(ENOANO, "ENOANO", "No anode"),
-#endif
-#if defined (EBADRQC)
- ENTRY(EBADRQC, "EBADRQC", "Invalid request code"),
-#endif
-#if defined (EBADSLT)
- ENTRY(EBADSLT, "EBADSLT", "Invalid slot"),
-#endif
-#if defined (EDEADLOCK)
- ENTRY(EDEADLOCK, "EDEADLOCK", "File locking deadlock error"),
-#endif
-#if defined (EBFONT)
- ENTRY(EBFONT, "EBFONT", "Bad font file format"),
-#endif
-#if defined (ENOSTR)
- ENTRY(ENOSTR, "ENOSTR", "Device not a stream"),
-#endif
-#if defined (ENODATA)
- ENTRY(ENODATA, "ENODATA", "No data available"),
-#endif
-#if defined (ETIME)
- ENTRY(ETIME, "ETIME", "Timer expired"),
-#endif
-#if defined (ENOSR)
- ENTRY(ENOSR, "ENOSR", "Out of streams resources"),
-#endif
-#if defined (ENONET)
- ENTRY(ENONET, "ENONET", "Machine is not on the network"),
-#endif
-#if defined (ENOPKG)
- ENTRY(ENOPKG, "ENOPKG", "Package not installed"),
-#endif
-#if defined (EREMOTE)
- ENTRY(EREMOTE, "EREMOTE", "Object is remote"),
-#endif
-#if defined (ENOLINK)
- ENTRY(ENOLINK, "ENOLINK", "Link has been severed"),
-#endif
-#if defined (EADV)
- ENTRY(EADV, "EADV", "Advertise error"),
-#endif
-#if defined (ESRMNT)
- ENTRY(ESRMNT, "ESRMNT", "Srmount error"),
-#endif
-#if defined (ECOMM)
- ENTRY(ECOMM, "ECOMM", "Communication error on send"),
-#endif
-#if defined (EPROTO)
- ENTRY(EPROTO, "EPROTO", "Protocol error"),
-#endif
-#if defined (EMULTIHOP)
- ENTRY(EMULTIHOP, "EMULTIHOP", "Multihop attempted"),
-#endif
-#if defined (EDOTDOT)
- ENTRY(EDOTDOT, "EDOTDOT", "RFS specific error"),
-#endif
-#if defined (EBADMSG)
- ENTRY(EBADMSG, "EBADMSG", "Not a data message"),
-#endif
-#if defined (ENAMETOOLONG)
- ENTRY(ENAMETOOLONG, "ENAMETOOLONG", "File name too long"),
-#endif
-#if defined (EOVERFLOW)
- ENTRY(EOVERFLOW, "EOVERFLOW", "Value too large for defined data type"),
-#endif
-#if defined (ENOTUNIQ)
- ENTRY(ENOTUNIQ, "ENOTUNIQ", "Name not unique on network"),
-#endif
-#if defined (EBADFD)
- ENTRY(EBADFD, "EBADFD", "File descriptor in bad state"),
-#endif
-#if defined (EREMCHG)
- ENTRY(EREMCHG, "EREMCHG", "Remote address changed"),
-#endif
-#if defined (ELIBACC)
- ENTRY(ELIBACC, "ELIBACC", "Can not access a needed shared library"),
-#endif
-#if defined (ELIBBAD)
- ENTRY(ELIBBAD, "ELIBBAD", "Accessing a corrupted shared library"),
-#endif
-#if defined (ELIBSCN)
- ENTRY(ELIBSCN, "ELIBSCN", ".lib section in a.out corrupted"),
-#endif
-#if defined (ELIBMAX)
- ENTRY(ELIBMAX, "ELIBMAX", "Attempting to link in too many shared libraries"),
-#endif
-#if defined (ELIBEXEC)
- ENTRY(ELIBEXEC, "ELIBEXEC", "Cannot exec a shared library directly"),
-#endif
-#if defined (EILSEQ)
- ENTRY(EILSEQ, "EILSEQ", "Illegal byte sequence"),
-#endif
-#if defined (ENOSYS)
- ENTRY(ENOSYS, "ENOSYS", "Operation not applicable"),
-#endif
-#if defined (ELOOP)
- ENTRY(ELOOP, "ELOOP", "Too many symbolic links encountered"),
-#endif
-#if defined (ERESTART)
- ENTRY(ERESTART, "ERESTART", "Interrupted system call should be restarted"),
-#endif
-#if defined (ESTRPIPE)
- ENTRY(ESTRPIPE, "ESTRPIPE", "Streams pipe error"),
-#endif
-#if defined (ENOTEMPTY)
- ENTRY(ENOTEMPTY, "ENOTEMPTY", "Directory not empty"),
-#endif
-#if defined (EUSERS)
- ENTRY(EUSERS, "EUSERS", "Too many users"),
-#endif
-#if defined (ENOTSOCK)
- ENTRY(ENOTSOCK, "ENOTSOCK", "Socket operation on non-socket"),
-#endif
-#if defined (EDESTADDRREQ)
- ENTRY(EDESTADDRREQ, "EDESTADDRREQ", "Destination address required"),
-#endif
-#if defined (EMSGSIZE)
- ENTRY(EMSGSIZE, "EMSGSIZE", "Message too long"),
-#endif
-#if defined (EPROTOTYPE)
- ENTRY(EPROTOTYPE, "EPROTOTYPE", "Protocol wrong type for socket"),
-#endif
-#if defined (ENOPROTOOPT)
- ENTRY(ENOPROTOOPT, "ENOPROTOOPT", "Protocol not available"),
-#endif
-#if defined (EPROTONOSUPPORT)
- ENTRY(EPROTONOSUPPORT, "EPROTONOSUPPORT", "Protocol not supported"),
-#endif
-#if defined (ESOCKTNOSUPPORT)
- ENTRY(ESOCKTNOSUPPORT, "ESOCKTNOSUPPORT", "Socket type not supported"),
-#endif
-#if defined (EOPNOTSUPP)
- ENTRY(EOPNOTSUPP, "EOPNOTSUPP", "Operation not supported on transport endpoint"),
-#endif
-#if defined (EPFNOSUPPORT)
- ENTRY(EPFNOSUPPORT, "EPFNOSUPPORT", "Protocol family not supported"),
-#endif
-#if defined (EAFNOSUPPORT)
- ENTRY(EAFNOSUPPORT, "EAFNOSUPPORT", "Address family not supported by protocol"),
-#endif
-#if defined (EADDRINUSE)
- ENTRY(EADDRINUSE, "EADDRINUSE", "Address already in use"),
-#endif
-#if defined (EADDRNOTAVAIL)
- ENTRY(EADDRNOTAVAIL, "EADDRNOTAVAIL","Cannot assign requested address"),
-#endif
-#if defined (ENETDOWN)
- ENTRY(ENETDOWN, "ENETDOWN", "Network is down"),
-#endif
-#if defined (ENETUNREACH)
- ENTRY(ENETUNREACH, "ENETUNREACH", "Network is unreachable"),
-#endif
-#if defined (ENETRESET)
- ENTRY(ENETRESET, "ENETRESET", "Network dropped connection because of reset"),
-#endif
-#if defined (ECONNABORTED)
- ENTRY(ECONNABORTED, "ECONNABORTED", "Software caused connection abort"),
-#endif
-#if defined (ECONNRESET)
- ENTRY(ECONNRESET, "ECONNRESET", "Connection reset by peer"),
-#endif
-#if defined (ENOBUFS)
- ENTRY(ENOBUFS, "ENOBUFS", "No buffer space available"),
-#endif
-#if defined (EISCONN)
- ENTRY(EISCONN, "EISCONN", "Transport endpoint is already connected"),
-#endif
-#if defined (ENOTCONN)
- ENTRY(ENOTCONN, "ENOTCONN", "Transport endpoint is not connected"),
-#endif
-#if defined (ESHUTDOWN)
- ENTRY(ESHUTDOWN, "ESHUTDOWN", "Cannot send after transport endpoint shutdown"),
-#endif
-#if defined (ETOOMANYREFS)
- ENTRY(ETOOMANYREFS, "ETOOMANYREFS", "Too many references: cannot splice"),
-#endif
-#if defined (ETIMEDOUT)
- ENTRY(ETIMEDOUT, "ETIMEDOUT", "Connection timed out"),
-#endif
-#if defined (ECONNREFUSED)
- ENTRY(ECONNREFUSED, "ECONNREFUSED", "Connection refused"),
-#endif
-#if defined (EHOSTDOWN)
- ENTRY(EHOSTDOWN, "EHOSTDOWN", "Host is down"),
-#endif
-#if defined (EHOSTUNREACH)
- ENTRY(EHOSTUNREACH, "EHOSTUNREACH", "No route to host"),
-#endif
-#if defined (EALREADY)
- ENTRY(EALREADY, "EALREADY", "Operation already in progress"),
-#endif
-#if defined (EINPROGRESS)
- ENTRY(EINPROGRESS, "EINPROGRESS", "Operation now in progress"),
-#endif
-#if defined (ESTALE)
- ENTRY(ESTALE, "ESTALE", "Stale NFS file handle"),
-#endif
-#if defined (EUCLEAN)
- ENTRY(EUCLEAN, "EUCLEAN", "Structure needs cleaning"),
-#endif
-#if defined (ENOTNAM)
- ENTRY(ENOTNAM, "ENOTNAM", "Not a XENIX named type file"),
-#endif
-#if defined (ENAVAIL)
- ENTRY(ENAVAIL, "ENAVAIL", "No XENIX semaphores available"),
-#endif
-#if defined (EISNAM)
- ENTRY(EISNAM, "EISNAM", "Is a named type file"),
-#endif
-#if defined (EREMOTEIO)
- ENTRY(EREMOTEIO, "EREMOTEIO", "Remote I/O error"),
-#endif
- ENTRY(0, NULL, NULL)
-};
-
-#ifdef EVMSERR
-/* This is not in the table, because the numeric value of EVMSERR (32767)
- lies outside the range of sys_errlist[]. */
-static struct { int value; const char *name, *msg; }
- evmserr = { EVMSERR, "EVMSERR", "VMS-specific error" };
-#endif
-
-/* Translation table allocated and initialized at runtime. Indexed by the
- errno value to find the equivalent symbolic value. */
-
-static const char **error_names;
-static int num_error_names = 0;
-
-/* Translation table allocated and initialized at runtime, if it does not
- already exist in the host environment. Indexed by the errno value to find
- the descriptive string.
-
- We don't export it for use in other modules because even though it has the
- same name, it differs from other implementations in that it is dynamically
- initialized rather than statically initialized. */
-
-#ifndef HAVE_SYS_ERRLIST
-
-static int sys_nerr;
-static const char **sys_errlist;
-
-#else
-
-extern int sys_nerr;
-extern char *sys_errlist[];
-
-#endif
-
-
-/*
-
-NAME
-
- init_error_tables -- initialize the name and message tables
-
-SYNOPSIS
-
- static void init_error_tables ();
-
-DESCRIPTION
-
- Using the error_table, which is initialized at compile time, generate
- the error_names and the sys_errlist (if needed) tables, which are
- indexed at runtime by a specific errno value.
-
-BUGS
-
- The initialization of the tables may fail under low memory conditions,
- in which case we don't do anything particularly useful, but we don't
- bomb either. Who knows, it might succeed at a later point if we free
- some memory in the meantime. In any case, the other routines know
- how to deal with lack of a table after trying to initialize it. This
- may or may not be considered to be a bug, that we don't specifically
- warn about this particular failure mode.
-
-*/
-
-static void
-init_error_tables ()
-{
- const struct error_info *eip;
- int nbytes;
-
- /* If we haven't already scanned the error_table once to find the maximum
- errno value, then go find it now. */
-
- if (num_error_names == 0)
- {
- for (eip = error_table; eip -> name != NULL; eip++)
- {
- if (eip -> value >= num_error_names)
- {
- num_error_names = eip -> value + 1;
- }
- }
- }
-
- /* Now attempt to allocate the error_names table, zero it out, and then
- initialize it from the statically initialized error_table. */
-
- if (error_names == NULL)
- {
- nbytes = num_error_names * sizeof (char *);
- if ((error_names = (const char **) malloc (nbytes)) != NULL)
- {
- memset (error_names, 0, nbytes);
- for (eip = error_table; eip -> name != NULL; eip++)
- {
- error_names[eip -> value] = eip -> name;
- }
- }
- }
-
-#ifndef HAVE_SYS_ERRLIST
-
- /* Now attempt to allocate the sys_errlist table, zero it out, and then
- initialize it from the statically initialized error_table. */
-
- if (sys_errlist == NULL)
- {
- nbytes = num_error_names * sizeof (char *);
- if ((sys_errlist = (const char **) malloc (nbytes)) != NULL)
- {
- memset (sys_errlist, 0, nbytes);
- sys_nerr = num_error_names;
- for (eip = error_table; eip -> name != NULL; eip++)
- {
- sys_errlist[eip -> value] = eip -> msg;
- }
- }
- }
-
-#endif
-
-}
-
-/*
-
-
-@deftypefn Extension int errno_max (void)
-
-Returns the maximum @code{errno} value for which a corresponding
-symbolic name or message is available. Note that in the case where we
-use the @code{sys_errlist} supplied by the system, it is possible for
-there to be more symbolic names than messages, or vice versa. In
-fact, the manual page for @code{perror(3C)} explicitly warns that one
-should check the size of the table (@code{sys_nerr}) before indexing
-it, since new error codes may be added to the system before they are
-added to the table. Thus @code{sys_nerr} might be smaller than value
-implied by the largest @code{errno} value defined in @code{<errno.h>}.
-
-We return the maximum value that can be used to obtain a meaningful
-symbolic name or message.
-
-@end deftypefn
-
-*/
-
-int
-errno_max ()
-{
- int maxsize;
-
- if (error_names == NULL)
- {
- init_error_tables ();
- }
- maxsize = MAX (sys_nerr, num_error_names);
- return (maxsize - 1);
-}
-
-#ifndef HAVE_STRERROR
-
-/*
-
-@deftypefn Supplemental char* strerror (int @var{errnoval})
-
-Maps an @code{errno} number to an error message string, the contents
-of which are implementation defined. On systems which have the
-external variables @code{sys_nerr} and @code{sys_errlist}, these
-strings will be the same as the ones used by @code{perror}.
-
-If the supplied error number is within the valid range of indices for
-the @code{sys_errlist}, but no message is available for the particular
-error number, then returns the string @samp{Error @var{num}}, where
-@var{num} is the error number.
-
-If the supplied error number is not a valid index into
-@code{sys_errlist}, returns @code{NULL}.
-
-The returned string is only guaranteed to be valid only until the
-next call to @code{strerror}.
-
-@end deftypefn
-
-*/
-
-char *
-strerror (errnoval)
- int errnoval;
-{
- const char *msg;
- static char buf[32];
-
-#ifndef HAVE_SYS_ERRLIST
-
- if (error_names == NULL)
- {
- init_error_tables ();
- }
-
-#endif
-
- if ((errnoval < 0) || (errnoval >= sys_nerr))
- {
-#ifdef EVMSERR
- if (errnoval == evmserr.value)
- msg = evmserr.msg;
- else
-#endif
- /* Out of range, just return NULL */
- msg = NULL;
- }
- else if ((sys_errlist == NULL) || (sys_errlist[errnoval] == NULL))
- {
- /* In range, but no sys_errlist or no entry at this index. */
- sprintf (buf, "Error %d", errnoval);
- msg = buf;
- }
- else
- {
- /* In range, and a valid message. Just return the message. */
- msg = (char *) sys_errlist[errnoval];
- }
-
- return (msg);
-}
-
-#endif /* ! HAVE_STRERROR */
-
-
-/*
-
-@deftypefn Replacement {const char*} strerrno (int @var{errnum})
-
-Given an error number returned from a system call (typically returned
-in @code{errno}), returns a pointer to a string containing the
-symbolic name of that error number, as found in @code{<errno.h>}.
-
-If the supplied error number is within the valid range of indices for
-symbolic names, but no name is available for the particular error
-number, then returns the string @samp{Error @var{num}}, where @var{num}
-is the error number.
-
-If the supplied error number is not within the range of valid
-indices, then returns @code{NULL}.
-
-The contents of the location pointed to are only guaranteed to be
-valid until the next call to @code{strerrno}.
-
-@end deftypefn
-
-*/
-
-const char *
-strerrno (errnoval)
- int errnoval;
-{
- const char *name;
- static char buf[32];
-
- if (error_names == NULL)
- {
- init_error_tables ();
- }
-
- if ((errnoval < 0) || (errnoval >= num_error_names))
- {
-#ifdef EVMSERR
- if (errnoval == evmserr.value)
- name = evmserr.name;
- else
-#endif
- /* Out of range, just return NULL */
- name = NULL;
- }
- else if ((error_names == NULL) || (error_names[errnoval] == NULL))
- {
- /* In range, but no error_names or no entry at this index. */
- sprintf (buf, "Error %d", errnoval);
- name = (const char *) buf;
- }
- else
- {
- /* In range, and a valid name. Just return the name. */
- name = error_names[errnoval];
- }
-
- return (name);
-}
-
-/*
-
-@deftypefn Extension int strtoerrno (const char *@var{name})
-
-Given the symbolic name of a error number (e.g., @code{EACCES}), map it
-to an errno value. If no translation is found, returns 0.
-
-@end deftypefn
-
-*/
-
-int
-strtoerrno (name)
- const char *name;
-{
- int errnoval = 0;
-
- if (name != NULL)
- {
- if (error_names == NULL)
- {
- init_error_tables ();
- }
- for (errnoval = 0; errnoval < num_error_names; errnoval++)
- {
- if ((error_names[errnoval] != NULL) &&
- (strcmp (name, error_names[errnoval]) == 0))
- {
- break;
- }
- }
- if (errnoval == num_error_names)
- {
-#ifdef EVMSERR
- if (strcmp (name, evmserr.name) == 0)
- errnoval = evmserr.value;
- else
-#endif
- errnoval = 0;
- }
- }
- return (errnoval);
-}
-
-
-/* A simple little main that does nothing but print all the errno translations
- if MAIN is defined and this file is compiled and linked. */
-
-#ifdef MAIN
-
-#include <stdio.h>
-
-int
-main ()
-{
- int errn;
- int errnmax;
- const char *name;
- const char *msg;
- char *strerror ();
-
- errnmax = errno_max ();
- printf ("%d entries in names table.\n", num_error_names);
- printf ("%d entries in messages table.\n", sys_nerr);
- printf ("%d is max useful index.\n", errnmax);
-
- /* Keep printing values until we get to the end of *both* tables, not
- *either* table. Note that knowing the maximum useful index does *not*
- relieve us of the responsibility of testing the return pointer for
- NULL. */
-
- for (errn = 0; errn <= errnmax; errn++)
- {
- name = strerrno (errn);
- name = (name == NULL) ? "<NULL>" : name;
- msg = strerror (errn);
- msg = (msg == NULL) ? "<NULL>" : msg;
- printf ("%-4d%-18s%s\n", errn, name, msg);
- }
-
- return 0;
-}
-
-#endif
diff --git a/libiberty/strncasecmp.c b/libiberty/strncasecmp.c
deleted file mode 100644
index 77cb421..0000000
--- a/libiberty/strncasecmp.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 1987 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that this notice is preserved and that due credit is given
- * to the University of California at Berkeley. The name of the University
- * may not be used to endorse or promote products derived from this
- * software without specific written prior permission. This software
- * is provided ``as is'' without express or implied warranty.
- */
-
-/*
-
-@deftypefn Supplemental int strncasecmp (const char *@var{s1}, const char *@var{s2})
-
-A case-insensitive @code{strncmp}.
-
-@end deftypefn
-
-*/
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strcasecmp.c 5.5 (Berkeley) 11/24/87";
-#endif /* LIBC_SCCS and not lint */
-
-#include <ansidecl.h>
-#ifdef __STDC__
-#include <stddef.h>
-#else
-#define size_t unsigned long
-#endif
-
-/*
- * This array is designed for mapping upper and lower case letter
- * together for a case independent comparison. The mappings are
- * based upon ascii character sequences.
- */
-static const unsigned char charmap[] = {
- '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007',
- '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017',
- '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027',
- '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037',
- '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047',
- '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057',
- '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067',
- '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077',
- '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
- '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
- '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
- '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137',
- '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
- '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
- '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
- '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177',
- '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207',
- '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217',
- '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227',
- '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237',
- '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247',
- '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257',
- '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267',
- '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277',
- '\300', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
- '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
- '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367',
- '\370', '\371', '\372', '\333', '\334', '\335', '\336', '\337',
- '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
- '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
- '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367',
- '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377',
-};
-
-int
-strncasecmp(s1, s2, n)
- const char *s1, *s2;
- register size_t n;
-{
- register unsigned char u1, u2;
-
- for (; n != 0; --n) {
- u1 = (unsigned char) *s1++;
- u2 = (unsigned char) *s2++;
- if (charmap[u1] != charmap[u2]) {
- return charmap[u1] - charmap[u2];
- }
- if (u1 == '\0') {
- return 0;
- }
- }
- return 0;
-}
diff --git a/libiberty/strncmp.c b/libiberty/strncmp.c
deleted file mode 100644
index 819cea6..0000000
--- a/libiberty/strncmp.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* strncmp -- compare two strings, stop after n bytes.
- This function is in the public domain. */
-
-/*
-
-@deftypefn Supplemental int strncmp (const char *@var{s1}, const char *@var{s2}, size_t @var{n})
-
-Compares the first @var{n} bytes of two strings, returning a value as
-@code{strcmp}.
-
-@end deftypefn
-
-*/
-
-#include <ansidecl.h>
-#ifdef __STDC__
-#include <stddef.h>
-#else
-#define size_t unsigned long
-#endif
-
-int
-strncmp(s1, s2, n)
- const char *s1, *s2;
- register size_t n;
-{
- register unsigned char u1, u2;
-
- while (n-- > 0)
- {
- u1 = (unsigned char) *s1++;
- u2 = (unsigned char) *s2++;
- if (u1 != u2)
- return u1 - u2;
- if (u1 == '\0')
- return 0;
- }
- return 0;
-}
diff --git a/libiberty/strrchr.c b/libiberty/strrchr.c
deleted file mode 100644
index bc380c4..0000000
--- a/libiberty/strrchr.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Portable version of strrchr().
- This function is in the public domain. */
-
-/*
-
-@deftypefn Supplemental char* strrchr (const char *@var{s}, int @var{c})
-
-Returns a pointer to the last occurrence of the character @var{c} in
-the string @var{s}, or @code{NULL} if not found. If @var{c} is itself the
-null character, the results are undefined.
-
-@end deftypefn
-
-*/
-
-#include <ansidecl.h>
-
-char *
-strrchr (s, c)
- register const char *s;
- int c;
-{
- char *rtnval = 0;
-
- do {
- if (*s == c)
- rtnval = (char*) s;
- } while (*s++);
- return (rtnval);
-}
diff --git a/libiberty/strsignal.c b/libiberty/strsignal.c
deleted file mode 100644
index 86c8aca..0000000
--- a/libiberty/strsignal.c
+++ /dev/null
@@ -1,618 +0,0 @@
-/* Extended support for using signal values.
- Written by Fred Fish. fnf@cygnus.com
- This file is in the public domain. */
-
-#include "ansidecl.h"
-#include "libiberty.h"
-
-#include "config.h"
-
-/* We need to declare sys_siglist, because even if the system provides
- it we can't assume that it is declared in <signal.h> (for example,
- SunOS provides sys_siglist, but it does not declare it in any
- header file). fHowever, we can't declare sys_siglist portably,
- because on some systems it is declared with const and on some
- systems it is declared without const. If we were using autoconf,
- we could work out the right declaration. Until, then we just
- ignore any declaration in the system header files, and always
- declare it ourselves. With luck, this will always work. */
-#define sys_siglist no_such_symbol
-#define sys_nsig sys_nsig__no_such_symbol
-
-#include <stdio.h>
-#include <signal.h>
-
-/* Routines imported from standard C runtime libraries. */
-
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#else
-extern PTR malloc ();
-#endif
-
-#ifdef HAVE_STRING_H
-#include <string.h>
-#else
-extern PTR memset ();
-#endif
-
-/* Undefine the macro we used to hide the definition of sys_siglist
- found in the system header files. */
-#undef sys_siglist
-#undef sys_nsig
-
-#ifndef NULL
-# ifdef __STDC__
-# define NULL (void *) 0
-# else
-# define NULL 0
-# endif
-#endif
-
-#ifndef MAX
-# define MAX(a,b) ((a) > (b) ? (a) : (b))
-#endif
-
-static void init_signal_tables PARAMS ((void));
-
-/* Translation table for signal values.
-
- Note that this table is generally only accessed when it is used at runtime
- to initialize signal name and message tables that are indexed by signal
- value.
-
- Not all of these signals will exist on all systems. This table is the only
- thing that should have to be updated as new signal numbers are introduced.
- It's sort of ugly, but at least its portable. */
-
-struct signal_info
-{
- const int value; /* The numeric value from <signal.h> */
- const char *const name; /* The equivalent symbolic value */
-#ifndef HAVE_SYS_SIGLIST
- const char *const msg; /* Short message about this value */
-#endif
-};
-
-#ifndef HAVE_SYS_SIGLIST
-# define ENTRY(value, name, msg) {value, name, msg}
-#else
-# define ENTRY(value, name, msg) {value, name}
-#endif
-
-static const struct signal_info signal_table[] =
-{
-#if defined (SIGHUP)
- ENTRY(SIGHUP, "SIGHUP", "Hangup"),
-#endif
-#if defined (SIGINT)
- ENTRY(SIGINT, "SIGINT", "Interrupt"),
-#endif
-#if defined (SIGQUIT)
- ENTRY(SIGQUIT, "SIGQUIT", "Quit"),
-#endif
-#if defined (SIGILL)
- ENTRY(SIGILL, "SIGILL", "Illegal instruction"),
-#endif
-#if defined (SIGTRAP)
- ENTRY(SIGTRAP, "SIGTRAP", "Trace/breakpoint trap"),
-#endif
-/* Put SIGIOT before SIGABRT, so that if SIGIOT==SIGABRT then SIGABRT
- overrides SIGIOT. SIGABRT is in ANSI and POSIX.1, and SIGIOT isn't. */
-#if defined (SIGIOT)
- ENTRY(SIGIOT, "SIGIOT", "IOT trap"),
-#endif
-#if defined (SIGABRT)
- ENTRY(SIGABRT, "SIGABRT", "Aborted"),
-#endif
-#if defined (SIGEMT)
- ENTRY(SIGEMT, "SIGEMT", "Emulation trap"),
-#endif
-#if defined (SIGFPE)
- ENTRY(SIGFPE, "SIGFPE", "Arithmetic exception"),
-#endif
-#if defined (SIGKILL)
- ENTRY(SIGKILL, "SIGKILL", "Killed"),
-#endif
-#if defined (SIGBUS)
- ENTRY(SIGBUS, "SIGBUS", "Bus error"),
-#endif
-#if defined (SIGSEGV)
- ENTRY(SIGSEGV, "SIGSEGV", "Segmentation fault"),
-#endif
-#if defined (SIGSYS)
- ENTRY(SIGSYS, "SIGSYS", "Bad system call"),
-#endif
-#if defined (SIGPIPE)
- ENTRY(SIGPIPE, "SIGPIPE", "Broken pipe"),
-#endif
-#if defined (SIGALRM)
- ENTRY(SIGALRM, "SIGALRM", "Alarm clock"),
-#endif
-#if defined (SIGTERM)
- ENTRY(SIGTERM, "SIGTERM", "Terminated"),
-#endif
-#if defined (SIGUSR1)
- ENTRY(SIGUSR1, "SIGUSR1", "User defined signal 1"),
-#endif
-#if defined (SIGUSR2)
- ENTRY(SIGUSR2, "SIGUSR2", "User defined signal 2"),
-#endif
-/* Put SIGCLD before SIGCHLD, so that if SIGCLD==SIGCHLD then SIGCHLD
- overrides SIGCLD. SIGCHLD is in POXIX.1 */
-#if defined (SIGCLD)
- ENTRY(SIGCLD, "SIGCLD", "Child status changed"),
-#endif
-#if defined (SIGCHLD)
- ENTRY(SIGCHLD, "SIGCHLD", "Child status changed"),
-#endif
-#if defined (SIGPWR)
- ENTRY(SIGPWR, "SIGPWR", "Power fail/restart"),
-#endif
-#if defined (SIGWINCH)
- ENTRY(SIGWINCH, "SIGWINCH", "Window size changed"),
-#endif
-#if defined (SIGURG)
- ENTRY(SIGURG, "SIGURG", "Urgent I/O condition"),
-#endif
-#if defined (SIGIO)
- /* "I/O pending" has also been suggested, but is misleading since the
- signal only happens when the process has asked for it, not everytime
- I/O is pending. */
- ENTRY(SIGIO, "SIGIO", "I/O possible"),
-#endif
-#if defined (SIGPOLL)
- ENTRY(SIGPOLL, "SIGPOLL", "Pollable event occurred"),
-#endif
-#if defined (SIGSTOP)
- ENTRY(SIGSTOP, "SIGSTOP", "Stopped (signal)"),
-#endif
-#if defined (SIGTSTP)
- ENTRY(SIGTSTP, "SIGTSTP", "Stopped (user)"),
-#endif
-#if defined (SIGCONT)
- ENTRY(SIGCONT, "SIGCONT", "Continued"),
-#endif
-#if defined (SIGTTIN)
- ENTRY(SIGTTIN, "SIGTTIN", "Stopped (tty input)"),
-#endif
-#if defined (SIGTTOU)
- ENTRY(SIGTTOU, "SIGTTOU", "Stopped (tty output)"),
-#endif
-#if defined (SIGVTALRM)
- ENTRY(SIGVTALRM, "SIGVTALRM", "Virtual timer expired"),
-#endif
-#if defined (SIGPROF)
- ENTRY(SIGPROF, "SIGPROF", "Profiling timer expired"),
-#endif
-#if defined (SIGXCPU)
- ENTRY(SIGXCPU, "SIGXCPU", "CPU time limit exceeded"),
-#endif
-#if defined (SIGXFSZ)
- ENTRY(SIGXFSZ, "SIGXFSZ", "File size limit exceeded"),
-#endif
-#if defined (SIGWIND)
- ENTRY(SIGWIND, "SIGWIND", "SIGWIND"),
-#endif
-#if defined (SIGPHONE)
- ENTRY(SIGPHONE, "SIGPHONE", "SIGPHONE"),
-#endif
-#if defined (SIGLOST)
- ENTRY(SIGLOST, "SIGLOST", "Resource lost"),
-#endif
-#if defined (SIGWAITING)
- ENTRY(SIGWAITING, "SIGWAITING", "Process's LWPs are blocked"),
-#endif
-#if defined (SIGLWP)
- ENTRY(SIGLWP, "SIGLWP", "Signal LWP"),
-#endif
-#if defined (SIGDANGER)
- ENTRY(SIGDANGER, "SIGDANGER", "Swap space dangerously low"),
-#endif
-#if defined (SIGGRANT)
- ENTRY(SIGGRANT, "SIGGRANT", "Monitor mode granted"),
-#endif
-#if defined (SIGRETRACT)
- ENTRY(SIGRETRACT, "SIGRETRACT", "Need to relinguish monitor mode"),
-#endif
-#if defined (SIGMSG)
- ENTRY(SIGMSG, "SIGMSG", "Monitor mode data available"),
-#endif
-#if defined (SIGSOUND)
- ENTRY(SIGSOUND, "SIGSOUND", "Sound completed"),
-#endif
-#if defined (SIGSAK)
- ENTRY(SIGSAK, "SIGSAK", "Secure attention"),
-#endif
- ENTRY(0, NULL, NULL)
-};
-
-/* Translation table allocated and initialized at runtime. Indexed by the
- signal value to find the equivalent symbolic value. */
-
-static const char **signal_names;
-static int num_signal_names = 0;
-
-/* Translation table allocated and initialized at runtime, if it does not
- already exist in the host environment. Indexed by the signal value to find
- the descriptive string.
-
- We don't export it for use in other modules because even though it has the
- same name, it differs from other implementations in that it is dynamically
- initialized rather than statically initialized. */
-
-#ifndef HAVE_SYS_SIGLIST
-
-static int sys_nsig;
-static const char **sys_siglist;
-
-#else
-
-#ifdef NSIG
-static int sys_nsig = NSIG;
-#else
-#ifdef _NSIG
-static int sys_nsig = _NSIG;
-#endif
-#endif
-extern const char * const sys_siglist[];
-
-#endif
-
-
-/*
-
-NAME
-
- init_signal_tables -- initialize the name and message tables
-
-SYNOPSIS
-
- static void init_signal_tables ();
-
-DESCRIPTION
-
- Using the signal_table, which is initialized at compile time, generate
- the signal_names and the sys_siglist (if needed) tables, which are
- indexed at runtime by a specific signal value.
-
-BUGS
-
- The initialization of the tables may fail under low memory conditions,
- in which case we don't do anything particularly useful, but we don't
- bomb either. Who knows, it might succeed at a later point if we free
- some memory in the meantime. In any case, the other routines know
- how to deal with lack of a table after trying to initialize it. This
- may or may not be considered to be a bug, that we don't specifically
- warn about this particular failure mode.
-
-*/
-
-static void
-init_signal_tables ()
-{
- const struct signal_info *eip;
- int nbytes;
-
- /* If we haven't already scanned the signal_table once to find the maximum
- signal value, then go find it now. */
-
- if (num_signal_names == 0)
- {
- for (eip = signal_table; eip -> name != NULL; eip++)
- {
- if (eip -> value >= num_signal_names)
- {
- num_signal_names = eip -> value + 1;
- }
- }
- }
-
- /* Now attempt to allocate the signal_names table, zero it out, and then
- initialize it from the statically initialized signal_table. */
-
- if (signal_names == NULL)
- {
- nbytes = num_signal_names * sizeof (char *);
- if ((signal_names = (const char **) malloc (nbytes)) != NULL)
- {
- memset (signal_names, 0, nbytes);
- for (eip = signal_table; eip -> name != NULL; eip++)
- {
- signal_names[eip -> value] = eip -> name;
- }
- }
- }
-
-#ifndef HAVE_SYS_SIGLIST
-
- /* Now attempt to allocate the sys_siglist table, zero it out, and then
- initialize it from the statically initialized signal_table. */
-
- if (sys_siglist == NULL)
- {
- nbytes = num_signal_names * sizeof (char *);
- if ((sys_siglist = (const char **) malloc (nbytes)) != NULL)
- {
- memset (sys_siglist, 0, nbytes);
- sys_nsig = num_signal_names;
- for (eip = signal_table; eip -> name != NULL; eip++)
- {
- sys_siglist[eip -> value] = eip -> msg;
- }
- }
- }
-
-#endif
-
-}
-
-
-/*
-
-@deftypefn Extension int signo_max (void)
-
-Returns the maximum signal value for which a corresponding symbolic
-name or message is available. Note that in the case where we use the
-@code{sys_siglist} supplied by the system, it is possible for there to
-be more symbolic names than messages, or vice versa. In fact, the
-manual page for @code{psignal(3b)} explicitly warns that one should
-check the size of the table (@code{NSIG}) before indexing it, since
-new signal codes may be added to the system before they are added to
-the table. Thus @code{NSIG} might be smaller than value implied by
-the largest signo value defined in @code{<signal.h>}.
-
-We return the maximum value that can be used to obtain a meaningful
-symbolic name or message.
-
-@end deftypefn
-
-*/
-
-int
-signo_max ()
-{
- int maxsize;
-
- if (signal_names == NULL)
- {
- init_signal_tables ();
- }
- maxsize = MAX (sys_nsig, num_signal_names);
- return (maxsize - 1);
-}
-
-
-/*
-
-@deftypefn Supplemental {const char *} strsignal (int @var{signo})
-
-Maps an signal number to an signal message string, the contents of
-which are implementation defined. On systems which have the external
-variable @code{sys_siglist}, these strings will be the same as the
-ones used by @code{psignal()}.
-
-If the supplied signal number is within the valid range of indices for
-the @code{sys_siglist}, but no message is available for the particular
-signal number, then returns the string @samp{Signal @var{num}}, where
-@var{num} is the signal number.
-
-If the supplied signal number is not a valid index into
-@code{sys_siglist}, returns @code{NULL}.
-
-The returned string is only guaranteed to be valid only until the next
-call to @code{strsignal}.
-
-@end deftypefn
-
-*/
-
-#ifndef HAVE_STRSIGNAL
-
-const char *
-strsignal (signo)
- int signo;
-{
- const char *msg;
- static char buf[32];
-
-#ifndef HAVE_SYS_SIGLIST
-
- if (signal_names == NULL)
- {
- init_signal_tables ();
- }
-
-#endif
-
- if ((signo < 0) || (signo >= sys_nsig))
- {
- /* Out of range, just return NULL */
- msg = NULL;
- }
- else if ((sys_siglist == NULL) || (sys_siglist[signo] == NULL))
- {
- /* In range, but no sys_siglist or no entry at this index. */
- sprintf (buf, "Signal %d", signo);
- msg = (const char *) buf;
- }
- else
- {
- /* In range, and a valid message. Just return the message. */
- msg = (const char *) sys_siglist[signo];
- }
-
- return (msg);
-}
-
-#endif /* ! HAVE_STRSIGNAL */
-
-/*
-
-@deftypefn Extension {const char*} strsigno (int @var{signo})
-
-Given an signal number, returns a pointer to a string containing the
-symbolic name of that signal number, as found in @code{<signal.h>}.
-
-If the supplied signal number is within the valid range of indices for
-symbolic names, but no name is available for the particular signal
-number, then returns the string @samp{Signal @var{num}}, where
-@var{num} is the signal number.
-
-If the supplied signal number is not within the range of valid
-indices, then returns @code{NULL}.
-
-The contents of the location pointed to are only guaranteed to be
-valid until the next call to @code{strsigno}.
-
-@end deftypefn
-
-*/
-
-const char *
-strsigno (signo)
- int signo;
-{
- const char *name;
- static char buf[32];
-
- if (signal_names == NULL)
- {
- init_signal_tables ();
- }
-
- if ((signo < 0) || (signo >= num_signal_names))
- {
- /* Out of range, just return NULL */
- name = NULL;
- }
- else if ((signal_names == NULL) || (signal_names[signo] == NULL))
- {
- /* In range, but no signal_names or no entry at this index. */
- sprintf (buf, "Signal %d", signo);
- name = (const char *) buf;
- }
- else
- {
- /* In range, and a valid name. Just return the name. */
- name = signal_names[signo];
- }
-
- return (name);
-}
-
-
-/*
-
-@deftypefn Extension int strtosigno (const char *@var{name})
-
-Given the symbolic name of a signal, map it to a signal number. If no
-translation is found, returns 0.
-
-@end deftypefn
-
-*/
-
-int
-strtosigno (name)
- const char *name;
-{
- int signo = 0;
-
- if (name != NULL)
- {
- if (signal_names == NULL)
- {
- init_signal_tables ();
- }
- for (signo = 0; signo < num_signal_names; signo++)
- {
- if ((signal_names[signo] != NULL) &&
- (strcmp (name, signal_names[signo]) == 0))
- {
- break;
- }
- }
- if (signo == num_signal_names)
- {
- signo = 0;
- }
- }
- return (signo);
-}
-
-
-/*
-
-@deftypefn Supplemental void psignal (unsigned @var{signo}, char *@var{message})
-
-Print @var{message} to the standard error, followed by a colon,
-followed by the description of the signal specified by @var{signo},
-followed by a newline.
-
-@end deftypefn
-
-*/
-
-#ifndef HAVE_PSIGNAL
-
-void
-psignal (signo, message)
- unsigned signo;
- char *message;
-{
- if (signal_names == NULL)
- {
- init_signal_tables ();
- }
- if ((signo <= 0) || (signo >= sys_nsig))
- {
- fprintf (stderr, "%s: unknown signal\n", message);
- }
- else
- {
- fprintf (stderr, "%s: %s\n", message, sys_siglist[signo]);
- }
-}
-
-#endif /* ! HAVE_PSIGNAL */
-
-
-/* A simple little main that does nothing but print all the signal translations
- if MAIN is defined and this file is compiled and linked. */
-
-#ifdef MAIN
-
-#include <stdio.h>
-
-int
-main ()
-{
- int signo;
- int maxsigno;
- const char *name;
- const char *msg;
-
- maxsigno = signo_max ();
- printf ("%d entries in names table.\n", num_signal_names);
- printf ("%d entries in messages table.\n", sys_nsig);
- printf ("%d is max useful index.\n", maxsigno);
-
- /* Keep printing values until we get to the end of *both* tables, not
- *either* table. Note that knowing the maximum useful index does *not*
- relieve us of the responsibility of testing the return pointer for
- NULL. */
-
- for (signo = 0; signo <= maxsigno; signo++)
- {
- name = strsigno (signo);
- name = (name == NULL) ? "<NULL>" : name;
- msg = strsignal (signo);
- msg = (msg == NULL) ? "<NULL>" : msg;
- printf ("%-4d%-18s%s\n", signo, name, msg);
- }
-
- return 0;
-}
-
-#endif
diff --git a/libiberty/strstr.c b/libiberty/strstr.c
deleted file mode 100644
index 470e04b..0000000
--- a/libiberty/strstr.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Simple implementation of strstr for systems without it.
- This function is in the public domain. */
-
-/*
-
-@deftypefn Supplemental char* strstr (const char *@var{string}, const char *@var{sub})
-
-This function searches for the substring @var{sub} in the string
-@var{string}, not including the terminating null characters. A pointer
-to the first occurrence of @var{sub} is returned, or @code{NULL} if the
-substring is absent. If @var{sub} points to a string with zero
-length, the function returns @var{string}.
-
-@end deftypefn
-
-
-*/
-
-
-/* FIXME: The above description is ANSI compiliant. This routine has not
- been validated to comply with it. -fnf */
-
-char *
-strstr (s1, s2)
- char *s1, *s2;
-{
- register char *p = s1;
- extern char *strchr ();
- extern int strncmp ();
-#if __GNUC__==2
- extern __SIZE_TYPE__ strlen ();
-#endif
- register int len = strlen (s2);
-
- for (; (p = strchr (p, *s2)) != 0; p++)
- {
- if (strncmp (p, s2, len) == 0)
- {
- return (p);
- }
- }
- return (0);
-}
diff --git a/libiberty/strtod.c b/libiberty/strtod.c
deleted file mode 100644
index 97fc933..0000000
--- a/libiberty/strtod.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/* Implementation of strtod for systems with atof.
- Copyright (C) 1991, 1995, 2002 Free Software Foundation, Inc.
-
-This file is part of the libiberty 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.
-
-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.
-
-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.
-
-As a special exception, if you link this library with files
-compiled with a GNU compiler to produce an executable, this does not 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. */
-
-/*
-
-@deftypefn Supplemental double strtod (const char *@var{string}, char **@var{endptr})
-
-This ISO C function converts the initial portion of @var{string} to a
-@code{double}. If @var{endptr} is not @code{NULL}, a pointer to the
-character after the last character used in the conversion is stored in
-the location referenced by @var{endptr}. If no conversion is
-performed, zero is returned and the value of @var{string} is stored in
-the location referenced by @var{endptr}.
-
-@end deftypefn
-
-*/
-
-#include "ansidecl.h"
-#include "safe-ctype.h"
-
-extern double atof ();
-
-/* Disclaimer: this is currently just used by CHILL in GDB and therefore
- has not been tested well. It may have been tested for nothing except
- that it compiles. */
-
-double
-strtod (str, ptr)
- char *str;
- char **ptr;
-{
- char *p;
-
- if (ptr == (char **)0)
- return atof (str);
-
- p = str;
-
- while (ISSPACE (*p))
- ++p;
-
- if (*p == '+' || *p == '-')
- ++p;
-
- /* INF or INFINITY. */
- if ((p[0] == 'i' || p[0] == 'I')
- && (p[1] == 'n' || p[1] == 'N')
- && (p[2] == 'f' || p[2] == 'F'))
- {
- if ((p[3] == 'i' || p[3] == 'I')
- && (p[4] == 'n' || p[4] == 'N')
- && (p[5] == 'i' || p[5] == 'I')
- && (p[6] == 't' || p[6] == 'T')
- && (p[7] == 'y' || p[7] == 'Y'))
- {
- *ptr = p + 8;
- return atof (str);
- }
- else
- {
- *ptr = p + 3;
- return atof (str);
- }
- }
-
- /* NAN or NAN(foo). */
- if ((p[0] == 'n' || p[0] == 'N')
- && (p[1] == 'a' || p[1] == 'A')
- && (p[2] == 'n' || p[2] == 'N'))
- {
- p += 3;
- if (*p == '(')
- {
- ++p;
- while (*p != '\0' && *p != ')')
- ++p;
- if (*p == ')')
- ++p;
- }
- *ptr = p;
- return atof (str);
- }
-
- /* digits, with 0 or 1 periods in it. */
- if (ISDIGIT (*p) || *p == '.')
- {
- int got_dot = 0;
- while (ISDIGIT (*p) || (!got_dot && *p == '.'))
- {
- if (*p == '.')
- got_dot = 1;
- ++p;
- }
-
- /* Exponent. */
- if (*p == 'e' || *p == 'E')
- {
- int i;
- i = 1;
- if (p[i] == '+' || p[i] == '-')
- ++i;
- if (ISDIGIT (p[i]))
- {
- while (ISDIGIT (p[i]))
- ++i;
- *ptr = p + i;
- return atof (str);
- }
- }
- *ptr = p;
- return atof (str);
- }
- /* Didn't find any digits. Doesn't look like a number. */
- *ptr = str;
- return 0.0;
-}
diff --git a/libiberty/strtol.c b/libiberty/strtol.c
deleted file mode 100644
index d9f54cc..0000000
--- a/libiberty/strtol.c
+++ /dev/null
@@ -1,166 +0,0 @@
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * 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.
- * 3. [rescinded 22 July 1999]
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * 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 REGENTS 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.
- */
-
-/*
-
-@deftypefn Supplemental {long int} strtol (const char *@var{string}, char **@var{endptr}, int @var{base})
-@deftypefnx Supplemental {unsigned long int} strtoul (const char *@var{string}, char **@var{endptr}, int @var{base})
-
-The @code{strtol} function converts the string in @var{string} to a
-long integer value according to the given @var{base}, which must be
-between 2 and 36 inclusive, or be the special value 0. If @var{base}
-is 0, @code{strtol} will look for the prefixes @code{0} and @code{0x}
-to indicate bases 8 and 16, respectively, else default to base 10.
-When the base is 16 (either explicitly or implicitly), a prefix of
-@code{0x} is allowed. The handling of @var{endptr} is as that of
-@code{strtod} above. The @code{strtoul} function is the same, except
-that the converted value is unsigned.
-
-@end deftypefn
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#ifdef HAVE_LIMITS_H
-#include <limits.h>
-#endif
-#ifdef HAVE_SYS_PARAM_H
-#include <sys/param.h>
-#endif
-#include <errno.h>
-#ifdef NEED_DECLARATION_ERRNO
-extern int errno;
-#endif
-#include "safe-ctype.h"
-
-/* FIXME: It'd be nice to configure around these, but the include files are too
- painful. These macros should at least be more portable than hardwired hex
- constants. */
-
-#ifndef ULONG_MAX
-#define ULONG_MAX ((unsigned long)(~0L)) /* 0xFFFFFFFF */
-#endif
-
-#ifndef LONG_MAX
-#define LONG_MAX ((long)(ULONG_MAX >> 1)) /* 0x7FFFFFFF */
-#endif
-
-#ifndef LONG_MIN
-#define LONG_MIN ((long)(~LONG_MAX)) /* 0x80000000 */
-#endif
-
-/*
- * Convert a string to a long integer.
- *
- * Ignores `locale' stuff. Assumes that the upper and lower case
- * alphabets and digits are each contiguous.
- */
-long
-strtol(nptr, endptr, base)
- const char *nptr;
- char **endptr;
- register int base;
-{
- register const char *s = nptr;
- register unsigned long acc;
- register int c;
- register unsigned long cutoff;
- register int neg = 0, any, cutlim;
-
- /*
- * Skip white space and pick up leading +/- sign if any.
- * If base is 0, allow 0x for hex and 0 for octal, else
- * assume decimal; if base is already 16, allow 0x.
- */
- do {
- c = *s++;
- } while (ISSPACE(c));
- if (c == '-') {
- neg = 1;
- c = *s++;
- } else if (c == '+')
- c = *s++;
- if ((base == 0 || base == 16) &&
- c == '0' && (*s == 'x' || *s == 'X')) {
- c = s[1];
- s += 2;
- base = 16;
- }
- if (base == 0)
- base = c == '0' ? 8 : 10;
-
- /*
- * Compute the cutoff value between legal numbers and illegal
- * numbers. That is the largest legal value, divided by the
- * base. An input number that is greater than this value, if
- * followed by a legal input character, is too big. One that
- * is equal to this value may be valid or not; the limit
- * between valid and invalid numbers is then based on the last
- * digit. For instance, if the range for longs is
- * [-2147483648..2147483647] and the input base is 10,
- * cutoff will be set to 214748364 and cutlim to either
- * 7 (neg==0) or 8 (neg==1), meaning that if we have accumulated
- * a value > 214748364, or equal but the next digit is > 7 (or 8),
- * the number is too big, and we will return a range error.
- *
- * Set any if any `digits' consumed; make it negative to indicate
- * overflow.
- */
- cutoff = neg ? -(unsigned long)LONG_MIN : LONG_MAX;
- cutlim = cutoff % (unsigned long)base;
- cutoff /= (unsigned long)base;
- for (acc = 0, any = 0;; c = *s++) {
- if (ISDIGIT(c))
- c -= '0';
- else if (ISALPHA(c))
- c -= ISUPPER(c) ? 'A' - 10 : 'a' - 10;
- else
- break;
- if (c >= base)
- break;
- if (any < 0 || acc > cutoff || acc == cutoff && c > cutlim)
- any = -1;
- else {
- any = 1;
- acc *= base;
- acc += c;
- }
- }
- if (any < 0) {
- acc = neg ? LONG_MIN : LONG_MAX;
- errno = ERANGE;
- } else if (neg)
- acc = -acc;
- if (endptr != 0)
- *endptr = (char *) (any ? s - 1 : nptr);
- return (acc);
-}
diff --git a/libiberty/strtoul.c b/libiberty/strtoul.c
deleted file mode 100644
index 66420f2..0000000
--- a/libiberty/strtoul.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright (c) 1990 Regents of the University of California.
- * All rights reserved.
- *
- * 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.
- * 3. [rescinded 22 July 1999]
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * 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 REGENTS 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#ifdef HAVE_LIMITS_H
-#include <limits.h>
-#endif
-#ifdef HAVE_SYS_PARAM_H
-#include <sys/param.h>
-#endif
-#include <errno.h>
-#ifdef NEED_DECLARATION_ERRNO
-extern int errno;
-#endif
-#if 0
-#include <stdlib.h>
-#endif
-#include "ansidecl.h"
-#include "safe-ctype.h"
-
-#ifndef ULONG_MAX
-#define ULONG_MAX ((unsigned long)(~0L)) /* 0xFFFFFFFF */
-#endif
-
-/*
- * Convert a string to an unsigned long integer.
- *
- * Ignores `locale' stuff. Assumes that the upper and lower case
- * alphabets and digits are each contiguous.
- */
-unsigned long
-strtoul(nptr, endptr, base)
- const char *nptr;
- char **endptr;
- register int base;
-{
- register const char *s = nptr;
- register unsigned long acc;
- register int c;
- register unsigned long cutoff;
- register int neg = 0, any, cutlim;
-
- /*
- * See strtol for comments as to the logic used.
- */
- do {
- c = *s++;
- } while (ISSPACE(c));
- if (c == '-') {
- neg = 1;
- c = *s++;
- } else if (c == '+')
- c = *s++;
- if ((base == 0 || base == 16) &&
- c == '0' && (*s == 'x' || *s == 'X')) {
- c = s[1];
- s += 2;
- base = 16;
- }
- if (base == 0)
- base = c == '0' ? 8 : 10;
- cutoff = (unsigned long)ULONG_MAX / (unsigned long)base;
- cutlim = (unsigned long)ULONG_MAX % (unsigned long)base;
- for (acc = 0, any = 0;; c = *s++) {
- if (ISDIGIT(c))
- c -= '0';
- else if (ISALPHA(c))
- c -= ISUPPER(c) ? 'A' - 10 : 'a' - 10;
- else
- break;
- if (c >= base)
- break;
- if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
- any = -1;
- else {
- any = 1;
- acc *= base;
- acc += c;
- }
- }
- if (any < 0) {
- acc = ULONG_MAX;
- errno = ERANGE;
- } else if (neg)
- acc = -acc;
- if (endptr != 0)
- *endptr = (char *) (any ? s - 1 : nptr);
- return (acc);
-}
diff --git a/libiberty/ternary.c b/libiberty/ternary.c
deleted file mode 100644
index 056d2ce..0000000
--- a/libiberty/ternary.c
+++ /dev/null
@@ -1,166 +0,0 @@
-/* ternary.c - Ternary Search Trees
- Copyright (C) 2001 Free Software Foundation, Inc.
-
- Contributed by Daniel Berlin (dan@cgsoftware.com)
-
- This program is free software; you can redistribute 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. */
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-
-#include <stdio.h>
-
-#include "libiberty.h"
-#include "ternary.h"
-
-/* Non-recursive so we don't waste stack space/time on large
- insertions. */
-
-PTR
-ternary_insert (root, s, data, replace)
- ternary_tree *root;
- const char *s;
- PTR data;
- int replace;
-{
- int diff;
- ternary_tree curr, *pcurr;
-
- /* Start at the root. */
- pcurr = root;
- /* Loop until we find the right position */
- while ((curr = *pcurr))
- {
- /* Calculate the difference */
- diff = *s - curr->splitchar;
- /* Handle current char equal to node splitchar */
- if (diff == 0)
- {
- /* Handle the case of a string we already have */
- if (*s++ == 0)
- {
- if (replace)
- curr->eqkid = (ternary_tree) data;
- return (PTR) curr->eqkid;
- }
- pcurr = &(curr->eqkid);
- }
- /* Handle current char less than node splitchar */
- else if (diff < 0)
- {
- pcurr = &(curr->lokid);
- }
- /* Handle current char greater than node splitchar */
- else
- {
- pcurr = &(curr->hikid);
- }
- }
- /* It's not a duplicate string, and we should insert what's left of
- the string, into the tree rooted at curr */
- for (;;)
- {
- /* Allocate the memory for the node, and fill it in */
- *pcurr = (ternary_tree) xmalloc (sizeof (ternary_node));
- curr = *pcurr;
- curr->splitchar = *s;
- curr->lokid = curr->hikid = curr->eqkid = 0;
-
- /* Place nodes until we hit the end of the string.
- When we hit it, place the data in the right place, and
- return.
- */
- if (*s++ == 0)
- {
- curr->eqkid = (ternary_tree) data;
- return data;
- }
- pcurr = &(curr->eqkid);
- }
-}
-
-/* Free the ternary search tree rooted at p. */
-void
-ternary_cleanup (p)
- ternary_tree p;
-{
- if (p)
- {
- ternary_cleanup (p->lokid);
- if (p->splitchar)
- ternary_cleanup (p->eqkid);
- ternary_cleanup (p->hikid);
- free (p);
- }
-}
-
-/* Non-recursive find of a string in the ternary tree */
-PTR
-ternary_search (p, s)
- const ternary_node *p;
- const char *s;
-{
- const ternary_node *curr;
- int diff, spchar;
- spchar = *s;
- curr = p;
- /* Loop while we haven't hit a NULL node or returned */
- while (curr)
- {
- /* Calculate the difference */
- diff = spchar - curr->splitchar;
- /* Handle the equal case */
- if (diff == 0)
- {
- if (spchar == 0)
- return (PTR) curr->eqkid;
- spchar = *++s;
- curr = curr->eqkid;
- }
- /* Handle the less than case */
- else if (diff < 0)
- curr = curr->lokid;
- /* All that's left is greater than */
- else
- curr = curr->hikid;
- }
- return NULL;
-}
-
-/* For those who care, the recursive version of the search. Useful if
- you want a starting point for pmsearch or nearsearch. */
-static PTR
-ternary_recursivesearch (p, s)
- const ternary_node *p;
- const char *s;
-{
- if (!p)
- return 0;
- if (*s < p->splitchar)
- return ternary_recursivesearch (p->lokid, s);
- else if (*s > p->splitchar)
- return ternary_recursivesearch (p->hikid, s);
- else
- {
- if (*s == 0)
- return (PTR) p->eqkid;
- return ternary_recursivesearch (p->eqkid, ++s);
- }
-}
diff --git a/libiberty/testsuite/Makefile.in b/libiberty/testsuite/Makefile.in
deleted file mode 100644
index 515dcd5..0000000
--- a/libiberty/testsuite/Makefile.in
+++ /dev/null
@@ -1,69 +0,0 @@
-#
-# Makefile
-# Copyright (C) 1999, 2002
-# Free Software Foundation
-#
-# This file is part of the libiberty library.
-# Libiberty is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Library General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# Libiberty is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Library General Public License for more details.
-#
-# You should have received a copy of the GNU Library General Public
-# License along with libiberty; see the file COPYING.LIB. If not,
-# write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-#
-
-# This file was written by Tom Tromey <tromey@cygnus.com>.
-
-#
-# Makefile for libiberty/testsuite directory
-#
-
-srcdir = @srcdir@
-VPATH = @srcdir@
-
-SHELL = @SHELL@
-
-CC = @CC@
-CFLAGS = @CFLAGS@
-LIBCFLAGS = $(CFLAGS)
-
-# Multilib support variables.
-MULTISRCTOP =
-
-INCDIR=$(srcdir)/../$(MULTISRCTOP)../include
-
-all:
-
-check: @CHECK@
-
-# Run some tests of the demangler.
-check-cplus-dem: test-demangle $(srcdir)/demangle-expected
- ./test-demangle < $(srcdir)/demangle-expected
-
-TEST_COMPILE = $(CC) @DEFS@ $(LIBCFLAGS) -I.. -I$(INCDIR) $(HDEFINES)
-test-demangle: $(srcdir)/test-demangle.c
- $(TEST_COMPILE) -o test-demangle \
- $(srcdir)/test-demangle.c ../libiberty.a
-
-# Standard (either GNU or Cygnus) rules we don't use.
-info install-info clean-info dvi install etags tags installcheck:
-
-# The standard clean rules.
-mostlyclean:
- rm -f test-demangle
-clean: mostlyclean
-distclean: clean
- rm -f Makefile
-maintainer-clean realclean: distclean
-
-Makefile: $(srcdir)/Makefile.in ../config.status
- CONFIG_FILES=testsuite/Makefile CONFIG_HEADERS= \
- cd .. && $(SHELL) ./config.status
diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected
deleted file mode 100644
index c048318..0000000
--- a/libiberty/testsuite/demangle-expected
+++ /dev/null
@@ -1,2606 +0,0 @@
-# This file holds test cases for the demangler.
-# Each test consists of three lines in succession.
-# The first line is arguments to pass to the test filter program.
-# The second line is the mangled string.
-# The third line is the expected output.
-# A line starting with `#' is ignore.
-# However blank lines in this file are NOT ignored.
-#
---format=gnu
-AddAlignment__9ivTSolverUiP12ivInteractorP7ivTGlue
-ivTSolver::AddAlignment(unsigned int, ivInteractor *, ivTGlue *)
-#
---format=gnu
-ArrowheadIntersects__9ArrowLineP9ArrowheadR6BoxObjP7Graphic
-ArrowLine::ArrowheadIntersects(Arrowhead *, BoxObj &, Graphic *)
-#
---format=gnu
-AtEnd__13ivRubberGroup
-ivRubberGroup::AtEnd(void)
-#
---format=gnu
-BgFilter__9ivTSolverP12ivInteractor
-ivTSolver::BgFilter(ivInteractor *)
-#
---format=gnu
-Check__6UArrayi
-UArray::Check(int)
-#
---format=gnu
-CoreConstDecls__8TextCodeR7ostream
-TextCode::CoreConstDecls(ostream &)
-#
---format=gnu
-Detach__8StateVarP12StateVarView
-StateVar::Detach(StateVarView *)
-#
---format=gnu
-Done__9ComponentG8Iterator
-Component::Done(Iterator)
-#
---format=gnu
-Effect__11RelateManipR7ivEvent
-RelateManip::Effect(ivEvent &)
-#
---format=gnu
-FindFixed__FRP4CNetP4CNet
-FindFixed(CNet *&, CNet *)
-#
---format=gnu
-Fix48_abort__FR8twolongs
-Fix48_abort(twolongs &)
-#
---format=gnu
-GetBarInfo__15iv2_6_VScrollerP13ivPerspectiveRiT2
-iv2_6_VScroller::GetBarInfo(ivPerspective *, int &, int &)
-#
---format=gnu
-GetBgColor__C9ivPainter
-ivPainter::GetBgColor(void) const
-#
---format=gnu
-InsertBody__15H_PullrightMenuii
-H_PullrightMenu::InsertBody(int, int)
-#
---format=gnu
-InsertCharacter__9TextManipc
-TextManip::InsertCharacter(char)
-#
---format=gnu
-InsertToplevel__7ivWorldP12ivInteractorT1
-ivWorld::InsertToplevel(ivInteractor *, ivInteractor *)
-#
---format=gnu
-InsertToplevel__7ivWorldP12ivInteractorT1iiUi
-ivWorld::InsertToplevel(ivInteractor *, ivInteractor *, int, int, unsigned int)
-#
---format=gnu
-IsAGroup__FP11GraphicViewP11GraphicComp
-IsAGroup(GraphicView *, GraphicComp *)
-#
---format=gnu
-IsA__10ButtonCodeUl
-ButtonCode::IsA(unsigned long)
-#
---format=gnu
-ReadName__FR7istreamPc
-ReadName(istream &, char *)
-#
---format=gnu
-Redraw__13StringBrowseriiii
-StringBrowser::Redraw(int, int, int, int)
-#
---format=gnu
-Rotate__13ivTransformerf
-ivTransformer::Rotate(float)
-#
---format=gnu
-Rotated__C13ivTransformerf
-ivTransformer::Rotated(float) const
-#
---format=gnu
-Round__Ff
-Round(float)
-#
---format=gnu
-SetExport__16MemberSharedNameUi
-MemberSharedName::SetExport(unsigned int)
-#
---format=gnu
-Set__14ivControlState13ControlStatusUi
-ivControlState::Set(ControlStatus, unsigned int)
-#
---format=gnu
-Set__5DFacePcii
-DFace::Set(char *, int, int)
-#
---format=gnu
-VConvert__9ivTSolverP12ivInteractorRP8TElementT2
-ivTSolver::VConvert(ivInteractor *, TElement *&, TElement *&)
-#
---format=gnu
-VConvert__9ivTSolverP7ivTGlueRP8TElement
-ivTSolver::VConvert(ivTGlue *, TElement *&)
-#
---format=gnu
-VOrder__9ivTSolverUiRP12ivInteractorT2
-ivTSolver::VOrder(unsigned int, ivInteractor *&, ivInteractor *&)
-#
---format=gnu
-_10PageButton$__both
-PageButton::__both
-#
---format=gnu
-_3RNG$singleMantissa
-RNG::singleMantissa
-#
---format=gnu
-_5IComp$_release
-IComp::_release
-#
---format=gnu
-_$_10BitmapComp
-BitmapComp::~BitmapComp(void)
-#
---format=gnu
-_$_9__io_defs
-__io_defs::~__io_defs(void)
-#
---format=gnu
-_$_Q23foo3bar
-foo::bar::~bar(void)
-#
---format=gnu
-_$_Q33foo3bar4bell
-foo::bar::bell::~bell(void)
-#
---format=gnu
-__10ivTelltaleiP7ivGlyph
-ivTelltale::ivTelltale(int, ivGlyph *)
-#
---format=gnu
-__10ivViewportiP12ivInteractorUi
-ivViewport::ivViewport(int, ivInteractor *, unsigned int)
-#
---format=gnu
-__10ostrstream
-ostrstream::ostrstream(void)
-#
---format=gnu
-__10ostrstreamPcii
-ostrstream::ostrstream(char *, int, int)
-#
---format=gnu
-__11BitmapTablei
-BitmapTable::BitmapTable(int)
-#
---format=gnu
-__12ViewportCodeP12ViewportComp
-ViewportCode::ViewportCode(ViewportComp *)
-#
---format=gnu
-__12iv2_6_Borderii
-iv2_6_Border::iv2_6_Border(int, int)
-#
---format=gnu
-__12ivBreak_Listl
-ivBreak_List::ivBreak_List(long)
-#
---format=gnu
-__14iv2_6_MenuItemiP12ivInteractor
-iv2_6_MenuItem::iv2_6_MenuItem(int, ivInteractor *)
-#
---format=gnu
-__20DisplayList_IteratorR11DisplayList
-DisplayList_Iterator::DisplayList_Iterator(DisplayList &)
-#
---format=gnu
-__3fooRT0
-foo::foo(foo &)
-#
---format=gnu
-__3fooiN31
-foo::foo(int, int, int, int)
-#
---format=gnu
-__3fooiRT0iT2iT2
-foo::foo(int, foo &, int, foo &, int, foo &)
-#
---format=gnu
-__6KeyMapPT0
-KeyMap::KeyMap(KeyMap *)
-#
---format=gnu
-__8ArrowCmdP6EditorUiUi
-ArrowCmd::ArrowCmd(Editor *, unsigned int, unsigned int)
-#
---format=gnu
-__9F_EllipseiiiiP7Graphic
-F_Ellipse::F_Ellipse(int, int, int, int, Graphic *)
-#
---format=gnu
-__9FrameDataP9FrameCompi
-FrameData::FrameData(FrameComp *, int)
-#
---format=gnu
-__9HVGraphicP9CanvasVarP7Graphic
-HVGraphic::HVGraphic(CanvasVar *, Graphic *)
-#
---format=gnu
-__Q23foo3bar
-foo::bar::bar(void)
-#
---format=gnu
-__Q33foo3bar4bell
-foo::bar::bell::bell(void)
-#
---format=gnu
-__aa__3fooRT0
-foo::operator&&(foo &)
-#
---format=gnu
-__aad__3fooRT0
-foo::operator&=(foo &)
-#
---format=gnu
-__ad__3fooRT0
-foo::operator&(foo &)
-#
---format=gnu
-__adv__3fooRT0
-foo::operator/=(foo &)
-#
---format=gnu
-__aer__3fooRT0
-foo::operator^=(foo &)
-#
---format=gnu
-__als__3fooRT0
-foo::operator<<=(foo &)
-#
---format=gnu
-__amd__3fooRT0
-foo::operator%=(foo &)
-#
---format=gnu
-__ami__3fooRT0
-foo::operator-=(foo &)
-#
---format=gnu
-__aml__3FixRT0
-Fix::operator*=(Fix &)
-#
---format=gnu
-__aml__5Fix16i
-Fix16::operator*=(int)
-#
---format=gnu
-__aml__5Fix32RT0
-Fix32::operator*=(Fix32 &)
-#
---format=gnu
-__aor__3fooRT0
-foo::operator|=(foo &)
-#
---format=gnu
-__apl__3fooRT0
-foo::operator+=(foo &)
-#
---format=gnu
-__ars__3fooRT0
-foo::operator>>=(foo &)
-#
---format=gnu
-__as__3fooRT0
-foo::operator=(foo &)
-#
---format=gnu
-__cl__3fooRT0
-foo::operator()(foo &)
-#
---format=gnu
-__cl__6Normal
-Normal::operator()(void)
-#
---format=gnu
-__cl__6Stringii
-String::operator()(int, int)
-#
---format=gnu
-__cm__3fooRT0
-foo::operator, (foo &)
-#
---format=gnu
-__co__3foo
-foo::operator~(void)
-#
---format=gnu
-__dl__3fooPv
-foo::operator delete(void *)
-#
---format=gnu
-__dv__3fooRT0
-foo::operator/(foo &)
-#
---format=gnu
-__eq__3fooRT0
-foo::operator==(foo &)
-#
---format=gnu
-__er__3fooRT0
-foo::operator^(foo &)
-#
---format=gnu
-__ge__3fooRT0
-foo::operator>=(foo &)
-#
---format=gnu
-__gt__3fooRT0
-foo::operator>(foo &)
-#
---format=gnu
-__le__3fooRT0
-foo::operator<=(foo &)
-#
---format=gnu
-__ls__3fooRT0
-foo::operator<<(foo &)
-#
---format=gnu
-__ls__FR7ostreamPFR3ios_R3ios
-operator<<(ostream &, ios &(*)(ios &))
-#
---format=gnu
-__ls__FR7ostreamR3Fix
-operator<<(ostream &, Fix &)
-#
---format=gnu
-__lt__3fooRT0
-foo::operator<(foo &)
-#
---format=gnu
-__md__3fooRT0
-foo::operator%(foo &)
-#
---format=gnu
-__mi__3fooRT0
-foo::operator-(foo &)
-#
---format=gnu
-__ml__3fooRT0
-foo::operator*(foo &)
-#
---format=gnu
-__mm__3fooi
-foo::operator--(int)
-#
---format=gnu
-__ne__3fooRT0
-foo::operator!=(foo &)
-#
---format=gnu
-__nt__3foo
-foo::operator!(void)
-#
---format=gnu
-__nw__3fooi
-foo::operator new(int)
-#
---format=gnu
-__oo__3fooRT0
-foo::operator||(foo &)
-#
---format=gnu
-__opPc__3foo
-foo::operator char *(void)
-#
---format=gnu
-__opi__3foo
-foo::operator int(void)
-#
---format=gnu
-__or__3fooRT0
-foo::operator|(foo &)
-#
---format=gnu
-__pl__3fooRT0
-foo::operator+(foo &)
-#
---format=gnu
-__pp__3fooi
-foo::operator++(int)
-#
---format=gnu
-__rf__3foo
-foo::operator->(void)
-#
---format=gnu
-__rm__3fooRT0
-foo::operator->*(foo &)
-#
---format=gnu
-__rs__3fooRT0
-foo::operator>>(foo &)
-#
---format=gnu
-_new_Fix__FUs
-_new_Fix(unsigned short)
-#
---format=gnu
-_vt.foo
-foo virtual table
-#
---format=gnu
-_vt.foo.bar
-foo::bar virtual table
-#
---format=gnu
-_vt$foo
-foo virtual table
-#
---format=gnu
-_vt$foo$bar
-foo::bar virtual table
-#
---format=gnu
-append__7ivGlyphPT0
-ivGlyph::append(ivGlyph *)
-#
---format=gnu
-clearok__FP7_win_sti
-clearok(_win_st *, int)
-#
---format=gnu
-complexfunc2__FPFPc_i
-complexfunc2(int (*)(char *))
-#
---format=gnu
-complexfunc3__FPFPFPl_s_i
-complexfunc3(int (*)(short (*)(long *)))
-#
---format=gnu
-complexfunc4__FPFPFPc_s_i
-complexfunc4(int (*)(short (*)(char *)))
-#
---format=gnu
-complexfunc5__FPFPc_PFl_i
-complexfunc5(int (*(*)(char *))(long))
-#
---format=gnu
-complexfunc6__FPFPi_PFl_i
-complexfunc6(int (*(*)(int *))(long))
-#
---format=gnu
-complexfunc7__FPFPFPc_i_PFl_i
-complexfunc7(int (*(*)(int (*)(char *)))(long))
-#
---format=gnu
-foo__FiN30
-foo(int, int, int, int)
-#
---format=gnu
-foo__FiR3fooiT1iT1
-foo(int, foo &, int, foo &, int, foo &)
-#
---format=gnu
-foo___3barl
-bar::foo_(long)
-#
---format=gnu
-insert__15ivClippingStacklRP8_XRegion
-ivClippingStack::insert(long, _XRegion *&)
-#
---format=gnu
-insert__16ChooserInfo_ListlR11ChooserInfo
-ChooserInfo_List::insert(long, ChooserInfo &)
-#
---format=gnu
-insert__17FontFamilyRepListlRP15ivFontFamilyRep
-FontFamilyRepList::insert(long, ivFontFamilyRep *&)
-#
---format=gnu
-leaveok__FP7_win_stc
-leaveok(_win_st *, char)
-#
---format=gnu
-left_mover__C7ivMFKitP12ivAdjustableP7ivStyle
-ivMFKit::left_mover(ivAdjustable *, ivStyle *) const
-#
---format=gnu
-overload1arg__FSc
-overload1arg(signed char)
-#
---format=gnu
-overload1arg__FUc
-overload1arg(unsigned char)
-#
---format=gnu
-overload1arg__FUi
-overload1arg(unsigned int)
-#
---format=gnu
-overload1arg__FUl
-overload1arg(unsigned long)
-#
---format=gnu
-overload1arg__FUs
-overload1arg(unsigned short)
-#
---format=gnu
-overload1arg__Fc
-overload1arg(char)
-#
---format=gnu
-overload1arg__Fd
-overload1arg(double)
-#
---format=gnu
-overload1arg__Ff
-overload1arg(float)
-#
---format=gnu
-overload1arg__Fi
-overload1arg(int)
-#
---format=gnu
-overload1arg__Fl
-overload1arg(long)
-#
---format=gnu
-overload1arg__Fs
-overload1arg(short)
-#
---format=gnu
-overload1arg__Fv
-overload1arg(void)
-#
---format=gnu
-overloadargs__Fi
-overloadargs(int)
-#
---format=gnu
-overloadargs__Fii
-overloadargs(int, int)
-#
---format=gnu
-overloadargs__Fiii
-overloadargs(int, int, int)
-#
---format=gnu
-overloadargs__Fiiii
-overloadargs(int, int, int, int)
-#
---format=gnu
-overloadargs__Fiiiii
-overloadargs(int, int, int, int, int)
-#
---format=gnu
-overloadargs__Fiiiiii
-overloadargs(int, int, int, int, int, int)
-#
---format=gnu
-overloadargs__Fiiiiiii
-overloadargs(int, int, int, int, int, int, int)
-#
---format=gnu
-overloadargs__Fiiiiiiii
-overloadargs(int, int, int, int, int, int, int, int)
-#
---format=gnu
-overloadargs__Fiiiiiiiii
-overloadargs(int, int, int, int, int, int, int, int, int)
-#
---format=gnu
-overloadargs__Fiiiiiiiiii
-overloadargs(int, int, int, int, int, int, int, int, int, int)
-#
---format=gnu
-overloadargs__Fiiiiiiiiiii
-overloadargs(int, int, int, int, int, int, int, int, int, int, int)
-#
---format=gnu
-poke__8ivRasterUlUlffff
-ivRaster::poke(unsigned long, unsigned long, float, float, float, float)
-#
---format=gnu
-polar__Fdd
-polar(double, double)
-#
---format=gnu
-scale__13ivTransformerff
-ivTransformer::scale(float, float)
-#
---format=gnu
-sgetn__7filebufPci
-filebuf::sgetn(char *, int)
-#
---format=gnu
-shift__FP5_FrepiT0
-shift(_Frep *, int, _Frep *)
-#
---format=gnu
-test__C6BitSeti
-BitSet::test(int) const
-#
---format=gnu
-test__C6BitSetii
-BitSet::test(int, int) const
-#
---format=gnu
-text_source__8Documentl
-Document::text_source(long)
-#
---format=gnu
-variance__6Erlangd
-Erlang::variance(double)
-#
---format=gnu
-view__14DocumentViewerP8ItemViewP11TabularItem
-DocumentViewer::view(ItemView *, TabularItem *)
-#
---format=gnu
-xy_extents__11ivExtensionffff
-ivExtension::xy_extents(float, float, float, float)
-#
---format=gnu
-zero__8osMemoryPvUi
-osMemory::zero(void *, unsigned int)
-#
---format=gnu
-_2T4$N
-T4::N
-#
---format=gnu
-_Q22T42t1$N
-T4::t1::N
-#
---format=gnu
-get__2T1
-T1::get(void)
-#
---format=gnu
-get__Q22T11a
-T1::a::get(void)
-#
---format=gnu
-get__Q32T11a1b
-T1::a::b::get(void)
-#
---format=gnu
-get__Q42T11a1b1c
-T1::a::b::c::get(void)
-#
---format=gnu
-get__Q52T11a1b1c1d
-T1::a::b::c::d::get(void)
-#
---format=gnu
-put__2T1i
-T1::put(int)
-#
---format=gnu
-put__Q22T11ai
-T1::a::put(int)
-#
---format=gnu
-put__Q32T11a1bi
-T1::a::b::put(int)
-#
---format=gnu
-put__Q42T11a1b1ci
-T1::a::b::c::put(int)
-#
---format=gnu
-put__Q52T11a1b1c1di
-T1::a::b::c::d::put(int)
-#
---format=gnu
-bar__3fooPv
-foo::bar(void *)
-#
---format=gnu
-bar__C3fooPv
-foo::bar(void *) const
-#
---format=gnu
-__eq__3fooRT0
-foo::operator==(foo &)
-#
---format=gnu
-__eq__C3fooR3foo
-foo::operator==(foo &) const
-#
---format=gnu
-elem__t6vector1Zdi
-vector<double>::elem(int)
-#
---format=gnu
-elem__t6vector1Zii
-vector<int>::elem(int)
-#
---format=gnu
-__t6vector1Zdi
-vector<double>::vector(int)
-#
---format=gnu
-__t6vector1Zii
-vector<int>::vector(int)
-#
---format=gnu
-_$_t6vector1Zdi
-vector<double>::~vector(int)
-#
---format=gnu
-_$_t6vector1Zii
-vector<int>::~vector(int)
-#
---format=gnu
-__nw__t2T11ZcUi
-T1<char>::operator new(unsigned int)
-#
---format=gnu
-__nw__t2T11Z1tUi
-T1<t>::operator new(unsigned int)
-#
---format=gnu
-__dl__t2T11ZcPv
-T1<char>::operator delete(void *)
-#
---format=gnu
-__dl__t2T11Z1tPv
-T1<t>::operator delete(void *)
-#
---format=gnu
-__t2T11Zci
-T1<char>::T1(int)
-#
---format=gnu
-__t2T11Zc
-T1<char>::T1(void)
-#
---format=gnu
-__t2T11Z1ti
-T1<t>::T1(int)
-#
---format=gnu
-__t2T11Z1t
-T1<t>::T1(void)
-#
---format=gnu
-__Q2t4List1Z10VHDLEntity3Pix
-List<VHDLEntity>::Pix::Pix(void)
-#
---format=gnu
-__Q2t4List1Z10VHDLEntity3PixPQ2t4List1Z10VHDLEntity7element
-List<VHDLEntity>::Pix::Pix(List<VHDLEntity>::element *)
-#
---format=gnu
-__Q2t4List1Z10VHDLEntity3PixRCQ2t4List1Z10VHDLEntity3Pix
-List<VHDLEntity>::Pix::Pix(List<VHDLEntity>::Pix const &)
-#
---format=gnu
-__Q2t4List1Z10VHDLEntity7elementRC10VHDLEntityPT0
-List<VHDLEntity>::element::element(VHDLEntity const &, List<VHDLEntity>::element *)
-#
---format=gnu
-__Q2t4List1Z10VHDLEntity7elementRCQ2t4List1Z10VHDLEntity7element
-List<VHDLEntity>::element::element(List<VHDLEntity>::element const &)
-#
---format=gnu
-__cl__C11VHDLLibraryGt4PixX3Z11VHDLLibraryZ14VHDLLibraryRepZt4List1Z10VHDLEntity
-VHDLLibrary::operator()(PixX<VHDLLibrary, VHDLLibraryRep, List<VHDLEntity> >) const
-#
---format=gnu
-__cl__Ct4List1Z10VHDLEntityRCQ2t4List1Z10VHDLEntity3Pix
-List<VHDLEntity>::operator()(List<VHDLEntity>::Pix const &) const
-#
---format=gnu
-__ne__FPvRCQ2t4List1Z10VHDLEntity3Pix
-operator!=(void *, List<VHDLEntity>::Pix const &)
-#
---format=gnu
-__ne__FPvRCt4PixX3Z11VHDLLibraryZ14VHDLLibraryRepZt4List1Z10VHDLEntity
-operator!=(void *, PixX<VHDLLibrary, VHDLLibraryRep, List<VHDLEntity> > const &)
-#
---format=gnu
-__t4List1Z10VHDLEntityRCt4List1Z10VHDLEntity
-List<VHDLEntity>::List(List<VHDLEntity> const &)
-#
---format=gnu
-__t4PixX3Z11VHDLLibraryZ14VHDLLibraryRepZt4List1Z10VHDLEntity
-PixX<VHDLLibrary, VHDLLibraryRep, List<VHDLEntity> >::PixX(void)
-#
---format=gnu
-__t4PixX3Z11VHDLLibraryZ14VHDLLibraryRepZt4List1Z10VHDLEntityP14VHDLLibraryRepGQ2t4List1Z10VHDLEntity3Pix
-PixX<VHDLLibrary, VHDLLibraryRep, List<VHDLEntity> >::PixX(VHDLLibraryRep *, List<VHDLEntity>::Pix)
-#
---format=gnu
-__t4PixX3Z11VHDLLibraryZ14VHDLLibraryRepZt4List1Z10VHDLEntityRCt4PixX3Z11VHDLLibraryZ14VHDLLibraryRepZt4List1Z10VHDLEntity
-PixX<VHDLLibrary, VHDLLibraryRep, List<VHDLEntity> >::PixX(PixX<VHDLLibrary, VHDLLibraryRep, List<VHDLEntity> > const &)
-#
---format=gnu
-nextE__C11VHDLLibraryRt4PixX3Z11VHDLLibraryZ14VHDLLibraryRepZt4List1Z10VHDLEntity
-VHDLLibrary::nextE(PixX<VHDLLibrary, VHDLLibraryRep, List<VHDLEntity> > &) const
-#
---format=gnu
-next__Ct4List1Z10VHDLEntityRQ2t4List1Z10VHDLEntity3Pix
-List<VHDLEntity>::next(List<VHDLEntity>::Pix &) const
-#
---format=gnu
-_GLOBAL_$D$set
-global destructors keyed to set
-#
---format=gnu
-_GLOBAL_$I$set
-global constructors keyed to set
-#
---format=gnu
-__as__t5ListS1ZUiRCt5ListS1ZUi
-ListS<unsigned int>::operator=(ListS<unsigned int> const &)
-#
---format=gnu
-__cl__Ct5ListS1ZUiRCQ2t5ListS1ZUi3Vix
-ListS<unsigned int>::operator()(ListS<unsigned int>::Vix const &) const
-#
---format=gnu
-__cl__Ct5SetLS1ZUiRCQ2t5SetLS1ZUi3Vix
-SetLS<unsigned int>::operator()(SetLS<unsigned int>::Vix const &) const
-#
---format=gnu
-__t10ListS_link1ZUiRCUiPT0
-ListS_link<unsigned int>::ListS_link(unsigned int const &, ListS_link<unsigned int> *)
-#
---format=gnu
-__t10ListS_link1ZUiRCt10ListS_link1ZUi
-ListS_link<unsigned int>::ListS_link(ListS_link<unsigned int> const &)
-#
---format=gnu
-__t5ListS1ZUiRCt5ListS1ZUi
-ListS<unsigned int>::ListS(ListS<unsigned int> const &)
-#
---format=gnu
-next__Ct5ListS1ZUiRQ2t5ListS1ZUi3Vix
-ListS<unsigned int>::next(ListS<unsigned int>::Vix &) const
-#
---format=gnu
-__ne__FPvRCQ2t5SetLS1ZUi3Vix
-operator!=(void *, SetLS<unsigned int>::Vix const &)
-#
---format=gnu
-__t8ListElem1Z5LabelRt4List1Z5Label
-ListElem<Label>::ListElem(List<Label> &)
-#
---format=gnu
-__t8BDDHookV1ZPcRCPc
-BDDHookV<char *>::BDDHookV(char *const &)
-#
---format=gnu
-_vt$t8BDDHookV1ZPc
-BDDHookV<char *> virtual table
-#
---format=gnu
-__ne__FPvRCQ211BDDFunction4VixB
-operator!=(void *, BDDFunction::VixB const &)
-#
---format=gnu
-__eq__FPvRCQ211BDDFunction4VixB
-operator==(void *, BDDFunction::VixB const &)
-#
---format=gnu
-relativeId__CQ36T_phi210T_preserve8FPC_nextRCQ26T_phi210T_preserveRC10Parameters
-T_phi2::T_preserve::FPC_next::relativeId(T_phi2::T_preserve const &, Parameters const &) const
-#
---format=lucid
-WS__FR7istream
-WS(istream &)
-#
---format=lucid
-__aa__3fooFR3foo
-foo::operator&&(foo &)
-#
---format=lucid
-__aad__3fooFR3foo
-foo::operator&=(foo &)
-#
---format=lucid
-__ad__3fooFR3foo
-foo::operator&(foo &)
-#
---format=lucid
-__adv__3fooFR3foo
-foo::operator/=(foo &)
-#
---format=lucid
-__adv__7complexF7complex
-complex::operator/=(complex)
-#
---format=lucid
-__aer__3fooFR3foo
-foo::operator^=(foo &)
-#
---format=lucid
-__als__3fooFR3foo
-foo::operator<<=(foo &)
-#
---format=lucid
-__amd__3fooFR3foo
-foo::operator%=(foo &)
-#
---format=lucid
-__ami__3fooFR3foo
-foo::operator-=(foo &)
-#
---format=lucid
-__amu__3fooFR3foo
-foo::operator*=(foo &)
-#
---format=lucid
-__amu__7complexF7complex
-complex::operator*=(complex)
-#
---format=lucid
-__aor__3fooFR3foo
-foo::operator|=(foo &)
-#
---format=lucid
-__apl__3fooFR3foo
-foo::operator+=(foo &)
-#
---format=lucid
-__ars__3fooFR3foo
-foo::operator>>=(foo &)
-#
---format=lucid
-__as__18istream_withassignFP9streambuf
-istream_withassign::operator=(streambuf *)
-#
---format=lucid
-__as__18istream_withassignFR7istream
-istream_withassign::operator=(istream &)
-#
---format=lucid
-__as__3fooFR3foo
-foo::operator=(foo &)
-#
---format=lucid
-__as__3iosFR3ios
-ios::operator=(ios &)
-#
---format=lucid
-__cl__3fooFR3foo
-foo::operator()(foo &)
-#
---format=lucid
-__cm__3fooFR3foo
-foo::operator, (foo &)
-#
---format=lucid
-__co__3fooFv
-foo::operator~(void)
-#
---format=lucid
-__ct__10istrstreamFPc
-istrstream::istrstream(char *)
-#
---format=lucid
-__ct__10istrstreamFPci
-istrstream::istrstream(char *, int)
-#
---format=lucid
-__ct__10ostrstreamFPciT2
-ostrstream::ostrstream(char *, int, int)
-#
---format=lucid
-__ct__10ostrstreamFv
-ostrstream::ostrstream(void)
-#
---format=lucid
-__ct__10smanip_intFPFR3iosi_R3iosi
-smanip_int::smanip_int(ios &(*)(ios &, int), int)
-#
---format=lucid
-__ct__11fstreambaseFi
-fstreambase::fstreambase(int)
-#
---format=lucid
-__ct__11fstreambaseFiPcT1
-fstreambase::fstreambase(int, char *, int)
-#
---format=lucid
-__ct__11fstreambaseFv
-fstreambase::fstreambase(void)
-#
---format=lucid
-__ct__11smanip_longFPFR3iosl_R3iosl
-smanip_long::smanip_long(ios &(*)(ios &, long), long)
-#
---format=lucid
-__ct__11stdiostreamFP4FILE
-stdiostream::stdiostream(FILE *)
-#
---format=lucid
-__ct__12strstreambufFPFl_PvPFPv_v
-strstreambuf::strstreambuf(void *(*)(long), void (*)(void *))
-#
---format=lucid
-__ct__12strstreambufFPUciT1
-strstreambuf::strstreambuf(unsigned char *, int, unsigned char *)
-#
---format=lucid
-__ct__12strstreambufFPciT1
-strstreambuf::strstreambuf(char *, int, char *)
-#
---format=lucid
-__ct__12strstreambufFi
-strstreambuf::strstreambuf(int)
-#
---format=lucid
-__ct__12strstreambufFv
-strstreambuf::strstreambuf(void)
-#
---format=lucid
-__ct__13strstreambaseFPciT1
-strstreambase::strstreambase(char *, int, char *)
-#
---format=lucid
-__ct__3fooFR3foo
-foo::foo(foo &)
-#
---format=lucid
-__ct__3fooFi
-foo::foo(int)
-#
---format=lucid
-__ct__3fooFiN31
-foo::foo(int, int, int, int)
-#
---format=lucid
-__ct__3fooFiR3fooT1T2T1T2
-foo::foo(int, foo &, int, foo &, int, foo &)
-#
---format=lucid
-__ct__3iosFP9streambuf
-ios::ios(streambuf *)
-#
---format=lucid
-__ct__7filebufFiPcT1
-filebuf::filebuf(int, char *, int)
-#
---format=lucid
-__ct__7fstreamFiPcT1
-fstream::fstream(int, char *, int)
-#
---format=lucid
-__ct__7istreamFP9streambuf
-istream::istream(streambuf *)
-#
---format=lucid
-__ct__7istreamFP9streambufiP7ostream
-istream::istream(streambuf *, int, ostream *)
-#
---format=lucid
-__ct__7istreamFiPcT1
-istream::istream(int, char *, int)
-#
---format=lucid
-__ct__7istreamFiT1P7ostream
-istream::istream(int, int, ostream *)
-#
---format=lucid
-__ct__7ostreamFP9streambuf
-ostream::ostream(streambuf *)
-#
---format=lucid
-__ct__7ostreamFiPc
-ostream::ostream(int, char *)
-#
---format=lucid
-__ct__8ifstreamFiPcT1
-ifstream::ifstream(int, char *, int)
-#
---format=lucid
-__ct__Q23foo3barFv
-foo::bar::bar(void)
-#
---format=lucid
-__ct__Q33foo3bar4bellFv
-foo::bar::bell::bell(void)
-#
---format=lucid
-__dl__3fooSFPv
-foo::operator delete(void *) static
-#
---format=lucid
-__dl__FPv
-operator delete(void *)
-#
---format=lucid
-__dt__10istrstreamFv
-istrstream::~istrstream(void)
-#
---format=lucid
-__dt__Q23foo3barFv
-foo::bar::~bar(void)
-#
---format=lucid
-__dt__Q33foo3bar4bellFv
-foo::bar::bell::~bell(void)
-#
---format=lucid
-__dv__3fooFR3foo
-foo::operator/(foo &)
-#
---format=lucid
-__dv__F7complexT1
-operator/(complex, complex)
-#
---format=lucid
-__eq__3fooFR3foo
-foo::operator==(foo &)
-#
---format=lucid
-__er__3fooFR3foo
-foo::operator^(foo &)
-#
---format=lucid
-__ge__3fooFR3foo
-foo::operator>=(foo &)
-#
---format=lucid
-__gt__3fooFR3foo
-foo::operator>(foo &)
-#
---format=lucid
-__le__3fooFR3foo
-foo::operator<=(foo &)
-#
---format=lucid
-__ls__3fooFR3foo
-foo::operator<<(foo &)
-#
---format=lucid
-__ls__7ostreamFP9streambuf
-ostream::operator<<(streambuf *)
-#
---format=lucid
-__ls__7ostreamFPFR3ios_R3ios
-ostream::operator<<(ios &(*)(ios &))
-#
---format=lucid
-__ls__7ostreamFPv
-ostream::operator<<(void *)
-#
---format=lucid
-__ls__7ostreamFUi
-ostream::operator<<(unsigned int)
-#
---format=lucid
-__ls__7ostreamFUl
-ostream::operator<<(unsigned long)
-#
---format=lucid
-__ls__7ostreamFd
-ostream::operator<<(double)
-#
---format=lucid
-__ls__7ostreamFf
-ostream::operator<<(float)
-#
---format=lucid
-__ls__7ostreamFi
-ostream::operator<<(int)
-#
---format=lucid
-__ls__7ostreamFl
-ostream::operator<<(long)
-#
---format=lucid
-__ls__FR7ostream7complex
-operator<<(ostream &, complex)
-#
---format=lucid
-__lt__3fooFR3foo
-foo::operator<(foo &)
-#
---format=lucid
-__md__3fooFR3foo
-foo::operator%(foo &)
-#
---format=lucid
-__mi__3fooFR3foo
-foo::operator-(foo &)
-#
---format=lucid
-__ml__3fooFR3foo
-foo::operator*(foo &)
-#
---format=lucid
-__ml__F7complexT1
-operator*(complex, complex)
-#
---format=lucid
-__mm__3fooFi
-foo::operator--(int)
-#
---format=lucid
-__ne__3fooFR3foo
-foo::operator!=(foo &)
-#
---format=lucid
-__nt__3fooFv
-foo::operator!(void)
-#
---format=lucid
-__nw__3fooSFi
-foo::operator new(int) static
-#
---format=lucid
-__nw__FUi
-operator new(unsigned int)
-#
---format=lucid
-__nw__FUiPv
-operator new(unsigned int, void *)
-#
---format=lucid
-__oo__3fooFR3foo
-foo::operator||(foo &)
-#
---format=lucid
-__opPc__3fooFv
-foo::operator char *(void)
-#
---format=lucid
-__opi__3fooFv
-foo::operator int(void)
-#
---format=lucid
-__or__3fooFR3foo
-foo::operator|(foo &)
-#
---format=lucid
-__pl__3fooFR3foo
-foo::operator+(foo &)
-#
---format=lucid
-__pp__3fooFi
-foo::operator++(int)
-#
---format=lucid
-__pt__3fooFv
-foo::operator->(void)
-#
---format=lucid
-__rm__3fooFR3foo
-foo::operator->*(foo &)
-#
---format=lucid
-__rs__3fooFR3foo
-foo::operator>>(foo &)
-#
---format=lucid
-__rs__7istreamFP9streambuf
-istream::operator>>(streambuf *)
-#
---format=lucid
-__rs__7istreamFPFR3ios_R3ios
-istream::operator>>(ios &(*)(ios &))
-#
---format=lucid
-__rs__7istreamFPFR7istream_R7istream
-istream::operator>>(istream &(*)(istream &))
-#
---format=lucid
-__rs__7istreamFPUc
-istream::operator>>(unsigned char *)
-#
---format=lucid
-__rs__7istreamFPc
-istream::operator>>(char *)
-#
---format=lucid
-__rs__7istreamFRUi
-istream::operator>>(unsigned int &)
-#
---format=lucid
-__rs__7istreamFRUl
-istream::operator>>(unsigned long &)
-#
---format=lucid
-__rs__7istreamFRUs
-istream::operator>>(unsigned short &)
-#
---format=lucid
-__rs__7istreamFRd
-istream::operator>>(double &)
-#
---format=lucid
-__rs__7istreamFRf
-istream::operator>>(float &)
-#
---format=lucid
-__rs__7istreamFRi
-istream::operator>>(int &)
-#
---format=lucid
-__rs__7istreamFRl
-istream::operator>>(long &)
-#
---format=lucid
-__rs__7istreamFRs
-istream::operator>>(short &)
-#
---format=lucid
-__rs__FR7istreamR7complex
-operator>>(istream &, complex &)
-#
---format=lucid
-__vtbl__10istrstream
-istrstream virtual table
-#
---format=lucid
-__vtbl__17ostream__iostream__19iostream_withassign
-iostream_withassign::ostream__iostream virtual table
-#
---format=lucid
-__vtbl__3ios
-ios virtual table
-#
---format=lucid
-__vtbl__3ios__13strstreambase
-strstreambase::ios virtual table
-#
---format=lucid
-abs__F7complex
-abs(complex)
-#
---format=lucid
-allocate__9streambufFv
-streambuf::allocate(void)
-#
---format=lucid
-attach__11fstreambaseFi
-fstreambase::attach(int)
-#
---format=lucid
-bitalloc__3iosSFv
-ios::bitalloc(void) static
-#
---format=lucid
-chr__FiT1
-chr(int, int)
-#
---format=lucid
-complex_error__FR11c_exception
-complex_error(c_exception &)
-#
---format=lucid
-complexfunc2__FPFPc_i
-complexfunc2(int (*)(char *))
-#
---format=lucid
-complexfunc3__FPFPFPl_s_i
-complexfunc3(int (*)(short (*)(long *)))
-#
---format=lucid
-complexfunc4__FPFPFPc_s_i
-complexfunc4(int (*)(short (*)(char *)))
-#
---format=lucid
-complexfunc5__FPFPc_PFl_i
-complexfunc5(int (*(*)(char *))(long))
-#
---format=lucid
-complexfunc6__FPFPi_PFl_i
-complexfunc6(int (*(*)(int *))(long))
-#
---format=lucid
-complexfunc7__FPFPFPc_i_PFl_i
-complexfunc7(int (*(*)(int (*)(char *)))(long))
-#
---format=lucid
-complicated_put__7ostreamFc
-ostream::complicated_put(char)
-#
---format=lucid
-conv10__FlPc
-conv10(long, char *)
-#
---format=lucid
-conv16__FUlPc
-conv16(unsigned long, char *)
-#
---format=lucid
-dec__FR3ios
-dec(ios &)
-#
---format=lucid
-dec__Fli
-dec(long, int)
-#
---format=lucid
-dofield__FP7ostreamPciT2T3
-dofield(ostream *, char *, int, char *, int)
-#
---format=lucid
-flags__3iosFl
-ios::flags(long)
-#
---format=lucid
-flags__3iosFv
-ios::flags(void)
-#
---format=lucid
-foo__FiN31
-foo(int, int, int, int)
-#
---format=lucid
-foo__FiR3fooT1T2T1T2
-foo(int, foo &, int, foo &, int, foo &)
-#
---format=lucid
-foo___3barFl
-bar::foo_(long)
-#
---format=lucid
-get__7istreamFPcic
-istream::get(char *, int, char)
-#
---format=lucid
-get__7istreamFR9streambufc
-istream::get(streambuf &, char)
-#
---format=lucid
-get_complicated__7istreamFRUc
-istream::get_complicated(unsigned char &)
-#
---format=lucid
-get_complicated__7istreamFRc
-istream::get_complicated(char &)
-#
---format=lucid
-getline__7istreamFPUcic
-istream::getline(unsigned char *, int, char)
-#
---format=lucid
-getline__7istreamFPcic
-istream::getline(char *, int, char)
-#
---format=lucid
-ignore__7istreamFiT1
-istream::ignore(int, int)
-#
---format=lucid
-init__12strstreambufFPciT1
-strstreambuf::init(char *, int, char *)
-#
---format=lucid
-init__3iosFP9streambuf
-ios::init(streambuf *)
-#
---format=lucid
-initcount__13Iostream_init
-Iostream_init::initcount
-#
---format=lucid
-ipfx__7istreamFi
-istream::ipfx(int)
-#
---format=lucid
-ls_complicated__7ostreamFUc
-ostream::ls_complicated(unsigned char)
-#
---format=lucid
-ls_complicated__7ostreamFc
-ostream::ls_complicated(char)
-#
---format=lucid
-overload1arg__FSc
-overload1arg(signed char)
-#
---format=lucid
-overload1arg__FUc
-overload1arg(unsigned char)
-#
---format=lucid
-overload1arg__FUi
-overload1arg(unsigned int)
-#
---format=lucid
-overload1arg__FUl
-overload1arg(unsigned long)
-#
---format=lucid
-overload1arg__FUs
-overload1arg(unsigned short)
-#
---format=lucid
-overload1arg__Fc
-overload1arg(char)
-#
---format=lucid
-overload1arg__Fd
-overload1arg(double)
-#
---format=lucid
-overload1arg__Ff
-overload1arg(float)
-#
---format=lucid
-overload1arg__Fi
-overload1arg(int)
-#
---format=lucid
-overload1arg__Fl
-overload1arg(long)
-#
---format=lucid
-overload1arg__Fs
-overload1arg(short)
-#
---format=lucid
-overload1arg__Fv
-overload1arg(void)
-#
---format=lucid
-overloadargs__FiN21
-overloadargs(int, int, int)
-#
---format=lucid
-overloadargs__FiN31
-overloadargs(int, int, int, int)
-#
---format=lucid
-overloadargs__FiN41
-overloadargs(int, int, int, int, int)
-#
---format=lucid
-overloadargs__FiN51
-overloadargs(int, int, int, int, int, int)
-#
---format=lucid
-overloadargs__FiN61
-overloadargs(int, int, int, int, int, int, int)
-#
---format=lucid
-overloadargs__FiN71
-overloadargs(int, int, int, int, int, int, int, int)
-#
---format=lucid
-overloadargs__FiN81
-overloadargs(int, int, int, int, int, int, int, int, int)
-#
---format=lucid
-overloadargs__FiN91
-overloadargs(int, int, int, int, int, int, int, int, int, int)
-#
---format=lucid
-overloadargs__FiN91N11
-overloadargs(int, int, int, int, int, int, int, int, int, int, int)
-#
---format=lucid
-overloadargs__FiT1
-overloadargs(int, int)
-#
---format=lucid
-polar__FdT1
-polar(double, double)
-#
---format=lucid
-pow__F7complexT1
-pow(complex, complex)
-#
---format=lucid
-pow__F7complexd
-pow(complex, double)
-#
---format=lucid
-pow__F7complexi
-pow(complex, int)
-#
---format=lucid
-pow__Fd7complex
-pow(double, complex)
-#
---format=lucid
-pstart__FPciT2
-pstart(char *, int, int)
-#
---format=lucid
-put__7ostreamFc
-ostream::put(char)
-#
---format=lucid
-read__7istreamFPci
-istream::read(char *, int)
-#
---format=lucid
-resetiosflags__FR3iosl
-resetiosflags(ios &, long)
-#
---format=lucid
-restore_errno__FRi
-restore_errno(int &)
-#
---format=lucid
-rs_complicated__7istreamFRUc
-istream::rs_complicated(unsigned char &)
-#
---format=lucid
-rs_complicated__7istreamFRc
-istream::rs_complicated(char &)
-#
---format=lucid
-seekg__7istreamFl8seek_dir
-istream::seekg(long, seek_dir)
-#
---format=lucid
-seekoff__12strstreambufFl8seek_diri
-strstreambuf::seekoff(long, seek_dir, int)
-#
---format=lucid
-seekoff__9streambufFlQ2_3ios12ios_seek_diri
-streambuf::seekoff(long, ios::ios_seek_dir, int)
-#
---format=lucid
-seekpos__9streambufFli
-streambuf::seekpos(long, int)
-#
---format=lucid
-set_new_handler__FPFv_v
-set_new_handler(void (*)(void))
-#
---format=lucid
-setb__9streambufFPcT1i
-streambuf::setb(char *, char *, int)
-#
---format=lucid
-setb__FR3iosi
-setb(ios &, int)
-#
---format=lucid
-setbuf__11fstreambaseFPci
-fstreambase::setbuf(char *, int)
-#
---format=lucid
-setbuf__9streambufFPUci
-streambuf::setbuf(unsigned char *, int)
-#
---format=lucid
-setbuf__9streambufFPciT2
-streambuf::setbuf(char *, int, int)
-#
---format=lucid
-setf__3iosFlT1
-ios::setf(long, long)
-#
---format=lucid
-setfill__FR3iosi
-setfill(ios &, int)
-#
---format=lucid
-setg__9streambufFPcN21
-streambuf::setg(char *, char *, char *)
-#
---format=lucid
-setp__9streambufFPcT1
-streambuf::setp(char *, char *)
-#
---format=lucid
-tie__3iosFP7ostream
-ios::tie(ostream *)
-#
---format=lucid
-uconv10__FUlPc
-uconv10(unsigned long, char *)
-#
---format=lucid
-xget__7istreamFPc
-istream::xget(char *)
-#
---format=lucid
-xsgetn__9streambufFPci
-streambuf::xsgetn(char *, int)
-#
---format=arm
-__dt__21T5__pt__11_PFiPPdPv_iFv
-T5<int (*)(int, double **, void *)>::~T5(void)
-#
---format=arm
-__ct__1cFi
-c::c(int)
-#
---format=arm
-__dt__11T5__pt__2_iFv
-T5<int>::~T5(void)
-#
---format=arm
-__dt__11T5__pt__2_cFv
-T5<char>::~T5(void)
-#
---format=arm
-__ct__2T2Fi
-T2::T2(int)
-#
---format=arm
-__dt__2T1Fv
-T1::~T1(void)
-#
---format=arm
-__dt__12T5__pt__3_1xFv
-T5<x>::~T5(void)
-#
---format=arm
-__dt__17T5__pt__8_PFcPv_iFv
-T5<int (*)(char, void *)>::~T5(void)
-#
---format=arm
-__ct__21T5__pt__11_PFiPPdPv_iFi
-T5<int (*)(int, double **, void *)>::T5(int)
-#
---format=arm
-__amd__FR2T2i
-operator%=(T2 &, int)
-#
---format=arm
-__adv__FR2T2i
-operator/=(T2 &, int)
-#
---format=arm
-__amu__FR2T2i
-operator*=(T2 &, int)
-#
---format=arm
-__ami__FR2T2i
-operator-=(T2 &, int)
-#
---format=arm
-__apl__FR2T2i
-operator+=(T2 &, int)
-#
---format=arm
-__nw__2T1SFUi
-T1::operator new(unsigned int) static
-#
---format=arm
-__dl__2T1SFPv
-T1::operator delete(void *) static
-#
---format=arm
-put__2T7SFi
-T7::put(int) static
-#
---format=arm
-__dl__12T5__pt__3_1xSFPv
-T5<x>::operator delete(void *) static
-#
---format=arm
-h__FUc
-h(unsigned char)
-#
---format=arm
-f__Fic
-f(int, char)
-#
---format=arm
-h__FUi
-h(unsigned int)
-#
---format=arm
-h__Fci
-h(char, int)
-#
---format=arm
-h__FUl
-h(unsigned long)
-#
---format=arm
-h__Fcl
-h(char, long)
-#
---format=arm
-h__FUs
-h(unsigned short)
-#
---format=arm
-h__Fcs
-h(char, short)
-#
---format=arm
-X__12T5__pt__3_1x
-T5<x>::X
-#
---format=arm
-__ct__11T5__pt__2_iFi
-T5<int>::T5(int)
-#
---format=arm
-__ct__11T5__pt__2_cFi
-T5<char>::T5(int)
-#
---format=arm
-h__FcT1
-h(char, char)
-#
---format=arm
-f__Ficd
-f(int, char, double)
-#
---format=arm
-__dl__17T5__pt__8_PFcPv_iSFPv
-T5<int (*)(char, void *)>::operator delete(void *) static
-#
---format=arm
-X__17T5__pt__8_PFcPv_i
-T5<int (*)(char, void *)>::X
-#
---format=arm
-__ct__12T5__pt__3_1xFi
-T5<x>::T5(int)
-#
---format=arm
-__dl__21T5__pt__11_PFiPPdPv_iSFPv
-T5<int (*)(int, double **, void *)>::operator delete(void *) static
-#
---format=arm
-__std__foo
-global destructors keyed to foo
-#
---format=arm
-__sti__bar
-global constructors keyed to bar
-#
---format=arm
-f__FicdPcPFci_v
-f(int, char, double, char *, void (*)(char, int))
-#
---format=arm
-f__FicdPcPFic_v
-f(int, char, double, char *, void (*)(int, char))
-#
---format=arm
-get__2T7SFv
-T7::get(void) static
-#
---format=arm
-X__21T5__pt__11_PFiPPdPv_i
-T5<int (*)(int, double **, void *)>::X
-#
---format=arm
-__dl__11T5__pt__2_iSFPv
-T5<int>::operator delete(void *) static
-#
---format=arm
-__dl__11T5__pt__2_cSFPv
-T5<char>::operator delete(void *) static
-#
---format=arm
-h__Fc
-h(char)
-#
---format=arm
-h__Fd
-h(double)
-#
---format=arm
-h__Ff
-h(float)
-#
---format=arm
-h__Fi
-h(int)
-#
---format=arm
-f__Fi
-f(int)
-#
---format=arm
-h__Fl
-h(long)
-#
---format=arm
-h__Fs
-h(short)
-#
---format=arm
-X__11T5__pt__2_c
-T5<char>::X
-#
---format=arm
-X__11T5__pt__2_i
-T5<int>::X
-#
---format=arm
-__ct__17T5__pt__8_PFcPv_iFi
-T5<int (*)(char, void *)>::T5(int)
-#
---format=arm
-f__FicdPc
-f(int, char, double, char *)
-#
---format=arm
-__nw__FUi
-operator new(unsigned int)
-#
---format=arm
-__ct__Q3_2T11a1bSFi
-T1::a::b::b(int) static
-#
---format=arm
-__dt__Q3_2T11a1bSFi
-T1::a::b::~b(int) static
-#
---format=arm
-put__Q3_2T11a1bSFi
-T1::a::b::put(int) static
-#
---format=arm
-get__Q2_2T11aSFv
-T1::a::get(void) static
-#
---format=arm
-put__2T1SFi
-T1::put(int) static
-#
---format=arm
-put__Q5_2T11a1b1c1dSFi
-T1::a::b::c::d::put(int) static
-#
---format=arm
-get__Q4_2T11a1b1cSFv
-T1::a::b::c::get(void) static
-#
---format=arm
-put__Q2_2T11aSFi
-T1::a::put(int) static
-#
---format=arm
-put__Q4_2T11a1b1cSFi
-T1::a::b::c::put(int) static
-#
---format=arm
-get__Q3_2T11a1bSFv
-T1::a::b::get(void) static
-#
---format=arm
-get__2T1SFv
-T1::get(void) static
-#
---format=arm
-get__Q5_2T11a1b1c1dSFv
-T1::a::b::c::d::get(void) static
-#
---format=arm
-__dt__11T1__pt__2_cFv
-T1<char>::~T1(void)
-#
---format=arm
-__dt__12T1__pt__3_1tFv
-T1<t>::~T1(void)
-#
---format=arm
-__dl__12T1__pt__3_1tSFPv
-T1<t>::operator delete(void *) static
-#
---format=arm
-__ct__11T1__pt__2_cFi
-T1<char>::T1(int)
-#
---format=arm
-__ct__11T1__pt__2_cFv
-T1<char>::T1(void)
-#
---format=arm
-__ct__12T1__pt__3_1tFi
-T1<t>::T1(int)
-#
---format=arm
-__ct__12T1__pt__3_1tFv
-T1<t>::T1(void)
-#
---format=arm
-__dl__11T1__pt__2_cSFPv
-T1<char>::operator delete(void *) static
-#
---format=arm
-bar__3fooFPv
-foo::bar(void *)
-#
---format=arm
-bar__3fooCFPv
-foo::bar(void *) const
-#
---format=arm
-__eq__3fooFR3foo
-foo::operator==(foo &)
-#
---format=arm
-__eq__3fooCFR3foo
-foo::operator==(foo &) const
-#
---format=arm
-elem__15vector__pt__2_dFi
-vector<double>::elem(int)
-#
---format=arm
-elem__15vector__pt__2_iFi
-vector<int>::elem(int)
-#
---format=arm
-__ct__15vector__pt__2_dFi
-vector<double>::vector(int)
-#
---format=arm
-__ct__15vector__pt__2_iFi
-vector<int>::vector(int)
-#
---format=arm
-__ct__25DListNode__pt__9_R6RLabelFR6RLabelP25DListNode__pt__9_R6RLabelT2
-DListNode<RLabel &>::DListNode(RLabel &, DListNode<RLabel &> *, DListNode<RLabel &> *)
-#
---format=arm
-bar__3fooFiT16FooBar
-foo::bar(int, int, FooBar)
-#
---format=arm
-bar__3fooFPiN51PdN37PcN211T1iN215
-foo::bar(int *, int *, int *, int *, int *, int *, double *, double *, double *, double *, char *, char *, char *, int *, int, int, int)
-#
---format=hp
-__amd__FR2T2i
-operator%=(T2 &, int)
-#
---format=hp
-__adv__FR2T2i
-operator/=(T2 &, int)
-#
---format=hp
-__amu__FR2T2i
-operator*=(T2 &, int)
-#
---format=hp
-__ami__FR2T2i
-operator-=(T2 &, int)
-#
---format=hp
-__apl__FR2T2i
-operator+=(T2 &, int)
-#
---format=hp
-__nw__2T1SFUi
-T1::operator new(unsigned int) static
-#
---format=hp
-__dl__2T1SFPv
-T1::operator delete(void *) static
-#
---format=hp
-put__2T7SFi
-T7::put(int) static
-#
---format=hp
-h__FUc
-h(unsigned char)
-#
---format=hp
-f__Fic
-f(int, char)
-#
---format=hp
-h__FUi
-h(unsigned int)
-#
---format=hp
-h__Fci
-h(char, int)
-#
---format=hp
-h__FUl
-h(unsigned long)
-#
---format=hp
-h__Fcl
-h(char, long)
-#
---format=hp
-h__FUs
-h(unsigned short)
-#
---format=hp
-h__Fcs
-h(char, short)
-#
---format=hp
-h__FcT1
-h(char, char)
-#
---format=hp
-f__Ficd
-f(int, char, double)
-#
---format=hp
-f__FicdPcPFci_v
-f(int, char, double, char *, void (*)(char, int))
-#
---format=hp
-f__FicdPcPFic_v
-f(int, char, double, char *, void (*)(int, char))
-#
---format=hp
-get__2T7SFv
-T7::get(void) static
-#
---format=hp
-h__Fc
-h(char)
-#
---format=hp
-h__Fd
-h(double)
-#
---format=hp
-h__Ff
-h(float)
-#
---format=hp
-h__Fi
-h(int)
-#
---format=hp
-f__Fi
-f(int)
-#
---format=hp
-h__Fl
-h(long)
-#
---format=hp
-h__Fs
-h(short)
-#
---format=hp
-f__FicdPc
-f(int, char, double, char *)
-#
---format=hp
-__nw__FUi
-operator new(unsigned int)
-#
---format=hp
-__ct__Q3_2T11a1bSFi
-T1::a::b::b(int) static
-#
---format=hp
-__dt__Q3_2T11a1bSFi
-T1::a::b::~b(int) static
-#
---format=hp
-put__Q3_2T11a1bSFi
-T1::a::b::put(int) static
-#
---format=hp
-get__Q2_2T11aSFv
-T1::a::get(void) static
-#
---format=hp
-put__2T1SFi
-T1::put(int) static
-#
---format=hp
-put__Q5_2T11a1b1c1dSFi
-T1::a::b::c::d::put(int) static
-#
---format=hp
-get__Q4_2T11a1b1cSFv
-T1::a::b::c::get(void) static
-#
---format=hp
-put__Q2_2T11aSFi
-T1::a::put(int) static
-#
---format=hp
-put__Q4_2T11a1b1cSFi
-T1::a::b::c::put(int) static
-#
---format=hp
-get__Q3_2T11a1bSFv
-T1::a::b::get(void) static
-#
---format=hp
-get__2T1SFv
-T1::get(void) static
-#
---format=hp
-get__Q5_2T11a1b1c1dSFv
-T1::a::b::c::d::get(void) static
-#
---format=hp
-bar__3fooFPv
-foo::bar(void *)
-#
---format=hp
-bar__3fooCFPv
-foo::bar(void *) const
-#
---format=hp
-__eq__3fooFR3foo
-foo::operator==(foo &)
-#
---format=hp
-__eq__3fooCFR3foo
-foo::operator==(foo &) const
-#
---format=hp
-bar__3fooFiT16FooBar
-foo::bar(int, int, FooBar)
-#
---format=hp
-bar__3fooFPiN51PdN37PcN211T1iN215
-foo::bar(int *, int *, int *, int *, int *, int *, double *, double *, double *, double *, char *, char *, char *, int *, int, int, int)
-#
---format=hp
-__dt__2T5XTPFiPPdPv_i__Fv
-T5<int (*)(int, double **, void *)>::~T5(void)
-#
---format=hp
-__ct__1cFi
-c::c(int)
-#
---format=hp
-__dt__2T5XTi__Fv
-T5<int>::~T5(void)
-#
---format=hp
-__dt__2T5XTc__Fv
-T5<char>::~T5(void)
-#
---format=hp
-__ct__2T2Fi
-T2::T2(int)
-#
---format=hp
-__dt__2T1Fv
-T1::~T1(void)
-#
---format=hp
-__dt__2T5XT1x__Fv
-T5<x>::~T5(void)
-#
---format=hp
-__dt__2T5XTPFcPv_i__Fv
-T5<int (*)(char, void *)>::~T5(void)
-#
---format=hp
-__ct__2T5XTPFiPPdPv_i__Fi
-T5<int (*)(int, double **, void *)>::T5(int)
-#
---format=hp
-__dl__2T5XT1x__SFPv
-T5<x>::operator delete(void *) static
-#
---format=hp
-X__2T5XT1x
-T5<x>::X
-#
---format=hp
-__ct__2T5XTi__Fi
-T5<int>::T5(int)
-#
---format=hp
-__ct__2T5XTc__Fi
-T5<char>::T5(int)
-#
---format=hp
-__dl__2T5XTPFcPv_i__SFPv
-T5<int (*)(char, void *)>::operator delete(void *) static
-#
---format=hp
-X__2T5XTPFcPv_i
-T5<int (*)(char, void *)>::X
-#
---format=hp
-__ct__2T5XT1x__Fi
-T5<x>::T5(int)
-#
---format=hp
-__dl__2T5XTPFiPPdPv_i__SFPv
-T5<int (*)(int, double **, void *)>::operator delete(void *) static
-#
---format=hp
-X__2T5XTPFiPPdPv_i
-T5<int (*)(int, double **, void *)>::X
-#
---format=hp
-__dl__2T5XTi__SFPv
-T5<int>::operator delete(void *) static
-#
---format=hp
-__dl__2T5XTc__SFPv
-T5<char>::operator delete(void *) static
-#
---format=hp
-X__2T5XTc
-T5<char>::X
-#
---format=hp
-X__2T5XTi
-T5<int>::X
-#
---format=hp
-__ct__2T5XTPFcPv_i__Fi
-T5<int (*)(char, void *)>::T5(int)
-#
---format=hp
-__dt__2T1XTc__Fv
-T1<char>::~T1(void)
-#
---format=hp
-__dt__2T1XT1t__Fv
-T1<t>::~T1(void)
-#
---format=hp
-__dl__2T1XT1t__SFPv
-T1<t>::operator delete(void *) static
-#
---format=hp
-__ct__2T1XTc__Fi
-T1<char>::T1(int)
-#
---format=hp
-__ct__2T1XTc__Fv
-T1<char>::T1(void)
-#
---format=hp
-__ct__2T1XT1t__Fi
-T1<t>::T1(int)
-#
---format=hp
-__ct__2T1XT1t__Fv
-T1<t>::T1(void)
-#
---format=hp
-__dl__2T1XTc__SFPv
-T1<char>::operator delete(void *) static
-#
---format=hp
-elem__6vectorXTd__Fi
-vector<double>::elem(int)
-#
---format=hp
-elem__6vectorXTi__Fi
-vector<int>::elem(int)
-#
---format=hp
-__ct__6vectorXTd__Fi
-vector<double>::vector(int)
-#
---format=hp
-__ct__6vectorXTi__Fi
-vector<int>::vector(int)
-#
---format=hp
-__ct__9DListNodeXTR6RLabel__FR6RLabelP9DListNodeXTR6RLabel_T2
-DListNode<RLabel &>::DListNode(RLabel &, DListNode<RLabel &> *, DListNode<RLabel &> *)
-#
---format=hp
-elem__6vectorXTiUP34__Fi
-vector<int,34U>::elem(int)
-#
---format=hp
-elem__6vectorXUP2701Td__Fi
-vector<2701U,double>::elem(int)
-#
---format=hp
-elem__6vectorXTiSP334__Fi
-vector<int,334>::elem(int)
-#
---format=hp
-elem__6vectorXTiSN67__Fi
-vector<int,-67>::elem(int)
-#
---format=hp
-elem__6vectorXTiSM__SCFPPd
-vector<int,-2147483648>::elem(double **) static const
-#
---format=hp
-elem__6vectorXTiSN67UP4000TRs__Fi
-vector<int,-67,4000U,short &>::elem(int)
-#
---format=hp
-elem__6vectorXTiSN67TRdTFPv_i__Fi
-vector<int,-67,double &,int (void *)>::elem(int)
-#
---format=hp
-X__6vectorXTiSN67TdTPvUP5TRs
-vector<int,-67,double,void *,5U,short &>::X
-#
---format=hp
-elem__6vectorXTiA3foo__Fi
-vector<int,&foo>::elem(int)
-#
---format=hp
-elem__6vectorXTiA3fooTPvA5Label__FiPPvT2
-vector<int,&foo,void *,&Label>::elem(int, void **, void **)
-#
---format=hp
-elem__6vectorXTiSN42A3foo__Fi
-vector<int,-42,&foo>::elem(int)
-#
---format=hp
-__ct__2T5XTPFcPv_i__Fi_2
-T5<int (*)(char, void *)>::T5(int)
-#
---format=hp
-__ct__2T5XTPFcPv_i__Fi_19
-T5<int (*)(char, void *)>::T5(int)
-#
---format=hp
-f__FicdPcPFci_v_34
-f(int, char, double, char *, void (*)(char, int))
-#
---format=hp
-spec__13Spec<#1,#1.*>XTiTPi_FPi
-Spec<int,int *>::spec(int *)
-#
---format=hp
-spec__16Spec<#1,#1.&,#1>XTiTRiTi_FPi
-Spec<int,int &,int>::spec(int *)
-#
---format=hp
-add__XTc_FcT1
-add<char>(char, char)
-#
---format=hp
-add__XTcSP9A5label_FcPPlT1
-add<char,9,&label>(char, long **, char)
-#
---format=hp
-add__XTPfTFPd_f_FcT1
-add<float *,float (double *)>(char, char)
-#
---format=hp
-unLink__12basic_stringXTcT18string_char_traitsXTc_T9allocator_Fv
-basic_string<char,string_char_traits<char>,allocator>::unLink(void)
-#
-# A regression test with no args. This used to cause a segv.
-
-_Utf390_1__1_9223372036854775807__9223372036854775
-_Utf390_1__1_9223372036854775807__9223372036854775
-#
---format=gnu
-call__H1Z4Test_RX01_t1C2ZX01PMX01FPX01i_vQ2X016output
-C<Test, Test::output> call<Test>(Test &)
-#
---format=gnu
-fn__FPQ21n1cPMQ21n1cFPQ21n1c_i
-fn(n::c *, int (n::c::*)(n::c *))
-#
---format=gnu
-f__FGt3Bar1i2G1i
-f(Bar<2>, i)
-#
---format=gnu
-f__FGt3Bar1i21i
-f(Bar<21>, int)
-#
---format=gnu
-f__FGt3Bar1i2G4XY_t
-f(Bar<2>, XY_t)
-#
---format=gnu
-foo__H1Zt2TA2ZRCiZt2NA1Ui9_X01_i
-int foo<TA<int const &, NA<9> > >(TA<int const &, NA<9> >)
-#
---format=gnu
-foo__H1Zt2TA2ZcZt2NA1Ui20_X01_i
-int foo<TA<char, NA<20> > >(TA<char, NA<20> >)
-#
---format=gnu
-foo__H1Zt2TA2ZiZt8N___A___1Ui99_X01_i
-int foo<TA<int, N___A___<99> > >(TA<int, N___A___<99> >)
-#
---format=gnu
-foo__H1Zt2TA2ZRCiZt2NA1im1_X01_i
-int foo<TA<int const &, NA<-1> > >(TA<int const &, NA<-1> >)
-#
---format=gnu
-foo__H1Zt2TA2ZRCiZt2NA1im9_X01_i
-int foo<TA<int const &, NA<-9> > >(TA<int const &, NA<-9> >)
-#
---format=gnu
-foo__H1Zt2TA2ZcZt2NA1i_m20__X01_i
-int foo<TA<char, NA<-20> > >(TA<char, NA<-20> >)
-#
---format=gnu
-foo__H1Zt2TA2ZcZt2NA1im1_X01_i
-int foo<TA<char, NA<-1> > >(TA<char, NA<-1> >)
-#
---format=gnu
-foo__H1Zt2TA2ZiZt4N__A1im9_X01_i
-int foo<TA<int, N__A<-9> > >(TA<int, N__A<-9> >)
-#
---format=gnu
-foo__H1Zt2TA2ZiZt4N__A1i_m99__X01_i
-int foo<TA<int, N__A<-99> > >(TA<int, N__A<-99> >)
-#
---format=gnu
-__opi__t2TA2ZiZt4N__A1i9
-TA<int, N__A<9> >::operator int(void)
-#
---format=gnu
-__opi__t2TA2ZiZt8N___A___1i_m99_
-TA<int, N___A___<-99> >::operator int(void)
-#
---format=gnu
-foo___bar__baz_____H1Zt2TA2ZiZt8N___A___1i99_X01_i
-int foo___bar__baz___<TA<int, N___A___<99> > >(TA<int, N___A___<99> >)
-#
---format=gnu
-foo__bar___foobar_____t2TA2ZiZt8N___A___1i_m99_
-TA<int, N___A___<-99> >::foo__bar___foobar___(void)
-#
---format=gnu
-foo__bar___foobar_____t2TA2ZiZt4N__A1i9
-TA<int, N__A<9> >::foo__bar___foobar___(void)
-#
---format=gnu
-__tfP8sockaddr
-sockaddr * type_info function
-#
---format=gnu
-__tfPQ25libcwt16option_event_tct1Z12burst_app_ct
-libcw::option_event_tct<burst_app_ct> * type_info function
-#
---format=gnu
-__tiP8sockaddr
-sockaddr * type_info node
-#
---format=gnu
-__tiPQ25libcwt16option_event_tct1Z12burst_app_ct
-libcw::option_event_tct<burst_app_ct> * type_info node
-#
---format=gnu
-_27_GLOBAL_.N.__12burst_app_ct.app_instance
-{anonymous}::app_instance
-#
---format=gnu
-_26_GLOBAL_$N$_tmp_n.iilg4Gya$app_instance
-{anonymous}::app_instance
-#
---format=java
-_ZN4java3awt10ScrollPane7addImplEPNS0_9ComponentEPNS_4lang6ObjectEi
-java.awt.ScrollPane.addImpl(java.awt.Component, java.lang.Object, int)
-#
---format=java
-_ZN4java3awt4geom15AffineTransform9getMatrixEP6JArrayIdE
-java.awt.geom.AffineTransform.getMatrix(double[])
-#
---format=java
-_ZN23Mangle$Inner$InnerInner3fooEP6JArrayIPS0_IiEEdPS0_IPS0_IPS0_IPS0_IPN4java4lang6StringEEEEEPS0_IPS0_IPN6MangleEEE
-Mangle$Inner$InnerInner.foo(int[][], double, java.lang.String[][][][], Mangle[][])
-#
---format=java
-_ZN6JArray1tEP6JArrayIPS_E
-JArray.t(JArray[])
-#
---format=java
-_ZN4Prim1iEibcdfwPN4java4lang6StringEsx
-Prim.i(int, boolean, byte, double, float, char, java.lang.String, short, long)
-#
---format=java
-_ZN4java4util14Map__U24_Entry11class__U24_E
-java.util.Map$Entry.class$
-#
---format=hp
-_Utf58_0_1__1_2147483647__2147483648
-_Utf58_0_1__1_2147483647__2147483648
-#
---format=gnu-v3
-St9bad_alloc
-std::bad_alloc
-#
-# This caused an infinite loop.
-# We still don't demangle this correctly, but at least we don't hang.
---format=auto
-__CPR212____ct__Q3_3std141list__tm__128_Q2_3edm41THandle__tm__26_Q2_4emid15EMparticleChunkQ2_3std68allocator__tm__51_Q2_3edmJ37J14const_iteratorFRCQ3_3std18list__tm__7_Z1ZZ2Z8iterator
-_Z1ZZ2Z::__CPR212____ct__Q3_3std141list__tm__128_Q2_3edm41THandle__tm__26_Q2_4emid15EMparticleChunkQ2_3std68allocator__tm__51_Q2_3edmJ37J14const_iteratorFRCQ3_3std18list__tm(iterator)
diff --git a/libiberty/testsuite/test-demangle.c b/libiberty/testsuite/test-demangle.c
deleted file mode 100644
index 82f263e..0000000
--- a/libiberty/testsuite/test-demangle.c
+++ /dev/null
@@ -1,175 +0,0 @@
-/* Demangler test program,
- Copyright (C) 2002 Free Software Foundation, Inc.
- Written by Zack Weinberg <zack@codesourcery.com
-
- This file is part of GNU libiberty.
-
- This program is free software; you can redistribute 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.
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include "ansidecl.h"
-#include <stdio.h>
-#include "libiberty.h"
-#include "demangle.h"
-
-struct line
-{
- size_t alloced;
- char *data;
-};
-
-static unsigned int lineno;
-
-/* Safely read a single line of arbitrary length from standard input. */
-
-#define LINELEN 80
-
-static void
-getline(buf)
- struct line *buf;
-{
- char *data = buf->data;
- size_t alloc = buf->alloced;
- size_t count = 0;
- int c;
-
- if (data == 0)
- {
- data = xmalloc (LINELEN);
- alloc = LINELEN;
- }
-
- /* Skip comment lines. */
- while ((c = getchar()) == '#')
- {
- while ((c = getchar()) != EOF && c != '\n');
- lineno++;
- }
-
- /* c is the first character on the line, and it's not a comment
- line: copy this line into the buffer and return. */
- while (c != EOF && c != '\n')
- {
- if (count >= alloc)
- {
- alloc *= 2;
- data = xrealloc (data, alloc);
- }
- data[count++] = c;
- c = getchar();
- }
- lineno++;
- data[count] = '\0';
-
- buf->data = data;
- buf->alloced = alloc;
-}
-
-/* The tester operates on a data file consisting of triples of lines:
- format switch
- input to be demangled
- expected output
-
- The format switch is expected to be either the empty string, a
- line of the form --format=<name>, or just <name> by itself. */
-
-#define FORMATS "--format="
-#define FORMATL (sizeof FORMATS - 1)
-
-int
-main(argc, argv)
- int argc;
- char **argv;
-{
- enum demangling_styles style;
- struct line format;
- struct line input;
- struct line expect;
- char *fstyle;
- char *result;
- int failures = 0;
- int tests = 0;
-
- if (argc > 1)
- {
- fprintf (stderr, "usage: %s < test-set\n", argv[0]);
- return 2;
- }
-
- format.data = 0;
- input.data = 0;
- expect.data = 0;
-
- for (;;)
- {
- getline (&format);
- if (feof (stdin))
- break;
-
- getline (&input);
- getline (&expect);
-
- tests++;
-
- fstyle = format.data;
- if (!strncmp (fstyle, FORMATS, FORMATL))
- fstyle += FORMATL;
-
- if (fstyle[0] == '\0')
- style = auto_demangling;
- else
- style = cplus_demangle_name_to_style (fstyle);
-
- if (style == unknown_demangling)
- {
- printf ("FAIL at line %d: unknown demangling style %s\n",
- lineno, fstyle);
- failures++;
- continue;
- }
-
- cplus_demangle_set_style (style);
-
- result = cplus_demangle (input.data,
- DMGL_PARAMS|DMGL_ANSI|DMGL_VERBOSE|DMGL_TYPES);
-
- if (result
- ? strcmp (result, expect.data)
- : strcmp (input.data, expect.data))
- {
- printf ("\
-FAIL at line %d, style %s:\n\
-in: %s\n\
-out: %s\n\
-exp: %s\n",
- lineno, fstyle,
- input.data,
- result,
- expect.data);
- failures++;
- }
- free (result);
- }
-
- free (format.data);
- free (input.data);
- free (expect.data);
-
- printf ("%s: %d tests, %d failures\n", argv[0], tests, failures);
- return failures ? 1 : 0;
-}
diff --git a/libiberty/tmpnam.c b/libiberty/tmpnam.c
deleted file mode 100644
index 406878c..0000000
--- a/libiberty/tmpnam.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-
-@deftypefn Supplemental char* tmpnam (char *@var{s})
-
-This function attempts to create a name for a temporary file, which
-will be a valid file name yet not exist when @code{tmpnam} checks for
-it. @var{s} must point to a buffer of at least @code{L_tmpnam} bytes,
-or be @code{NULL}. Use of this function creates a security risk, and it must
-not be used in new projects. Use @code{mkstemp} instead.
-
-@end deftypefn
-
-*/
-
-#include <stdio.h>
-
-#ifndef L_tmpnam
-#define L_tmpnam 100
-#endif
-#ifndef P_tmpdir
-#define P_tmpdir "/usr/tmp"
-#endif
-
-static char tmpnam_buffer[L_tmpnam];
-static int tmpnam_counter;
-
-extern int getpid ();
-
-char *
-tmpnam (s)
- char *s;
-{
- int pid = getpid ();
-
- if (s == NULL)
- s = tmpnam_buffer;
-
- /* Generate the filename and make sure that there isn't one called
- it already. */
-
- while (1)
- {
- FILE *f;
- sprintf (s, "%s/%s%x.%x", P_tmpdir, "t", pid, tmpnam_counter);
- f = fopen (s, "r");
- if (f == NULL)
- break;
- tmpnam_counter++;
- fclose (f);
- }
-
- return s;
-}
diff --git a/libiberty/vasprintf.c b/libiberty/vasprintf.c
deleted file mode 100644
index aa20e5b..0000000
--- a/libiberty/vasprintf.c
+++ /dev/null
@@ -1,195 +0,0 @@
-/* Like vsprintf but provides a pointer to malloc'd storage, which must
- be freed by the caller.
- Copyright (C) 1994 Free Software Foundation, Inc.
-
-This file is part of the libiberty library.
-Libiberty is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public
-License as published by the Free Software Foundation; either
-version 2 of the License, or (at your option) any later version.
-
-Libiberty is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with libiberty; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include <ansidecl.h>
-#ifdef ANSI_PROTOTYPES
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-#include <stdio.h>
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#else
-extern unsigned long strtoul ();
-extern PTR malloc ();
-#endif
-#include "libiberty.h"
-
-#ifdef TEST
-int global_total_width;
-#endif
-
-/*
-
-@deftypefn Extension int vasprintf (char **@var{resptr}, const char *@var{format}, va_list @var{args})
-
-Like @code{vsprintf}, but instead of passing a pointer to a buffer,
-you pass a pointer to a pointer. This function will compute the size
-of the buffer needed, allocate memory with @code{malloc}, and store a
-pointer to the allocated memory in @code{*@var{resptr}}. The value
-returned is the same as @code{vsprintf} would return. If memory could
-not be allocated, zero is returned and @code{NULL} is stored in
-@code{*@var{resptr}}.
-
-@end deftypefn
-
-*/
-
-static int int_vasprintf PARAMS ((char **, const char *, va_list *));
-
-static int
-int_vasprintf (result, format, args)
- char **result;
- const char *format;
- va_list *args;
-{
- const char *p = format;
- /* Add one to make sure that it is never zero, which might cause malloc
- to return NULL. */
- int total_width = strlen (format) + 1;
- va_list ap;
-
- memcpy ((PTR) &ap, (PTR) args, sizeof (va_list));
-
- while (*p != '\0')
- {
- if (*p++ == '%')
- {
- while (strchr ("-+ #0", *p))
- ++p;
- if (*p == '*')
- {
- ++p;
- total_width += abs (va_arg (ap, int));
- }
- else
- total_width += strtoul (p, (char **) &p, 10);
- if (*p == '.')
- {
- ++p;
- if (*p == '*')
- {
- ++p;
- total_width += abs (va_arg (ap, int));
- }
- else
- total_width += strtoul (p, (char **) &p, 10);
- }
- while (strchr ("hlL", *p))
- ++p;
- /* Should be big enough for any format specifier except %s and floats. */
- total_width += 30;
- switch (*p)
- {
- case 'd':
- case 'i':
- case 'o':
- case 'u':
- case 'x':
- case 'X':
- case 'c':
- (void) va_arg (ap, int);
- break;
- case 'f':
- case 'e':
- case 'E':
- case 'g':
- case 'G':
- (void) va_arg (ap, double);
- /* Since an ieee double can have an exponent of 307, we'll
- make the buffer wide enough to cover the gross case. */
- total_width += 307;
- break;
- case 's':
- total_width += strlen (va_arg (ap, char *));
- break;
- case 'p':
- case 'n':
- (void) va_arg (ap, char *);
- break;
- }
- p++;
- }
- }
-#ifdef TEST
- global_total_width = total_width;
-#endif
- *result = (char *) malloc (total_width);
- if (*result != NULL)
- return vsprintf (*result, format, *args);
- else
- return 0;
-}
-
-int
-vasprintf (result, format, args)
- char **result;
- const char *format;
-#if defined (_BSD_VA_LIST_) && defined (__FreeBSD__)
- _BSD_VA_LIST_ args;
-#else
- va_list args;
-#endif
-{
- return int_vasprintf (result, format, &args);
-}
-
-#ifdef TEST
-static void ATTRIBUTE_PRINTF_1
-checkit VPARAMS ((const char *format, ...))
-{
- char *result;
- VA_OPEN (args, format);
- VA_FIXEDARG (args, const char *, format);
- vasprintf (&result, format, args);
- VA_CLOSE (args);
-
- if (strlen (result) < (size_t) global_total_width)
- printf ("PASS: ");
- else
- printf ("FAIL: ");
- printf ("%d %s\n", global_total_width, result);
-
- free (result);
-}
-
-extern int main PARAMS ((void));
-
-int
-main ()
-{
- checkit ("%d", 0x12345678);
- checkit ("%200d", 5);
- checkit ("%.300d", 6);
- checkit ("%100.150d", 7);
- checkit ("%s", "jjjjjjjjjiiiiiiiiiiiiiiioooooooooooooooooppppppppppppaa\n\
-777777777777777777333333333333366666666666622222222222777777777777733333");
- checkit ("%f%s%d%s", 1.0, "foo", 77, "asdjffffffffffffffiiiiiiiiiiixxxxx");
-
- return 0;
-}
-#endif /* TEST */
diff --git a/libiberty/vfork.c b/libiberty/vfork.c
deleted file mode 100644
index 4aa5c21..0000000
--- a/libiberty/vfork.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Emulate vfork using just plain fork, for systems without a real vfork.
- This function is in the public domain. */
-
-/*
-
-@deftypefn Supplemental int vfork (void)
-
-Emulates @code{vfork} by calling @code{fork} and returning its value.
-
-@end deftypefn
-
-*/
-
-#include "ansidecl.h"
-
-extern int fork PARAMS ((void));
-
-int
-vfork ()
-{
- return (fork ());
-}
diff --git a/libiberty/vfprintf.c b/libiberty/vfprintf.c
deleted file mode 100644
index db7b2ff..0000000
--- a/libiberty/vfprintf.c
+++ /dev/null
@@ -1,21 +0,0 @@
-/* Provide a version vfprintf in terms of _doprnt.
- By Kaveh Ghazi (ghazi@caip.rutgers.edu) 3/29/98
- Copyright (C) 1998 Free Software Foundation, Inc.
- */
-
-#ifdef __STDC__
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-#include <stdio.h>
-#undef vfprintf
-
-int
-vfprintf (stream, format, ap)
- FILE * stream;
- const char * format;
- va_list ap;
-{
- return _doprnt (format, ap, stream);
-}
diff --git a/libiberty/vmsbuild.com b/libiberty/vmsbuild.com
deleted file mode 100644
index 497ea89..0000000
--- a/libiberty/vmsbuild.com
+++ /dev/null
@@ -1,165 +0,0 @@
-$! libiberty/vmsbuild.com -- build liberty.olb for VMS host, VMS target
-$!
-$ CC = "gcc /noVerbose/Debug/Incl=([],[-.include])"
-$ LIBR = "library /Obj"
-$ LINK = "link"
-$ DELETE= "delete /noConfirm"
-$ SEARCH= "search /Exact"
-$ ECHO = "write sys$output"
-$ ABORT = "exit %x002C"
-$!
-$ LIB_NAME = "liberty.olb" !this is what we're going to construct
-$ WORK_LIB = "new-lib.olb" !used to guard against an incomplete build
-$
-$! manually copied from Makefile.in
-$ REQUIRED_OFILES = "argv.o basename.o choose-temp.o concat.o cplus-dem.o "-
- + "fdmatch.o fnmatch.o getopt.o getopt1.o getruntime.o hex.o "-
- + "floatformat.o objalloc.o obstack.o spaces.o strerror.o strsignal.o "-
- + "xatexit.o xexit.o xmalloc.o xmemdup.o xstrdup.o xstrerror.o"
-$! anything not caught by link+search of dummy.* should be added here
-$ EXTRA_OFILES = ""
-$!
-$! move to the directory which contains this command procedure
-$ old_dir = f$environ("DEFAULT")
-$ new_dir = f$parse("_._;",f$environ("PROCEDURE")) - "_._;"
-$ set default 'new_dir'
-$
-$ ECHO "Starting libiberty build..."
-$ create config.h
-/* libiberty config.h for VMS */
-#define NEED_sys_siglist
-#define NEED_strsignal
-#define NEED_psignal
-#define NEED_basename
-$ LIBR 'WORK_LIB' /Create
-$
-$! first pass: compile "required" modules
-$ ofiles = REQUIRED_OFILES + " " + EXTRA_OFILES
-$ pass = 1
-$ gosub do_ofiles
-$
-$! second pass: process dummy.c, using the first pass' results
-$ ECHO " now checking run-time library for missing functionality"
-$ if f$search("dummy.obj").nes."" then DELETE dummy.obj;*
-$ define/noLog sys$error _NL: !can't use /User_Mode here due to gcc
-$ define/noLog sys$output _NL: ! driver's use of multiple image activation
-$ on error then continue
-$ 'CC' dummy.c
-$ deassign sys$error !restore, more or less
-$ deassign sys$output
-$ if f$search("dummy.obj").eqs."" then goto pass2_failure1
-$! link dummy.obj, capturing full linker feedback in dummy.map
-$ oldmsg = f$environ("MESSAGE")
-$ set message /Facility/Severity/Identification/Text
-$ define/User sys$output _NL:
-$ define/User sys$error _NL:
-$ LINK/Map=dummy.map/noExe dummy.obj,'WORK_LIB'/Libr,-
- gnu_cc:[000000]gcclib.olb/Libr,sys$library:vaxcrtl.olb/Libr
-$ set message 'oldmsg'
-$ if f$search("dummy.map").eqs."" then goto pass2_failure2
-$ DELETE dummy.obj;*
-$ SEARCH dummy.map "%LINK-I-UDFSYM" /Output=dummy.list
-$ DELETE dummy.map;*
-$ ECHO " check completed"
-$! we now have a file with one entry per line of unresolvable symbols
-$ ofiles = ""
-$ if f$trnlnm("IFILE$").nes."" then close/noLog ifile$
-$ open/Read ifile$ dummy.list
-$iloop: read/End=idone ifile$ iline
-$ iline = f$edit(iline,"COMPRESS,TRIM,LOWERCASE")
-$ ofiles = ofiles + " " + f$element(1," ",iline) + ".o"
-$ goto iloop
-$idone: close ifile$
-$ DELETE dummy.list;*
-$ on error then ABORT
-$
-$! third pass: compile "missing" modules collected in pass 2
-$ pass = 3
-$ gosub do_ofiles
-$
-$! finish up
-$ LIBR 'WORK_LIB' /Compress /Output='LIB_NAME' !new-lib.olb -> liberty.olb
-$ DELETE 'WORK_LIB';*
-$
-$! all done
-$ ECHO "Completed libiberty build."
-$ type sys$input:
-
- You many wish to do
- $ COPY LIBERTY.OLB GNU_CC:[000000]
- so that this run-time library resides in the same location as gcc's
- support library. When building gas, be sure to leave the original
- copy of liberty.olb here so that gas's build procedure can find it.
-
-$ set default 'old_dir'
-$ exit
-$
-$!
-$! compile each element of the space-delimited list 'ofiles'
-$!
-$do_ofiles:
-$ ofiles = f$edit(ofiles,"COMPRESS,TRIM")
-$ i = 0
-$oloop:
-$ f = f$element(i," ",ofiles)
-$ if f.eqs." " then goto odone
-$ f = f - ".o" !strip dummy suffix
-$ ECHO " ''f'"
-$ skip_f = 0
-$ if pass.eq.3 .and. f$search("''f'.c").eqs."" then gosub chk_deffunc
-$ if .not.skip_f
-$ then
-$ 'CC' 'f'.c
-$ LIBR 'WORK_LIB' 'f'.obj /Insert
-$ DELETE 'f'.obj;*
-$ endif
-$ i = i + 1
-$ goto oloop
-$odone:
-$ return
-$
-$!
-$! check functions.def for a DEFFUNC() entry corresponding to missing file 'f'.c
-$!
-$chk_deffunc:
-$ define/User sys$output _NL:
-$ define/User sys$error _NL:
-$ SEARCH functions.def "DEFFUNC","''f'" /Match=AND
-$ if (($status.and.%x7FFFFFFF) .eq. 1)
-$ then
-$ skip_f = 1
-$ open/Append config_h config.h
-$ write config_h "#define NEED_''f'"
-$ close config_h
-$ endif
-$ return
-$
-$!
-$pass2_failure1:
-$! if we reach here, dummy.c failed to compile and we're really stuck
-$ type sys$input:
-
- Cannot compile the library contents checker (dummy.c + functions.def),
- so cannot continue!
-
-$! attempt the compile again, without suppressing diagnostic messages this time
-$ on error then ABORT +0*f$verify(v)
-$ v = f$verify(1)
-$ 'CC' dummy.c
-$ ABORT +0*f$verify(v) !'f$verify(0)'
-$!
-$pass2_failure2:
-$! should never reach here..
-$ type sys$input:
-
- Cannot link the library contents checker (dummy.obj), so cannot continue!
-
-$! attempt the link again, without suppressing diagnostic messages this time
-$ on error then ABORT +0*f$verify(v)
-$ v = f$verify(1)
-$ LINK/Map=dummy.map/noExe dummy.obj,'WORK_LIB'/Libr,-
- gnu_cc:[000000]gcclib.olb/Libr,sys$library:vaxcrtl.olb/Libr
-$ ABORT +0*f$verify(v) !'f$verify(0)'
-$
-$! not reached
-$ exit
diff --git a/libiberty/vprintf.c b/libiberty/vprintf.c
deleted file mode 100644
index c57c3e4..0000000
--- a/libiberty/vprintf.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
-
-@deftypefn Supplemental int vprintf (const char *@var{format}, va_list @var{ap})
-@deftypefnx Supplemental int vfprintf (FILE *@var{stream}, const char *@var{format}, va_list @var{ap})
-@deftypefnx Supplemental int vsprintf (char *@var{str}, const char *@var{format}, va_list @var{ap})
-
-These functions are the same as @code{printf}, @code{fprintf}, and
-@code{sprintf}, respectively, except that they are called with a
-@code{va_list} instead of a variable number of arguments. Note that
-they do not call @code{va_end}; this is the application's
-responsibility. In @libib{} they are implemented in terms of the
-nonstandard but common function @code{_doprnt}.
-
-@end deftypefn
-
-*/
-
-#ifdef __STDC__
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-#include <stdio.h>
-#include <ansidecl.h>
-#undef vprintf
-int
-vprintf (format, ap)
- const char *format;
- va_list ap;
-{
- return vfprintf (stdout, format, ap);
-}
diff --git a/libiberty/vsprintf.c b/libiberty/vsprintf.c
deleted file mode 100644
index b69e9bc..0000000
--- a/libiberty/vsprintf.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/* Simple implementation of vsprintf for systems without it.
- Highly system-dependent, but should work on most "traditional"
- implementations of stdio; newer ones should already have vsprintf.
- Written by Per Bothner of Cygnus Support.
- Based on libg++'s "form" (written by Doug Lea; dl@rocky.oswego.edu).
- Copyright (C) 1991, 1995, 2002 Free Software Foundation, Inc.
-
-This file is part of the libiberty 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.
-
-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.
-
-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.
-
-As a special exception, if you link this library with files
-compiled with a GNU compiler to produce an executable, this does not 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. */
-
-#include <varargs.h>
-#include <stdio.h>
-#include <ansidecl.h>
-#undef vsprintf
-
-#if defined _IOSTRG && defined _IOWRT
-
-int
-vsprintf (buf, format, ap)
- char *buf;
- const char *format;
- va_list ap;
-{
- FILE b;
- int ret;
-#ifdef VMS
- b->_flag = _IOWRT|_IOSTRG;
- b->_ptr = buf;
- b->_cnt = 12000;
-#else
- b._flag = _IOWRT|_IOSTRG;
- b._ptr = buf;
- b._cnt = 12000;
-#endif
- ret = _doprnt(format, ap, &b);
- putc('\0', &b);
- return ret;
-
-}
-
-#endif
diff --git a/libiberty/waitpid.c b/libiberty/waitpid.c
deleted file mode 100644
index 6e31f25..0000000
--- a/libiberty/waitpid.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
-
-@deftypefn Supplemental int waitpid (int @var{pid}, int *@var{status}, int)
-
-This is a wrapper around the @code{wait} function. Any ``special''
-values of @var{pid} depend on your implementation of @code{wait}, as
-does the return value. The third argument is unused in @libib{}.
-
-@end deftypefn
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-/* On some systems (such as WindISS), you must include <sys/types.h>
- to get the definition of "pid_t" before you include <sys/wait.h>. */
-#include <sys/types.h>
-
-#ifdef HAVE_SYS_WAIT_H
-#include <sys/wait.h>
-#endif
-
-pid_t
-waitpid (pid, stat_loc, options)
- pid_t pid;
- int *stat_loc, options;
-{
- for (;;)
- {
- int wpid = wait(stat_loc);
- if (wpid == pid || wpid == -1)
- return wpid;
- }
-}
diff --git a/libiberty/xatexit.c b/libiberty/xatexit.c
deleted file mode 100644
index abf3407..0000000
--- a/libiberty/xatexit.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright (c) 1990 Regents of the University of California.
- * All rights reserved.
- *
- * %sccs.include.redist.c%
- */
-
-
-/*
-
-@deftypefun int xatexit (void (*@var{fn}) (void))
-
-Behaves as the standard @code{atexit} function, but with no limit on
-the number of registered functions. Returns 0 on success, or @minus{}1 on
-failure. If you use @code{xatexit} to register functions, you must use
-@code{xexit} to terminate your program.
-
-@end deftypefun
-
-*/
-
-/* Adapted from newlib/libc/stdlib/{,at}exit.[ch].
- If you use xatexit, you must call xexit instead of exit. */
-
-#include "ansidecl.h"
-#include "libiberty.h"
-
-#include <stdio.h>
-
-#ifdef __STDC__
-#include <stddef.h>
-#else
-#define size_t unsigned long
-#endif
-
-#if VMS
-#include <stdlib.h>
-#include <unixlib.h>
-#else
-/* For systems with larger pointers than ints, this must be declared. */
-PTR malloc PARAMS ((size_t));
-#endif
-
-static void xatexit_cleanup PARAMS ((void));
-
-/* Pointer to function run by xexit. */
-extern void (*_xexit_cleanup) PARAMS ((void));
-
-#define XATEXIT_SIZE 32
-
-struct xatexit {
- struct xatexit *next; /* next in list */
- int ind; /* next index in this table */
- void (*fns[XATEXIT_SIZE]) PARAMS ((void)); /* the table itself */
-};
-
-/* Allocate one struct statically to guarantee that we can register
- at least a few handlers. */
-static struct xatexit xatexit_first;
-
-/* Points to head of LIFO stack. */
-static struct xatexit *xatexit_head = &xatexit_first;
-
-/* Register function FN to be run by xexit.
- Return 0 if successful, -1 if not. */
-
-int
-xatexit (fn)
- void (*fn) PARAMS ((void));
-{
- register struct xatexit *p;
-
- /* Tell xexit to call xatexit_cleanup. */
- if (!_xexit_cleanup)
- _xexit_cleanup = xatexit_cleanup;
-
- p = xatexit_head;
- if (p->ind >= XATEXIT_SIZE)
- {
- if ((p = (struct xatexit *) malloc (sizeof *p)) == NULL)
- return -1;
- p->ind = 0;
- p->next = xatexit_head;
- xatexit_head = p;
- }
- p->fns[p->ind++] = fn;
- return 0;
-}
-
-/* Call any cleanup functions. */
-
-static void
-xatexit_cleanup ()
-{
- register struct xatexit *p;
- register int n;
-
- for (p = xatexit_head; p; p = p->next)
- for (n = p->ind; --n >= 0;)
- (*p->fns[n]) ();
-}
diff --git a/libiberty/xexit.c b/libiberty/xexit.c
deleted file mode 100644
index a65690f..0000000
--- a/libiberty/xexit.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/* xexit.c -- Run any exit handlers, then exit.
- Copyright (C) 1994, 95, 1997 Free Software Foundation, Inc.
-
-This file is part of the libiberty library.
-Libiberty is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public
-License as published by the Free Software Foundation; either
-version 2 of the License, or (at your option) any later version.
-
-Libiberty is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with libiberty; see the file COPYING.LIB. If not, write
-to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-/*
-
-@deftypefn Replacement void xexit (int @var{code})
-
-Terminates the program. If any functions have been registered with
-the @code{xatexit} replacement function, they will be called first.
-Termination is handled via the system's normal @code{exit} call.
-
-@end deftypefn
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include <stdio.h>
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#include "libiberty.h"
-
-
-/* This variable is set by xatexit if it is called. This way, xmalloc
- doesn't drag xatexit into the link. */
-void (*_xexit_cleanup) PARAMS ((void));
-
-void
-xexit (code)
- int code;
-{
- if (_xexit_cleanup != NULL)
- (*_xexit_cleanup) ();
- exit (code);
-}
diff --git a/libiberty/xmalloc.c b/libiberty/xmalloc.c
deleted file mode 100644
index 4c8249a..0000000
--- a/libiberty/xmalloc.c
+++ /dev/null
@@ -1,183 +0,0 @@
-/* memory allocation routines with error checking.
- Copyright 1989, 90, 91, 92, 93, 94 Free Software Foundation, Inc.
-
-This file is part of the libiberty library.
-Libiberty is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public
-License as published by the Free Software Foundation; either
-version 2 of the License, or (at your option) any later version.
-
-Libiberty is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with libiberty; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-/*
-
-@deftypefn Replacement void* xmalloc (size_t)
-
-Allocate memory without fail. If @code{malloc} fails, this will print
-a message to @code{stderr} (using the name set by
-@code{xmalloc_set_program_name},
-if any) and then call @code{xexit}. Note that it is therefore safe for
-a program to contain @code{#define malloc xmalloc} in its source.
-
-@end deftypefn
-
-@deftypefn Replacement void* xrealloc (void *@var{ptr}, size_t @var{size})
-Reallocate memory without fail. This routine functions like @code{realloc},
-but will behave the same as @code{xmalloc} if memory cannot be found.
-
-@end deftypefn
-
-@deftypefn Replacement void* xcalloc (size_t @var{nelem}, size_t @var{elsize})
-
-Allocate memory without fail, and set it to zero. This routine functions
-like @code{calloc}, but will behave the same as @code{xmalloc} if memory
-cannot be found.
-
-@end deftypefn
-
-@deftypefn Replacement void xmalloc_set_program_name (const char *@var{name})
-
-You can use this to set the name of the program used by
-@code{xmalloc_failed} when printing a failure message.
-
-@end deftypefn
-
-@deftypefn Replacement void xmalloc_failed (size_t)
-
-This function is not meant to be called by client code, and is listed
-here for completeness only. If any of the allocation routines fail, this
-function will be called to print an error message and terminate execution.
-
-@end deftypefn
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include "ansidecl.h"
-#include "libiberty.h"
-
-#include <stdio.h>
-
-#ifdef __STDC__
-#include <stddef.h>
-#else
-#define size_t unsigned long
-#define ptrdiff_t long
-#endif
-
-#if VMS
-#include <stdlib.h>
-#include <unixlib.h>
-#else
-/* For systems with larger pointers than ints, these must be declared. */
-PTR malloc PARAMS ((size_t));
-PTR realloc PARAMS ((PTR, size_t));
-PTR calloc PARAMS ((size_t, size_t));
-PTR sbrk PARAMS ((ptrdiff_t));
-#endif
-
-/* The program name if set. */
-static const char *name = "";
-
-#ifdef HAVE_SBRK
-/* The initial sbrk, set when the program name is set. Not used for win32
- ports other than cygwin32. */
-static char *first_break = NULL;
-#endif /* HAVE_SBRK */
-
-void
-xmalloc_set_program_name (s)
- const char *s;
-{
- name = s;
-#ifdef HAVE_SBRK
- /* Win32 ports other than cygwin32 don't have brk() */
- if (first_break == NULL)
- first_break = (char *) sbrk (0);
-#endif /* HAVE_SBRK */
-}
-
-void
-xmalloc_failed (size)
- size_t size;
-{
-#ifdef HAVE_SBRK
- extern char **environ;
- size_t allocated;
-
- if (first_break != NULL)
- allocated = (char *) sbrk (0) - first_break;
- else
- allocated = (char *) sbrk (0) - (char *) &environ;
- fprintf (stderr,
- "\n%s%sout of memory allocating %lu bytes after a total of %lu bytes\n",
- name, *name ? ": " : "",
- (unsigned long) size, (unsigned long) allocated);
-#else /* HAVE_SBRK */
- fprintf (stderr,
- "\n%s%sout of memory allocating %lu bytes\n",
- name, *name ? ": " : "",
- (unsigned long) size);
-#endif /* HAVE_SBRK */
- xexit (1);
-}
-
-PTR
-xmalloc (size)
- size_t size;
-{
- PTR newmem;
-
- if (size == 0)
- size = 1;
- newmem = malloc (size);
- if (!newmem)
- xmalloc_failed (size);
-
- return (newmem);
-}
-
-PTR
-xcalloc (nelem, elsize)
- size_t nelem, elsize;
-{
- PTR newmem;
-
- if (nelem == 0 || elsize == 0)
- nelem = elsize = 1;
-
- newmem = calloc (nelem, elsize);
- if (!newmem)
- xmalloc_failed (nelem * elsize);
-
- return (newmem);
-}
-
-PTR
-xrealloc (oldmem, size)
- PTR oldmem;
- size_t size;
-{
- PTR newmem;
-
- if (size == 0)
- size = 1;
- if (!oldmem)
- newmem = malloc (size);
- else
- newmem = realloc (oldmem, size);
- if (!newmem)
- xmalloc_failed (size);
-
- return (newmem);
-}
diff --git a/libiberty/xmemdup.c b/libiberty/xmemdup.c
deleted file mode 100644
index 9e9d66b..0000000
--- a/libiberty/xmemdup.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* xmemdup.c -- Duplicate a memory buffer, using xcalloc.
- This trivial function is in the public domain.
- Jeff Garzik, September 1999. */
-
-/*
-
-@deftypefn Replacement void* xmemdup (void *@var{input}, size_t @var{copy_size}, size_t @var{alloc_size})
-
-Duplicates a region of memory without fail. First, @var{alloc_size} bytes
-are allocated, then @var{copy_size} bytes from @var{input} are copied into
-it, and the new memory is returned. If fewer bytes are copied than were
-allocated, the remaining memory is zeroed.
-
-@end deftypefn
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include "ansidecl.h"
-#include "libiberty.h"
-
-#include <sys/types.h> /* For size_t. */
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-
-PTR
-xmemdup (input, copy_size, alloc_size)
- const PTR input;
- size_t copy_size;
- size_t alloc_size;
-{
- PTR output = xcalloc (1, alloc_size);
- memcpy (output, input, copy_size);
- return output;
-}
diff --git a/libiberty/xstrdup.c b/libiberty/xstrdup.c
deleted file mode 100644
index 5aa084a..0000000
--- a/libiberty/xstrdup.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* xstrdup.c -- Duplicate a string in memory, using xmalloc.
- This trivial function is in the public domain.
- Ian Lance Taylor, Cygnus Support, December 1995. */
-
-/*
-
-@deftypefn Replacement char* xstrdup (const char *@var{s})
-
-Duplicates a character string without fail, using @code{xmalloc} to
-obtain memory.
-
-@end deftypefn
-
-*/
-
-#include <sys/types.h>
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-#include "ansidecl.h"
-#include "libiberty.h"
-
-char *
-xstrdup (s)
- const char *s;
-{
- register size_t len = strlen (s) + 1;
- register char *ret = xmalloc (len);
- memcpy (ret, s, len);
- return ret;
-}
diff --git a/libiberty/xstrerror.c b/libiberty/xstrerror.c
deleted file mode 100644
index 9000d17..0000000
--- a/libiberty/xstrerror.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/* xstrerror.c -- jacket routine for more robust strerror() usage.
- Fri Jun 16 18:30:00 1995 Pat Rankin <rankin@eql.caltech.edu>
- This code is in the public domain. */
-
-/*
-
-@deftypefn Replacement char* xstrerror (int @var{errnum})
-
-Behaves exactly like the standard @code{strerror} function, but
-will never return a @code{NULL} pointer.
-
-@end deftypefn
-
-*/
-
-#include <stdio.h>
-
-#include "libiberty.h"
-#include "config.h"
-
-#ifdef VMS
-#include <errno.h>
-#if !defined (__STRICT_ANSI__) && !defined (__HIDE_FORBIDDEN_NAMES)
-extern char *strerror PARAMS ((int,...));
-#define DONT_DECLARE_STRERROR
-#endif
-#endif /* VMS */
-
-#ifndef DONT_DECLARE_STRERROR
-extern char *strerror PARAMS ((int));
-#endif
-
-/* If strerror returns NULL, we'll format the number into a static buffer. */
-
-#define ERRSTR_FMT "undocumented error #%d"
-static char xstrerror_buf[sizeof ERRSTR_FMT + 20];
-
-/* Like strerror, but result is never a null pointer. */
-
-char *
-xstrerror (errnum)
- int errnum;
-{
- char *errstr;
-#ifdef VMS
- char *(*vmslib_strerror) PARAMS ((int,...));
-
- /* Override any possibly-conflicting declaration from system header. */
- vmslib_strerror = (char *(*) PARAMS ((int,...))) strerror;
- /* Second argument matters iff first is EVMSERR, but it's simpler to
- pass it unconditionally. `vaxc$errno' is declared in <errno.h>
- and maintained by the run-time library in parallel to `errno'.
- We assume that `errnum' corresponds to the last value assigned to
- errno by the run-time library, hence vaxc$errno will be relevant. */
- errstr = (*vmslib_strerror) (errnum, vaxc$errno);
-#else
- errstr = strerror (errnum);
-#endif
-
- /* If `errnum' is out of range, result might be NULL. We'll fix that. */
- if (!errstr)
- {
- sprintf (xstrerror_buf, ERRSTR_FMT, errnum);
- errstr = xstrerror_buf;
- }
- return errstr;
-}