SimpleStreamsOnViewerIOImpl.mesa
Copyright Ó 1988, 1992 by Xerox Corporation. All rights reserved.
Christian Jacobi, April 18, 1989 3:12:01 pm PDT
Christian Jacobi, March 27, 1992 4:19 pm PST
DIRECTORY
Ascii, EditedStream, IO, Rope, SimpleStreams, TypeScript, ViewerIO;
SimpleStreamsOnViewerIOImpl:
CEDAR
MONITOR
IMPORTS EditedStream, Rope, SimpleStreams, TypeScript, ViewerIO =
BEGIN
VCreateSimpleStreams: SimpleStreams.CreateProcType = {
ts: TypeScript.TS;
IF Rope.IsEmpty[header] THEN header ¬ "Simple Stream";
ts ¬ TypeScript.Create[info: [name: header]];
[in: in, out: out] ¬ ViewerIO.CreateViewerStreams[name: NIL, viewer: ts, editedStream: echo];
IF echo
THEN {
IF windowSystem = $ViewerIOWithRubout
THEN EditedStream.SetDeliverWhen[in, DirtyDeliverOnCrOrLf]
ELSE EditedStream.SetDeliverWhen[in, CleanDeliverOnCrOrLf];
};
hasEcho ¬ echo;
};
CleanDeliverOnCrOrLf: EditedStream.DeliverWhenProc = {
IF char = Ascii.
DEL
THEN {
--prevent raising EditedStream.Rubout
--(not an allowed error to be raised by streams; Pfui EditedStream)
RETURN [appendChar: FALSE, activate: FALSE];
};
RETURN [appendChar: TRUE, activate: char = Ascii.CR OR char = Ascii.LF]
};
DirtyDeliverOnCrOrLf: EditedStream.DeliverWhenProc = {
RETURN [appendChar: TRUE, activate: char = Ascii.CR OR char = Ascii.LF];
};
SimpleStreams.ImplementCreate[$ViewerIOWithRubout, VCreateSimpleStreams];
SimpleStreams.ImplementCreate[$ViewerIO, VCreateSimpleStreams];
END.