summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Lisp/libobjcl.lisp2
-rw-r--r--Objective-C/libobjcl.m44
2 files changed, 45 insertions, 1 deletions
diff --git a/Lisp/libobjcl.lisp b/Lisp/libobjcl.lisp
index 797ee1e..ca8e3d8 100644
--- a/Lisp/libobjcl.lisp
+++ b/Lisp/libobjcl.lisp
@@ -194,6 +194,8 @@
:int
(function :pointer))
+(defcfun ("objcl_test_foo" objcl-test-foo) :void)
+
(defcvar *objcl-current-exception-lock* :pointer)
(defcvar *objcl-current-exception* :pointer)
diff --git a/Objective-C/libobjcl.m b/Objective-C/libobjcl.m
index 48996cc..e6283d2 100644
--- a/Objective-C/libobjcl.m
+++ b/Objective-C/libobjcl.m
@@ -39,7 +39,9 @@
#include <objc/objc-class.h>
#endif
-#if 0
+#define DEBUG 0
+
+#if DEBUG
#define TRACE NSLog
#else
#define TRACE objcl_null_log
@@ -1044,3 +1046,43 @@ objcl_for_each_class_do (void (*function) (Class))
return 0;
}
+
+
+/* The function objcl_test_foo is a general-purpose debugging tool that
+ can be adapted as needed. */
+@interface MLKTestStringHelper
+-(int) foo:(int)n bar:(id)x stuff:(id)y do:(id)z;
+@end
+
+void
+objcl_test_foo (void)
+{
+#if DEBUG
+ Class c;
+ id i;
+
+ TRACE (@"###################### test-foo ######################");
+
+ NS_DURING
+ {
+
+ c = objcl_find_class ("MLKTestString1");
+ TRACE (@"%@", c);
+
+ i = [c new];
+ TRACE (@"%@", i);
+
+ TRACE (@"%d", (int) [i foo: 100
+ bar: i
+ stuff: nil
+ do: [NSNumber numberWithInt: 30]]);
+
+ TRACE (@"test-foo => %");
+ }
+ NS_HANDLER
+ {
+ TRACE (@"test-foo: Caught exception: %@", localException);
+ }
+ NS_ENDHANDLER
+#endif
+}