diff options
author | Matthias Benkard <code@mail.matthias.benkard.de> | 2008-03-04 15:05:14 +0100 |
---|---|---|
committer | Matthias Benkard <code@mail.matthias.benkard.de> | 2008-03-04 15:05:14 +0100 |
commit | 69cf14b4e5ade03daf57657ad1adafc3275bd5da (patch) | |
tree | 49e75cc3f7d553017dc0fad7416c0e0a826ba392 | |
parent | 0880bd6ab8539d43cde12ca556ea46b2ee0f0518 (diff) |
Objective-C layer: Add function objcl_test_foo.
darcs-hash:c52655ddfd12cd8a69285250252705606f3bce35
-rw-r--r-- | Lisp/libobjcl.lisp | 2 | ||||
-rw-r--r-- | Objective-C/libobjcl.m | 44 |
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 +} |