summaryrefslogtreecommitdiff
path: root/libobjc
diff options
context:
space:
mode:
authornicola <nicola@138bc75d-0d04-0410-961f-82ee72b054a4>2010-10-15 23:42:02 +0000
committernicola <nicola@138bc75d-0d04-0410-961f-82ee72b054a4>2010-10-15 23:42:02 +0000
commitad337f1d435385c3dbdd7a46796778b95688b699 (patch)
tree1748b6dad2e0a551aadb4ac306897ff4d594c4f2 /libobjc
parent4028020e9f517e272f3f9889d35f74cac6bbbb29 (diff)
downloadgcc-ad337f1d435385c3dbdd7a46796778b95688b699.tar.gz
In libobjc/:
2010-10-15 Nicola Pero <nicola.pero@meta-innovation.com> * objc/runtime.h (class_copyPropertyList): New. (class_getProperty): New. (property_getAttributes): New. (property_getName): New. * ivars.c (class_copyPropertyList): New. (class_getProperty): New. (property_getAttributes): New. (property_getName): New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@165531 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libobjc')
-rw-r--r--libobjc/ChangeLog11
-rw-r--r--libobjc/ivars.c53
-rw-r--r--libobjc/objc/runtime.h72
3 files changed, 116 insertions, 20 deletions
diff --git a/libobjc/ChangeLog b/libobjc/ChangeLog
index 0561f88d15e..383d02f621c 100644
--- a/libobjc/ChangeLog
+++ b/libobjc/ChangeLog
@@ -1,4 +1,15 @@
2010-10-15 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objc/runtime.h (class_copyPropertyList): New.
+ (class_getProperty): New.
+ (property_getAttributes): New.
+ (property_getName): New.
+ * ivars.c (class_copyPropertyList): New.
+ (class_getProperty): New.
+ (property_getAttributes): New.
+ (property_getName): New.
+
+2010-10-15 Nicola Pero <nicola.pero@meta-innovation.com>
* objc-private/runtime.h (__objc_update_classes_with_methods): New.
* class.c (__objc_update_classes_with_methods): New.
diff --git a/libobjc/ivars.c b/libobjc/ivars.c
index 0dbb45b676a..b1e261bb8cc 100644
--- a/libobjc/ivars.c
+++ b/libobjc/ivars.c
@@ -228,3 +228,56 @@ struct objc_ivar ** class_copyIvarList (Class class_, unsigned int *numberOfRetu
return returnValue;
}
+
+const char *
+property_getName (struct objc_property * property __attribute__ ((__unused__)))
+{
+ if (property == NULL)
+ return NULL;
+
+ /* TODO: New ABI. */
+ /* The current ABI does not have any information on properties. */
+ return NULL;
+}
+
+const char *
+property_getAttributes (struct objc_property * property __attribute__ ((__unused__)))
+{
+ if (property == NULL)
+ return NULL;
+
+ /* TODO: New ABI. */
+ /* The current ABI does not have any information on properties. */
+ return NULL;
+}
+
+struct objc_property *
+class_getProperty (Class class_ __attribute__ ((__unused__)),
+ const char *propertyName __attribute__ ((__unused__)))
+{
+ if (class_ == NULL || propertyName == NULL)
+ return NULL;
+
+ /* TODO: New ABI. */
+ /* The current ABI does not have any information on class properties. */
+ return NULL;
+}
+
+struct objc_property **
+class_copyPropertyList (Class class_ __attribute__ ((__unused__)),
+ unsigned int *numberOfReturnedProperties __attribute__ ((__unused__)))
+{
+ if (class_ == Nil)
+ {
+ if (numberOfReturnedProperties)
+ *numberOfReturnedProperties = 0;
+ return NULL;
+ }
+
+ /* TODO: New ABI. */
+ /* The current ABI does not have any information on class properties. */
+ if (numberOfReturnedProperties)
+ *numberOfReturnedProperties = 0;
+
+ return NULL;
+}
diff --git a/libobjc/objc/runtime.h b/libobjc/objc/runtime.h
index bb241acd5b3..27ecabf8850 100644
--- a/libobjc/objc/runtime.h
+++ b/libobjc/objc/runtime.h
@@ -305,6 +305,37 @@ objc_EXPORT const char * ivar_getTypeEncoding (Ivar variable);
will be filled with the number of instance variables returned. */
objc_EXPORT Ivar * class_copyIvarList (Class class_, unsigned int *numberOfReturnedIvars);
+/* Return the name of the property. Return NULL if 'property' is
+ NULL. */
+objc_EXPORT const char * property_getName (Property property);
+
+/* Return the attributes of the property as a string. Return NULL if
+ 'property' is NULL. */
+objc_EXPORT const char * property_getAttributes (Property property);
+
+/* Return the property with name 'propertyName' of the class 'class_'.
+ This function returns NULL if the required property can not be
+ found. Return NULL if 'class_' or 'propertyName' is NULL.
+
+ Note that the traditional ABI does not store the list of properties
+ of a class in a compiled module, so the traditional ABI will always
+ return NULL. */
+objc_EXPORT Property class_getProperty (Class class_, const char *propertyName);
+
+/* Return all the properties of the class. The return value
+ of the function is a pointer to an area, allocated with malloc(),
+ that contains all the properties of the class. It does not
+ include properties of superclasses. The list is terminated
+ by NULL. Optionally, if you pass a non-NULL
+ 'numberOfReturnedIvars' pointer, the unsigned int that it points to
+ will be filled with the number of properties returned.
+
+ Note that the traditional ABI does not store the list of properties
+ of a class in a compiled module, so the traditional ABI will always
+ return an empty list. */
+objc_EXPORT Property * class_copyPropertyList
+(Class class_, unsigned int *numberOfReturnedProperties);
+
/** Implementation: the following functions are in class.c. */
@@ -422,6 +453,27 @@ objc_EXPORT void class_setVersion (Class class_, int version);
for all classes). */
objc_EXPORT size_t class_getInstanceSize (Class class_);
+/* Change the implementation of the method. It also searches all
+ classes for any class implementing the method, and replaces the
+ existing implementation with the new one. For that to work,
+ 'method' must be a method returned by class_getInstanceMethod() or
+ class_getClassMethod() as the matching is done by comparing the
+ pointers; in that case, only the implementation in the class is
+ modified. Return the previous implementation that has been
+ replaced. If method or implementation is NULL, do nothing and
+ return NULL. */
+objc_EXPORT IMP
+method_setImplementation (Method method, IMP implementation);
+
+/* Swap the implementation of two methods in a single, atomic
+ operation. This is equivalent to getting the implementation of
+ each method and then calling method_setImplementation() on the
+ other one. For this to work, the two methods must have been
+ returned by class_getInstanceMethod() or class_getClassMethod().
+ If 'method_a' or 'method_b' is NULL, do nothing. */
+objc_EXPORT void
+method_exchangeImplementations (Method method_a, Method method_b);
+
/** Implementation: the following functions are in sendmsg.c. */
@@ -545,26 +597,6 @@ objc_EXPORT void method_getReturnType (Method method, char *returnValue,
objc_EXPORT void method_getArgumentType (Method method, unsigned int argumentNumber,
char *returnValue, size_t returnValueSize);
-/* Change the implementation of the method. It also searches all
- classes for any class implementing the method, and replaces the
- existing implementation with the new one. For that to work,
- 'method' must be a method returned by class_getInstanceMethod() or
- class_getClassMethod() as the matching is done by comparing the
- pointers; in that case, only the implementation in the class is
- modified. Return the previous implementation that has been
- replaced. If method or implementation is NULL, do nothing and
- return NULL. */
-objc_EXPORT IMP
-method_setImplementation (Method method, IMP implementation);
-
-/* Swap the implementation of two methods in a single, atomic
- operation. This is equivalent to getting the implementation of
- each method and then calling method_setImplementation() on the
- other one. For this to work, the two methods must have been
- returned by class_getInstanceMethod() or class_getClassMethod().
- If 'method_a' or 'method_b' is NULL, do nothing. */
-objc_EXPORT void
-method_exchangeImplementations (Method method_a, Method method_b);
/** Implementation: the following functions are in protocols.c. */