ImagerErrorImpl.mesa
Copyright Ó 1991, 1992 by Xerox Corporation. All rights reserved.
Michael Plass, February 13, 1992 2:11 pm PST
DIRECTORY Atom, Convert, RefText, Rope, Prop, ImagerError;
ImagerErrorImpl: CEDAR PROGRAM
IMPORTS Atom, Convert, RefText
EXPORTS ImagerError
~ BEGIN
Error: PUBLIC ERROR [error: ImagerError.ErrorDesc] ~ CODE;
Warning: PUBLIC SIGNAL [error: ImagerError.ErrorDesc] ~ CODE;
ErrorCodeFromAtom: PUBLIC PROC [atom: ATOM] RETURNS [ImagerError.ErrorCode] ~ {
FOR e: ImagerError.ErrorCode IN ImagerError.ErrorCode DO
IF AtomFromErrorCode[e] = atom THEN RETURN [e];
ENDLOOP;
RETURN [bug]
};
NameFromErrorCode: PUBLIC PROC [code: ImagerError.ErrorCode] RETURNS [name: ATOM] ~ {
name ¬ AtomFromErrorCode[code];
IF name = NIL THEN name ¬ AtomForNumber[ORD[code]];
};
AtomFromErrorCode: PUBLIC PROC [code: ImagerError.ErrorCode] RETURNS [ATOM] ~ {
RETURN [
SELECT code FROM
ok => $ok, -- unused
bounds => $bounds, -- A value is out of rang
overflow => $overflow, -- A computation overflowed
zeroDivide => $zeroDivide, -- divide by zero
nilFault => $nilFault, -- a NIL value was encountered
insufficientMemory => $insufficientMemory, -- out of memory
ioError => $ioError, -- unrecoverable I/O error
timeout => $timeout, -- some resource timed out
eof => $eof, -- unexpected end-of-file
numericalInstability => $numericalInstability, -- dubious floating-point computation
bug => $bug, -- an internal error
fileNotFound => $fileNotFound,
colorModelOperatorNotFound => $colorModelOperatorNotFound,
colorOperatorNotFound => $colorOperatorNotFound,
colorNotFound => $colorNotFound,
decompressorNotFound => $decompressorNotFound,
fontNotFound => $fontNotFound,
operatorNotFound => $operatorNotFound,
resourceNotFound => $resourceNotFound,
accessError => $accessError,
syntax => $syntax,
undefinedOperation => $undefinedOperation,
invalidCompressedSequence => $invalidCompressedSequence,
malformedFont => $malformedFont,
invalidEncoding => $invalidEncoding,
invalidHeader => $invalidHeader,
invalidIdentifier => $invalidIdentifier,
invalidInstructionProperty => $invalidInstructionProperty,
invalidName => $invalidName,
invalidString => $invalidString,
invalidToner => $invalidToner,
invalidVersion => $invalidVersion,
nullValue => $nullValue, -- an uninitialized value was encountered
illegalAlternateMetrics => $illegalAlternateMetrics,
illegalColor => $illegalColor,
unknownSpecialColor => $unknownSpecialColor,
unknownSignalType => $unknownSignalType,
wrongShape => $wrongShape,
wrongSize => $wrongSize,
notCardinal => $notCardinal,
notInteger => $notInteger,
notNumber => $notNumber,
wrongType => $wrongType,
noFont => $noFont,
illegalArguments => $illegalArguments,
illegalTransformation => $illegalTransformation,
illegalPixelMask => $illegalPixelMask,
illegalPropertyVector => $illegalPropertyVector,
illegalRunVector => $illegalRunVector,
undefinedProperty => $undefinedProperty,
stackOverflow => $stackOverflow,
stackUnderflow => $stackUnderflow,
saveRestoreMismatch => $saveRestoreMismatch,
markMismatch => $markMismatch,
unmarkFailed => $unmarkFailed,
invalidOperationSequence => $invalidOperationSequence,
obsoleteConstruct => $obsoleteConstruct,
unsupportedColorOperator => $unsupportedColorOperator,
notImplemented => $notImplemented, -- not currently implemented
unimplemented => $unimplemented, -- not implemented, probably for a good reason
squareEndOnStrokeOfZeroLength => $squareEndOnStrokeOfZeroLength,
unableToProperlyAdjustMaskPositions => $unableToProperlyAdjustMaskPositions,
noSubstituteColor => $noSubstituteColor,
fontSubstitution => $fontSubstitution,
appearance => $appearance,
error => $error,
copySensitive => $copySensitive,
ENDCASE => NIL
]
};
AtomForNumber: PROC [card: CARD] RETURNS [atom: ATOM] ~ {
t: REF TEXT ¬ RefText.ObtainScratch[100];
t ¬ RefText.Append[t, "imager"];
t ¬ Convert.AppendCard[t, card];
atom ¬ Atom.MakeAtomFromRefText[t];
RefText.ReleaseScratch[t];
};
END.