From 69cf14b4e5ade03daf57657ad1adafc3275bd5da Mon Sep 17 00:00:00 2001 From: Matthias Benkard Date: Tue, 4 Mar 2008 15:05:14 +0100 Subject: Objective-C layer: Add function objcl_test_foo. darcs-hash:c52655ddfd12cd8a69285250252705606f3bce35 --- Objective-C/libobjcl.m | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) (limited to 'Objective-C') 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 #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 +} -- cgit v1.2.3