summaryrefslogtreecommitdiff
path: root/Objective-C/libobjcl.m
diff options
context:
space:
mode:
Diffstat (limited to 'Objective-C/libobjcl.m')
-rw-r--r--Objective-C/libobjcl.m44
1 files changed, 43 insertions, 1 deletions
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
+}