File: SVErrorImpl.mesa
Last edited by: Eric Bier on January 27, 1987 11:28:43 pm PST
Contents: Routines for handling user error messages throughout Solidviews. (It's never too late to try to do it right.
DIRECTORY
IO, MessageWindow, Rope, SVError;
SVErrorImpl: CEDAR PROGRAM
IMPORTS IO, MessageWindow
EXPORTS SVError =
BEGIN
Global Variables
gErrorStream: IO.STREAM;
Problem: PUBLIC SIGNAL [msg: Rope.ROPE] = CODE;
MsgType: TYPE = SVError.MsgType; -- {oneLiner, begin, middle, end};
SetErrorStream: PUBLIC PROC [errorStream: IO.STREAM] = {
gErrorStream ← errorStream;
};
GetErrorStream: PUBLIC PROC [] RETURNS [errorStream: IO.STREAM] = {
RETURN[gErrorStream];
};
Blink: PUBLIC PROC [] = {
MessageWindow.Blink[];
};
Append: PUBLIC PROC [msg: Rope.ROPE, msgType: MsgType] = {
clearHerald: BOOL ← msgType = begin OR msgType = oneLiner;
MessageWindow.Append[msg, clearHerald];
gErrorStream.PutF[msg];
IF msgType = oneLiner OR msgType = end THEN gErrorStream.PutChar[IO.CR];
};
AppendHerald: PUBLIC PROC [msg: Rope.ROPE, msgType: MsgType] = {
clearHerald: BOOL ← msgType = begin OR msgType = oneLiner;
MessageWindow.Append[msg, clearHerald];
};
AppendTypescript: PUBLIC PROC [msg: Rope.ROPE, msgType: MsgType] = {
gErrorStream.PutF[msg];
IF msgType = oneLiner OR msgType = end THEN gErrorStream.PutChar[IO.CR];
};
PutF: PUBLIC PROC [msgType: MsgType, format: Rope.ROPENIL, v1, v2, v3, v4, v5: IO.Value ← [null[]] ] = { -- to script and feedback line
msg: Rope.ROPEIO.PutFR[format, v1, v2, v3, v4, v5];
Append[msg, msgType];
};
PutFHerald: PUBLIC PROC [msgType: MsgType, format: Rope.ROPENIL, v1, v2, v3, v4, v5: IO.Value ← [null[]] ] = { -- to feedback line only
msg: Rope.ROPEIO.PutFR[format, v1, v2, v3, v4, v5];
AppendHerald[msg, msgType];
};
PutFTypescript: PUBLIC PROC [msgType: MsgType, format: Rope.ROPENIL, v1, v2, v3, v4, v5: IO.Value ← [null[]] ] = { -- to script only
msg: Rope.ROPEIO.PutFR[format, v1, v2, v3, v4, v5];
AppendTypescript[msg, msgType];
};
NotYetImplemented: PUBLIC SIGNAL = CODE;
END.