diff options
author | Matthias Benkard <code@mail.matthias.benkard.de> | 2008-02-19 00:18:31 +0100 |
---|---|---|
committer | Matthias Benkard <code@mail.matthias.benkard.de> | 2008-02-19 00:18:31 +0100 |
commit | 272a6c36bf2c91985bf7ec87da8d4576393c6e84 (patch) | |
tree | a0d5fb19f8b3aefd2e6a4fa10bb6e5a8eb9341aa /Objective-C | |
parent | 806872f29587bb24d215cf2c4a94513376130fd1 (diff) |
Remove NSObject category ObjectiveCLWrapperLink.
darcs-hash:07ee45edca14214270891334f18d56f30e4ea57a
Diffstat (limited to 'Objective-C')
-rw-r--r-- | Objective-C/GNUmakefile | 2 | ||||
-rw-r--r-- | Objective-C/NSObject-ObjectiveCLWrapperLink.h | 14 | ||||
-rw-r--r-- | Objective-C/NSObject-ObjectiveCLWrapperLink.m | 48 | ||||
-rw-r--r-- | Objective-C/libobjcl.m | 27 |
4 files changed, 21 insertions, 70 deletions
diff --git a/Objective-C/GNUmakefile b/Objective-C/GNUmakefile index 2680426..598c79f 100644 --- a/Objective-C/GNUmakefile +++ b/Objective-C/GNUmakefile @@ -33,7 +33,7 @@ LIBRARY_NAME = libobjcl RPM_DISABLE_RELOCATABLE = YES ADDITIONAL_OBJCFLAGS = -Wall -g -DVERSION=\"$(VERSION)\" -I/usr/local/include -libobjcl_OBJC_FILES = JIGS/ObjcRuntimeUtilities2.m libobjcl.m NSObject-ObjectiveCLWrapperLink.m PyObjC/objc_support.m PyObjC/objc-runtime-apple.m PyObjC/objc-runtime-gnu.m PyObjC/objc-runtime-compat.m +libobjcl_OBJC_FILES = JIGS/ObjcRuntimeUtilities2.m libobjcl.m PyObjC/objc_support.m PyObjC/objc-runtime-apple.m PyObjC/objc-runtime-gnu.m PyObjC/objc-runtime-compat.m libobjcl_C_FILES = JIGS/ObjcRuntimeUtilities.c LIBRARIES_DEPEND_UPON = $(FND_LIBS) $(GUI_LIBS) $(OBJC_LIBS) $(SYSTEM_LIBS) $(CONFIG_SYSTEM_LIBS) diff --git a/Objective-C/NSObject-ObjectiveCLWrapperLink.h b/Objective-C/NSObject-ObjectiveCLWrapperLink.h deleted file mode 100644 index 4c4cc4c..0000000 --- a/Objective-C/NSObject-ObjectiveCLWrapperLink.h +++ /dev/null @@ -1,14 +0,0 @@ -/* -*- mode: objc; coding: utf-8 -*- */ - -#import <Foundation/NSObject.h> - -void -objcl_initialise_instance_wrappers (void); - -void -objcl_shutdown_instance_wrappers (void); - -@interface NSObject (ObjectiveCLWrapperLink) -+(BOOL) __objcl_isBackedByLispClass; -+(void) __objcl_setBackedByLispClass: (BOOL)backed_p; -@end /* NSObject (ObjectiveCL) */ diff --git a/Objective-C/NSObject-ObjectiveCLWrapperLink.m b/Objective-C/NSObject-ObjectiveCLWrapperLink.m deleted file mode 100644 index 8d34a19..0000000 --- a/Objective-C/NSObject-ObjectiveCLWrapperLink.m +++ /dev/null @@ -1,48 +0,0 @@ -/* -*- mode: objc; coding: utf-8 -*- */ - -#import "NSObject-ObjectiveCLWrapperLink.h" -#import <Foundation/NSSet.h> -#import <Foundation/NSObject.h> -#import <Foundation/NSString.h> - -/* A class is considered Lisp-backed if some of its methods are - implemented as Lisp callbacks. This is true if and only if - @selector(retain) and @selector(release) are overridden by - Objective-CL. In this case, the corresponding Lisp objects are - stored in a regular hash table instead of a weak one, as they may - hold data (like CLOS slots) that we can't do without as long as the - Objective-C instance is referenced from anywhere (where `anywhere' - includes both the Lisp and Objective-C worlds). */ -static NSMutableSet *lisp_backed_classes = nil; - -void -objcl_initialise_instance_wrappers (void) -{ - if (lisp_backed_classes == nil) - lisp_backed_classes = [[NSMutableSet alloc] init]; -} - -void -objcl_shutdown_instance_wrappers (void) -{ - if (lisp_backed_classes != nil) - { - [lisp_backed_classes release]; - lisp_backed_classes = nil; - } -} - -@implementation NSObject (ObjectiveCLWrapperLink) -+(BOOL) __objcl_isBackedByLispClass -{ - return [lisp_backed_classes containsObject: self]; -} - -+(void) __objcl_setBackedByLispClass: (BOOL)backed_p -{ - if (backed_p) - [lisp_backed_classes addObject: self]; - else - [lisp_backed_classes removeObject: self]; -} -@end /* NSObject (ObjectiveCL) */ diff --git a/Objective-C/libobjcl.m b/Objective-C/libobjcl.m index c228162..4f4b922 100644 --- a/Objective-C/libobjcl.m +++ b/Objective-C/libobjcl.m @@ -55,6 +55,16 @@ NSRecursiveLock *objcl_current_exception_lock = nil; static NSMutableDictionary *method_lists = nil; static NSMutableDictionary *method_list_lengths = nil; +/* A class is considered Lisp-backed if some of its methods are + implemented as Lisp callbacks. This is true if and only if + @selector(retain) and @selector(release) are overridden by + Objective-CL. In this case, the corresponding Lisp objects are + stored in a regular hash table instead of a weak one, as they may + hold data (like CLOS slots) that we can't do without as long as the + Objective-C instance is referenced from anywhere (where `anywhere' + includes both the Lisp and Objective-C worlds). */ +static NSMutableSet *lisp_backed_classes = nil; + static int init_count = 0; @@ -76,7 +86,7 @@ objcl_initialise_runtime (void) objcl_current_exception_lock = [[NSRecursiveLock alloc] init]; method_lists = [[NSMutableDictionary alloc] init]; method_list_lengths = [[NSMutableDictionary alloc] init]; - objcl_initialise_instance_wrappers (); + lisp_backed_classes = [[NSMutableSet alloc] init]; init_count = 1; } else @@ -87,10 +97,10 @@ objcl_initialise_runtime (void) static void release_unless_null (id *object) { - if (*object) + if (*object != nil) { [*object release]; - *object = NULL; + *object = nil; } } @@ -106,7 +116,7 @@ objcl_shutdown_runtime (void) release_unless_null (&objcl_oom_exception); release_unless_null (&method_lists); release_unless_null (&method_list_lengths); - objcl_shutdown_instance_wrappers (); + release_unless_null (&lisp_backed_classes); } else if (init_count < 0) init_count = 0; @@ -853,19 +863,22 @@ objcl_finalise_class (Class class) int objcl_class_backed_by_lisp_class_p (Class class) { - return [class __objcl_isBackedByLispClass]; + return [lisp_backed_classes containsObject: class]; } void objcl_class_set_backed_by_lisp_class (Class class, int backed_p) { - [class __objcl_setBackedByLispClass: backed_p]; + if (backed_p) + [lisp_backed_classes addObject: class]; + else + [lisp_backed_classes removeObject: class]; } int objcl_object_backed_by_lisp_class_p (id object) { - return [[object class] __objcl_isBackedByLispClass]; + return objcl_class_backed_by_lisp_class_p ([object class]); } |