summaryrefslogtreecommitdiff
path: root/MLKRoot.m
diff options
context:
space:
mode:
Diffstat (limited to 'MLKRoot.m')
-rw-r--r--MLKRoot.m27
1 files changed, 27 insertions, 0 deletions
diff --git a/MLKRoot.m b/MLKRoot.m
index 4492b7b..8326e39 100644
--- a/MLKRoot.m
+++ b/MLKRoot.m
@@ -17,8 +17,10 @@
*/
#import "MLKCons.h"
+#import "MLKInterpreter.h"
#import "MLKPackage.h"
#import "MLKRoot.h"
+#import "MLKStream.h"
#import "MLKSymbol.h"
#import "runtime-compatibility.h"
@@ -27,6 +29,7 @@
#import <Foundation/NSInvocation.h>
#import <Foundation/NSMethodSignature.h>
#import <Foundation/NSNull.h>
+#import <Foundation/NSStream.h>
#import <Foundation/NSString.h>
@@ -49,6 +52,7 @@ static id denullify (id value)
static NSMethodSignature *signature;
static MLKPackage *sys;
+static MLKPackage *cl;
@implementation MLKRoot
@@ -56,6 +60,7 @@ static MLKPackage *sys;
{
signature = RETAIN ([self methodSignatureForSelector:@selector(car:)]);
sys = [MLKPackage findPackage:@"TOILET-SYSTEM"];
+ cl = [MLKPackage findPackage:@"COMMON-LISP"];
}
+(NSArray *) dispatch:(MLKSymbol *)name withArguments:(NSArray *)args
@@ -128,4 +133,26 @@ static MLKPackage *sys;
[MLKCons cons:denullify([args objectAtIndex:0])
with:denullify([args objectAtIndex:1])]];
}
+
++(NSArray *) load:(NSArray *)args
+{
+ // FIXME
+ BOOL success;
+ NSString *fileName = denullify ([args objectAtIndex:0]);
+ NSInputStream *input = [NSInputStream inputStreamWithFileAtPath:fileName];
+ MLKStream *stream = AUTORELEASE ([[MLKStream alloc] initWithInputStream:input]);
+
+ //NSLog (@"%d", [input hasBytesAvailable]);
+ [input open];
+ //NSLog (@"%d", [input hasBytesAvailable]);
+
+ success = [MLKInterpreter load:stream verbose:YES print:YES];
+
+ [input close];
+
+ if (success)
+ return [NSArray arrayWithObject:[cl intern:@"T"]];
+ else
+ return [NSArray arrayWithObject:[NSNull null]];
+}
@end