File: Feedback.mesa
Copyright © 1986 by Xerox Corporation. All rights reserved.
Bier, March 1, 1987 6:19:47 pm PST
Contents: Routines for handling error and feedback messages throughout a set of applications. This package handles some of the niceties of sending the output to both a Labels.Label (where the user sees it immediately) and to a Typescript (where it can be referred to at leisure). The client simply stores a FeedbackData with the data for each application window. For code deep inside the application where it is inconvenient to pass the FeedbackData all the way down, Feedback sends the message to the MessageWindow and Typescript instead of the Labels.Label and Typescript.
This package performs five functions: First, It uses sensible conventions for when to add CR characters to the Typescript, so the client need not worry about CRs at all. Second, it posts messages to two places at once with only one procedure call. Third, in the case of the PutF constructs it combines the formatting and posting of message statements into one procedure call. Fourth, it allows a single Typescript per application, coupled with a feedback line per viewer. Fifth, it notices when the Typescript has been deleted and stops sending messages to the Typescript until another Typescript is created.
DIRECTORY
AtomButtonsTypes, IO, Rope, ViewerClasses;
Feedback: CEDAR DEFINITIONS = BEGIN
Viewer: TYPE = ViewerClasses.Viewer;
FeedbackData: TYPE = REF FeedbackDataObj;
FeedbackDataObj: TYPE = AtomButtonsTypes.FeedbackDataObj;
Problem: SIGNAL [msg: Rope.ROPE];
MsgType: TYPE = {oneLiner, begin, middle, end};
OpenTypescript: PROC [headerText: Rope.ROPE, atomName: ATOM, openHeight: NAT ← 120] RETURNS [alreadyExists: BOOL, typescript: Viewer];
Open a new typescript with the headerText in its black strip. Register it under atomName. Text will be sent to this typescript when Append or PutF operations are called with a feedback region that is registered under atomName. The typescript is returned so that the client can destroy it, if desired.
GetTypescriptStream: PROC [atomName: ATOM] RETURNS [IO.STREAM];
Returns the output stream that goes to typescript atomName.
RegisterFeedback: PROC [label: Viewer, atomName: ATOM] RETURNS [feedback: FeedbackData];
feedback should be a Labels.Label. atomName is the name of the Typescript with which this label should be associated.
ClearHerald: PROC [feedback: FeedbackData];
Remove any messages from the feedback Label.
ClearHeraldRaw: PROC [atomName: ATOM];
Remove any messages from the Message Window.
Blink: PROC [feedback: FeedbackData];
Blink the feedback Label.
BlinkRaw: PROC [atomName: ATOM];
Blink the Message Window.
Append: PROC [feedback: FeedbackData, msg: Rope.ROPE, msgType: MsgType];
The message goes to the feedback label AND the typescript.
AppendHerald: PROC [feedback: FeedbackData, msg: Rope.ROPE, msgType: MsgType];
The message goes to the feedback label only.
AppendTypescript: PROC [feedback: FeedbackData, msg: Rope.ROPE, msgType: MsgType];
The message goes to the typescript only.
AppendRaw: PROC [atomName: ATOM, msg: Rope.ROPE, msgType: MsgType];
Like Append, but the message is posted to Typscript atomName and the MessageWindow. This is useful for places deep in your code where the FeedbackData is not handy.
AppendHeraldRaw: PROC [atomName: ATOM, msg: Rope.ROPE, msgType: MsgType];
Like AppendHerald, but the message is posted to Typscript atomName and the MessageWindow. This is useful for places deep in your code where the FeedbackData is not handy.
AppendTypescriptRaw: PROC [atomName: ATOM, msg: Rope.ROPE, msgType: MsgType];
Like AppendTypescript, but the message is posted to Typscript atomName and the MessageWindow. This is useful for places deep in your code where the FeedbackData is not handy.
PutF: PROC [feedback: FeedbackData, msgType: MsgType, format: Rope.ROPENIL, v1, v2, v3, v4, v5: IO.Value ← [null[]] ];
The message goes to the feedback label AND the typescript.
PutFHerald: PROC [feedback: FeedbackData, msgType: MsgType, format: Rope.ROPENIL, v1, v2, v3, v4, v5: IO.Value ← [null[]] ];
The message goes to the feedback label only.
PutFTypescript: PROC [feedback: FeedbackData, msgType: MsgType, format: Rope.ROPENIL, v1, v2, v3, v4, v5: IO.Value ← [null[]] ];
The message goes to the typescript only.
PutFRaw: PROC [atomName: ATOM, msgType: MsgType, format: Rope.ROPENIL, v1, v2, v3, v4, v5: IO.Value ← [null[]] ];
Like PutF, but the message is posted to Typscript atomName and the MessageWindow. This is useful for places deep in your code where the FeedbackData is not handy.
PutFHeraldRaw: PROC [atomName: ATOM, msgType: MsgType, format: Rope.ROPENIL, v1, v2, v3, v4, v5: IO.Value ← [null[]] ];
Like PutFHerald, but the message is posted to Typscript atomName and the MessageWindow. This is useful for places deep in your code where the FeedbackData is not handy.
PutFTypescriptRaw: PROC [atomName: ATOM, msgType: MsgType, format: Rope.ROPENIL, v1, v2, v3, v4, v5: IO.Value ← [null[]] ];
Like PutFTypescript, but the message is posted to Typscript atomName and the MessageWindow. This is useful for places deep in your code where the FeedbackData is not handy.
END.