IPErrorImpl.mesa
Copyright © 1984, 1985 Xerox Corporation. All rights reserved.
Doug Wyatt, May 31, 1985 12:06:44 pm PDT
Errors and Signals known throughout the Interpress interpreter
DIRECTORY
Interpress,
IPInterpreter,
List USING [AList, Assoc, PutAssoc],
ProcessProps USING [AddPropList, GetPropList],
Rope USING [ROPE];
IPErrorImpl: CEDAR PROGRAM
IMPORTS IPInterpreter, List, ProcessProps
EXPORTS Interpress, IPInterpreter
~ BEGIN OPEN IPInterpreter;
ROPE: TYPE ~ Rope.ROPE;
stateKey: ATOM ~ $InterpressMaster;
OpenMaster: TYPE ~ Interpress.OpenMaster;
AddMaster: PUBLIC PROC [master: OpenMaster, inner: PROC] ~ {
aList: List.AList ← NIL;
aList ← List.PutAssoc[key: stateKey, val: master, aList: aList];
ProcessProps.AddPropList[aList, inner];
};
GetMaster: PUBLIC PROC RETURNS [OpenMaster] ~ {
aList: List.AList ~ ProcessProps.GetPropList[];
val: REF ~ List.Assoc[key: stateKey, aList: aList];
WITH val SELECT FROM val: OpenMaster => RETURN[val] ENDCASE;
RETURN[NIL];
};
NonDefaultingRope: TYPE ~ ROPE
RopeFromClassArray: TYPE ~ ARRAY ErrorClass OF NonDefaultingRope;
ropeFromClass: REF RopeFromClassArray ~ NEW[RopeFromClassArray ← [nil: NIL,
masterError: "Master Error",
masterWarning: "Master Warning",
appearanceError: "Appearance Error",
appearanceWarning: "Appearance Warning",
comment: "Comment"
]];
ReportError: PUBLIC PROC [class: ErrorClass, code: ATOM, explanation: ROPE] ~ {
master: OpenMaster ~ GetMaster[];
IF master#NIL AND master.logProc#NIL THEN master.logProc[master, class, code, explanation];
IF class=masterError THEN ERROR MarkRecovery;
};
NonDefaultingATOM: TYPE ~ ATOM
MasterErrorCodeTable: TYPE ~ ARRAY MasterErrorType OF NonDefaultingATOM;
MasterWarningCodeTable: TYPE ~ ARRAY MasterWarningType OF NonDefaultingATOM;
masterErrorCode: REF MasterErrorCodeTable ~ NEW[MasterErrorCodeTable ← [bug: $bug, unimplemented: $unimplemented, boundsFault: $boundsFault, nilFault: $nilFault, invalidArgs: $invalidArgs, limitExceeded: $limitExceeded, markMismatch: $markMismatch, missingBody: $missingBody, notInteger: $notInteger, stackOverflow: $stackOverflow, stackUnderflow: $stackUnderflow, undefinedOperation: $undefinedOperation, undefinedProperty: $undefinedProperty, unmarkFailed: $unmarkFailed, wrongType: $wrongType]];
masterWarningCode: REF MasterWarningCodeTable ~ NEW[MasterWarningCodeTable ← [bug: $bug, unimplemented: $unimplemented, nullValue: $nullValue, illegalIdentifier: $illegalIdentifier, illegalString: $illegalString, unknownToken: $unknownToken]];
MasterError: PUBLIC PROC [code: ATOM, explanation: ROPE] ~ {
ReportError[class: $masterError, code: code, explanation: explanation];
};
MasterWarning: PUBLIC PROC [code: ATOM, explanation: ROPE ←] ~ {
ReportError[class: $masterWarning, code: code, explanation: explanation];
};
END.