diff options
author | nicola <nicola@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-10-12 18:43:54 +0000 |
---|---|---|
committer | nicola <nicola@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-10-12 18:43:54 +0000 |
commit | f75aa15889d4afbf4944da0dc3dba5ba3c21a0c1 (patch) | |
tree | b4d41623d7f15f6d47b2a7f3c02ac077462df0f9 /libobjc/class.c | |
parent | a10fc41a0de5e88df4bfeeda0b72f41101232913 (diff) | |
download | gcc-f75aa15889d4afbf4944da0dc3dba5ba3c21a0c1.tar.gz |
In libobjc/:
2010-10-12 Nicola Pero <nicola.pero@meta-innovation.com>
* class.c: Include objc/runtime.h and objc-private/module-abi-8.h
instead of objc/objc-api.h.
(objc_get_unknown_class_handler): Do not define.
(class_isMetaClass): New.
(class_getSuperclass): New.
(class_getVersion): New.
(class_setVersion): New.
(class_getInstanceSize): New.
* exceptions.c: Include objc/runtime.h instead of objc/objc-api.h.
(is_kind_of_exception_matcher): Use objc_getSuperclass instead of
objc_get_super_class.
(get_ttype_entry): Use objc_getRequiredClass instead of
objc_get_class.
* ivars.c (class_getClassVariable): New.
* objects.c: Include objc/runtime.h, objc/thr.h and
objc-private/module-abi-8.h instead of objc/objc-api.h
* objc/runtime.h (class_getClassVariable): New.
(class_isMetaClass): New.
(class_getSuperclass): New.
(class_getVersion): New.
(class_setVersion): New.
(class_getInstanceSize): New.
* objc-private/module-abi-8.h (HOST_BITS_PER_LONG): New (from
objc/objc-api.h)
(__CLS_INFO): Same.
(__CLS_ISINFO): Same.
(__CLS_SETINFO): Same.
(CLS_ISMETA): Same.
(CLS_ISCLASS): Same.
(CLS_ISRESOLV): Same.
(CLS_SETRESOLV): Same.
(CLS_ISINITIALIZED): Same.
(CLS_SETINITIALIZED): Same.
(CLS_GETNUMBER): Same.
(CLS_SETNUMBER): Same.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@165392 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libobjc/class.c')
-rw-r--r-- | libobjc/class.c | 56 |
1 files changed, 48 insertions, 8 deletions
diff --git a/libobjc/class.c b/libobjc/class.c index 75c933ba32f..4eb86761ee8 100644 --- a/libobjc/class.c +++ b/libobjc/class.c @@ -89,10 +89,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "objc-private/common.h" #include "objc-private/error.h" -#include "objc/objc-api.h" +#include "objc/runtime.h" #include "objc/thr.h" -#include "objc-private/runtime.h" /* the kitchen sink */ -#include <string.h> /* For memset */ +#include "objc-private/module-abi-8.h" /* For CLS_ISCLASS and similar. */ +#include "objc-private/runtime.h" /* the kitchen sink */ +#include <string.h> /* For memset */ /* We use a table which maps a class name to the corresponding class * pointer. The first part of this file defines this table, and @@ -417,11 +418,6 @@ class_table_print_histogram (void) */ Class (*_objc_lookup_class) (const char *name) = 0; /* !T:SAFE */ -/* Temporarily while we still include objc/objc-api.h instead of objc/runtime.h. */ -#ifndef __objc_runtime_INCLUDE_GNU -typedef Class (*objc_get_unknown_class_handler)(const char *class_name); -#endif - /* The handler currently in use. PS: if both __obj_get_unknown_class_handler and _objc_lookup_class are defined, __objc_get_unknown_class_handler is called first. */ @@ -591,6 +587,7 @@ objc_lookup_class (const char *name) called automatically by the compiler while messaging (if using the traditional ABI), so it is worth keeping it fast; don't make it just a wrapper around objc_getClass(). */ +/* Note that this is roughly equivalent to objc_getRequiredClass(). */ /* Get the class object for the class named NAME. If NAME does not identify a known class, the hook _objc_lookup_class is called. If this fails, an error message is issued and the system aborts. */ @@ -739,6 +736,49 @@ class_getName (Class class_) return class_->name; } +BOOL +class_isMetaClass (Class class_) +{ + /* CLS_ISMETA includes the check for Nil class_. */ + return CLS_ISMETA (class_); +} + +Class +class_getSuperclass (Class class_) +{ + if (class_ == Nil) + return Nil; + + return class_->super_class; +} + +int +class_getVersion (Class class_) +{ + if (class_ == Nil) + return 0; + + return (int)(class_->version); +} + +void +class_setVersion (Class class_, int version) +{ + if (class_ == Nil) + return; + + class_->version = version; +} + +size_t +class_getInstanceSize (Class class_) +{ + if (class_ == Nil) + return 0; + + return class_->instance_size; +} + #define CLASSOF(c) ((c)->class_pointer) Class |