<> <> <> <> DIRECTORY Ieee USING [BitOn, IResultEnable, IResultSticky, Microcode, MicroSticky], Real USING [ExceptionFlags, Extended, NoExceptions], RealExceptions USING [CombinedFlags, GetCombined, GetSticky, SetCombined, SetSticky], RealOps USING [DefMode, InfinityMode, Mode, NormalizationMode, RoundingMode]; IeeeMode: CEDAR PROGRAM IMPORTS Ieee, RealExceptions EXPORTS Ieee, Real, RealOps = BEGIN normalMode: RealOps.Mode _ RealOps.DefMode; userMode: RealOps.Mode _ normalMode; alwaysNormal: BOOL _ TRUE; SetStickyFlags: PUBLIC PROC [new: Real.ExceptionFlags _ Real.NoExceptions] RETURNS [old: Real.ExceptionFlags] = { MicroStickySet[]; IF alwaysNormal THEN { old _ Real.NoExceptions } ELSE { entry: RealExceptions.CombinedFlags _ RealExceptions.GetCombined[]; old _ entry.sticky; entry.sticky _ new; RealExceptions.SetCombined[entry]; }; }; GetStickyFlags: PUBLIC PROC RETURNS [Real.ExceptionFlags] = { MicroStickySet[]; RETURN[RealExceptions.GetSticky[]]; }; SetMode: PUBLIC PROC [new: RealOps.Mode] RETURNS [old: RealOps.Mode] = { IF alwaysNormal THEN {userMode _ old _ normalMode} ELSE {old _ userMode; userMode _ new}; MicroStickySet[]; }; GetMode: PUBLIC PROC RETURNS [RealOps.Mode] = { IF alwaysNormal THEN RETURN [normalMode] ELSE RETURN[userMode]; }; MicroStickySet: PUBLIC PROC = TRUSTED { IF Ieee.Microcode THEN { xx: CARDINAL _ IF userMode.traps[inexactResult] THEN Ieee.IResultEnable ELSE 0; xx _ Ieee.MicroSticky[xx]; IF Ieee.BitOn[xx, Ieee.IResultSticky] THEN RealExceptions.SetSticky[inexactResult]; }; }; RealException: PUBLIC SIGNAL [ flags: Real.ExceptionFlags, vp: REF Real.Extended] RETURNS [clientFixup: BOOL _ FALSE] = CODE; RealError: PUBLIC ERROR = CODE; END. L. Stewart, July 6, 1980 4:13 PM, Microcode sticky bit stuff added. August 25, 1980 4:42 PM, LStewart; Formatting September 28, 1980 8:06 PM; Stewart, Deleted individual twiddle procs. 17-Nov-81 1:12:39, Stewart, userMode uninitialized June 3, 1982 11:41 am, L. Stewart, RealException REF August 27, 1982 1:02 pm, L. Stewart, CEDAR January 14, 1984 4:55 pm, L. Stewart, change to Ieee