IPErrorImpl.mesa
Copyright © 1984, 1985 Xerox Corporation. All rights reserved.
Doug Wyatt, November 21, 1985 3:15:42 pm PST
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];
};
ReportError: PUBLIC PROC [code: Cardinal, atom: ATOM, message: ROPE] ~ {
master: OpenMaster ~ GetMaster[];
IF master#NIL AND master.logProc#NIL THEN master.logProc[master, code, atom, message];
IF code=masterErrorCode 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, notCardinal: $notCardinal, 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 [atom: ATOM, message: ROPE] ~ {
ReportError[masterErrorCode, atom, message];
};
MasterWarning: PUBLIC PROC [atom: ATOM, message: ROPE] ~ {
ReportError[masterWarningCode, atom, message];
};
END.