summaryrefslogtreecommitdiff
path: root/Objective-C/NSObject-ObjectiveCLWrapperLink.m
diff options
context:
space:
mode:
Diffstat (limited to 'Objective-C/NSObject-ObjectiveCLWrapperLink.m')
-rw-r--r--Objective-C/NSObject-ObjectiveCLWrapperLink.m39
1 files changed, 14 insertions, 25 deletions
diff --git a/Objective-C/NSObject-ObjectiveCLWrapperLink.m b/Objective-C/NSObject-ObjectiveCLWrapperLink.m
index 8677ef3..665d302 100644
--- a/Objective-C/NSObject-ObjectiveCLWrapperLink.m
+++ b/Objective-C/NSObject-ObjectiveCLWrapperLink.m
@@ -1,51 +1,40 @@
/* -*- mode: objc; coding: utf-8 -*- */
#import "NSObject-ObjectiveCLWrapperLink.h"
-#import <Foundation/NSDictionary.h>
+#import <Foundation/NSSet.h>
#import <Foundation/NSObject.h>
#import <Foundation/NSString.h>
-#ifndef NULL
-#define NULL (void *)0
-#endif
-
-static NSMutableDictionary *instance_wrappers = NULL;
+static NSMutableSet *lisp_backed_objects = nil;
void
objcl_initialise_instance_wrappers (void)
{
- if (!instance_wrappers)
- instance_wrappers = [[NSMutableDictionary alloc] init];
+ if (lisp_backed_objects == nil)
+ lisp_backed_objects = [[NSMutableSet alloc] init];
}
void
objcl_shutdown_instance_wrappers (void)
{
- if (instance_wrappers)
+ if (lisp_backed_objects != nil)
{
- [instance_wrappers release];
- instance_wrappers = NULL;
+ [lisp_backed_objects release];
+ lisp_backed_objects = nil;
}
}
@implementation NSObject (ObjectiveCLWrapperLink)
--(const char *) __objectiveCLWrapperID
-{
- NSString *string = [instance_wrappers objectForKey: self];
- if (string != nil)
- return [string UTF8String];
- else
- return NULL;
-}
-
--(void) __setObjectiveCLWrapperID: (const char *)wrapper_id
+-(BOOL) __objcl_isBackedByLispInstance
{
- [instance_wrappers setObject: [NSString stringWithUTF8String: wrapper_id]
- forKey: self];
+ return [lisp_backed_objects containsObject: self];
}
--(void) __removeObjectiveCLWrapperID
+-(void) __objcl_setBackedByLispInstance: (BOOL)backed_p
{
- [instance_wrappers removeObjectForKey: self];
+ if (backed_p)
+ [lisp_backed_objects addObject: self];
+ else
+ [lisp_backed_objects removeObject: self];
}
@end /* NSObject (ObjectiveCL) */