SimpleTerminalBackdoor.mesa
Copyright Ó 1985, 1986 by Xerox Corporation. All rights reserved.
Levin on September 22, 1983 12:21 pm
Doug Wyatt, February 27, 1985 10:22:06 am PST
Mike Spreitzer March 4, 1987 12:05:06 pm PST
DIRECTORY
IO USING [STREAM],
Process USING [Ticks],
Rope USING [ROPE];
SimpleTerminalBackdoor: CEDAR DEFINITIONS
= BEGIN
ROPE: TYPE ~ Rope.ROPE;
STREAM: TYPE ~ IO.STREAM;
Ticks: TYPE ~ Process.Ticks;
FullTurnOn: PROC [bannerLeft, bannerRight: ROPENIL] RETURNS [in, out: STREAM];
If either banner is NIL, a default is used.
DefaultBannerLeft: PROC RETURNS [ROPE];
DefaultBannerRight: PROC RETURNS [ROPE];
Impl: TYPE ~ REF ImplRep;
ImplRep: TYPE ~ RECORD [
CaptureOriginalState: PROC [impl: Impl],
So TurnOff can restore it. Called on transition from off to on.
Start: PROC [impl: Impl, bannerLeft, bannerRight: ROPE] RETURNS [in, out: STREAM],
Effects the transition from off to on.
ReStart: PROC [impl: Impl],
Done when TurnOn called while already on.
TurnOff: PROC [impl: Impl, ShutdownNeeded: PROC RETURNS [BOOL]],
Consults ShutdownNeeded, and if so, closes down the simple terminal. If ShutdownNeeded, someone must eventually call StartShutdown before any further state change can proceed.
SetInputTimeout: PROC [impl: Impl, ticks: Ticks],
DisableCursorTracking: PROC [impl: Impl],
EnableCursorTracking: PROC [impl: Impl],
data: REF ANYNIL
];
CaptureOriginalState, Start, ReStart, and TurnOff are never called concurrently. CaptureOriginalState and ReStart must not call StartShutdown, ShuttingDown, FinishShutdown, SetImpl, or UnsetImpl.
StartShutdown: PROC RETURNS [needed: BOOL];
If called between ShutdownNeeded and FinishShutdown, will return TRUE, and shutdown should proceed. Otherwise returns FALSE, and shutdown should not proceed.
ShuttingDown: PROC RETURNS [BOOL];
Call this to find out if we're between StartShutdown and FinishShutdown.
FinishShutdown: PROC;
Call this to indicate shutdown complete.
SetImpl: PROC [Impl] RETURNS [ok: BOOL];
If not ok, the implementation is currently ambushed by something else. Otherwise ambush has been successful.
UnsetImpl: PROC [Impl];
Called between successful calls to SetImpl.
defaultImpl: Impl;
END.