edited by Teitelman January 14, 1983 6:53 pm
DIRECTORY
Atom USING [GetPropFromList, PutPropOnList],
TypeScript USING [UserAbort, SetUserAbort, ResetUserAbort, IsATypeScript],
ViewerAbort USING [],
ViewerClasses USING [Viewer]
;
ViewerAbortImpl: CEDAR PROGRAM
IMPORTS Atom, TypeScript
EXPORTS ViewerAbort
= BEGIN
Viewer: TYPE = ViewerClasses.Viewer;
UserAbort: PUBLIC PROCEDURE [viewer: Viewer] RETURNS [BOOL] = {
val: REF ANY;
IF TypeScript.IsATypeScript[viewer] AND TypeScript.UserAbort[viewer] THEN RETURN[TRUE];
when Bill fixes it so that he always calls ViewerAbort.SetUserAbort, then the next check would be unnecessary when the viewer is in fact a typescript. However, as things stand now, the "abort" bit gets set one way if selection at end of typescript, a different way if in middle.
IF (val ← Atom.GetPropFromList[viewer.props, $Abort]) # NIL THEN RETURN[(NARROW[val, REF BOOLEAN])^];
RETURN[FALSE];
};
SetUserAbort: PUBLIC PROCEDURE [viewer: Viewer] = {
val: REF ANY;
IF TypeScript.IsATypeScript[viewer] THEN {TypeScript.SetUserAbort[viewer]; RETURN};
IF (val ← Atom.GetPropFromList[viewer.props, $Abort]) # NIL THEN
(NARROW[val, REF BOOLEAN])^ ← TRUE
ELSE viewer.props ← Atom.PutPropOnList[propList: viewer.props, prop: $Abort, val: NEW[BOOLTRUE]];
};
ResetUserAbort: PUBLIC PROCEDURE [viewer: Viewer] = {
val: REF ANY;
IF TypeScript.IsATypeScript[viewer] THEN TypeScript.ResetUserAbort[viewer];
IF (val ← Atom.GetPropFromList[viewer.props, $Abort]) # NIL THEN
(NARROW[val, REF BOOLEAN])^ ← FALSE;
};
END.