From 382f1be127ada9e777cae9c230254040b508f607 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Mon, 16 Jun 2008 11:51:55 +0200 Subject: Add protocol MLKFuncallable. --- MLKClosure.h | 3 ++- MLKDynamicContext.h | 2 +- MLKFuncallable.h | 24 ++++++++++++++++++++++++ MLKReader.m | 4 ++-- MLKReadtable.h | 6 +++--- MLKReadtable.m | 2 +- 6 files changed, 33 insertions(+), 8 deletions(-) create mode 100644 MLKFuncallable.h 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 { 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 . */ -@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 . + */ + +@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 #import -@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]]; } -- cgit v1.2.3