diff options
-rw-r--r-- | MLKInterpreter.m | 14 | ||||
-rw-r--r-- | MLKPackage.m | 1 |
2 files changed, 15 insertions, 0 deletions
diff --git a/MLKInterpreter.m b/MLKInterpreter.m index 778985f..37d4523 100644 --- a/MLKInterpreter.m +++ b/MLKInterpreter.m @@ -42,6 +42,7 @@ static MLKPackage *cl; static MLKPackage *sys; static MLKSymbol *IF; +static MLKSymbol *IN_PACKAGE; static MLKSymbol *DECLARE; static MLKSymbol *PROGN; static MLKSymbol *TAGBODY; @@ -72,6 +73,7 @@ static MLKSymbol *_LAMBDA; sys = [MLKPackage findPackage:@"TOILET-SYSTEM"]; IF = [cl intern:@"IF"]; + IN_PACKAGE = [cl intern:@"IN-PACKAGE"]; DECLARE = [cl intern:@"DECLARE"]; PROGN = [cl intern:@"PROGN"]; TAGBODY = [cl intern:@"TAGBODY"]; @@ -208,6 +210,18 @@ static MLKSymbol *_LAMBDA; inLexicalContext:context withEnvironment:lexenv]; } + else if (car == IN_PACKAGE) + { + id cadr = [[program cdr] car]; + id package = [MLKPackage findPackage:stringify(cadr)]; + + [[MLKDynamicContext currentContext] + setValue:package + forSymbol:[[MLKPackage findPackage:@"COMMON-LISP"] + intern:@"*PACKAGE*"]]; + + return [NSArray arrayWithObject:nullify(package)]; + } else if (car == _LAMBDA) { // A bare-bones LAMBDA without a real lambda list. What diff --git a/MLKPackage.m b/MLKPackage.m index fb5ab20..568dfd3 100644 --- a/MLKPackage.m +++ b/MLKPackage.m @@ -63,6 +63,7 @@ static NSMutableDictionary *packages = nil; [cl export:nil]; [cl export:[cl intern:@"T"]]; [cl export:[cl intern:@"IF"]]; + [cl export:[cl intern:@"IN-PACKAGE"]]; [cl export:[cl intern:@"LET"]]; [cl export:[cl intern:@"LAMBDA"]]; [cl export:[cl intern:@"FUNCALL"]]; |