summaryrefslogtreecommitdiff
path: root/Objective-C
diff options
context:
space:
mode:
authorMatthias Benkard <code@mail.matthias.benkard.de>2008-03-05 02:13:26 +0100
committerMatthias Benkard <code@mail.matthias.benkard.de>2008-03-05 02:13:26 +0100
commitd907d3d250c9a0f43b3497dcf5fa354be4ffc83f (patch)
treee9b264494ed4e18fbb7823eeae3d201e72104319 /Objective-C
parent1b2b509cd214ce604ce6ac58ef38ac6b5aec81e1 (diff)
Add function COLLECT-METHODS.
darcs-hash:4c78479b2d67157304f041d700fceb34a3ed7721
Diffstat (limited to 'Objective-C')
-rw-r--r--Objective-C/libobjcl.m48
1 files changed, 48 insertions, 0 deletions
diff --git a/Objective-C/libobjcl.m b/Objective-C/libobjcl.m
index d32a37c..0b1719f 100644
--- a/Objective-C/libobjcl.m
+++ b/Objective-C/libobjcl.m
@@ -1053,6 +1053,54 @@ objcl_for_each_class_do (void (*function) (Class))
}
+void **
+objcl_class_methods (Class class, unsigned int *count)
+{
+#ifdef __NEXT_RUNTIME__
+ return (void **) class_copyMethodList (class, count);
+#else
+ size_t buflen = 0;
+ void **buf = NULL;
+ MethodList_t list = class->methods;
+
+ *count = 0;
+
+ while (list)
+ {
+ int i;
+ unsigned int position = *count;
+ *count += list->method_count;
+
+ if (buflen < *count)
+ {
+ buflen = *count;
+ buf = realloc (buf, buflen * sizeof (void *));
+ }
+
+ for (i = 0; i < list->method_count; i++)
+ {
+ buf[position + i] = &list->method_list[i];
+ }
+
+ list = list->method_next;
+ }
+
+ return buf;
+#endif
+}
+
+
+SEL
+objcl_method_selector (void *method)
+{
+#ifdef __NEXT_RUNTIME__
+ return method_getName ((Method) method);
+#else
+ return ((Method_t) method)->method_name;
+#endif
+}
+
+
/* The function objcl_test_foo is a general-purpose debugging tool that
can be adapted as needed. */
@interface MLKTestStringHelper