aboutsummaryrefslogtreecommitdiff
path: root/libobjc/objc-private
diff options
context:
space:
mode:
authorNicola Pero <nicola.pero@meta-innovation.com>2010-10-12 18:43:54 +0000
committerNicola Pero <nicola@gcc.gnu.org>2010-10-12 18:43:54 +0000
commitbe05b0f5991ef9d9cd7b99f2f8e042a24e5336b0 (patch)
treeb4d41623d7f15f6d47b2a7f3c02ac077462df0f9 /libobjc/objc-private
parentce9555cb8273fc011d81d7bb2bb54da020b95b16 (diff)
downloadgcc-be05b0f5991ef9d9cd7b99f2f8e042a24e5336b0.zip
gcc-be05b0f5991ef9d9cd7b99f2f8e042a24e5336b0.tar.gz
gcc-be05b0f5991ef9d9cd7b99f2f8e042a24e5336b0.tar.bz2
In libobjc/: 2010-10-12 Nicola Pero <nicola.pero@meta-innovation.com>
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. From-SVN: r165392
Diffstat (limited to 'libobjc/objc-private')
-rw-r--r--libobjc/objc-private/module-abi-8.h41
1 files changed, 40 insertions, 1 deletions
diff --git a/libobjc/objc-private/module-abi-8.h b/libobjc/objc-private/module-abi-8.h
index 120f513..414e5e3 100644
--- a/libobjc/objc-private/module-abi-8.h
+++ b/libobjc/objc-private/module-abi-8.h
@@ -183,7 +183,7 @@ struct objc_class {
const char* name; /* Name of the class. */
long version; /* Unknown. */
unsigned long info; /* Bit mask. See class masks
- defined above. */
+ defined below. */
long instance_size; /* Size in bytes of the class.
The sum of the class
definition and all super
@@ -218,6 +218,45 @@ struct objc_class {
};
#endif /* __objc_STRUCT_OBJC_CLASS_defined */
+/* 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 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. */