diff options
author | Matthias Benkard <mulk@minimulk.mst-plus> | 2008-08-28 14:31:01 +0200 |
---|---|---|
committer | Matthias Benkard <mulk@minimulk.mst-plus> | 2008-08-28 14:31:01 +0200 |
commit | 5afdd34ed00ed1de76b90a884e5b04bd699dc0af (patch) | |
tree | 80ee1ced4a3830f21da4bd9c9658903a45e44bc7 | |
parent | b2b6a790d8f6b1002973ef522a928a2047be511d (diff) |
Listener: Add output stream stubs.
-rw-r--r-- | MLKListenerController.h | 11 | ||||
-rw-r--r-- | MLKListenerController.m | 26 |
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 |