summaryrefslogtreecommitdiff
path: root/MLKRoot.m
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <matthias@benkard.de>2008-08-29 16:35:14 +0200
committerMatthias Andreas Benkard <matthias@benkard.de>2008-08-29 16:35:14 +0200
commit43921ef49a4c9a4acf2182728c60a52f71dd95ec (patch)
tree1c3e41ad1f10e191746c7f50dbcde1c5e12d0a1e /MLKRoot.m
parent63eadba1c4ed6e92aeda0a0691e0ac97ce580a43 (diff)
parentea78de039ba122180ac0fe7ffbdca4073342ad0c (diff)
Merge mulk_benkard@ssh.phx.nearlyfreespeech.net:/home/htdocs/code/mulklisp
Diffstat (limited to 'MLKRoot.m')
-rw-r--r--MLKRoot.m12
1 files changed, 11 insertions, 1 deletions
diff --git a/MLKRoot.m b/MLKRoot.m
index eaff94c..6789ffb 100644
--- a/MLKRoot.m
+++ b/MLKRoot.m
@@ -39,6 +39,7 @@
#import "util.h"
#import <Foundation/NSArray.h>
+#import <Foundation/NSBundle.h>
#import <Foundation/NSException.h>
#import <Foundation/NSInvocation.h>
#import <Foundation/NSMethodSignature.h>
@@ -95,7 +96,6 @@ cons (id _data, id car, id cdr, id _marker)
static id
load (id _data, NSString *fileName, id _marker)
{
- // FIXME
BOOL success;
int l, i;
NSInputStream *input = [NSInputStream inputStreamWithFileAtPath:fileName];
@@ -166,6 +166,15 @@ load (id _data, NSString *fileName, id _marker)
}
static id
+require (id _data, id moduleName, id _marker)
+{
+ NSBundle *toiletKit = [NSBundle bundleForClass:[MLKRoot class]];
+ NSString *path = [[toiletKit resourcePath]
+ stringByAppendingPathComponent:stringify(moduleName)];
+ return load (nil, path, MLKEndOfArgumentsMarker);
+}
+
+static id
eq (id _data, id x, id y, id _marker)
{
return truify (x == y);
@@ -808,6 +817,7 @@ register_sys (NSString *name, id (*function)())
register_sys (@"RPLACD", rplacd);
register_sys (@"CONS", cons);
register_sys (@"LOAD", load);
+ register_sys (@"REQUIRE", require);
register_sys (@"EQ", eq);
register_sys (@"FIXNUM-EQ", fixnum_eq);
register_sys (@"SYMBOLP", symbolp);