summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <matthias@benkard.de>2008-06-16 11:51:55 +0200
committerMatthias Andreas Benkard <matthias@benkard.de>2008-06-16 11:51:55 +0200
commit382f1be127ada9e777cae9c230254040b508f607 (patch)
tree6f7024c413657cda21c3630d29422add2afaeb44
parente60a004c48a14d0b5bb109fe7be5552643289925 (diff)
Add protocol MLKFuncallable.
-rw-r--r--MLKClosure.h3
-rw-r--r--MLKDynamicContext.h2
-rw-r--r--MLKFuncallable.h24
-rw-r--r--MLKReader.m4
-rw-r--r--MLKReadtable.h6
-rw-r--r--MLKReadtable.m2
6 files changed, 33 insertions, 8 deletions
diff --git a/MLKClosure.h b/MLKClosure.h
index b05783f..e8a20d4 100644
--- a/MLKClosure.h
+++ b/MLKClosure.h
@@ -17,11 +17,12 @@
*/
#import "MLKLispValue.h"
+#import "MLKFuncallable.h"
@class MLKFunction, NSArray, NSData;
-@interface MLKClosure : MLKLispValue
+@interface MLKClosure : MLKLispValue <MLKFuncallable>
{
MLKFunction *_code;
NSData *_closedOverVariableVector;
diff --git a/MLKDynamicContext.h b/MLKDynamicContext.h
index c6df58f..78c6e82 100644
--- a/MLKDynamicContext.h
+++ b/MLKDynamicContext.h
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-@class MLKClosure, MLKEnvironment, MLKSymbol, NSLinkedList,
+@class MLKEnvironment, MLKSymbol, NSLinkedList,
NSMutableDictionary, NSString;
diff --git a/MLKFuncallable.h b/MLKFuncallable.h
new file mode 100644
index 0000000..6f7fd40
--- /dev/null
+++ b/MLKFuncallable.h
@@ -0,0 +1,24 @@
+/* -*- mode: objc; coding: utf-8 -*- */
+/* Étoilisp/Mulklisp, a Common Lisp subset for the Étoilé runtime.
+ * Copyright (C) 2008 Matthias Andreas Benkard.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+@class NSArray;
+
+
+@protocol MLKFuncallable
+-(NSArray *) applyToArray:(NSArray *)arguments;
+@end
diff --git a/MLKReader.m b/MLKReader.m
index eb9a9fc..18d6571 100644
--- a/MLKReader.m
+++ b/MLKReader.m
@@ -24,7 +24,7 @@
#import "MLKDynamicContext.h"
#import "MLKEnvironment.h"
#import "MLKPackage.h"
-#import "MLKClosure.h"
+#import "MLKFuncallable.h"
#import "MLKStream.h"
#import "MLKFloat.h"
#import "MLKInteger.h"
@@ -68,7 +68,7 @@
if ([readtable isMacroCharacter:ch])
{
NSArray *returnValues;
- MLKClosure *macrofun = [readtable macroFunctionForCharacter:ch];
+ MLKFuncallable *macrofun = [readtable macroFunctionForCharacter:ch];
NSArray *args = [NSArray arrayWithObjects:
stream,
[MLKCharacter characterWithUnichar:ch],
diff --git a/MLKReadtable.h b/MLKReadtable.h
index c8421cb..fcdc479 100644
--- a/MLKReadtable.h
+++ b/MLKReadtable.h
@@ -21,7 +21,7 @@
#import <Foundation/NSObject.h>
#import <Foundation/NSString.h>
-@class MLKClosure, NSMutableDictionary;
+@class MLKFuncallable, NSMutableDictionary;
enum MLKReadtableCase
@@ -37,7 +37,7 @@ enum MLKReadtableCase
{
NSMutableDictionary *_syntaxTable;
NSMutableDictionary *_readerMacros;
- //MLKClosure *_caseConverter;
+ //MLKFuncallable *_caseConverter;
enum MLKReadtableCase _case;
}
@@ -73,6 +73,6 @@ enum MLKReadtableCase
-(BOOL) isDigit:(unichar)ch;
-(int) digitWeight:(unichar)ch;
--(MLKClosure *) macroFunctionForCharacter:(unichar)ch;
+-(MLKFuncallable *) macroFunctionForCharacter:(unichar)ch;
-(unichar) charWithReadtableCase:(unichar)ch;
@end
diff --git a/MLKReadtable.m b/MLKReadtable.m
index 702a00b..585d930 100644
--- a/MLKReadtable.m
+++ b/MLKReadtable.m
@@ -103,7 +103,7 @@
isEqual:[[NSString stringWithFormat:@"%C", ch] lowercaseString]]);
}
--(MLKClosure *) macroFunctionForCharacter:(unichar)ch;
+-(MLKFuncallable *) macroFunctionForCharacter:(unichar)ch;
{
return [_readerMacros objectForKey:[NSNumber numberWithLong:ch]];
}