summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MLKListenerController.h11
-rw-r--r--MLKListenerController.m26
2 files changed, 37 insertions, 0 deletions
diff --git a/MLKListenerController.h b/MLKListenerController.h
index d9714dd..a5a7a4b 100644
--- a/MLKListenerController.h
+++ b/MLKListenerController.h
@@ -16,6 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#import "MLKStream.h"
+
#import <Cocoa/Cocoa.h>
@interface MLKListenerController : NSObject
@@ -25,6 +27,15 @@
IBOutlet id outputTextView;
IBOutlet id statusText;
IBOutlet id submitButton;
+
+ MLKStream *lispStream;
+ NSOutputStream *ostream;
}
+
+- (id)init;
+- (void)dealloc;
+
+- (void)stream:(NSStream *)stream handleEvent:(NSStreamEvent)event;
+
- (IBAction)submit:(id)sender;
@end
diff --git a/MLKListenerController.m b/MLKListenerController.m
index 4e238a7..696b08f 100644
--- a/MLKListenerController.m
+++ b/MLKListenerController.m
@@ -24,6 +24,27 @@
#import "util.h"
@implementation MLKListenerController
+- (id)init
+{
+ self = [super init];
+
+ ostream = [[NSOutputStream alloc] initToMemory];
+ lispStream = [[MLKStream alloc] initWithOutputStream:ostream];
+ [ostream setDelegate:self];
+ [ostream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
+ [ostream open];
+
+ return self;
+}
+
+- (void)dealloc
+{
+ [ostream close];
+ LDESTROY (ostream);
+ LDESTROY (lispStream);
+ [super dealloc];
+}
+
- (IBAction)submit:(id)sender
{
id object;
@@ -101,4 +122,9 @@
[submitButton setEnabled:YES];
}
+
+- (void)stream:(NSStream *)stream handleEvent:(NSStreamEvent)event
+{
+ NSLog (@"Heya!");
+}
@end