From 3170b6d37b051f42fe0b28ba2dfa54344e1c85e6 Mon Sep 17 00:00:00 2001 From: Matthias Benkard Date: Sun, 10 Feb 2008 14:46:54 +0100 Subject: Add NSObject category ObjectiveCLWrapperLink. darcs-hash:0a90de7a76127351a989662a577b5688fe39654c --- Objective-C/libobjcl.m | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) (limited to 'Objective-C/libobjcl.m') diff --git a/Objective-C/libobjcl.m b/Objective-C/libobjcl.m index c75ebea..94a3663 100644 --- a/Objective-C/libobjcl.m +++ b/Objective-C/libobjcl.m @@ -18,6 +18,7 @@ */ #import "libobjcl.h" +#import "NSObject-ObjectiveCLWrapperLink.h" #import "PyObjC/libffi_support.h" #import "JIGS/ObjcRuntimeUtilities.h" @@ -79,25 +80,33 @@ objcl_initialise_runtime (void) if (!method_list_lengths) method_list_lengths = [[NSMutableDictionary alloc] init]; + + objcl_initialise_instance_wrappers (); } -void -objcl_shutdown_runtime (void) +static void +release_unless_null (id *object) { - if (objcl_autorelease_pool) + if (*object) { - [objcl_autorelease_pool release]; - objcl_autorelease_pool = NULL; - } - if (objcl_oom_exception) - { - [objcl_oom_exception release]; - objcl_oom_exception = NULL; + [*object release]; + *object = NULL; } } +void +objcl_shutdown_runtime (void) +{ + release_unless_null (&objcl_autorelease_pool); + release_unless_null (&objcl_oom_exception); + release_unless_null (&method_lists); + release_unless_null (&method_list_lengths); + objcl_shutdown_instance_wrappers (); +} + + #ifdef USE_LIBFFI id objcl_invoke_with_types (int argc, @@ -661,14 +670,16 @@ objcl_create_class (const char *class_name, objcl_alignof_type (ivar_typespecs[i]), ivar_typespecs[i]); +#ifdef __OBJC2__ + /* FIXME: What to do for the NeXT Objective-C 1.0 and GNU runtimes + here? */ for (i = 0; i < protocol_number; i++) preclass_addProtocol (class, -#ifdef __OBJC2__ objc_getProtocol ((char *) protocol_names[i]) -#else - objc_getClass (protocol_names[i]) -#endif + /* ??? !__OBJC2__ ??? + objc_getClass (protocol_names[i]) */ ); +#endif return class; #else -- cgit v1.2.3