summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <matthias@benkard.de>2008-06-14 19:54:45 +0200
committerMatthias Andreas Benkard <matthias@benkard.de>2008-06-14 19:54:45 +0200
commitcfc17a412d17cac2aa8ad31e434c803a4a7d21b3 (patch)
treef14b0e1748db6a6ca54a055b963ec57be6757c62
parente02c197a86a9c177937a6df95a92ab05b009a479 (diff)
Add method declarations needed by the reader.
-rw-r--r--MLKClosure.h36
-rw-r--r--MLKDynamicContext.h9
-rw-r--r--MLKDynamicContext.m22
-rw-r--r--MLKFunction.h32
-rw-r--r--MLKPackage.h2
-rw-r--r--MLKReader.m3
-rw-r--r--MLKReadtable.h15
7 files changed, 116 insertions, 3 deletions
diff --git a/MLKClosure.h b/MLKClosure.h
new file mode 100644
index 0000000..b05783f
--- /dev/null
+++ b/MLKClosure.h
@@ -0,0 +1,36 @@
+/* -*- 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/>.
+ */
+
+#import "MLKLispValue.h"
+
+@class MLKFunction, NSArray, NSData;
+
+
+@interface MLKClosure : MLKLispValue
+{
+ MLKFunction *_code;
+ NSData *_closedOverVariableVector;
+}
+
+-(MLKClosure *) initWithFunction:(MLKFunction *)code
+ environment:(MLKEnvironment *)lexenv;
+
+-(NSArray *) applyToArray:(NSArray *)arguments;
+
+-(void) dealloc;
+@end
diff --git a/MLKDynamicContext.h b/MLKDynamicContext.h
index f8be118..aa3614f 100644
--- a/MLKDynamicContext.h
+++ b/MLKDynamicContext.h
@@ -16,7 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-@class MLKClosure, MLKEnvironment, NSLinkedList, NSMutableDictionary, NSString;
+@class MLKClosure, MLKEnvironment, MLKSymbol, NSLinkedList,
+ NSMutableDictionary, NSString;
@interface MLKDynamicContext : NSObject
@@ -41,5 +42,11 @@
+(MLKDynamicContext *) currentContext;
+(MLKDynamicContext *) popContext;
+-(MLKEnvironment *) environment;
+
+-(id) findRestart:(MLKSymbol *)symbol;
+-(id) findHandler:(MLKSymbol *)symbol;
+-(id) findCatchTag:(MLKSymbol *)symbol;
+
-(void) dealloc;
@end
diff --git a/MLKDynamicContext.m b/MLKDynamicContext.m
index cf6b861..c034eac 100644
--- a/MLKDynamicContext.m
+++ b/MLKDynamicContext.m
@@ -79,6 +79,28 @@
return context;
}
+-(MLKEnvironment *) environment
+{
+ return _environment;
+}
+
+-(id) findRestart:(MLKSymbol *)symbol
+{
+ return [_restarts valueForBinding:symbol];
+}
+
+/*
+-(id) findHandler:(MLKSymbol *)symbol
+{
+ // ???
+}
+*/
+
+-(id) findCatchTag:(MLKSymbol *)symbol
+{
+ return [_catchTags valueForBinding:symbol];
+}
+
-(void) dealloc
{
RELEASE (_conditionHandlers);
diff --git a/MLKFunction.h b/MLKFunction.h
new file mode 100644
index 0000000..22c493b
--- /dev/null
+++ b/MLKFunction.h
@@ -0,0 +1,32 @@
+/* -*- 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/>.
+ */
+
+#import "MLKLispValue.h"
+
+
+@interface MLKFunction : MLKLispValue
+{
+ void (*_function)();
+ NSDictionary *_closedOverVariableIndices;
+}
+
++(MLKFunction *) initWithCode:(void (*)())code
+ closedOverVariableIndices:(NSDictionary *)variables;
+
+-(void) dealloc;
+@end
diff --git a/MLKPackage.h b/MLKPackage.h
index 25834f1..e601b18 100644
--- a/MLKPackage.h
+++ b/MLKPackage.h
@@ -33,6 +33,8 @@
-(MLKPackage *) initWithName:(NSString *)name
nicknames:(NSSet *)nicknames;
++(MLKPackage *)findPackage:(NSString *)name;
+
-(void) usePackage:(MLKPackage *)aPackage;
-(void) import:(MLKSymbol *)aSymbol;
-(void) shadow:(MLKPackage *)aPackage;
diff --git a/MLKReader.m b/MLKReader.m
index fba2ef2..5fc8d24 100644
--- a/MLKReader.m
+++ b/MLKReader.m
@@ -24,6 +24,7 @@
#import "MLKDynamicContext.h"
#import "MLKEnvironment.h"
#import "MLKPackage.h"
+#import "MLKClosure.h"
#import <Foundation/NSArray.h>
#import <Foundation/NSString.h>
@@ -42,7 +43,7 @@
BOOL escaped;
readtable = [[[MLKDynamicContext currentContext] environment]
- valueForBinding:[[MLKPackage commonLisp]
+ valueForBinding:[[MLKPackage findPackage:@"COMMON-LISP"]
intern:@"*READTABLE*"]];
start:
diff --git a/MLKReadtable.h b/MLKReadtable.h
index ed08d84..1f4bf97 100644
--- a/MLKReadtable.h
+++ b/MLKReadtable.h
@@ -18,7 +18,7 @@
#import "MLKLispValue.h"
-@class NSMutableDictionary;
+@class MLKClosure, NSMutableDictionary;
enum MLKReadtableCase
@@ -40,4 +40,17 @@ enum MLKReadtableCase
-(MLKReadtable *) init;
-(MLKReadtable *) copy;
+
+-(BOOL) isWhitespaceCharacter:(unichar)ch;
+-(BOOL) isMacroCharacter:(unichar)ch;
+-(BOOL) isNonTerminatingMacroCharacter:(unichar)ch;
+-(BOOL) isTerminatingMacroCharacter:(unichar)ch;
+-(BOOL) isSingleEscapeCharacter:(unichar)ch;
+-(BOOL) isMultipleEscapeCharacter:(unichar)ch;
+-(BOOL) isConstituentCharacter:(unichar)ch;
+-(BOOL) isInvalidCharacter:(unichar)ch;
+-(BOOL) characterHasCase:(unichar)ch;
+
+-(MLKClosure *) macroFunctionForCharacter:(unichar)ch;
+-(unichar) charWithReadtableCase:(unichar)ch;
@end