summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MLKInterpreter.m17
-rw-r--r--MLKReadEvalPrintLoop.m8
2 files changed, 18 insertions, 7 deletions
diff --git a/MLKInterpreter.m b/MLKInterpreter.m
index 48a4bc9..4341e55 100644
--- a/MLKInterpreter.m
+++ b/MLKInterpreter.m
@@ -1334,19 +1334,24 @@ static MLKSymbol *MULTIPLE_VALUE_CALL;
id result;
id expansion;
//NSLog (@"; LOAD: Reding a form.");
- id code = [MLKReader readFromStream:stream
- eofError:NO
- eofValue:eofValue
- recursive:NO
- preserveWhitespace:NO];
+ id code;
//NSLog (@"; LOAD: Reading finished.");
NSString *formdesc;
+ NSAutoreleasePool *pool;
//NSLog (@"%@", code);
//NSLog (@"%@", [code descriptionForLisp]);
//NSLog (@"%@", stream);
//NSLog (@"...");
+ pool = [[NSAutoreleasePool alloc] init];
+
+ code = [MLKReader readFromStream:stream
+ eofError:NO
+ eofValue:eofValue
+ recursive:NO
+ preserveWhitespace:NO];
+
if (code == eofValue)
break;
@@ -1383,6 +1388,8 @@ static MLKSymbol *MULTIPLE_VALUE_CALL;
expandOnly:NO];
//NSLog (@"; LOAD: Top-level form evaluated.");
+ RELEASE (pool);
+
if (print)
{
//FIXME
diff --git a/MLKReadEvalPrintLoop.m b/MLKReadEvalPrintLoop.m
index d50b10b..092c6bd 100644
--- a/MLKReadEvalPrintLoop.m
+++ b/MLKReadEvalPrintLoop.m
@@ -68,6 +68,7 @@ static const char *prompt (EditLine *e) {
NSInputStream *input;
MLKStream *stream;
BOOL success;
+ NSAutoreleasePool *pool;
editline = el_init (_argv[0], stdin, stdout, stderr);
el_set (editline, EL_PROMPT, &prompt);
@@ -76,7 +77,9 @@ static const char *prompt (EditLine *e) {
commands = history_init();
history (commands, &event, H_SETSIZE, 1000);
el_set (editline, EL_HIST, history, commands);
-
+
+ pool = [[NSAutoreleasePool alloc] init];
+
printf ("Loading init.lisp.\n");
NS_DURING
{
@@ -96,6 +99,8 @@ static const char *prompt (EditLine *e) {
}
NS_ENDHANDLER;
+ RELEASE (pool);
+
printf ("Done.\n\n");
printf ("This is Toilet Lisp, version 0.0.1.\n");
@@ -116,7 +121,6 @@ static const char *prompt (EditLine *e) {
if (line_length > 1)
{
- NSAutoreleasePool *pool;
NSArray *results;
id code;