diff options
-rw-r--r-- | MLKReadEvalPrintLoop.m | 4 | ||||
-rw-r--r-- | MLKRoot.m | 12 |
2 files changed, 13 insertions, 3 deletions
diff --git a/MLKReadEvalPrintLoop.m b/MLKReadEvalPrintLoop.m index 092c6bd..f2a7803 100644 --- a/MLKReadEvalPrintLoop.m +++ b/MLKReadEvalPrintLoop.m @@ -99,8 +99,6 @@ static const char *prompt (EditLine *e) { } NS_ENDHANDLER; - RELEASE (pool); - printf ("Done.\n\n"); printf ("This is Toilet Lisp, version 0.0.1.\n"); @@ -112,6 +110,8 @@ static const char *prompt (EditLine *e) { forSymbol:[[MLKPackage findPackage:@"TOILET-SYSTEM"] intern:@"*SYSTEM-INITIALISED-P*"]]; + RELEASE (pool); + while (1) { const char *line; @@ -229,12 +229,22 @@ static id truify (BOOL value) id form = [args objectAtIndex:0]; id env = [args count] > 1 ? denullify([args objectAtIndex:1]) : nil; MLKLexicalContext *context = env ? (id)env : (id)[MLKLexicalContext globalContext]; + id <MLKFuncallable> macrofun = nil; if ([form isKindOfClass:[MLKCons class]] && (![form car] || [[form car] isKindOfClass:[MLKSymbol class]]) && [context symbolNamesMacro:[form car]]) { - id <MLKFuncallable> macrofun = [context macroForSymbol:[form car]]; + macrofun = [context macroForSymbol:[form car]]; + } + else if ([form isKindOfClass:[MLKSymbol class]] + && [context symbolNamesSymbolMacro:form]) + { + macrofun = [context symbolMacroForSymbol:[form car]]; + } + + if (macrofun) + { form = denullify ([[macrofun applyToArray: [NSArray arrayWithObjects: form, context, nil]] |