diff --git a/COPYING b/COPYING
index aed9b57..8647a56 100644
--- a/COPYING
+++ b/COPYING
@@ -1,37 +1,20 @@
-This document governs the GNUstep Objective-C runtime. This is based on the
-GCC Objective-C runtime, which is governed by version 3 of the GNU General
-Public License and on the Étoilé Objective-C 2 framework and Objective-C
-runtime, which are MIT licensed.
+Copyright (c) 2009 David Chisnall
-As a result of this dual inheritance, some portions of this library are more
-permissively licensed than the whole. When viewed in aggregate, this library
-is licensed under the GNU General Public Licence, version 3 or later (at your
-option). You may find the relevant license texts in full in the following
-files in this distribution:
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
-COPYING3 contains the GNU general public license version 3.
-COPYING.RUNTIME contains the GCC runtime exemption to the GNU GPL.
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
-Some individual files retain their original MIT license. These are:
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
-blocks_runtime.m
-class_table.c
-hash_table.h
-ivar.c
-lock.h
-mutation.m
-pool.h
-runtime.c
-string_hash.c
-sync.m
-objc/blocks_runtime.h
-objc/runtime.h
-NSBlocks.m
-
-All of the private headers (those not in the objc/ directory) are also covered
-by the MIT license, in as far as they are covered by copyright law.
-
-These files may be used for any purpose, including binary-only redistribution,
-according to the terms of the MIT license, as long as their copyright notices
-remain intact. You may find the full text of the license for these files in
-COPYING.MIT
diff --git a/COPYING.MIT b/COPYING.MIT
deleted file mode 100644
index 8647a56..0000000
--- a/COPYING.MIT
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright (c) 2009 David Chisnall
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
diff --git a/COPYING.RUNTIME b/COPYING.RUNTIME
deleted file mode 100644
index e1b3c69..0000000
--- a/COPYING.RUNTIME
+++ /dev/null
@@ -1,73 +0,0 @@
-GCC RUNTIME LIBRARY EXCEPTION
-
-Version 3.1, 31 March 2009
-
-Copyright (C) 2009 Free Software Foundation, Inc.
-
-Everyone is permitted to copy and distribute verbatim copies of this
-license document, but changing it is not allowed.
-
-This GCC Runtime Library Exception ("Exception") is an additional
-permission under section 7 of the GNU General Public License, version
-3 ("GPLv3"). It applies to a given file (the "Runtime Library") that
-bears a notice placed by the copyright holder of the file stating that
-the file is governed by GPLv3 along with this Exception.
-
-When you use GCC to compile a program, GCC may combine portions of
-certain GCC header files and runtime libraries with the compiled
-program. The purpose of this Exception is to allow compilation of
-non-GPL (including proprietary) programs to use, in this way, the
-header files and runtime libraries covered by this Exception.
-
-0. Definitions.
-
-A file is an "Independent Module" if it either requires the Runtime
-Library for execution after a Compilation Process, or makes use of an
-interface provided by the Runtime Library, but is not otherwise based
-on the Runtime Library.
-
-"GCC" means a version of the GNU Compiler Collection, with or without
-modifications, governed by version 3 (or a specified later version) of
-the GNU General Public License (GPL) with the option of using any
-subsequent versions published by the FSF.
-
-"GPL-compatible Software" is software whose conditions of propagation,
-modification and use would permit combination with GCC in accord with
-the license of GCC.
-
-"Target Code" refers to output from any compiler for a real or virtual
-target processor architecture, in executable form or suitable for
-input to an assembler, loader, linker and/or execution
-phase. Notwithstanding that, Target Code does not include data in any
-format that is used as a compiler intermediate representation, or used
-for producing a compiler intermediate representation.
-
-The "Compilation Process" transforms code entirely represented in
-non-intermediate languages designed for human-written code, and/or in
-Java Virtual Machine byte code, into Target Code. Thus, for example,
-use of source code generators and preprocessors need not be considered
-part of the Compilation Process, since the Compilation Process can be
-understood as starting with the output of the generators or
-preprocessors.
-
-A Compilation Process is "Eligible" if it is done using GCC, alone or
-with other GPL-compatible software, or if it is done without using any
-work based on GCC. For example, using non-GPL-compatible Software to
-optimize any GCC intermediate representations would not qualify as an
-Eligible Compilation Process.
-
-1. Grant of Additional Permission.
-
-You have permission to propagate a work of Target Code formed by
-combining the Runtime Library with Independent Modules, even if such
-propagation would otherwise violate the terms of GPLv3, provided that
-all Target Code was generated by Eligible Compilation Processes. You
-may then convey such a combination under terms of your choice,
-consistent with the licensing of the Independent Modules.
-
-2. No Weakening of GCC Copyleft.
-
-The availability of this Exception does not imply any general
-presumption that third-party software is unaffected by the copyleft
-requirements of the license of GCC.
-
diff --git a/COPYING3 b/COPYING3
deleted file mode 100644
index 94a9ed0..0000000
--- a/COPYING3
+++ /dev/null
@@ -1,674 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc.
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
- The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works. By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users. We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors. You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
- To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights. Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received. You must make sure that they, too, receive
-or can get the source code. And you must show them these terms so they
-know their rights.
-
- Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
- For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software. For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
- Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so. This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software. The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable. Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products. If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
- Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary. To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- TERMS AND CONDITIONS
-
- 0. Definitions.
-
- "This License" refers to version 3 of the GNU General Public License.
-
- "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
- "The Program" refers to any copyrightable work licensed under this
-License. Each licensee is addressed as "you". "Licensees" and
-"recipients" may be individuals or organizations.
-
- To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy. The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
- A "covered work" means either the unmodified Program or a work based
-on the Program.
-
- To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy. Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
- To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies. Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
- An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License. If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
- 1. Source Code.
-
- The "source code" for a work means the preferred form of the work
-for making modifications to it. "Object code" means any non-source
-form of a work.
-
- A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
- The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form. A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
- The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities. However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work. For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
- The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
- The Corresponding Source for a work in source code form is that
-same work.
-
- 2. Basic Permissions.
-
- All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met. This License explicitly affirms your unlimited
-permission to run the unmodified Program. The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work. This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
- You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force. You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright. Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
- Conveying under any other circumstances is permitted solely under
-the conditions stated below. Sublicensing is not allowed; section 10
-makes it unnecessary.
-
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
- No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
- When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
- 4. Conveying Verbatim Copies.
-
- You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
- You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
- 5. Conveying Modified Source Versions.
-
- You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
- a) The work must carry prominent notices stating that you modified
- it, and giving a relevant date.
-
- b) The work must carry prominent notices stating that it is
- released under this License and any conditions added under section
- 7. This requirement modifies the requirement in section 4 to
- "keep intact all notices".
-
- c) You must license the entire work, as a whole, under this
- License to anyone who comes into possession of a copy. This
- License will therefore apply, along with any applicable section 7
- additional terms, to the whole of the work, and all its parts,
- regardless of how they are packaged. This License gives no
- permission to license the work in any other way, but it does not
- invalidate such permission if you have separately received it.
-
- d) If the work has interactive user interfaces, each must display
- Appropriate Legal Notices; however, if the Program has interactive
- interfaces that do not display Appropriate Legal Notices, your
- work need not make them do so.
-
- A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit. Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
- 6. Conveying Non-Source Forms.
-
- You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
- a) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by the
- Corresponding Source fixed on a durable physical medium
- customarily used for software interchange.
-
- b) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by a
- written offer, valid for at least three years and valid for as
- long as you offer spare parts or customer support for that product
- model, to give anyone who possesses the object code either (1) a
- copy of the Corresponding Source for all the software in the
- product that is covered by this License, on a durable physical
- medium customarily used for software interchange, for a price no
- more than your reasonable cost of physically performing this
- conveying of source, or (2) access to copy the
- Corresponding Source from a network server at no charge.
-
- c) Convey individual copies of the object code with a copy of the
- written offer to provide the Corresponding Source. This
- alternative is allowed only occasionally and noncommercially, and
- only if you received the object code with such an offer, in accord
- with subsection 6b.
-
- d) Convey the object code by offering access from a designated
- place (gratis or for a charge), and offer equivalent access to the
- Corresponding Source in the same way through the same place at no
- further charge. You need not require recipients to copy the
- Corresponding Source along with the object code. If the place to
- copy the object code is a network server, the Corresponding Source
- may be on a different server (operated by you or a third party)
- that supports equivalent copying facilities, provided you maintain
- clear directions next to the object code saying where to find the
- Corresponding Source. Regardless of what server hosts the
- Corresponding Source, you remain obligated to ensure that it is
- available for as long as needed to satisfy these requirements.
-
- e) Convey the object code using peer-to-peer transmission, provided
- you inform other peers where the object code and Corresponding
- Source of the work are being offered to the general public at no
- charge under subsection 6d.
-
- A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
- A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling. In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage. For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product. A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
- "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source. The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
- If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information. But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
- The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed. Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
- Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
- 7. Additional Terms.
-
- "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law. If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
- When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it. (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.) You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
- Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
- a) Disclaiming warranty or limiting liability differently from the
- terms of sections 15 and 16 of this License; or
-
- b) Requiring preservation of specified reasonable legal notices or
- author attributions in that material or in the Appropriate Legal
- Notices displayed by works containing it; or
-
- c) Prohibiting misrepresentation of the origin of that material, or
- requiring that modified versions of such material be marked in
- reasonable ways as different from the original version; or
-
- d) Limiting the use for publicity purposes of names of licensors or
- authors of the material; or
-
- e) Declining to grant rights under trademark law for use of some
- trade names, trademarks, or service marks; or
-
- f) Requiring indemnification of licensors and authors of that
- material by anyone who conveys the material (or modified versions of
- it) with contractual assumptions of liability to the recipient, for
- any liability that these contractual assumptions directly impose on
- those licensors and authors.
-
- All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10. If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term. If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
- If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
- Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
- 8. Termination.
-
- You may not propagate or modify a covered work except as expressly
-provided under this License. Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
- However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
- Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
- Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License. If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
- 9. Acceptance Not Required for Having Copies.
-
- You are not required to accept this License in order to receive or
-run a copy of the Program. Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance. However,
-nothing other than this License grants you permission to propagate or
-modify any covered work. These actions infringe copyright if you do
-not accept this License. Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
- 10. Automatic Licensing of Downstream Recipients.
-
- Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License. You are not responsible
-for enforcing compliance by third parties with this License.
-
- An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations. If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
- You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License. For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
- 11. Patents.
-
- A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based. The
-work thus licensed is called the contributor's "contributor version".
-
- A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version. For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
- Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
- In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement). To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
- If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients. "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
- If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
- A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License. You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
- Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
- 12. No Surrender of Others' Freedom.
-
- If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all. For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
- 13. Use with the GNU Affero General Public License.
-
- Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work. The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
- 14. Revised Versions of this License.
-
- The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation. If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
- If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
- Later license versions may give you additional or different
-permissions. However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
- 15. Disclaimer of Warranty.
-
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. Limitation of Liability.
-
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
- 17. Interpretation of Sections 15 and 16.
-
- If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-
- Copyright (C)
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
-
-Also add information on how to contact you by electronic and paper mail.
-
- If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
- Copyright (C)
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
- You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-.
-
- The GNU General Public License does not permit incorporating your program
-into proprietary programs. If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License. But first, please read
-.
diff --git a/GNUmakefile b/GNUmakefile
index bf325d8..ce62f19 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -22,7 +22,7 @@ libobjc_C_FILES = \
dtable.c\
encoding2.c\
hash_table.c\
- exception.c\
+ eh_personality.c\
hooks.c\
ivar.c\
loader.c\
@@ -38,6 +38,7 @@ libobjc_C_FILES += \
legacy_malloc.c\
objects.c\
thr.c
+
endif
libobjc_HEADER_FILES_DIR = objc
@@ -45,22 +46,9 @@ libobjc_HEADER_FILES_INSTALL_DIR = objc
ifneq ($(install_headers), no)
libobjc_HEADER_FILES = \
Availability.h\
- NXConstStr.h\
- Object.h\
- Protocol.h\
blocks_runtime.h\
- encoding.h\
- hash.h\
- objc-api.h\
- objc-decls.h\
- objc-list.h\
- objc.h\
- runtime-legacy.h\
runtime.h\
- sarray.h\
- slot.h\
- thr.h\
- typedstream.h
+ slot.h
endif
libobjc_LIBRARIES_DEPEND_UPON += -lpthread
diff --git a/dwarf_eh.h b/dwarf_eh.h
new file mode 100644
index 0000000..8cd5e4b
--- /dev/null
+++ b/dwarf_eh.h
@@ -0,0 +1,317 @@
+/**
+ * This file is Copyright PathScale 2010. Permission granted to distribute
+ * according to the terms of the MIT license (see COPYING.MIT)
+ */
+#include
+#include
+
+// _GNU_SOURCE must be defiend for unwind.h to expose some of the functions
+// that we want. If it isn't, then we define it and undefine it to make sure
+// that it doesn't impact the rest of the program.
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE 1
+# include
+# undef _GNU_SOURCE
+#else
+# include
+#endif
+
+typedef unsigned char *dw_eh_ptr_t;
+// Flag indicating a signed quantity
+#define DW_EH_PE_signed 0x08
+/// DWARF data encoding types
+enum dwarf_data_encoding
+{
+ // Unsigned, little-endian, base 128-encoded (variable length)
+ DW_EH_PE_uleb128 = 0x01,
+ // uint16
+ DW_EH_PE_udata2 = 0x02,
+ // uint32
+ DW_EH_PE_udata4 = 0x03,
+ // uint64
+ DW_EH_PE_udata8 = 0x04,
+ // Signed versions of the above:
+ DW_EH_PE_sleb128 = DW_EH_PE_uleb128 | DW_EH_PE_signed,
+ DW_EH_PE_sdata2 = DW_EH_PE_udata2 | DW_EH_PE_signed,
+ DW_EH_PE_sdata4 = DW_EH_PE_udata4 | DW_EH_PE_signed,
+ DW_EH_PE_sdata8 = DW_EH_PE_udata8 | DW_EH_PE_signed
+};
+
+static inline enum dwarf_data_encoding get_encoding(unsigned char x)
+{
+ return (enum dwarf_data_encoding)(x & 0xf);
+}
+
+enum dwarf_data_relative
+{
+ // Value is omitted
+ DW_EH_PE_omit = 0xff,
+ // Absolute pointer value
+ DW_EH_PE_absptr = 0x00,
+ // Value relative to program counter
+ DW_EH_PE_pcrel = 0x10,
+ // Value relative to the text segment
+ DW_EH_PE_textrel = 0x20,
+ // Value relative to the data segment
+ DW_EH_PE_datarel = 0x30,
+ // Value relative to the start of the function
+ DW_EH_PE_funcrel = 0x40,
+ // Aligned pointer (Not supported yet - are they actually used?)
+ DW_EH_PE_aligned = 0x50,
+ // Pointer points to address of real value
+ DW_EH_PE_indirect = 0x80
+};
+static inline enum dwarf_data_relative get_base(unsigned char x)
+{
+ return (enum dwarf_data_relative)(x & 0x70);
+}
+static int is_indirect(unsigned char x)
+{
+ return (x & DW_EH_PE_indirect);
+}
+
+static inline int dwarf_size_of_fixed_size_field(unsigned char type)
+{
+ // Low three bits indicate size...
+ switch (type & 7)
+ {
+ case DW_EH_PE_udata2: return 2;
+ case DW_EH_PE_udata4: return 4;
+ case DW_EH_PE_udata8: return 8;
+ case DW_EH_PE_absptr: return sizeof(void*);
+ }
+ abort();
+}
+
+/**
+ * Read an unsigned, little-endian, base-128, DWARF value. Updates *data to
+ * point to the end of the value.
+ */
+static uint64_t read_leb128(unsigned char** data, int *b)
+{
+ uint64_t uleb = 0;
+ unsigned int bit = 0;
+ unsigned char digit = 0;
+ // We have to read at least one octet, and keep reading until we get to one
+ // with the high bit unset
+ do
+ {
+ // This check is a bit too strict - we should also check the highest
+ // bit of the digit.
+ assert(bit < sizeof(uint64_t) * 8);
+ // Get the base 128 digit
+ digit = (**data) & 0x7f;
+ // Add it to the current value
+ uleb += digit << bit;
+ // Increase the shift value
+ bit += 7;
+ // Proceed to the next octet
+ (*data)++;
+ // Terminate when we reach a value that does not have the high bit set
+ // (i.e. which was not modified when we mask it with 0x7f)
+ } while ((*(*data - 1)) != digit);
+ *b = bit;
+
+ return uleb;
+}
+
+static int64_t read_uleb128(unsigned char** data)
+{
+ int b;
+ return read_leb128(data, &b);
+}
+
+
+static int64_t read_sleb128(unsigned char** data)
+{
+ int bits;
+ // Read as if it's signed
+ uint64_t uleb = read_leb128(data, &bits);
+ // If the most significant bit read is 1, then we need to sign extend it
+ if (uleb >> (bits-1) == 1)
+ {
+ // Sign extend by setting all bits in front of it to 1
+ uleb |= ((int64_t)-1) << bits;
+ }
+ return (int64_t)uleb;
+}
+
+static uint64_t read_value(char encoding, unsigned char **data)
+{
+ enum dwarf_data_encoding type = get_encoding(encoding);
+ uint64_t v;
+ switch (type)
+ {
+ // Read fixed-length types
+#define READ(dwarf, type) \
+ case dwarf:\
+ v = (uint64_t)(*(type*)(*data));\
+ *data += sizeof(type);\
+ break;
+ READ(DW_EH_PE_udata2, uint16_t)
+ READ(DW_EH_PE_udata4, uint32_t)
+ READ(DW_EH_PE_udata8, uint64_t)
+ READ(DW_EH_PE_sdata2, int16_t)
+ READ(DW_EH_PE_sdata4, int32_t)
+ READ(DW_EH_PE_sdata8, int64_t)
+ case DW_EH_PE_absptr:
+ v = (uint64_t)(*(intptr_t*)(*data));
+ *data += sizeof(intptr_t);
+ break;
+ //READ(DW_EH_PE_absptr, intptr_t)
+#undef READ
+ case DW_EH_PE_sleb128:
+ v = read_sleb128(data);
+ break;
+ case DW_EH_PE_uleb128:
+ v = read_uleb128(data);
+ break;
+ default: abort();
+ }
+
+ return v;
+}
+
+static uint64_t resolve_indirect_value(struct _Unwind_Context *c, unsigned char encoding, int64_t v, dw_eh_ptr_t start)
+{
+ switch (get_base(encoding))
+ {
+ case DW_EH_PE_pcrel:
+ v += (uint64_t)(uintptr_t)start;
+ break;
+ case DW_EH_PE_textrel:
+ v += (uint64_t)(uintptr_t)_Unwind_GetTextRelBase(c);
+ break;
+ case DW_EH_PE_datarel:
+ v += (uint64_t)(uintptr_t)_Unwind_GetDataRelBase(c);
+ break;
+ case DW_EH_PE_funcrel:
+ v += (uint64_t)(uintptr_t)_Unwind_GetRegionStart(c);
+ default:
+ break;
+ }
+ // If this is an indirect value, then it is really the address of the real
+ // value
+ // TODO: Check whether this should really always be a pointer - it seems to
+ // be a GCC extensions, so not properly documented...
+ if (is_indirect(encoding))
+ {
+ v = (uint64_t)(uintptr_t)*(void**)(uintptr_t)v;
+ }
+ return v;
+}
+
+
+static inline void read_value_with_encoding(struct _Unwind_Context *context,
+ dw_eh_ptr_t *data,
+ uint64_t *out)
+{
+ dw_eh_ptr_t start = *data;
+ unsigned char encoding = *((*data)++);
+ // If this value is omitted, skip it and don't touch the output value
+ if (encoding == DW_EH_PE_omit) { return; }
+
+ *out = read_value(encoding, data);
+ *out = resolve_indirect_value(context, encoding, *out, start);
+}
+
+
+struct dwarf_eh_lsda
+{
+ dw_eh_ptr_t region_start;
+ dw_eh_ptr_t landing_pads;
+ dw_eh_ptr_t type_table;
+ unsigned char type_table_encoding;
+ dw_eh_ptr_t call_site_table;
+ dw_eh_ptr_t action_table;
+ unsigned char callsite_encoding;
+};
+
+static inline struct dwarf_eh_lsda parse_lsda(struct _Unwind_Context *context, unsigned char *data)
+{
+ struct dwarf_eh_lsda lsda;
+
+ lsda.region_start = (dw_eh_ptr_t)(uintptr_t)_Unwind_GetRegionStart(context);
+
+ // If the landing pads are relative to anything other than the start of
+ // this region, find out where. This is @LPStart in the spec, although the
+ // encoding that GCC uses does not quite match the spec.
+ uint64_t v = (uint64_t)(uintptr_t)lsda.region_start;
+ read_value_with_encoding(context, &data, &v);
+ lsda.landing_pads = (dw_eh_ptr_t)(uintptr_t)v;
+
+ // If there is a type table, find out where it is. This is @TTBase in the
+ // spec. Note: we find whether there is a type table pointer by checking
+ // whether the leading byte is DW_EH_PE_omit (0xff), which is not what the
+ // spec says, but does seem to be how G++ indicates this.
+ lsda.type_table = 0;
+ lsda.type_table_encoding = *data++;
+ if (lsda.type_table_encoding != DW_EH_PE_omit)
+ {
+ v = read_uleb128(&data);
+ dw_eh_ptr_t type_table = data;
+ type_table += v;
+ lsda.type_table = type_table;
+ //lsda.type_table = (uintptr_t*)(data + v);
+ }
+
+ lsda.callsite_encoding = (enum dwarf_data_encoding)(*(data++));
+
+ // Action table is immediately after the call site table
+ lsda.action_table = data;
+ uintptr_t callsite_size = (uintptr_t)read_uleb128(&data);
+ lsda.action_table = data + callsite_size;
+ // Call site table is immediately after the header
+ lsda.call_site_table = (dw_eh_ptr_t)data;
+
+
+ return lsda;
+}
+
+struct dwarf_eh_action
+{
+ dw_eh_ptr_t landing_pad;
+ dw_eh_ptr_t action_record;
+};
+
+/**
+ * Look up the landing pad that corresponds to the current invoke.
+ */
+static struct dwarf_eh_action
+ dwarf_eh_find_callsite(struct _Unwind_Context *context, struct dwarf_eh_lsda *lsda)
+{
+ struct dwarf_eh_action result = { 0, 0};
+ uint64_t ip = _Unwind_GetIP(context) - _Unwind_GetRegionStart(context);
+ unsigned char *callsite_table = (unsigned char*)lsda->call_site_table;
+ while (callsite_table <= lsda->action_table)
+ {
+ // Once again, the layout deviates from the spec.
+ uint64_t call_site_start, call_site_size, landing_pad, action;
+ call_site_start = read_value(lsda->callsite_encoding, &callsite_table);
+ call_site_size = read_value(lsda->callsite_encoding, &callsite_table);
+
+ // Call site entries are started
+ if (call_site_start > ip) { break; }
+
+ landing_pad = read_value(lsda->callsite_encoding, &callsite_table);
+ action = read_uleb128(&callsite_table);
+
+ if (call_site_start <= ip && ip <= call_site_start + call_site_size)
+ {
+ if (action)
+ {
+ // Action records are 1-biased so both no-record and zeroth
+ // record can be stored.
+ result.action_record = lsda->action_table + action - 1;
+ }
+ // No landing pad means keep unwinding.
+ if (landing_pad)
+ {
+ // Landing pad is the offset from the value in the header
+ result.landing_pad = lsda->landing_pads + landing_pad;
+ }
+ break;
+ }
+ }
+ return result;
+}
diff --git a/eh_personality.c b/eh_personality.c
new file mode 100644
index 0000000..5fc2d3b
--- /dev/null
+++ b/eh_personality.c
@@ -0,0 +1,224 @@
+#include
+#include
+#include
+#include
+#include "dwarf_eh.h"
+#include "objc/runtime.h"
+#include "objc/hooks.h"
+
+#include "class.h"
+
+/**
+ * Class of exceptions to distinguish between this and other exception types.
+ */
+#define objc_exception_class (*(int64_t*)"GNUCC++\0")
+/**
+ * Class used for C++ exceptions. Used to box them.
+ */
+#define cxx_exception_class (*(int64_t*)"GNUCC++\0")
+
+/**
+ * Structure used as a header on thrown exceptions.
+ */
+struct objc_exception
+{
+ /** The selector value to be returned when installing the catch handler.
+ * Used at the call site to determine which catch() block should execute.
+ * This is found in phase 1 of unwinding then installed in phase 2.*/
+ int handlerSwitchValue;
+ /** The cached landing pad for the catch handler.*/
+ void *landingPad;
+
+ /** The language-agnostic part of the exception header. */
+ struct _Unwind_Exception unwindHeader;
+ /** Thrown object. This is after the unwind header so that the C++
+ * exception handler can catch this as a foreign exception. */
+ id object;
+};
+
+/**
+ *
+ */
+void objc_exception_throw(id object)
+{
+ struct objc_exception *ex = calloc(1, sizeof(struct objc_exception));
+
+ ex->unwindHeader.exception_class = objc_exception_class;
+
+ ex->object = object;
+
+ _Unwind_Reason_Code err = _Unwind_RaiseException(&ex->unwindHeader);
+ free(ex);
+ if (_URC_END_OF_STACK == err && 0 != _objc_unexpected_exception)
+ {
+ _objc_unexpected_exception(object);
+ }
+ abort();
+}
+
+Class get_type_table_entry(struct _Unwind_Context *context,
+ struct dwarf_eh_lsda *lsda,
+ int filter)
+{
+ dw_eh_ptr_t record = lsda->type_table -
+ dwarf_size_of_fixed_size_field(lsda->type_table_encoding)*filter;
+ dw_eh_ptr_t start = record;
+ int64_t offset = read_value(lsda->type_table_encoding, &record);
+
+ if (0 == offset) { return Nil; }
+
+ // ...so we need to resolve it
+ char *class_name = (char*)(intptr_t)resolve_indirect_value(context,
+ lsda->type_table_encoding, offset, start);
+
+ if (0 == class_name) { return Nil; }
+
+ return (Class)objc_getClass(class_name);
+}
+
+static BOOL isKindOfClass(struct _Unwind_Exception *ex, Class type)
+{
+ // Nil is a catchall, but we only want to catch things that are not foreign
+ // exceptions in it.
+ if (Nil == type)
+ {
+ return ex->exception_class == objc_exception_class;
+ }
+ if (ex->exception_class != objc_exception_class)
+ {
+ // FIXME: Box and stuff.
+ return NO;
+ }
+ id object = *(id*)(ex + 1);
+
+ do
+ {
+ if (object->isa == type)
+ {
+ return YES;
+ }
+ type = class_getSuperclass(type);
+ } while (Nil != type);
+
+ return NO;
+}
+
+
+static BOOL check_action_record(struct _Unwind_Context *context,
+ int64_t exceptionClass,
+ struct dwarf_eh_lsda *lsda,
+ dw_eh_ptr_t action_record,
+ struct _Unwind_Exception *ex,
+ unsigned long *selector)
+{
+ while (action_record)
+ {
+ int filter = read_sleb128(&action_record);
+ dw_eh_ptr_t action_record_offset_base = action_record;
+ int displacement = read_sleb128(&action_record);
+ *selector = filter;
+ if (filter > 0)
+ {
+ Class type = get_type_table_entry(context, lsda, filter);
+ if (ex && isKindOfClass(ex, type))
+ {
+ return YES;
+ }
+ }
+ else if (filter == 0)
+ {
+ // Catchall
+ return YES;
+ }
+ *selector = 0;
+ action_record = displacement ?
+ action_record_offset_base + displacement : 0;
+ }
+ return NO;
+}
+
+/**
+ * The exception personality function.
+ */
+_Unwind_Reason_Code __gnu_objc_personality_v0(int version,
+ _Unwind_Action actions,
+ uint64_t exceptionClass,
+ struct _Unwind_Exception *exceptionObject,
+ struct _Unwind_Context *context)
+{
+ // This personality function is for version 1 of the ABI. If you use it
+ // with a future version of the ABI, it won't know what to do, so it
+ // reports a fatal error and give up before it breaks anything.
+ if (1 != version)
+ {
+ return _URC_FATAL_PHASE1_ERROR;
+ }
+ struct objc_exception *ex = 0;
+
+
+ // Check if this is a foreign exception. If it is a C++ exception, then we
+ // have to box it. If it's something else, like a LanguageKit exception
+ // then we ignore it (for now)
+ BOOL foreignException = exceptionClass != objc_exception_class;
+
+ // If it's not a foreign exception, then we know the layout of the
+ // language-specific exception stuff.
+ if (!foreignException)
+ {
+ ex = (struct objc_exception*) ((char*)exceptionObject -
+ offsetof(struct objc_exception, unwindHeader));
+ }
+
+ unsigned char *lsda_addr = (void*)_Unwind_GetLanguageSpecificData(context);
+
+ // No LSDA implies no landing pads - try the next frame
+ if (0 == lsda_addr) { return _URC_CONTINUE_UNWIND; }
+
+ // These two variables define how the exception will be handled.
+ struct dwarf_eh_action action = {0};
+ unsigned long selector = 0;
+
+ if (actions & _UA_SEARCH_PHASE)
+ {
+ struct dwarf_eh_lsda lsda = parse_lsda(context, lsda_addr);
+ action = dwarf_eh_find_callsite(context, &lsda);
+ BOOL found_handler = check_action_record(context, exceptionClass, &lsda,
+ action.action_record, exceptionObject, &selector);
+ // If there's no action record, we've only found a cleanup, so keep
+ // searching for something real
+ if (found_handler)
+ {
+ // Cache the results for the phase 2 unwind, if we found a handler
+ // and this is not a foreign exception.
+ if (ex)
+ {
+ ex->handlerSwitchValue = selector;
+ ex->landingPad = action.landing_pad;
+ }
+ return _URC_HANDLER_FOUND;
+ }
+ return _URC_CONTINUE_UNWIND;
+ }
+
+ if (!(actions & _UA_HANDLER_FRAME) || foreignException)
+ {
+ struct dwarf_eh_lsda lsda = parse_lsda(context, lsda_addr);
+ action = dwarf_eh_find_callsite(context, &lsda);
+ if (0 == action.landing_pad) { return _URC_CONTINUE_UNWIND; }
+ selector = 0;
+ }
+ else
+ {
+ // Restore the saved info if we saved some last time.
+ action.landing_pad = ex->landingPad;
+ selector = ex->handlerSwitchValue;
+ }
+
+
+ _Unwind_SetIP(context, (unsigned long)action.landing_pad);
+ _Unwind_SetGR(context, __builtin_eh_return_data_regno(0),
+ (unsigned long)exceptionObject);
+ _Unwind_SetGR(context, __builtin_eh_return_data_regno(1), selector);
+
+ return _URC_INSTALL_CONTEXT;
+}
diff --git a/exception.c b/exception.c
deleted file mode 100644
index 3c22402..0000000
--- a/exception.c
+++ /dev/null
@@ -1,498 +0,0 @@
-/* The implementation of exception handling primitives for Objective-C.
- Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3, or (at your option) any
-later version.
-
-GCC is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-License for more details.
-
-Under Section 7 of GPL version 3, you are granted additional
-permissions described in the GCC Runtime Library Exception, version
-3.1, as published by the Free Software Foundation.
-
-You should have received a copy of the GNU General Public License and
-a copy of the GCC Runtime Library Exception along with this program;
-see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-. */
-
-#include
-#include "objc/objc-api.h"
-//#include
-#include "unwind-pe.h"
-
-#ifdef __ARM_EABI_UNWINDER__
-
-const _Unwind_Exception_Class __objc_exception_class
- = {'G', 'N', 'U', 'C', 'O', 'B', 'J', 'C'};
-
-#else
-
-/* This is the exception class we report -- "GNUCOBJC". */
-static const _Unwind_Exception_Class __objc_exception_class
- = ((((((((_Unwind_Exception_Class) 'G'
- << 8 | (_Unwind_Exception_Class) 'N')
- << 8 | (_Unwind_Exception_Class) 'U')
- << 8 | (_Unwind_Exception_Class) 'C')
- << 8 | (_Unwind_Exception_Class) 'O')
- << 8 | (_Unwind_Exception_Class) 'B')
- << 8 | (_Unwind_Exception_Class) 'J')
- << 8 | (_Unwind_Exception_Class) 'C');
-
-#endif
-
-/* This is the object that is passed around by the Objective C runtime
- to represent the exception in flight. */
-
-struct ObjcException
-{
- /* This bit is needed in order to interact with the unwind runtime. */
- struct _Unwind_Exception base;
-
- /* The actual object we want to throw. Note: must come immediately after
- unwind header. */
- id value;
-
-#ifdef __ARM_EABI_UNWINDER__
- /* Note: we use the barrier cache defined in the unwind control block for
- ARM EABI. */
-#else
- /* Cache some internal unwind data between phase 1 and phase 2. */
- _Unwind_Ptr landingPad;
- int handlerSwitchValue;
-#endif
-};
-
-
-
-struct lsda_header_info
-{
- _Unwind_Ptr Start;
- _Unwind_Ptr LPStart;
- _Unwind_Ptr ttype_base;
- const unsigned char *TType;
- const unsigned char *action_table;
- unsigned char ttype_encoding;
- unsigned char call_site_encoding;
-};
-
-/* This hook allows libraries to sepecify special actions when an
- exception is thrown without a handler in place.
- */
-void (*_objc_unexpected_exception) (id exception); /* !T:SAFE */
-
-static const unsigned char *
-parse_lsda_header (struct _Unwind_Context *context, const unsigned char *p,
- struct lsda_header_info *info)
-{
- _uleb128_t tmp;
- unsigned char lpstart_encoding;
-
- info->Start = (context ? _Unwind_GetRegionStart (context) : 0);
-
- /* Find @LPStart, the base to which landing pad offsets are relative. */
- lpstart_encoding = *p++;
- if (lpstart_encoding != DW_EH_PE_omit)
- p = read_encoded_value (context, lpstart_encoding, p, &info->LPStart);
- else
- info->LPStart = info->Start;
-
- /* Find @TType, the base of the handler and exception spec type data. */
- info->ttype_encoding = *p++;
- if (info->ttype_encoding != DW_EH_PE_omit)
- {
- p = read_uleb128 (p, &tmp);
- info->TType = p + tmp;
- }
- else
- info->TType = 0;
-
- /* The encoding and length of the call-site table; the action table
- immediately follows. */
- info->call_site_encoding = *p++;
- p = read_uleb128 (p, &tmp);
- info->action_table = p + tmp;
-
- return p;
-}
-
-#ifdef __ARM_EABI_UNWINDER__
-
-static Class
-get_ttype_entry (struct lsda_header_info *info, _uleb128_t i)
-{
- _Unwind_Ptr ptr;
-
- ptr = (_Unwind_Ptr) (info->TType - (i * 4));
- ptr = _Unwind_decode_target2 (ptr);
-
- if (ptr)
- return objc_get_class ((const char *) ptr);
- else
- return 0;
-}
-
-#else
-
-static Class
-get_ttype_entry (struct lsda_header_info *info, _Unwind_Word i)
-{
- _Unwind_Ptr ptr;
-
- i *= size_of_encoded_value (info->ttype_encoding);
- read_encoded_value_with_base (info->ttype_encoding, info->ttype_base,
- info->TType - i, &ptr);
-
- /* NULL ptr means catch-all. */
- if (ptr)
- {
- return objc_get_class ((const char *) ptr);
- }
- else
- return 0;
-}
-
-#endif
-
-/* Like unto the method of the same name on Object, but takes an id. */
-/* ??? Does this bork the meta-type system? Can/should we look up an
- isKindOf method on the id? */
-
-static int
-isKindOf (id value, Class target)
-{
- Class c;
-
- /* NULL target is catch-all. */
- if (target == 0)
- return 1;
-
- for (c = value->class_pointer; c; c = class_get_super_class (c))
- if (c == target)
- return 1;
- return 0;
-}
-
-/* Using a different personality function name causes link failures
- when trying to mix code using different exception handling models. */
-#ifdef SJLJ_EXCEPTIONS
-#define PERSONALITY_FUNCTION __gnu_objc_personality_sj0
-#define __builtin_eh_return_data_regno(x) x
-#else
-#define PERSONALITY_FUNCTION __gnu_objc_personality_v0
-#endif
-
-#ifdef __ARM_EABI_UNWINDER__
-
-#define CONTINUE_UNWINDING \
- do \
- { \
- if (__gnu_unwind_frame(ue_header, context) != _URC_OK) \
- return _URC_FAILURE; \
- return _URC_CONTINUE_UNWIND; \
- } \
- while (0)
-
-_Unwind_Reason_Code
-PERSONALITY_FUNCTION (_Unwind_State state,
- struct _Unwind_Exception *ue_header,
- struct _Unwind_Context *context)
-#else
-
-#define CONTINUE_UNWINDING return _URC_CONTINUE_UNWIND
-
-_Unwind_Reason_Code
-PERSONALITY_FUNCTION (int version,
- _Unwind_Action actions,
- _Unwind_Exception_Class exception_class,
- struct _Unwind_Exception *ue_header,
- struct _Unwind_Context *context)
-#endif
-{
- struct ObjcException *xh = (struct ObjcException *) ue_header;
-
- struct lsda_header_info info;
- const unsigned char *language_specific_data;
- const unsigned char *action_record;
- const unsigned char *p;
- _Unwind_Ptr landing_pad, ip;
- int handler_switch_value;
- int saw_cleanup = 0, saw_handler, foreign_exception;
- void *return_object;
- int ip_before_insn = 0;
-
-#ifdef __ARM_EABI_UNWINDER__
- _Unwind_Action actions;
-
- switch (state & _US_ACTION_MASK)
- {
- case _US_VIRTUAL_UNWIND_FRAME:
- actions = _UA_SEARCH_PHASE;
- break;
-
- case _US_UNWIND_FRAME_STARTING:
- actions = _UA_CLEANUP_PHASE;
- if (!(state & _US_FORCE_UNWIND)
- && ue_header->barrier_cache.sp == _Unwind_GetGR (context, 13))
- actions |= _UA_HANDLER_FRAME;
- break;
-
- case _US_UNWIND_FRAME_RESUME:
- CONTINUE_UNWINDING;
- break;
-
- default:
- abort();
- }
- actions |= state & _US_FORCE_UNWIND;
-
- /* TODO: Foreign exceptions need some attention (e.g. rethrowing doesn't
- work). */
- foreign_exception = 0;
-
- /* The dwarf unwinder assumes the context structure holds things like the
- function and LSDA pointers. The ARM implementation caches these in
- the exception header (UCB). To avoid rewriting everything we make the
- virtual IP register point at the UCB. */
- ip = (_Unwind_Ptr) ue_header;
- _Unwind_SetGR (context, 12, ip);
-
-#else /* !__ARM_EABI_UNWINDER. */
- /* Interface version check. */
- if (version != 1)
- return _URC_FATAL_PHASE1_ERROR;
-
- foreign_exception = (exception_class != __objc_exception_class);
-#endif
-
- /* Shortcut for phase 2 found handler for domestic exception. */
- if (actions == (_UA_CLEANUP_PHASE | _UA_HANDLER_FRAME)
- && !foreign_exception)
- {
-#ifdef __ARM_EABI_UNWINDER__
- handler_switch_value = (int) ue_header->barrier_cache.bitpattern[1];
- landing_pad = (_Unwind_Ptr) ue_header->barrier_cache.bitpattern[3];
-#else
- handler_switch_value = xh->handlerSwitchValue;
- landing_pad = xh->landingPad;
-#endif
- goto install_context;
- }
-
- language_specific_data = (const unsigned char *)
- _Unwind_GetLanguageSpecificData (context);
-
- /* If no LSDA, then there are no handlers or cleanups. */
- if (! language_specific_data)
- CONTINUE_UNWINDING;
-
- /* Parse the LSDA header. */
- p = parse_lsda_header (context, language_specific_data, &info);
- info.ttype_base = base_of_encoded_value (info.ttype_encoding, context);
-#ifdef HAVE_GETIPINFO
- ip = _Unwind_GetIPInfo (context, &ip_before_insn);
-#else
- ip = _Unwind_GetIP (context);
-#endif
- if (!ip_before_insn)
- --ip;
- landing_pad = 0;
- action_record = 0;
- handler_switch_value = 0;
-
-#ifdef SJLJ_EXCEPTIONS
- /* The given "IP" is an index into the call-site table, with two
- exceptions -- -1 means no-action, and 0 means terminate. But
- since we're using uleb128 values, we've not got random access
- to the array. */
- if ((int) ip < 0)
- return _URC_CONTINUE_UNWIND;
- else
- {
- _uleb128_t cs_lp, cs_action;
- do
- {
- p = read_uleb128 (p, &cs_lp);
- p = read_uleb128 (p, &cs_action);
- }
- while (--ip);
-
- /* Can never have null landing pad for sjlj -- that would have
- been indicated by a -1 call site index. */
- landing_pad = cs_lp + 1;
- if (cs_action)
- action_record = info.action_table + cs_action - 1;
- goto found_something;
- }
-#else
- /* Search the call-site table for the action associated with this IP. */
- while (p < info.action_table)
- {
- _Unwind_Ptr cs_start, cs_len, cs_lp;
- _uleb128_t cs_action;
-
- /* Note that all call-site encodings are "absolute" displacements. */
- p = read_encoded_value (0, info.call_site_encoding, p, &cs_start);
- p = read_encoded_value (0, info.call_site_encoding, p, &cs_len);
- p = read_encoded_value (0, info.call_site_encoding, p, &cs_lp);
- p = read_uleb128 (p, &cs_action);
-
- /* The table is sorted, so if we've passed the ip, stop. */
- if (ip < info.Start + cs_start)
- p = info.action_table;
- else if (ip < info.Start + cs_start + cs_len)
- {
- if (cs_lp)
- landing_pad = info.LPStart + cs_lp;
- if (cs_action)
- action_record = info.action_table + cs_action - 1;
- goto found_something;
- }
- }
-#endif /* SJLJ_EXCEPTIONS */
-
- /* If ip is not present in the table, C++ would call terminate. */
- /* ??? As with Java, it's perhaps better to tweek the LSDA to
- that no-action is mapped to no-entry. */
- CONTINUE_UNWINDING;
-
- found_something:
- saw_cleanup = 0;
- saw_handler = 0;
-
- if (landing_pad == 0)
- {
- /* If ip is present, and has a null landing pad, there are
- no cleanups or handlers to be run. */
- }
- else if (action_record == 0)
- {
- /* If ip is present, has a non-null landing pad, and a null
- action table offset, then there are only cleanups present.
- Cleanups use a zero switch value, as set above. */
- saw_cleanup = 1;
- }
- else
- {
- /* Otherwise we have a catch handler. */
- _sleb128_t ar_filter, ar_disp;
-
- while (1)
- {
- p = action_record;
- p = read_sleb128 (p, &ar_filter);
- read_sleb128 (p, &ar_disp);
-
- if (ar_filter == 0)
- {
- /* Zero filter values are cleanups. */
- saw_cleanup = 1;
- }
-
- /* During forced unwinding, we only run cleanups. With a
- foreign exception class, we have no class info to match. */
- else if ((actions & _UA_FORCE_UNWIND) || foreign_exception)
- ;
-
- else if (ar_filter > 0)
- {
- /* Positive filter values are handlers. */
-
- Class catch_type = get_ttype_entry (&info, ar_filter);
-
- if (isKindOf (xh->value, catch_type))
- {
- handler_switch_value = ar_filter;
- saw_handler = 1;
- break;
- }
- }
- else
- {
- /* Negative filter values are exception specifications,
- which Objective-C does not use. */
- abort ();
- }
-
- if (ar_disp == 0)
- break;
- action_record = p + ar_disp;
- }
- }
-
- if (! saw_handler && ! saw_cleanup)
- CONTINUE_UNWINDING;
-
- if (actions & _UA_SEARCH_PHASE)
- {
- if (!saw_handler)
- CONTINUE_UNWINDING;
-
- /* For domestic exceptions, we cache data from phase 1 for phase 2. */
- if (!foreign_exception)
- {
-#ifdef __ARM_EABI_UNWINDER__
- ue_header->barrier_cache.sp = _Unwind_GetGR (context, 13);
- ue_header->barrier_cache.bitpattern[1] = (_uw) handler_switch_value;
- ue_header->barrier_cache.bitpattern[3] = (_uw) landing_pad;
-#else
- xh->handlerSwitchValue = handler_switch_value;
- xh->landingPad = landing_pad;
-#endif
- }
- return _URC_HANDLER_FOUND;
- }
-
- install_context:
- if (saw_cleanup == 0)
- {
- return_object = xh->value;
- if (!(actions & _UA_SEARCH_PHASE))
- _Unwind_DeleteException(&xh->base);
- }
-
- _Unwind_SetGR (context, __builtin_eh_return_data_regno (0),
- (intptr_t)(saw_cleanup ? xh : return_object));
- _Unwind_SetGR (context, __builtin_eh_return_data_regno (1),
- handler_switch_value);
- _Unwind_SetIP (context, landing_pad);
- return _URC_INSTALL_CONTEXT;
-}
-
-static void
-__objc_exception_cleanup (_Unwind_Reason_Code code __attribute__((unused)),
- struct _Unwind_Exception *exc)
-{
- free (exc);
-}
-
-void
-objc_exception_throw (id value)
-{
- struct ObjcException *header = calloc (1, sizeof (*header));
-
- memcpy (&header->base.exception_class, &__objc_exception_class,
- sizeof (__objc_exception_class));
- header->base.exception_cleanup =
- (_Unwind_Exception_Cleanup_Fn)__objc_exception_cleanup;
- header->value = value;
-
-#ifdef SJLJ_EXCEPTIONS
- _Unwind_SjLj_RaiseException (&header->base);
-#else
- _Unwind_RaiseException (&header->base);
-#endif
-
- /* Some sort of unwinding error. */
- if (_objc_unexpected_exception != 0)
- {
- (*_objc_unexpected_exception) (value);
- }
- abort ();
-}
diff --git a/objc/NXConstStr.h b/objc/NXConstStr.h
deleted file mode 100644
index 40eb66e..0000000
--- a/objc/NXConstStr.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Interface for the NXConstantString class for Objective-C.
- Copyright (C) 1995, 2004, 2009 Free Software Foundation, Inc.
- Contributed by Pieter J. Schoenmakers
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3, or (at your option) any
-later version.
-
-GCC is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-License for more details.
-
-Under Section 7 of GPL version 3, you are granted additional
-permissions described in the GCC Runtime Library Exception, version
-3.1, as published by the Free Software Foundation.
-
-You should have received a copy of the GNU General Public License and
-a copy of the GCC Runtime Library Exception along with this program;
-see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-. */
-
-
-#ifndef __nxconstantstring_INCLUDE_GNU
-#define __nxconstantstring_INCLUDE_GNU
-
-#include "Object.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-@interface NXConstantString: Object
-{
- char *c_string;
- unsigned int len;
-}
-
--(const char *) cString;
--(unsigned int) length;
-
-@end
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/objc/Object.h b/objc/Object.h
deleted file mode 100644
index 2efc872..0000000
--- a/objc/Object.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/* Interface for the Object class for Objective-C.
- Copyright (C) 1993, 1994, 1995, 2009 Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3, or (at your option) any
-later version.
-
-GCC is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-License for more details.
-
-Under Section 7 of GPL version 3, you are granted additional
-permissions described in the GCC Runtime Library Exception, version
-3.1, as published by the Free Software Foundation.
-
-You should have received a copy of the GNU General Public License and
-a copy of the GCC Runtime Library Exception along with this program;
-see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-. */
-
-
-#ifndef __object_INCLUDE_GNU
-#define __object_INCLUDE_GNU
-
-#include "objc.h"
-#include "typedstream.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * All classes are derived from Object. As such,
- * this is the overhead tacked onto those objects.
- */
-@interface Object
-{
- Class isa; /* A pointer to the instance's class structure */
-}
-
- /* Initializing classes and instances */
-+ initialize;
-- init;
-
- /* Creating, freeing, and copying instances */
-+ new;
-+ alloc;
-- free;
-- copy;
-- shallowCopy;
-- deepen;
-- deepCopy;
-
- /* Identifying classes */
-- (Class)class;
-- (Class)superClass;
-- (MetaClass)metaClass;
-- (const char *)name;
-
- /* Identifying and comparing objects */
-- self;
-- (unsigned int)hash;
-- (BOOL)isEqual:anObject;
-- (int)compare:(id)anotherObject;
-
- /* Testing object type */
-- (BOOL)isMetaClass;
-- (BOOL)isClass;
-- (BOOL)isInstance;
-
- /* Testing inheritance relationships */
-- (BOOL)isKindOf:(Class)aClassObject;
-- (BOOL)isMemberOf:(Class)aClassObject;
-- (BOOL)isKindOfClassNamed:(const char *)aClassName;
-- (BOOL)isMemberOfClassNamed:(const char *)aClassName;
-
- /* Testing class functionality */
-+ (BOOL)instancesRespondTo:(SEL)aSel;
-- (BOOL)respondsTo:(SEL)aSel;
-
- /* Testing protocol conformance */
-- (BOOL)conformsTo:(Protocol*)aProtocol;
-
- /* Introspection */
-+ (IMP)instanceMethodFor:(SEL)aSel;
-- (IMP)methodFor:(SEL)aSel;
-+ (struct objc_method_description *)descriptionForInstanceMethod:(SEL)aSel;
-- (struct objc_method_description *)descriptionForMethod:(SEL)aSel;
-
- /* Sending messages determined at run time */
-- perform:(SEL)aSel;
-- perform:(SEL)aSel with:anObject;
-- perform:(SEL)aSel with:anObject1 with:anObject2;
-
- /* Forwarding */
-- (retval_t)forward:(SEL)aSel :(arglist_t)argFrame;
-- (retval_t)performv:(SEL)aSel :(arglist_t)argFrame;
-
- /* Posing */
-+ poseAs:(Class)aClassObject;
-- (Class)transmuteClassTo:(Class)aClassObject;
-
- /* Enforcing intentions */
-- subclassResponsibility:(SEL)aSel;
-- notImplemented:(SEL)aSel;
-- shouldNotImplement:(SEL)aSel;
-
- /* Error handling */
-- doesNotRecognize:(SEL)aSel;
-- error:(const char *)aString, ...;
-
- /* Archiving */
-+ (int)version;
-+ setVersion:(int)aVersion;
-@end
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/objc/Protocol.h b/objc/Protocol.h
deleted file mode 100644
index 75cb388..0000000
--- a/objc/Protocol.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* Declare the class Protocol for Objective C programs.
- Copyright (C) 1993, 2004, 2009 Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 3, or (at your option)
-any later version.
-
-GCC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-Under Section 7 of GPL version 3, you are granted additional
-permissions described in the GCC Runtime Library Exception, version
-3.1, as published by the Free Software Foundation.
-
-You should have received a copy of the GNU General Public License and
-a copy of the GCC Runtime Library Exception along with this program;
-see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-. */
-
-
-#ifndef __Protocol_INCLUDE_GNU
-#define __Protocol_INCLUDE_GNU
-
-#include "Object.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-@interface Protocol : Object
-{
-@protected
- char *protocol_name;
- struct objc_protocol_list *protocol_list;
- struct objc_method_description_list *instance_methods, *class_methods;
-}
-
-/* Obtaining attributes intrinsic to the protocol */
-
-- (const char *)name;
-
-/* Testing protocol conformance */
-
-- (BOOL) conformsTo: (Protocol *)aProtocolObject;
-
-/* Looking up information specific to a protocol */
-
-- (struct objc_method_description *) descriptionForInstanceMethod:(SEL)aSel;
-- (struct objc_method_description *) descriptionForClassMethod:(SEL)aSel;
-
-@end
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* not __Protocol_INCLUDE_GNU */
diff --git a/objc/encoding.h b/objc/encoding.h
deleted file mode 100644
index 57ac224..0000000
--- a/objc/encoding.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/* Encoding of types for Objective C.
- Copyright (C) 1993, 1997, 2002, 2004, 2009 Free Software Foundation, Inc.
-
-Author: Kresten Krab Thorup
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 3, or (at your option)
-any later version.
-
-GCC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-Under Section 7 of GPL version 3, you are granted additional
-permissions described in the GCC Runtime Library Exception, version
-3.1, as published by the Free Software Foundation.
-
-You should have received a copy of the GNU General Public License and
-a copy of the GCC Runtime Library Exception along with this program;
-see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-. */
-
-
-#ifndef __encoding_INCLUDE_GNU
-#define __encoding_INCLUDE_GNU
-
-#include "objc-api.h"
-#include "Availability.h"
-#include
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define _C_CONST 'r'
-#define _C_IN 'n'
-#define _C_INOUT 'N'
-#define _C_OUT 'o'
-#define _C_BYCOPY 'O'
-#define _C_BYREF 'R'
-#define _C_ONEWAY 'V'
-#define _C_GCINVISIBLE '!'
-
-#define _F_CONST 0x01
-#define _F_IN 0x01
-#define _F_OUT 0x02
-#define _F_INOUT 0x03
-#define _F_BYCOPY 0x04
-#define _F_BYREF 0x08
-#define _F_ONEWAY 0x10
-#define _F_GCINVISIBLE 0x20
-
-int objc_aligned_size (const char *type) OBJC_DEPRECATED;
-int objc_sizeof_type (const char *type) OBJC_DEPRECATED;
-int objc_alignof_type (const char *type) OBJC_DEPRECATED;
-int objc_aligned_size (const char *type) OBJC_DEPRECATED;
-int objc_promoted_size (const char *type) OBJC_DEPRECATED;
-
-const char *objc_skip_type_qualifiers (const char *type) OBJC_DEPRECATED;
-const char *objc_skip_typespec (const char *type) OBJC_DEPRECATED;
-const char *objc_skip_offset (const char *type) OBJC_DEPRECATED;
-const char *objc_skip_argspec (const char *type) OBJC_DEPRECATED;
-int method_get_number_of_arguments (struct objc_method *) OBJC_DEPRECATED;
-int method_get_sizeof_arguments (struct objc_method *) OBJC_DEPRECATED;
-
-char *method_get_first_argument (struct objc_method *,
- arglist_t argframe,
- const char **type) OBJC_DEPRECATED;
-char *method_get_next_argument (arglist_t argframe,
- const char **type) OBJC_DEPRECATED;
-char *method_get_nth_argument (struct objc_method *m,
- arglist_t argframe,
- int arg,
- const char **type) OBJC_DEPRECATED;
-
-unsigned objc_get_type_qualifiers (const char *type) OBJC_DEPRECATED;
-
-
-struct objc_struct_layout
-{
- const char *original_type;
- const char *type;
- const char *prev_type;
- unsigned int record_size;
- unsigned int record_align;
-};
-
-void objc_layout_structure (const char *type,
- struct objc_struct_layout *layout) OBJC_DEPRECATED;
-BOOL objc_layout_structure_next_member (struct objc_struct_layout *layout) OBJC_DEPRECATED;
-void objc_layout_finish_structure (struct objc_struct_layout *layout,
- unsigned int *size,
- unsigned int *align) OBJC_DEPRECATED;
-void objc_layout_structure_get_info (struct objc_struct_layout *layout,
- unsigned int *offset,
- unsigned int *align,
- const char **type) OBJC_DEPRECATED;
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __encoding_INCLUDE_GNU */
diff --git a/objc/hash.h b/objc/hash.h
deleted file mode 100644
index 475a4fc..0000000
--- a/objc/hash.h
+++ /dev/null
@@ -1,216 +0,0 @@
-/* Hash tables for Objective C method dispatch.
- Copyright (C) 1993, 1995, 1996, 2004, 2009 Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 3, or (at your option)
-any later version.
-
-GCC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-Under Section 7 of GPL version 3, you are granted additional
-permissions described in the GCC Runtime Library Exception, version
-3.1, as published by the Free Software Foundation.
-
-You should have received a copy of the GNU General Public License and
-a copy of the GCC Runtime Library Exception along with this program;
-see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-. */
-
-
-
-#ifndef __hash_INCLUDE_GNU
-#define __hash_INCLUDE_GNU
-
-#include
-#include
-#include "objc.h"
-#include "Availability.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/*
- * This data structure is used to hold items
- * stored in a hash table. Each node holds
- * a key/value pair.
- *
- * Items in the cache are really of type void *.
- */
-typedef struct cache_node
-{
- struct cache_node *next; /* Pointer to next entry on the list.
- NULL indicates end of list. */
- const void *key; /* Key used to locate the value. Used
- to locate value when more than one
- key computes the same hash
- value. */
- void *value; /* Value stored for the key. */
-} *node_ptr;
-
-
-/*
- * This data type is the function that computes a hash code given a key.
- * Therefore, the key can be a pointer to anything and the function specific
- * to the key type.
- *
- * Unfortunately there is a mutual data structure reference problem with this
- * typedef. Therefore, to remove compiler warnings the functions passed to
- * objc_hash_new will have to be casted to this type.
- */
-typedef unsigned int (*hash_func_type) (void *, const void *);
-
-/*
- * This data type is the function that compares two hash keys and returns an
- * integer greater than, equal to, or less than 0, according as the first
- * parameter is lexicographically greater than, equal to, or less than the
- * second.
- */
-
-typedef int (*compare_func_type) (const void *, const void *);
-
-
-/*
- * This data structure is the cache.
- *
- * It must be passed to all of the hashing routines
- * (except for new).
- */
-typedef struct cache
-{
- /* Variables used to implement the hash itself. */
- node_ptr *node_table; /* Pointer to an array of hash nodes. */
- /* Variables used to track the size of the hash table so to determine
- when to resize it. */
- unsigned int size; /* Number of buckets allocated for the hash table
- (number of array entries allocated for
- "node_table"). Must be a power of two. */
- unsigned int used; /* Current number of entries in the hash table. */
- unsigned int mask; /* Precomputed mask. */
-
- /* Variables used to implement indexing through the hash table. */
-
- unsigned int last_bucket; /* Tracks which entry in the array where
- the last value was returned. */
- /* Function used to compute a hash code given a key.
- This function is specified when the hash table is created. */
- hash_func_type hash_func;
- /* Function used to compare two hash keys to see if they are equal. */
- compare_func_type compare_func;
-} *cache_ptr;
-
-
-/* Two important hash tables. */
-extern cache_ptr module_hash_table, class_hash_table;
-
-/* Allocate and initialize a hash table. */
-
-cache_ptr objc_hash_new (unsigned int size,
- hash_func_type hash_func,
- compare_func_type compare_func) OBJC_DEPRECATED;
-
-/* Deallocate all of the hash nodes and the cache itself. */
-
-void objc_hash_delete (cache_ptr cache) OBJC_DEPRECATED;
-
-/* Add the key/value pair to the hash table. If the
- hash table reaches a level of fullness then it will be resized.
-
- assert if the key is already in the hash. */
-
-void objc_hash_add (cache_ptr *cachep, const void *key, void *value) OBJC_DEPRECATED;
-
-/* Remove the key/value pair from the hash table.
- assert if the key isn't in the table. */
-
-void objc_hash_remove (cache_ptr cache, const void *key) OBJC_DEPRECATED;
-
-/* Used to index through the hash table. Start with NULL
- to get the first entry.
-
- Successive calls pass the value returned previously.
- ** Don't modify the hash during this operation ***
-
- Cache nodes are returned such that key or value can
- be extracted. */
-
-node_ptr objc_hash_next (cache_ptr cache, node_ptr node) OBJC_DEPRECATED;
-
-/* Used to return a value from a hash table using a given key. */
-
-void *objc_hash_value_for_key (cache_ptr cache, const void *key) OBJC_DEPRECATED;
-
-/* Used to determine if the given key exists in the hash table */
-
-BOOL objc_hash_is_key_in_hash (cache_ptr cache, const void *key) OBJC_DEPRECATED;
-
-/************************************************
-
- Useful hashing functions.
-
- Declared inline for your pleasure.
-
-************************************************/
-
-/* Calculate a hash code by performing some
- manipulation of the key pointer. (Use the lowest bits
- except for those likely to be 0 due to alignment.) */
-
-static inline unsigned int
-objc_hash_ptr (cache_ptr cache, const void *key)
-{
- return ((size_t)key / sizeof (void *)) & cache->mask;
-}
-
-
-/* Calculate a hash code by iterating over a NULL
- terminate string. */
-static inline unsigned int
-objc_hash_string (cache_ptr cache, const void *key)
-{
- unsigned int ret = 0;
- unsigned int ctr = 0;
- const char *ckey = (const char *) key;
-
- while (*ckey) {
- ret ^= *ckey++ << ctr;
- ctr = (ctr + 1) % sizeof (void *);
- }
-
- return ret & cache->mask;
-}
-
-
-/* Compare two pointers for equality. */
-static inline int
-objc_compare_ptrs (const void *k1, const void *k2)
-{
- return (k1 == k2);
-}
-
-
-/* Compare two strings. */
-static inline int
-objc_compare_strings (const void *k1, const void *k2)
-{
- if (k1 == k2)
- return 1;
- else if (k1 == 0 || k2 == 0)
- return 0;
- else
- return ! strcmp ((const char *) k1, (const char *) k2);
-}
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* not __hash_INCLUDE_GNU */
diff --git a/objc/hooks.h b/objc/hooks.h
index b8abc61..d372da5 100644
--- a/objc/hooks.h
+++ b/objc/hooks.h
@@ -38,3 +38,9 @@ OBJC_HOOK struct objc_slot *(*__objc_msg_forward3)(id, SEL);
* handles the forwarding.
*/
OBJC_HOOK IMP (*__objc_msg_forward2)(id, SEL);
+/**
+ * Hook defined for handling unhandled exceptions. If the unwind library
+ * reaches the end of the stack without finding a handler then this hook is
+ * called.
+ */
+OBJC_HOOK void (*_objc_unexpected_exception)(id exception);
diff --git a/objc/objc-api.h b/objc/objc-api.h
deleted file mode 100644
index 3c9df43..0000000
--- a/objc/objc-api.h
+++ /dev/null
@@ -1,662 +0,0 @@
-/* GNU Objective-C Runtime API.
- Copyright (C) 1993, 1995, 1996, 1997, 2001, 2002, 2003, 2004, 2005,
- 2007, 2009 Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3, or (at your option) any
-later version.
-
-GCC is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-License for more details.
-
-Under Section 7 of GPL version 3, you are granted additional
-permissions described in the GCC Runtime Library Exception, version
-3.1, as published by the Free Software Foundation.
-
-You should have received a copy of the GNU General Public License and
-a copy of the GCC Runtime Library Exception along with this program;
-see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-. */
-
-
-#ifndef __objc_api_INCLUDE_GNU
-#define __objc_api_INCLUDE_GNU
-
-#include "objc.h"
-#include "hash.h"
-#include "thr.h"
-#include "objc-decls.h"
-#include "Availability.h"
-#include
-#include
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-/* For functions which return Method_t */
-#define METHOD_NULL (Method_t)0
- /* Boolean typedefs */
-/* Method descriptor returned by introspective Object methods.
- This is really just the first part of the more complete objc_method
- structure defined below and used internally by the runtime. */
-struct objc_method_description
-{
- SEL name; /* this is a selector, not a string */
- char *types; /* type encoding */
-};
-
-/* Filer types used to describe Ivars and Methods. */
-#define _C_ID '@'
-#define _C_CLASS '#'
-#define _C_SEL ':'
-#define _C_CHR 'c'
-#define _C_UCHR 'C'
-#define _C_SHT 's'
-#define _C_USHT 'S'
-#define _C_INT 'i'
-#define _C_UINT 'I'
-#define _C_LNG 'l'
-#define _C_ULNG 'L'
-#define _C_LNG_LNG 'q'
-#define _C_ULNG_LNG 'Q'
-#define _C_FLT 'f'
-#define _C_DBL 'd'
-#define _C_BFLD 'b'
-#define _C_BOOL 'B'
-#define _C_VOID 'v'
-#define _C_UNDEF '?'
-#define _C_PTR '^'
-#define _C_CHARPTR '*'
-#define _C_ATOM '%'
-#define _C_ARY_B '['
-#define _C_ARY_E ']'
-#define _C_UNION_B '('
-#define _C_UNION_E ')'
-#define _C_STRUCT_B '{'
-#define _C_STRUCT_E '}'
-#define _C_VECTOR '!'
-#define _C_COMPLEX 'j'
-
-
-/* Error handling
-
- Call objc_error() or objc_verror() to record an error; this error
- routine will generally exit the program but not necessarily if the
- user has installed his own error handler.
-
- Call objc_set_error_handler to assign your own function for
- handling errors. The function should return YES if it is ok
- to continue execution, or return NO or just abort if the
- program should be stopped. The default error handler is just to
- print a message on stderr.
-
- The error handler function should be of type objc_error_handler
- The first parameter is an object instance of relevance.
- The second parameter is an error code.
- The third parameter is a format string in the printf style.
- The fourth parameter is a variable list of arguments. */
-extern void objc_error(id object, int code, const char* fmt, ...) OBJC_DEPRECATED;
-extern void objc_verror(id object, int code, const char* fmt, va_list ap) OBJC_DEPRECATED;
-typedef BOOL (*objc_error_handler)(id, int code, const char *fmt, va_list ap) OBJC_DEPRECATED;
-extern objc_error_handler objc_set_error_handler(objc_error_handler func) OBJC_DEPRECATED;
-
-/* Error codes
- These are used by the runtime library, and your
- error handling may use them to determine if the error is
- hard or soft thus whether execution can continue or abort. */
-#define OBJC_ERR_UNKNOWN 0 /* Generic error */
-
-#define OBJC_ERR_OBJC_VERSION 1 /* Incorrect runtime version */
-#define OBJC_ERR_GCC_VERSION 2 /* Incorrect compiler version */
-#define OBJC_ERR_MODULE_SIZE 3 /* Bad module size */
-#define OBJC_ERR_PROTOCOL_VERSION 4 /* Incorrect protocol version */
-
-#define OBJC_ERR_MEMORY 10 /* Out of memory */
-
-#define OBJC_ERR_RECURSE_ROOT 20 /* Attempt to archive the root
- object more than once. */
-#define OBJC_ERR_BAD_DATA 21 /* Didn't read expected data */
-#define OBJC_ERR_BAD_KEY 22 /* Bad key for object */
-#define OBJC_ERR_BAD_CLASS 23 /* Unknown class */
-#define OBJC_ERR_BAD_TYPE 24 /* Bad type specification */
-#define OBJC_ERR_NO_READ 25 /* Cannot read stream */
-#define OBJC_ERR_NO_WRITE 26 /* Cannot write stream */
-#define OBJC_ERR_STREAM_VERSION 27 /* Incorrect stream version */
-#define OBJC_ERR_BAD_OPCODE 28 /* Bad opcode */
-
-#define OBJC_ERR_UNIMPLEMENTED 30 /* Method is not implemented */
-
-#define OBJC_ERR_BAD_STATE 40 /* Bad thread state */
-
-/* Set this variable nonzero to print a line describing each
- message that is sent. (this is currently disabled) */
-extern BOOL objc_trace;
-
-
-/* For every class which happens to have statically allocated instances in
- this module, one OBJC_STATIC_INSTANCES is allocated by the compiler.
- INSTANCES is NULL terminated and points to all statically allocated
- instances of this class. */
-struct objc_static_instances
-{
- char *class_name;
-#ifdef __cplusplus
- id instances[1];
-#else
- id instances[0];
-#endif
-};
-
-/* Whereas a Module (defined further down) is the root (typically) of a file,
- a Symtab is the root of the class and category definitions within the
- module.
-
- A Symtab contains a variable length array of pointers to classes and
- categories defined in the module. */
-typedef struct objc_symtab {
- unsigned long sel_ref_cnt; /* Unknown. */
- SEL refs; /* Unknown. */
- unsigned short cls_def_cnt; /* Number of classes compiled
- (defined) in the module. */
- unsigned short cat_def_cnt; /* Number of categories
- compiled (defined) in the
- module. */
-
- void *defs[1]; /* Variable array of pointers.
- cls_def_cnt of type Class
- followed by cat_def_cnt of
- type Category_t, followed
- by a NULL terminated array
- of objc_static_instances. */
-} Symtab, *Symtab_t;
-
-
-/*
-** The compiler generates one of these structures for each module that
-** composes the executable (eg main.m).
-**
-** This data structure is the root of the definition tree for the module.
-**
-** A collect program runs between ld stages and creates a ObjC ctor array.
-** That array holds a pointer to each module structure of the executable.
-*/
-typedef struct objc_module {
- unsigned long version; /* Compiler revision. */
- unsigned long size; /* sizeof(Module). */
- const char* name; /* Name of the file where the
- module was generated. The
- name includes the path. */
-
- Symtab_t symtab; /* Pointer to the Symtab of
- the module. The Symtab
- holds an array of
- pointers to
- the classes and categories
- defined in the module. */
-} Module, *Module_t;
-
-
-/*
-** The compiler generates one of these structures for a class that has
-** instance variables defined in its specification.
-*/
-typedef struct objc_ivar {
- const char* ivar_name; /* Name of the instance
- variable as entered in the
- class definition. */
- const char* ivar_type; /* Description of the Ivar's
- type. Useful for
- debuggers. */
- int ivar_offset; /* Byte offset from the base
- address of the instance
- structure to the variable. */
-} *Ivar_t;
-
-typedef struct objc_ivar_list {
- int ivar_count; /* Number of structures (Ivar)
- contained in the list. One
- structure per instance
- variable defined in the
- class. */
- struct objc_ivar ivar_list[1]; /* Variable length
- structure. */
-} IvarList, *IvarList_t;
-
-/*
-** The compiler generates one (or more) of these structures for a class that
-** has methods defined in its specification.
-**
-** The implementation of a class can be broken into separate pieces in a file
-** and categories can break them across modules. To handle this problem is a
-** singly linked list of methods.
-*/
-typedef struct objc_method {
- SEL method_name; /* The selector used to identify
- the method. The types for this
- selector should match the next
- field. */
-
- const char* method_types; /* Description of the method's
- parameter list. Useful for
- debuggers. */
- IMP method_imp; /* Address of the method in the
- executable. */
-} Method, *Method_t;
-
-typedef struct objc_method_list {
- struct objc_method_list* method_next; /* This variable is used to link
- a method list to another. It
- is a singly linked list. */
- int method_count; /* Number of methods defined in
- this structure. */
- Method method_list[1]; /* Variable length
- structure. */
-} MethodList, *MethodList_t;
-
-struct objc_protocol_list {
- struct objc_protocol_list *next;
- size_t count;
- Protocol *list[1];
-};
-
-/*
-** This is used to assure consistent access to the info field of
-** classes
-*/
-#ifndef HOST_BITS_PER_LONG
-#define HOST_BITS_PER_LONG (sizeof(long)*8)
-#endif
-
-#define __CLS_INFO(cls) ((cls)->info)
-#define __CLS_ISINFO(cls, mask) ((__CLS_INFO(cls)&mask)==mask)
-#define __CLS_SETINFO(cls, mask) (__CLS_INFO(cls) |= mask)
-
-/* The structure is of type MetaClass */
-#define _CLS_META 0x2L
-#define CLS_ISMETA(cls) ((cls)&&__CLS_ISINFO(cls, _CLS_META))
-
-
-/* The structure is of type Class */
-#define _CLS_CLASS 0x1L
-#define CLS_ISCLASS(cls) ((cls)&&__CLS_ISINFO(cls, _CLS_CLASS))
-
-/*
-** The class is initialized within the runtime. This means that
-** it has had correct super and sublinks assigned
-*/
-#define _CLS_RESOLV 0x8L
-#define CLS_ISRESOLV(cls) __CLS_ISINFO(cls, _CLS_RESOLV)
-#define CLS_SETRESOLV(cls) __CLS_SETINFO(cls, _CLS_RESOLV)
-
-/*
-** The class has been send a +initialize message or a such is not
-** defined for this class
-*/
-#define _CLS_INITIALIZED 0x04L
-#define CLS_ISINITIALIZED(cls) __CLS_ISINFO(cls, _CLS_INITIALIZED)
-#define CLS_SETINITIALIZED(cls) __CLS_SETINFO(cls, _CLS_INITIALIZED)
-
-/*
-** The class uses the new, Objective-C 2, runtime ABI. This ABI defines an ABI
-** version field inside the class, and so will be used for all subsequent
-** versions that retain some degree of compatibility.
-*/
-#define _CLS_NEW_ABI 0x10L
-#define CLS_ISNEW_ABI(cls) __CLS_ISINFO(cls, _CLS_NEW_ABI)
-#define CLS_SETNEW_ABI(cls) __CLS_SETINFO(cls, _CLS_NEW_ABI)
-/*
-** The class was created at runtime and exists in heap-backed memory.
-*/
-#define _CLS_RUNTIME 0x20L
-#define CLS_ISRUNTIME(cls) __CLS_ISINFO(cls, _CLS_RUNTIME)
-#define CLS_SETRUNTIME(cls) __CLS_SETINFO(cls, _CLS_RUNTIME)
-/*
-** Instances of this class have a reference count and plane ID prepended to
-** them. The default for this is set for classes, unset for metaclasses. It
-** should be cleared by protocols, constant strings, and objects not allocated
-** by NSAllocateObject().
- */
-#define _CLS_PLANE_AWARE 0x40L
-#define CLS_ISPLANE_AWARE(cls) __CLS_ISINFO(cls, _CLS_PLANE_AWARE)
-#define CLS_SETPLANE_AWARE(cls) __CLS_SETINFO(cls, _CLS_PLANE_AWARE)
-/*
-** The class number of this class. This must be the same for both the
-** class and its meta class object
-*/
-#define CLS_GETNUMBER(cls) (__CLS_INFO(cls) >> (HOST_BITS_PER_LONG/2))
-#define CLS_SETNUMBER(cls, num) \
- ({ (cls)->info <<= (HOST_BITS_PER_LONG/2); \
- (cls)->info >>= (HOST_BITS_PER_LONG/2); \
- __CLS_SETINFO(cls, (((unsigned long)num) << (HOST_BITS_PER_LONG/2))); })
-
-/*
-** The compiler generates one of these structures for each category. A class
-** may have many categories and contain both instance and factory methods.
-*/
-typedef struct objc_category {
- const char* category_name; /* Name of the category. Name
- contained in the () of the
- category definition. */
- const char* class_name; /* Name of the class to which
- the category belongs. */
- MethodList_t instance_methods; /* Linked list of instance
- methods defined in the
- category. NULL indicates no
- instance methods defined. */
- MethodList_t class_methods; /* Linked list of factory
- methods defined in the
- category. NULL indicates no
- class methods defined. */
- struct objc_protocol_list *protocols; /* List of Protocols
- conformed to */
-} Category, *Category_t;
-
-/*
-** Structure used when a message is send to a class's super class. The
-** compiler generates one of these structures and passes it to
-** objc_msg_super.
-*/
-typedef struct objc_super {
- id self; /* Id of the object sending
- the message. */
-#ifdef __cplusplus
- Class super_class;
-#else
- Class class; /* Object's super class. */
-#endif
-} Super, *Super_t;
-
-IMP objc_msg_lookup_super(Super_t super, SEL sel);
-
-retval_t objc_msg_sendv(id, SEL, arglist_t);
-
-
-
-/*
-** This is a hook which is called by objc_lookup_class and
-** objc_get_class if the runtime is not able to find the class.
-** This may e.g. try to load in the class using dynamic loading.
-** The function is guaranteed to be passed a non-NULL name string.
-*/
-objc_EXPORT Class (*_objc_lookup_class)(const char *name);
-
-/*
-** This is a hook which is called by __objc_exec_class every time a class
-** or a category is loaded into the runtime. This may e.g. help a
-** dynamic loader determine the classes that have been loaded when
-** an object file is dynamically linked in.
-*/
-objc_EXPORT void (*_objc_load_callback)(Class _class, Category* category);
-
-/*
-** Hook functions for allocating, copying and disposing of instances
-*/
-objc_EXPORT id (*_objc_object_alloc)(Class _class);
-objc_EXPORT id (*_objc_object_copy)(id object);
-objc_EXPORT id (*_objc_object_dispose)(id object);
-
-/*
-** Standard functions for memory allocation and disposal.
-** Users should use these functions in their ObjC programs so
-** that they work properly with garbage collectors as well as
-** can take advantage of the exception/error handling available.
-*/
-void *
-objc_malloc(size_t size);
-
-void *
-objc_atomic_malloc(size_t size);
-
-void *
-objc_valloc(size_t size);
-
-void *
-objc_realloc(void *mem, size_t size);
-
-void *
-objc_calloc(size_t nelem, size_t size);
-
-void
-objc_free(void *mem);
-
-/*
-** Hook functions for memory allocation and disposal.
-** This makes it easy to substitute garbage collection systems
-** such as Boehm's GC by assigning these function pointers
-** to the GC's allocation routines. By default these point
-** to the ANSI standard malloc, realloc, free, etc.
-**
-** Users should call the normal objc routines above for
-** memory allocation and disposal within their programs.
-*/
-objc_EXPORT void *(*_objc_malloc)(size_t);
-objc_EXPORT void *(*_objc_atomic_malloc)(size_t);
-objc_EXPORT void *(*_objc_valloc)(size_t);
-objc_EXPORT void *(*_objc_realloc)(void *, size_t);
-objc_EXPORT void *(*_objc_calloc)(size_t, size_t);
-objc_EXPORT void (*_objc_free)(void *);
-
-/*
-** Hooks for method forwarding. This makes it easy to substitute a
-** library, such as ffcall, that implements closures, thereby avoiding
-** gcc's __builtin_apply problems. __objc_msg_forward2's result will
-** be preferred over that of __objc_msg_forward if both are set and
-** return non-NULL.
-*/
-objc_EXPORT IMP (*__objc_msg_forward)(SEL);
-objc_EXPORT IMP (*__objc_msg_forward2)(id, SEL);
-
-/*
-** Hook for uncaught exceptions. This hook is called when an exception
-** is thrown and no valid exception handler is in place. The function
-** is expected never to return. If the function returns the result is
-** currently undefined.
-*/
-objc_EXPORT void (*_objc_unexpected_exception)(id);
-
-
-Method_t class_get_class_method(MetaClass _class, SEL aSel) OBJC_DEPRECATED;
-
-Method_t class_get_instance_method(Class _class, SEL aSel) OBJC_DEPRECATED;
-
-Class class_pose_as(Class impostor, Class superclass) OBJC_DEPRECATED;
-
-Class objc_get_class(const char *name) OBJC_DEPRECATED;
-
-Class objc_lookup_class(const char *name) OBJC_DEPRECATED;
-
-Class objc_next_class(void **enum_state) OBJC_DEPRECATED;
-
-const char *sel_get_name(SEL selector) OBJC_DEPRECATED;
-
-const char *sel_get_type(SEL selector) OBJC_DEPRECATED;
-
-SEL sel_get_uid(const char *name) OBJC_DEPRECATED;
-
-SEL sel_get_any_uid(const char *name) OBJC_DEPRECATED;
-
-SEL sel_get_any_typed_uid(const char *name) OBJC_DEPRECATED;
-
-SEL sel_get_typed_uid(const char *name, const char*) OBJC_DEPRECATED;
-
-SEL sel_register_name(const char *name) OBJC_DEPRECATED;
-
-SEL sel_register_typed_name(const char *name, const char*type) OBJC_DEPRECATED;
-
-
-BOOL sel_is_mapped (SEL aSel) OBJC_DEPRECATED;
-
-extern id class_create_instance(Class _class) OBJC_DEPRECATED;
-
-static inline const char *
-class_get_class_name(Class _class)
-{
- return CLS_ISCLASS(_class)?_class->name:((_class==Nil)?"Nil":0);
-}
-
-static inline long
-class_get_instance_size(Class _class)
-{
- return CLS_ISCLASS(_class)?_class->instance_size:0;
-}
-
-static inline MetaClass
-class_get_meta_class(Class _class)
-{
- return CLS_ISCLASS(_class)?_class->class_pointer:Nil;
-}
-
-static inline Class
-class_get_super_class(Class _class)
-{
- if (!CLS_ISRESOLV(_class))
- {
- /* This class is not yet resolved ... so lookup superclass by name.
- * We need to allow for this case because we might doing a lookup in
- * a class which has not yet been registered with the runtime and
- * which might have ivars or methods added after this call (so we
- * mustn't resolve this class now).
- */
- if (NULL == _class->super_class) { return NULL; }
- return (Class)objc_get_class((const char*)_class->super_class);
- }
- return _class->super_class;
-}
-
-static inline int
-class_get_version(Class _class)
-{
- return CLS_ISCLASS(_class)?_class->version:-1;
-}
-
-static inline BOOL
-class_is_class(Class _class)
-{
- return CLS_ISCLASS(_class);
-}
-
-static inline BOOL
-class_is_meta_class(Class _class)
-{
- return CLS_ISMETA(_class);
-}
-
-
-static inline void
-class_set_version(Class _class, long version)
-{
- if (CLS_ISCLASS(_class))
- _class->version = version;
-}
-
-static inline void *
-class_get_gc_object_type (Class _class)
-{
- return CLS_ISCLASS(_class) ? _class->gc_object_type : NULL;
-}
-
-/* Mark the instance variable as innaccessible to the garbage collector */
-extern void class_ivar_set_gcinvisible (Class _class,
- const char* ivarname,
- BOOL gcInvisible);
-
-static inline IMP
-method_get_imp(Method_t method)
-{
- return (method!=METHOD_NULL)?method->method_imp:(IMP)0;
-}
-
-IMP get_imp (Class _class, SEL sel);
-
-/* Redefine on NeXTSTEP so as not to conflict with system function */
-#ifdef __NeXT__
-#define object_copy gnu_object_copy
-#define object_dispose gnu_object_dispose
-#endif
-
-id object_copy(id object);
-
-id object_dispose(id object);
-
-static inline Class
-object_get_class(id object)
-{
- return ((object!=nil)
- ? (CLS_ISCLASS(object->class_pointer)
- ? object->class_pointer
- : (CLS_ISMETA(object->class_pointer)
- ? (Class)object
- : Nil))
- : Nil);
-}
-
-static inline const char *
-object_get_class_name(id object)
-{
- return ((object!=nil)?(CLS_ISCLASS(object->class_pointer)
- ?object->class_pointer->name
- :((Class)object)->name)
- :"Nil");
-}
-
-static inline MetaClass
-object_get_meta_class(id object)
-{
- return ((object!=nil)?(CLS_ISCLASS(object->class_pointer)
- ?object->class_pointer->class_pointer
- :(CLS_ISMETA(object->class_pointer)
- ?object->class_pointer
- :Nil))
- :Nil);
-}
-
-static inline Class
-object_get_super_class
-(id object)
-{
- return ((object!=nil)?(CLS_ISCLASS(object->class_pointer)
- ?object->class_pointer->super_class
- :(CLS_ISMETA(object->class_pointer)
- ?((Class)object)->super_class
- :Nil))
- :Nil);
-}
-
-static inline BOOL
-object_is_class (id object)
-{
- return ((object != nil) && CLS_ISMETA (object->class_pointer));
-}
-
-static inline BOOL
-object_is_instance (id object)
-{
- return ((object != nil) && CLS_ISCLASS (object->class_pointer));
-}
-
-static inline BOOL
-object_is_meta_class (id object)
-{
- return ((object != nil)
- && !object_is_instance (object)
- && !object_is_class (object));
-}
-
-struct sarray*
-objc_get_uninstalled_dtable(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* not __objc_api_INCLUDE_GNU */
-
-
-
diff --git a/objc/objc-decls.h b/objc/objc-decls.h
deleted file mode 100644
index 6054237..0000000
--- a/objc/objc-decls.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* GNU Objective-C Extern helpers for Win32.
- Copyright (C) 2004, 2009 Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3, or (at your option) any
-later version.
-
-GCC is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-License for more details.
-
-Under Section 7 of GPL version 3, you are granted additional
-permissions described in the GCC Runtime Library Exception, version
-3.1, as published by the Free Software Foundation.
-
-You should have received a copy of the GNU General Public License and
-a copy of the GCC Runtime Library Exception along with this program;
-see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-. */
-
-
-#ifndef __objc_decls_INCLUDE_GNU
-#define __objc_decls_INCLUDE_GNU
-
-#if defined (_WIN32) || defined (__WIN32__) || defined (WIN32)
-
-# ifdef DLL_EXPORT /* defined by libtool (if required) */
-# define objc_EXPORT __declspec(dllexport)
-# define objc_DECLARE __declspec(dllexport)
-#else
-# define objc_EXPORT extern __declspec(dllimport)
-# define objc_DECLARE extern __declspec(dllimport)
-#endif
-
-#else
-
-# define objc_EXPORT extern
-# define objc_DECLARE
-
-#endif
-
-#endif /* __objc_decls_INCLUDE_GNU */
diff --git a/objc/objc-list.h b/objc/objc-list.h
deleted file mode 100644
index e542bfc..0000000
--- a/objc/objc-list.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/* Generic single linked list to keep various information
- Copyright (C) 1993, 1994, 1996, 2009 Free Software Foundation, Inc.
- Contributed by Kresten Krab Thorup.
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 3, or (at your option)
-any later version.
-
-GCC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-Under Section 7 of GPL version 3, you are granted additional
-permissions described in the GCC Runtime Library Exception, version
-3.1, as published by the Free Software Foundation.
-
-You should have received a copy of the GNU General Public License and
-a copy of the GCC Runtime Library Exception along with this program;
-see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-. */
-
-
-#ifndef __GNU_OBJC_LIST_H
-#define __GNU_OBJC_LIST_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-struct objc_list {
- void *head;
- struct objc_list *tail;
-};
-
-/* Return a cons cell produced from (head . tail) */
-
-static inline struct objc_list*
-list_cons(void* head, struct objc_list* tail)
-{
- struct objc_list* cell;
-
- cell = (struct objc_list*)objc_malloc(sizeof(struct objc_list));
- cell->head = head;
- cell->tail = tail;
- return cell;
-}
-
-/* Return the length of a list, list_length(NULL) returns zero */
-
-static inline int
-list_length(struct objc_list* list)
-{
- int i = 0;
- while(list)
- {
- i += 1;
- list = list->tail;
- }
- return i;
-}
-
-/* Return the Nth element of LIST, where N count from zero. If N
- larger than the list length, NULL is returned */
-
-static inline void*
-list_nth(int indx, struct objc_list* list)
-{
- while(indx-- != 0)
- {
- if(list->tail)
- list = list->tail;
- else
- return 0;
- }
- return list->head;
-}
-
-/* Remove the element at the head by replacing it by its successor */
-
-static inline void
-list_remove_head(struct objc_list** list)
-{
- if ((*list)->tail)
- {
- struct objc_list* tail = (*list)->tail; /* fetch next */
- *(*list) = *tail; /* copy next to list head */
- objc_free(tail); /* free next */
- }
- else /* only one element in list */
- {
- objc_free(*list);
- (*list) = 0;
- }
-}
-
-
-/* Remove the element with `car' set to ELEMENT */
-
-static inline void
-list_remove_elem(struct objc_list** list, void* elem)
-{
- while (*list) {
- if ((*list)->head == elem)
- list_remove_head(list);
- list = &((*list)->tail);
- }
-}
-
-/* Map FUNCTION over all elements in LIST */
-
-static inline void
-list_mapcar(struct objc_list* list, void(*function)(void*))
-{
- while(list)
- {
- (*function)(list->head);
- list = list->tail;
- }
-}
-
-/* Return element that has ELEM as car */
-
-static inline struct objc_list**
-list_find(struct objc_list** list, void* elem)
-{
- while(*list)
- {
- if ((*list)->head == elem)
- return list;
- list = &((*list)->tail);
- }
- return NULL;
-}
-
-/* Free list (backwards recursive) */
-
-static inline void
-list_free(struct objc_list* list)
-{
- if(list)
- {
- list_free(list->tail);
- objc_free(list);
- }
-}
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* not __GNU_OBJC_LIST_H */
diff --git a/objc/objc.h b/objc/objc.h
deleted file mode 100644
index b4a3a26..0000000
--- a/objc/objc.h
+++ /dev/null
@@ -1,209 +0,0 @@
-/* Basic data types for Objective C.
- Copyright (C) 1993, 1995, 1996, 2004, 2009 Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 3, or (at your option)
-any later version.
-
-GCC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-Under Section 7 of GPL version 3, you are granted additional
-permissions described in the GCC Runtime Library Exception, version
-3.1, as published by the Free Software Foundation.
-
-You should have received a copy of the GNU General Public License and
-a copy of the GCC Runtime Library Exception along with this program;
-see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-. */
-
-
-#ifndef __objc_INCLUDE_GNU
-#define __objc_INCLUDE_GNU
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include
-
-/*
-** Definition of the boolean type.
-*/
-#ifdef __vxworks
-typedef int BOOL;
-#else
-typedef unsigned char BOOL;
-#endif
-#define YES (BOOL)1
-#define NO (BOOL)0
-
-/*
-** Definition of a selector. Selectors themselves are not unique, but
-** the sel_id is a unique identifier.
-*/
-typedef const struct objc_selector
-{
- void *sel_id;
- const char *sel_types;
-} *SEL;
-
-inline static BOOL
-sel_eq (SEL s1, SEL s2)
-{
- if (s1 == 0 || s2 == 0)
- return s1 == s2;
- else
- return s1->sel_id == s2->sel_id;
-}
-
-
-/*
-** ObjC uses this typedef for untyped instances.
-*/
-typedef struct objc_object {
- struct objc_class* class_pointer;
-} *id;
-
-/*
-** Definition of method type. When retrieving the implementation of a
-** method, this is type of the pointer returned. The idea of the
-** definition of IMP is to represent a 'pointer to a general function
-** taking an id, a SEL, followed by other unspecified arguments'. You
-** must always cast an IMP to a pointer to a function taking the
-** appropriate, specific types for that function, before calling it -
-** to make sure the appropriate arguments are passed to it. The code
-** generated by the compiler to perform method calls automatically
-** does this cast inside method calls.
-*/
-typedef id (*IMP)(id, SEL, ...);
-
-/*
-** More simple types...
-*/
-#define nil (id)0 /* id of Nil instance */
-#define Nil (Class)0 /* id of Nil class */
-typedef char *STR; /* String alias */
-
-/*
-** The compiler generates one of these structures for each class.
-**
-** This structure is the definition for classes.
-**
-** This structure is generated by the compiler in the executable and used by
-** the run-time during normal messaging operations. Therefore some members
-** change type. The compiler generates "char* const" and places a string in
-** the following member variables: super_class.
-*/
-typedef struct objc_class *MetaClass;
-typedef struct objc_class *Class;
-struct objc_class {
- MetaClass class_pointer; /* Pointer to the class's
- meta class. */
- struct objc_class* super_class; /* Pointer to the super
- class. NULL for class
- Object. */
- const char* name; /* Name of the class. */
- long version; /* Unknown. */
- unsigned long info; /* Bit mask. See class masks
- defined above. */
- long instance_size; /* Size in bytes of the class.
- The sum of the class
- definition and all super
- class definitions. */
- struct objc_ivar_list* ivars; /* Pointer to a structure that
- describes the instance
- variables in the class
- definition. NULL indicates
- no instance variables. Does
- not include super class
- variables. */
- struct objc_method_list* methods; /* Linked list of instance
- methods defined for the
- class. */
- struct sarray * dtable; /* Pointer to instance
- method dispatch table. */
- struct objc_class* subclass_list; /* Subclasses */
- struct objc_class* sibling_class;
-
- struct objc_protocol_list *protocols; /* Protocols conformed to */
- void* gc_object_type;
- /**
- * New ABI. The following fields are only available with classes compiled to
- * support the new ABI. You may test whether any given class supports this
- * ABI by using the CLS_ISNEW_ABI() macro.
- */
-
- /**
- * The version of the ABI used for this class. This is currently always zero.
- */
- long abi_version;
-
- /**
- * Array of pointers to variables where the runtime will store the ivar
- * offset. These may be used for faster access to non-fragile ivars if all
- * of the code is compiled for the new ABI. Each of these pointers should
- * have the mangled name __objc_ivar_offset_value_{class name}.{ivar name}
- *
- * When using the compatible non-fragile ABI, this faster form should only be
- * used for classes declared in the same compilation unit.
- *
- * The compiler should also emit symbols of the form
- * __objc_ivar_offset_{class name}.{ivar name} which are pointers to the
- * offset values. These should be emitted as weak symbols in every module
- * where they are used. The legacy-compatible ABI uses these with a double
- * layer of indirection.
- */
- int **ivar_offsets;
- /**
- * List of declared properties on this class (NULL if none). This contains
- * the accessor methods for each property.
- */
- struct objc_property_list *properties;
-};
-
-#ifndef __OBJC__
-typedef struct objc_protocol {
- struct objc_class* class_pointer;
- char *protocol_name;
- struct objc_protocol_list *protocol_list;
- struct objc_method_description_list *instance_methods, *class_methods;
-} Protocol;
-
-struct objc_protocol2
-{
- struct objc_class* class_pointer;
- char *protocol_name;
- struct objc_protocol_list *protocol_list;
- struct objc_method_description_list *instance_methods, *class_methods;
- // New ABI
- struct objc_method_description_list *optional_instance_methods, *optional_class_methods;
- struct objc_property_list *properties, *optional_properties;
-};
-
-
-
-#else /* __OBJC__ */
-@class Protocol;
-#endif
-
-typedef void* retval_t; /* return value */
-typedef void(*apply_t)(void); /* function pointer */
-typedef union arglist {
- char *arg_ptr;
- char arg_regs[sizeof (char*)];
-} *arglist_t; /* argument frame */
-
-
-IMP objc_msg_lookup(id receiver, SEL op);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* not __objc_INCLUDE_GNU */
diff --git a/objc/runtime-legacy.h b/objc/runtime-legacy.h
deleted file mode 100644
index 5a0e38f..0000000
--- a/objc/runtime-legacy.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/* GNU Objective C Runtime internal declarations
- Copyright (C) 1993, 1995, 1996, 1997, 2002, 2004, 2009 Free Software Foundation, Inc.
- Contributed by Kresten Krab Thorup
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation; either version 3, or (at your option) any later version.
-
-GCC is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-details.
-
-Under Section 7 of GPL version 3, you are granted additional
-permissions described in the GCC Runtime Library Exception, version
-3.1, as published by the Free Software Foundation.
-
-You should have received a copy of the GNU General Public License and
-a copy of the GCC Runtime Library Exception along with this program;
-see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-. */
-
-
-#ifndef __objc_runtime_INCLUDE_GNU
-#define __objc_runtime_INCLUDE_GNU
-
-#include /* for varargs and va_list's */
-
-#include
-#include
-
-#include /* so noone else will get system versions */
-#include
-
-#include "objc.h" /* core data types */
-#include "objc-api.h" /* runtime api functions */
-
-#include "thr.h" /* thread and mutex support */
-
-#include "hash.h" /* hash structures */
-#include "objc-list.h" /* linear lists */
-#include "Availability.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-extern void __objc_add_class_to_hash(Class) OBJC_DEPRECATED; /* (objc-class.c) */
-extern void __objc_init_selector_tables(void) OBJC_DEPRECATED; /* (objc-sel.c) */
-extern void __objc_init_class_tables(void) OBJC_DEPRECATED; /* (objc-class.c) */
-extern void __objc_init_dispatch_tables(void) OBJC_DEPRECATED; /* (objc-dispatch.c) */
-extern void __objc_install_premature_dtable(Class) OBJC_DEPRECATED; /* (objc-dispatch.c) */
-extern void __objc_resolve_class_links(void) OBJC_DEPRECATED; /* (objc-class.c) */
-extern void __objc_register_selectors_from_class(Class) OBJC_DEPRECATED; /* (objc-sel.c) */
-extern void __objc_register_selectors_from_list (MethodList_t) OBJC_DEPRECATED; /* (selector.c) */
-extern void __objc_update_dispatch_table_for_class (Class) OBJC_DEPRECATED;/* (objc-msg.c) */
-
-extern int __objc_init_thread_system(void) OBJC_DEPRECATED; /* thread.c */
-extern int __objc_fini_thread_system(void) OBJC_DEPRECATED; /* thread.c */
-extern void __objc_print_dtable_stats(void) OBJC_DEPRECATED; /* sendmsg.c */
-
-extern void class_add_method_list(Class, MethodList_t) OBJC_DEPRECATED;
-
-/* Registering instance methods as class methods for root classes */
-extern void __objc_register_instance_methods_to_class(Class) OBJC_DEPRECATED;
-extern Method_t search_for_method_in_list(MethodList_t list, SEL op) OBJC_DEPRECATED;
-
-/* True when class links has been resolved */
-extern BOOL __objc_class_links_resolved OBJC_DEPRECATED;
-
-/* Number of selectors stored in each of the selector tables */
-extern unsigned int __objc_selector_max_index OBJC_DEPRECATED;
-
-/* Mutex locking __objc_selector_max_index and its arrays. */
-extern objc_mutex_t __objc_runtime_mutex;
-
-/* Number of threads which are alive. */
-extern int __objc_runtime_threads_alive;
-
-#ifdef DEBUG
-#define DEBUG_PRINTF(format, args...) printf (format, ## args)
-#else
-#define DEBUG_PRINTF(format, args...)
-#endif
-
-BOOL __objc_responds_to (id object, SEL sel) OBJC_DEPRECATED; /* for internal use only! */
-SEL __sel_register_typed_name (const char*, const char*,
- struct objc_selector*, BOOL is_const) OBJC_DEPRECATED;
-extern void __objc_generate_gc_type_description (Class) OBJC_DEPRECATED;
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* not __objc_runtime_INCLUDE_GNU */
diff --git a/objc/sarray.h b/objc/sarray.h
deleted file mode 100644
index e69de29..0000000
diff --git a/objc/thr.h b/objc/thr.h
deleted file mode 100644
index c67c093..0000000
--- a/objc/thr.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* Thread and mutex controls for Objective C.
- Copyright (C) 1996, 1997, 2002, 2004, 2009 Free Software Foundation, Inc.
- Contributed by Galen C. Hunt (gchunt@cs.rochester.edu)
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 3, or (at your option)
-any later version.
-
-GCC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-Under Section 7 of GPL version 3, you are granted additional
-permissions described in the GCC Runtime Library Exception, version
-3.1, as published by the Free Software Foundation.
-
-You should have received a copy of the GNU General Public License and
-a copy of the GCC Runtime Library Exception along with this program;
-see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-. */
-
-#ifndef __thread_INCLUDE_GNU
-#define __thread_INCLUDE_GNU
-
-#include "objc.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/** Recursive mutex type used to protect the runtime. */
-typedef void *objc_mutex_t;
-
-/**
- * Global runtime mutex. Acquire this before calling any unsafe runtime
- * functions. Note that this is never needed if you restrict yourself to the
- * public interfaces, which are strongly recommended.
- */
-extern objc_mutex_t __objc_runtime_mutex;
-/* Frontend mutex functions */
-int objc_mutex_lock (objc_mutex_t mutex);
-int objc_mutex_unlock (objc_mutex_t mutex);
-
-/**
- * Callback for when the runtime becomes multithreaded. As the runtime is now
- * always in multithreaded mode, the callback is called as soon as it is
- * registered and then discarded. This interface is maintained solely for
- * legacy compatibility.
- */
-typedef void (*objc_thread_callback) (void);
-objc_thread_callback objc_set_thread_callback (objc_thread_callback func);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* not __thread_INCLUDE_GNU */
diff --git a/objc/typedstream.h b/objc/typedstream.h
deleted file mode 100644
index 0d7643f..0000000
--- a/objc/typedstream.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/* GNU Objective-C Typed Streams interface.
- Copyright (C) 1993, 1995, 2004, 2009 Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3, or (at your option) any
-later version.
-
-GCC is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-License for more details.
-
-Under Section 7 of GPL version 3, you are granted additional
-permissions described in the GCC Runtime Library Exception, version
-3.1, as published by the Free Software Foundation.
-
-You should have received a copy of the GNU General Public License and
-a copy of the GCC Runtime Library Exception along with this program;
-see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-. */
-
-
-#ifndef __typedstream_INCLUDE_GNU
-#define __typedstream_INCLUDE_GNU
-
-#include "objc.h"
-#include "hash.h"
-
-#include
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-typedef int (*objc_typed_read_func)(void*, char*, int);
-typedef int (*objc_typed_write_func)(void*, const char*, int);
-typedef int (*objc_typed_flush_func)(void*);
-typedef int (*objc_typed_eof_func)(void*);
-
-#define OBJC_READONLY 0x01
-#define OBJC_WRITEONLY 0x02
-
-#define OBJC_MANAGED_STREAM 0x01
-#define OBJC_FILE_STREAM 0x02
-#define OBJC_MEMORY_STREAM 0x04
-
-#define OBJC_TYPED_STREAM_VERSION 0x01
-
-typedef struct objc_typed_stream {
- void* physical;
- cache_ptr object_table; /* read/written objects */
- cache_ptr stream_table; /* other read/written but shared things.. */
- cache_ptr class_table; /* class version mapping */
- cache_ptr object_refs; /* forward references */
- int mode; /* OBJC_READONLY or OBJC_WRITEONLY */
- int type; /* MANAGED, FILE, MEMORY etc bit string */
- int version; /* version used when writing */
- int writing_root_p;
- objc_typed_read_func read;
- objc_typed_write_func write;
- objc_typed_eof_func eof;
- objc_typed_flush_func flush;
-} TypedStream;
-
-/* opcode masks */
-#define _B_VALUE 0x1fU
-#define _B_CODE 0xe0U
-#define _B_SIGN 0x10U
-#define _B_NUMBER 0x0fU
-
-/* standard opcodes */
-#define _B_INVALID 0x00U
-#define _B_SINT 0x20U
-#define _B_NINT 0x40U
-#define _B_SSTR 0x60U
-#define _B_NSTR 0x80U
-#define _B_RCOMM 0xa0U
-#define _B_UCOMM 0xc0U
-#define _B_EXT 0xe0U
-
-/* eXtension opcodes */
-#define _BX_OBJECT 0x00U
-#define _BX_CLASS 0x01U
-#define _BX_SEL 0x02U
-#define _BX_OBJREF 0x03U
-#define _BX_OBJROOT 0x04U
-#define _BX_EXT 0x1fU
-
-/*
-** Read and write objects as specified by TYPE. All the `last'
-** arguments are pointers to the objects to read/write.
-*/
-
-int objc_write_type (TypedStream* stream, const char* type, const void* data);
-int objc_read_type (TypedStream* stream, const char* type, void* data);
-
-int objc_write_types (TypedStream* stream, const char* type, ...);
-int objc_read_types (TypedStream* stream, const char* type, ...);
-
-int objc_write_object_reference (TypedStream* stream, id object);
-int objc_write_root_object (TypedStream* stream, id object);
-
-long objc_get_stream_class_version (TypedStream* stream, Class class_type);
-
-
-/*
-** Convenience functions
-*/
-
-int objc_write_array (TypedStream* stream, const char* type,
- int count, const void* data);
-int objc_read_array (TypedStream* stream, const char* type,
- int count, void* data);
-
-int objc_write_object (TypedStream* stream, id object);
-int objc_read_object (TypedStream* stream, id* object);
-
-
-
-/*
-** Open a typed stream for reading or writing. MODE may be either of
-** OBJC_READONLY or OBJC_WRITEONLY.
-*/
-
-TypedStream* objc_open_typed_stream (FILE* physical, int mode);
-TypedStream* objc_open_typed_stream_for_file (const char* file_name, int mode);
-
-void objc_close_typed_stream (TypedStream* stream);
-
-BOOL objc_end_of_typed_stream (TypedStream* stream);
-void objc_flush_typed_stream (TypedStream* stream);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* not __typedstream_INCLUDE_GNU */