LogViewer.mesa
Copyright © 1983, 1985, 1986 by Xerox Corporation. All rights reserved.
Created by: Christian. Jacobi, August 3, 1983 9:54 am
Last edited by: Christian Jacobi, August 30, 1986 12:30:04 pm PDT
DIRECTORY
IO USING [STREAM, Value],
Rope USING [ROPE];
LogViewer: CEDAR DEFINITIONS = BEGIN
Sequential IO for "terminal and keyboard"
All processes share one log viewer.
Output may be delayed while input is pending.
Don't use procedures from inside a viewers-repaint or a TIP-notify procedure.
Output
Output must not overwhelm the user: the user must be able to recognize an
output line made by a different application. Output made in form of lines
simplifies the recognition of the output source. It is also a good idea to follow
the input convention for outputs.
CreateStream: PROC [] RETURNS [stream: IO.STREAM];
Creates an output stream which writes its output into the log viewer.
This procedure is lightweight; the viewer is only created when output is done.
No signals or errors are raised, neither on call nor on sequential output.
Short cuts
PutRope: PROC [text: Rope.ROPE];
PutRopes: PROC [t1, t2, t3: Rope.ROPE←NIL];
PutF: PROC [format: Rope.ROPENIL, v1, v2, v3, v4, v5: IO.Value ← [null[]]];
PutF1: PROC [format: Rope.ROPENIL, value: IO.Value ← [null[]]];
Input
In order to allow different applications to share this package in an orderly fashion,
(one that will not confuse users) clients must follow the convention below:
Do not require input except as immediate response to an user action.
UserAbort: SIGNAL;
TimeOut: SIGNAL;
RequestRope: PROC [prompt: Rope.ROPENIL, timeOut: NAT𡤀] RETURNS [Rope.ROPE];
Requests user to type in a rope.
May raise UserAbort and TimeOut.
prompt: NIL is ok, but others are better.
timeOut: in seconds; 0 for no timeout [the user can always abort].
AddLock: PRIVATE PROC [lock, free: PROC];
USE WITH CARE.
Procedures tell client module whether some input is in progress. This
is typically used to diplay a different cursor, so the user sees that input
is required. The lock procedure is a hint, do not rely on it.
The client procedures are called in a monitored way; they must be fast
and not cause any wedge. Do not make assumptions about the order of calls.
The registered procedures can not be removed, use only one per client.
END.