diff options
author | Matthias Andreas Benkard <matthias@benkard.de> | 2008-07-08 15:43:06 +0200 |
---|---|---|
committer | Matthias Andreas Benkard <matthias@benkard.de> | 2008-07-08 15:43:06 +0200 |
commit | 0654d8d1017b202c5aa250c77626c54bf571a354 (patch) | |
tree | f1522576c8577de45d15482f788ebfccbdc195a9 | |
parent | 13715775d26700ba8d0b3ccb2e29be7c2a60e869 (diff) |
Implement IMPORT, INTERN, and MAKE-SYMBOL.
-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 |