diff options
-rw-r--r-- | MLKPackage.m | 3 | ||||
-rw-r--r-- | MLKRoot.m | 35 |
2 files changed, 38 insertions, 0 deletions
diff --git a/MLKPackage.m b/MLKPackage.m index 85da3c1..00d6344 100644 --- a/MLKPackage.m +++ b/MLKPackage.m @@ -112,6 +112,9 @@ static NSMutableDictionary *packages = nil; [sys export:[sys intern:@"FIND-PACKAGE"]]; [sys export:[sys intern:@"STRING"]]; [sys export:[sys intern:@"GENSYM"]]; + [sys export:[sys intern:@"MAKE-SYMBOL"]]; + [sys export:[sys intern:@"IMPORT"]]; + [sys export:[sys intern:@"INTERN"]]; [cl export:[cl intern:@"*BREAK-ON-SIGNALS*"]]; [cl export:[cl intern:@"*COMPILE-FILE-PATHNAME*"]]; @@ -372,4 +372,39 @@ static id truify (BOOL value) package:nil])); } ++(NSArray *) make_symbol:(NSArray *)args +{ + NSString *name = [args objectAtIndex:0]; + + RETURN_VALUE ([MLKSymbol symbolWithName:name package:nil]); +} + ++(NSArray *) intern:(NSArray *)args +{ + NSString *name = [args objectAtIndex:0]; + id package = denullify (([args count] > 1 + ? [args objectAtIndex:1] + : [[MLKDynamicContext currentContext] + valueForSymbol: + [[MLKPackage findPackage:@"COMMON-LISP"] + intern:@"*PACKAGE*"]])); + MLKSymbol *symbol = [package intern:name]; + + return [NSArray arrayWithObjects:symbol, nil]; +} + ++(NSArray *) import:(NSArray *)args +{ + MLKSymbol *symbol = [args objectAtIndex:0]; + id package = denullify (([args count] > 1 + ? [args objectAtIndex:1] + : [[MLKDynamicContext currentContext] + valueForSymbol: + [[MLKPackage findPackage:@"COMMON-LISP"] + intern:@"*PACKAGE*"]])); + + [package import:symbol]; + + RETURN_VALUE ([cl intern:@"T"]); +} @end |