summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MLKCons.h2
-rw-r--r--MLKCons.m8
-rw-r--r--MLKDynamicContext.h6
-rw-r--r--MLKDynamicContext.m15
-rw-r--r--MLKEnvironment.h2
-rw-r--r--MLKEnvironment.m7
-rw-r--r--MLKLinkedList.h2
-rw-r--r--MLKLinkedList.m6
-rw-r--r--MLKLowLevelTests.m2
-rw-r--r--MLKSymbol.h2
-rw-r--r--MLKSymbol.m8
-rw-r--r--MLKThrowException.h2
-rw-r--r--MLKThrowException.m11
-rw-r--r--MLKUndefinedVariableException.h2
-rw-r--r--MLKUndefinedVariableException.m7
15 files changed, 73 insertions, 9 deletions
diff --git a/MLKCons.h b/MLKCons.h
index 4430275..a278e98 100644
--- a/MLKCons.h
+++ b/MLKCons.h
@@ -18,4 +18,6 @@
-(id) cdr;
-(void) setCar:(id)value;
-(void) setCdr:(id)value;
+
+-(void) dealloc;
@end
diff --git a/MLKCons.m b/MLKCons.m
index e9e6360..f1db7e6 100644
--- a/MLKCons.m
+++ b/MLKCons.m
@@ -37,5 +37,11 @@
{
ASSIGN (_cdr, value);
}
-@end
+-(void) dealloc
+{
+ RELEASE (_car);
+ RELEASE (_cdr);
+ [super dealloc];
+}
+@end
diff --git a/MLKDynamicContext.h b/MLKDynamicContext.h
index ba67ad8..8dc1a2f 100644
--- a/MLKDynamicContext.h
+++ b/MLKDynamicContext.h
@@ -4,12 +4,12 @@
@class MLKClosure, MLKEnvironment, NSLinkedList, NSMutableDictionary, NSString;
-@interface MLKDynamicContext
+@interface MLKDynamicContext : NSObject
{
MLKEnvironment *_conditionHandlers;
MLKEnvironment *_restarts;
MLKEnvironment *_catchTags;
- MLKClosure *_currentConditionHandler;
+ MLKClosure *_currentConditionHandler; // needed for the Condition Firewall
MLKEnvironment *_environment;
MLKDynamicContext *_parent;
}
@@ -25,4 +25,6 @@
+(MLKDynamicContext *) currentContext;
+(MLKDynamicContext *) popContext;
+
+-(void) dealloc;
@end
diff --git a/MLKDynamicContext.m b/MLKDynamicContext.m
index ed4357a..7be5748 100644
--- a/MLKDynamicContext.m
+++ b/MLKDynamicContext.m
@@ -17,7 +17,7 @@
? (id) parent_member \
: nil) \
bindings:vars] \
- : (id) (parent ? (id) parent_member : nil));
+ : (id) (parent ? (id) RETAIN (parent_member) : nil));
@implementation MLKDynamicContext
@@ -28,7 +28,7 @@
catchTags:(NSDictionary *)catchTags
currentHandler:(MLKClosure *)handler
{
- _parent = (aContext ? aContext : [MLKDynamicContext currentContext]);
+ ASSIGN (_parent, (aContext ? aContext : [MLKDynamicContext currentContext]));
_environment = MAKE_ENVIRONMENT(vars, _parent, _parent->_environment);
_conditionHandlers = MAKE_ENVIRONMENT(handlers,
_parent,
@@ -62,4 +62,15 @@
forKey:@"MLKDynamicContext"];
return context;
}
+
+-(void) dealloc
+{
+ RELEASE (_conditionHandlers);
+ RELEASE (_restarts);
+ RELEASE (_catchTags);
+ RELEASE (_currentConditionHandler);
+ RELEASE (_environment);
+ RELEASE (_parent);
+ [super dealloc];
+}
@end
diff --git a/MLKEnvironment.h b/MLKEnvironment.h
index b40ea5a..cda8576 100644
--- a/MLKEnvironment.h
+++ b/MLKEnvironment.h
@@ -25,4 +25,6 @@
// Private methods.
-(void) setBinding:(MLKSymbol *)symbol to:(id)value inEnvironment:(MLKEnvironment *)env;
-(id) valueForBinding:(MLKSymbol *)symbol inEnvironment:(MLKEnvironment *)env;
+
+-(void) dealloc;
@end
diff --git a/MLKEnvironment.m b/MLKEnvironment.m
index 6df4e11..0da3a14 100644
--- a/MLKEnvironment.m
+++ b/MLKEnvironment.m
@@ -79,4 +79,11 @@
{
[_bindings setObject:value forKey:symbol];
}
+
+-(void) dealloc
+{
+ RELEASE (_bindings);
+ RELEASE (_parent);
+ [super dealloc];
+}
@end
diff --git a/MLKLinkedList.h b/MLKLinkedList.h
index 70e4604..67e8ba0 100644
--- a/MLKLinkedList.h
+++ b/MLKLinkedList.h
@@ -23,4 +23,6 @@
#ifdef __OBJC2__
-(NSUInteger) countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id *)stackbuf count:(NSUInteger)len;
#endif
+
+-(void) dealloc;
@end
diff --git a/MLKLinkedList.m b/MLKLinkedList.m
index 40174e0..3f047a0 100644
--- a/MLKLinkedList.m
+++ b/MLKLinkedList.m
@@ -61,4 +61,10 @@
return 0;
}
#endif
+
+-(void) dealloc
+{
+ RELEASE (_firstCons);
+ [super dealloc];
+}
@end
diff --git a/MLKLowLevelTests.m b/MLKLowLevelTests.m
index 1de05ff..c47fd2a 100644
--- a/MLKLowLevelTests.m
+++ b/MLKLowLevelTests.m
@@ -38,7 +38,7 @@
-(id) testCons
{
id obj1 = @"Mulk.";
- id obj2 = [[NSMutableDictionary alloc] init];
+ id obj2 = AUTORELEASE ([[NSMutableDictionary alloc] init]);
MLKCons *cons2 = [MLKCons cons:obj1 with:obj2];
MLKCons *cons3 = [MLKCons cons:obj1 with:nil];
diff --git a/MLKSymbol.h b/MLKSymbol.h
index e239c67..d048451 100644
--- a/MLKSymbol.h
+++ b/MLKSymbol.h
@@ -17,4 +17,6 @@
-(NSString *) name;
-(MLKPackage *) homePackage;
-(void) setHomePackage:(MLKPackage *)aPackage;
+
+-(void) dealloc;
@end
diff --git a/MLKSymbol.m b/MLKSymbol.m
index 6d19323..6ef0411 100644
--- a/MLKSymbol.m
+++ b/MLKSymbol.m
@@ -26,5 +26,11 @@
{
ASSIGN (homePackage, aPackage);
}
-@end
+-(void) dealloc
+{
+ RELEASE (name);
+ RELEASE (homePackage);
+ [super dealloc];
+}
+@end
diff --git a/MLKThrowException.h b/MLKThrowException.h
index 567cbcc..32e39c8 100644
--- a/MLKThrowException.h
+++ b/MLKThrowException.h
@@ -17,4 +17,6 @@
-(MLKSymbol *) catchTag;
-(id) value;
+
+-(void) dealloc;
@end
diff --git a/MLKThrowException.m b/MLKThrowException.m
index 799db7e..e3f3e0c 100644
--- a/MLKThrowException.m
+++ b/MLKThrowException.m
@@ -8,8 +8,8 @@
-(MLKThrowException *) initWithCatchTag:(MLKSymbol *)catchTag
value:(id)value
{
- _catchTag = catchTag;
- _value = value;
+ ASSIGN (_catchTag, catchTag);
+ ASSIGN (_value, value);
return self;
}
@@ -22,4 +22,11 @@
{
return _value;
}
+
+-(void) dealloc
+{
+ RELEASE (_catchTag);
+ RELEASE (_value);
+ [super dealloc];
+}
@end
diff --git a/MLKUndefinedVariableException.h b/MLKUndefinedVariableException.h
index 16005ce..d373656 100644
--- a/MLKUndefinedVariableException.h
+++ b/MLKUndefinedVariableException.h
@@ -14,4 +14,6 @@
-(MLKUndefinedVariableException *) initWithEnvironment:(id)environment
variableName:(id)symbol;
+
+-(void) dealloc;
@end
diff --git a/MLKUndefinedVariableException.m b/MLKUndefinedVariableException.m
index 531a394..5795b55 100644
--- a/MLKUndefinedVariableException.m
+++ b/MLKUndefinedVariableException.m
@@ -12,4 +12,11 @@
environment = anEnvironment;
return self;
}
+
+-(void) dealloc
+{
+ RELEASE (variableName);
+ RELEASE (environment);
+ [super dealloc];
+}
@end