SimpleStreams.mesa
Copyright Ó 1988, 1992 by Xerox Corporation. All rights reserved.
Christian Jacobi, August 26, 1988 11:12:22 am PDT
Christian Jacobi, October 6, 1988 12:50:03 pm PDT
Create:
PROC [header: Rope.
ROPE ¬
NIL, echo:
BOOL ¬
TRUE, windowSystem:
REF ¬
NIL]
RETURNS [in, out, err:
IO.
STREAM, hasEcho:
BOOL];
--Creates top level window with input, output and error stream for typescript-style I/O.
--header: may be header line or simply first output, depending on window system.
--windowSystem: preferred window system. Use this windowSystem if it is implemented,
-- but otherwise use the "current" window system. Usually NIL or an atom.
--echo: Whether input echos to the output stream. If no echo, streams returned are
-- extremely simple, the input stream offers no editing, comment filtering,
-- or echoing to the output stream. The client is free to layer these features
-- anyway on top using the IO or EditedStream interface.
-- Restriction: there might be "windowSystem" implementors which fail to
-- implement the non echoed input stream; Clients can test for this using
-- the returned hasEcho boolean.
--Returns in, out, err: streams; out and err might be identical; err is useful for
-- simulating unix, but is mostly ignored by more Cedarish clients.
--The streams will raise IO.EndOfStream if the window is interactively destroyed (using
-- a "windowSystem" dependent action).
--Closing a stream might or might not remove the window.
Backdoor features
CreateProcType:
TYPE =
PROC [header: Rope.
ROPE ¬
NIL, echo:
BOOL ¬
TRUE, windowSystem:
REF ¬
NIL]
RETURNS [in, out, err:
IO.
STREAM ¬
NIL, hasEcho:
BOOL ¬
FALSE];
--Type used for implementations of Create
ImplementCreate:
PROC [windowSystem:
REF, create: CreateProcType, setCurrent:
BOOL ¬
TRUE];
--Provides procedure called on client requests for Create.
--It is ok to return NIL for err.
--It is ok to implement only non-echoed streams.
--It is tolerated but not liked to implement only echoed streams.
--See doc for restrictions on certain TYPE's of the windowSystem REF.
SetCurrentCreate:
PROC [windowSystem:
REF, scope:
REF ¬
NIL];
--Defines windowSystem to be used if windowSystem parameter in Create is defaulted
--No-op in case of non-implemented windowSystem
--scope: validity range for call; see doc