diff options
author | Nicola Pero <nicola.pero@meta-innovation.com> | 2010-10-12 18:43:54 +0000 |
---|---|---|
committer | Nicola Pero <nicola@gcc.gnu.org> | 2010-10-12 18:43:54 +0000 |
commit | be05b0f5991ef9d9cd7b99f2f8e042a24e5336b0 (patch) | |
tree | b4d41623d7f15f6d47b2a7f3c02ac077462df0f9 /libobjc/objc | |
parent | ce9555cb8273fc011d81d7bb2bb54da020b95b16 (diff) | |
download | gcc-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')
-rw-r--r-- | libobjc/objc/runtime.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/libobjc/objc/runtime.h b/libobjc/objc/runtime.h index 6efe78d..a52c761 100644 --- a/libobjc/objc/runtime.h +++ b/libobjc/objc/runtime.h @@ -239,6 +239,14 @@ objc_EXPORT Class object_setClass (id object, Class class_); reuse the returned Ivar if you can. */ objc_EXPORT Ivar class_getInstanceVariable (Class class_, const char *name); +/* Return a class variable given the class and the class variable + name. This is an expensive function to call, so try to reuse the + returned Ivar if you can. + + This function always returns NULL since class variables are + currently unavailable in Objective-C. */ +objc_EXPORT Ivar class_getClassVariable (Class class_, const char *name); + /* If the object was created in class_createInstance() with some extraBytes, returns a pointer to them. If it was not, then the returned pointer may make no sense. */ @@ -361,6 +369,48 @@ objc_EXPORT int objc_getClassList (Class *returnValue, int maxNumberOfClassesToR class_ is Nil. */ objc_EXPORT const char * class_getName (Class class_); +/* Return YES if 'class_' is a meta class, and NO if not. If 'class_' + is Nil, return NO. */ +objc_EXPORT BOOL class_isMetaClass (Class class_); + +/* Return the superclass of 'class_'. If 'class_' is Nil, or it is a root + class, return Nil. + + TODO: It may be worth to define this inline, since it is usually + used in loops when traversing the class hierarchy. */ +objc_EXPORT Class class_getSuperclass (Class class_); + +/* Return the 'version' number of the class, which is an integer that + can be used to track changes in the class API, methods and + variables. If class_ is Nil, return 0. If class_ is not Nil, the + version is 0 unless class_setVersion() has been called to set a + different one. + + Please note that internally the version is a long, but the API only + allows you to set and retrieve int values. */ +objc_EXPORT int class_getVersion (Class class_); + +/* Set the 'version' number of the class, which is an integer that can + be used to track changes in the class API, methods and variables. + If 'class_' is Nil, does nothing. + + This is typically used internally by "Foundation" libraries such as + GNUstep Base to support serialization / deserialization of objects + that work across changes in the classes. If you are using such a + library, you probably want to use their versioning API, which may + be based on this one, but is integrated with the rest of the + library. + + Please note that internally the version is a long, but the API only + allows you to set and retrieve int values. */ +objc_EXPORT void class_setVersion (Class class_, int version); + +/* Return the size in bytes (a byte is the size of a char) of an + instance of the class. If class_ is Nil, return 0; else it return + a non-zero number (since the 'isa' instance variable is required + for all classes). */ +objc_EXPORT size_t class_getInstanceSize (Class class_); + /** Implementation: the following functions are in protocols.c. */ |