summaryrefslogtreecommitdiff
path: root/Objective-C
diff options
context:
space:
mode:
Diffstat (limited to 'Objective-C')
-rw-r--r--Objective-C/libobjcl.h10
-rw-r--r--Objective-C/libobjcl.m42
2 files changed, 49 insertions, 3 deletions
diff --git a/Objective-C/libobjcl.h b/Objective-C/libobjcl.h
index b3e1a3a..c9b7345 100644
--- a/Objective-C/libobjcl.h
+++ b/Objective-C/libobjcl.h
@@ -88,11 +88,12 @@ objcl_find_selector (const char *selector_name);
SEL
objcl_intern_selector (const char *selector_name);
-/* Return a null-terminated list of type information strings.
- The first entry describes the type of the method's return value. */
+/* Return a freshly consed null-terminated list of type information
+ strings. The first entry describes the type of the method's return
+ value. */
char **
objcl_query_arglist_info (void *receiver,
- const char *method_name);
+ SEL method_name);
const char *
@@ -217,3 +218,6 @@ objcl_class_set_backed_by_lisp_class (Class class, int backed_p);
int
objcl_object_backed_by_lisp_class_p (id object);
+
+int
+objcl_for_each_class_do (void (*function) (Class));
diff --git a/Objective-C/libobjcl.m b/Objective-C/libobjcl.m
index 1e70a37..d3a8514 100644
--- a/Objective-C/libobjcl.m
+++ b/Objective-C/libobjcl.m
@@ -24,6 +24,11 @@
#import "Foundation/Foundation.h"
+#ifdef GNUSTEP
+#import "GNUstepBase/GSLock.h"
+/* #import "GNUstepBase/GSObjCRuntime.h" */
+#endif
+
#include <stdarg.h>
#include <string.h>
#include <sys/mman.h>
@@ -91,7 +96,11 @@ objcl_initialise_runtime (void)
PyObjC_SetupRuntimeCompat ();
#endif
+#ifdef GNUSTEP
+ objcl_current_exception_lock = [[GSLazyRecursiveLock alloc] init];
+#else
objcl_current_exception_lock = [[NSRecursiveLock alloc] init];
+#endif
method_lists = [[NSMutableDictionary alloc] init];
method_list_lengths = [[NSMutableDictionary alloc] init];
lisp_backed_classes = [[NSMutableSet alloc] init];
@@ -911,3 +920,36 @@ objcl_object_backed_by_lisp_class_p (id object)
{
return objcl_class_backed_by_lisp_class_p ([object class]);
}
+
+
+int
+objcl_for_each_class_do (void (*function) (Class))
+{
+#ifdef __NEXT_RUNTIME__
+ int class_num;
+
+ class_num = objc_getClassList (NULL, 0);
+ if (class_num)
+ {
+ int i;
+ Class class_list[class_num];
+
+ objc_getClassList (&class_list, class_num);
+ for (i = 0; i < class_num; i++)
+ {
+ function (class_list[i]);
+ }
+ }
+#else
+ /* In order to build a list of classes, we can use GSClassList(). */
+ void *iter = 0;
+ Class class;
+
+ while ((class = objc_next_class (&iter)))
+ {
+ function (class);
+ };
+#endif
+
+ return 0;
+}