summaryrefslogtreecommitdiff
path: root/functions.m
diff options
context:
space:
mode:
authorMatthias Benkard <mulk@minimulk.mst-plus>2008-08-18 16:13:54 +0200
committerMatthias Benkard <mulk@minimulk.mst-plus>2008-08-18 16:13:54 +0200
commiteec88254d7e37ecb07b0503a9e87abfb81ce2460 (patch)
treed96aa76e24b4b090383623134b35eaf6a10f3431 /functions.m
parent5cd4de577c08637cb5d78d1c3376b1ff80e74065 (diff)
parent054dc70426505f72a1e9856c9e48c0ae3349d68d (diff)
Merge branch 'master' of http://matthias.benkard.de/code/mulklisp
Diffstat (limited to 'functions.m')
-rw-r--r--functions.m28
1 files changed, 27 insertions, 1 deletions
diff --git a/functions.m b/functions.m
index 7caea41..20cde07 100644
--- a/functions.m
+++ b/functions.m
@@ -25,7 +25,9 @@
#import "MLKInterpretedClosure.h"
#import "MLKPackage.h"
#import "MLKSymbol.h"
+#import "MLKRoot.h"
+#import <Foundation/NSArray.h>
#import <Foundation/NSException.h>
#import <Foundation/NSString.h>
@@ -405,7 +407,31 @@ id MLKInterpretedFunctionTrampoline (void *target, ...)
values = [closure applyToArray:arguments];
if ([values count] > 0)
- return [values objectAtIndex:0];
+ return denullify ([values objectAtIndex:0]);
+ else
+ return nil;
+}
+
+id MLKDispatchRootFunction (MLKSymbol *name, ...)
+{
+ NSArray *values;
+ NSMutableArray *arguments;
+ id arg;
+ va_list ap;
+
+ arguments = [NSMutableArray array];
+
+ va_start (ap, name);
+ while ((arg = va_arg (ap, id)) != MLKEndOfArgumentsMarker)
+ {
+ [arguments addObject:nullify(arg)];
+ }
+ va_end (ap);
+
+ values = [MLKRoot dispatch:name withArguments:arguments];
+
+ if ([values count] > 0)
+ return denullify ([values objectAtIndex:0]);
else
return nil;
}