FloatingPointSoftImpl.mesa
Copyright Ó 1989, 1991 by Xerox Corporation. All rights reserved.
Russ Atkinson (RRA) July 5, 1989 10:55:16 pm PDT
DIRECTORY
FloatingPointCommon,
FloatingPointPrivate;
FloatingPointSoftImpl: CEDAR PROGRAM
EXPORTS FloatingPointCommon, FloatingPointPrivate
= BEGIN OPEN FloatingPointCommon, FloatingPointPrivate;
currentState: PUBLIC FloatingState ¬ noCheck;
SetState: PUBLIC PROC [new: FloatingState] RETURNS [old: FloatingState] = {
old ¬ currentState;
currentState ¬ noCheck;
};
MesaFloatingSignalHandlerType: TYPE = PROC [code: Exception];
FloatingSignalHandler: MesaFloatingSignalHandlerType = {ERROR Error[code]};
Error: PUBLIC ERROR [code: Exception] = CODE;
SupportedExceptionErrors: PUBLIC PROC RETURNS [ExceptionFlags] = {
This operation indicates which exception flags are supported by Error. It is permitted for none of the flags to be supported by the primitive operations.
flags: ExceptionFlags ¬ NoExceptions;
IF currentState # noCheck THEN {
flags[invalidOperation] ¬ TRUE;
flags[overflow] ¬ TRUE;
flags[divisionByZero] ¬ TRUE;
};
RETURN [flags];
};
SupportedStickyFlags: PUBLIC PROC RETURNS [ExceptionFlags] = {
This operation indicates which exception flags are supported by GetStickyFlags and SetStickyFlags. It is permitted for none of the flags to be supported.
RETURN [NoExceptions];
};
GetStickyFlags: PUBLIC PROC RETURNS [ExceptionFlags] = {
RETURN [NoExceptions];
};
SetStickyFlags: PUBLIC PROC
[new: ExceptionFlags ¬ NoExceptions] RETURNS [old: ExceptionFlags] = {
The various exceptions may have independent "sticky" flags that remember if the exception has occurred since the last call to SetStickyFlags. SetStickyFlags is provided so that procedures may save and restore the state for others.
RETURN [NoExceptions];
};
END.