summaryrefslogtreecommitdiff
path: root/MLKInterpreter.m
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <matthias@benkard.de>2008-08-02 23:42:21 +0200
committerMatthias Andreas Benkard <matthias@benkard.de>2008-08-02 23:42:21 +0200
commit226e1e2ddfdf84237a1b8caaab7a4114c70ca8f3 (patch)
treeddb022060d016263867cde462f5bbfffa3538bc0 /MLKInterpreter.m
parent19113af941e79eb99d5a34b5913a5f827961d39b (diff)
Add *SYSTEM-INITIALISED-P*.
Diffstat (limited to 'MLKInterpreter.m')
-rw-r--r--MLKInterpreter.m23
1 files changed, 18 insertions, 5 deletions
diff --git a/MLKInterpreter.m b/MLKInterpreter.m
index 3e00b37..d2c29c0 100644
--- a/MLKInterpreter.m
+++ b/MLKInterpreter.m
@@ -70,6 +70,7 @@ static MLKSymbol *VALUES;
static MLKSymbol *_DEFMACRO;
static MLKSymbol *_LAMBDA;
static MLKSymbol *_LOOP;
+static MLKSymbol *V_INITP;
@implementation MLKInterpreter
@@ -106,6 +107,7 @@ static MLKSymbol *_LOOP;
UNWIND_PROTECT = [cl intern:@"UNWIND-PROTECT"];
_DEFMACRO = [sys intern:@"%DEFMACRO"];
_LAMBDA = [sys intern:@"%LAMBDA"];
+ V_INITP = [sys intern:@"*SYSTEM-INITIALISED-P*"];
}
@@ -130,18 +132,29 @@ static MLKSymbol *_LOOP;
expandOnly:(BOOL)expandOnly
{
MLKDynamicContext *dynamicContext = [MLKDynamicContext currentContext];
+ BOOL trace = NO;
- // NSLog (@"eval: %@", [program descriptionForLisp]);
+#define TRACE_EVAL 0
+#if TRACE_EVAL
+ if ([dynamicContext valueForSymbol:V_INITP])
+ trace = YES;
+
+ if (trace)
+ NSLog (@"; EVAL: %@", [program descriptionForLisp]);
+#endif // TRACE_EVAL
if (!program || [program isKindOfClass:[MLKSymbol class]])
{
//NSLog (@"Processing symbol.");
if ([context symbolNamesSymbolMacro:program])
{
- id macrofun = [context macroForSymbol:program];
- id expansion = [macrofun applyToArray:
- [NSArray arrayWithObjects:
- program, context, nil]];
+ id macrofun, expansion;
+
+ macrofun = [context macroForSymbol:program];
+ expansion = [macrofun applyToArray:
+ [NSArray arrayWithObjects:
+ program, context, nil]];
+
return [self eval:expansion
inLexicalContext:context
withEnvironment:lexenv