TestRealConvert.mesa
Copyright Ó 1989, 1991 by Xerox Corporation. All rights reserved.
weiser, January 13, 1991
Test the RealConvert interface for PCedar
Weiser, January 13, 1991 10:50 pm PST
Michael Plass, September 27, 1991 12:32 pm PDT
DIRECTORY
Commander,
RealConvert,
Ieee,
IO,
Rope;
TestRealConvert: CEDAR PROGRAM
IMPORTS Commander, RealConvert, IO
~ BEGIN
IEEE: TYPE ~ Ieee.SingleReal;
BCPL: TYPE ~ RealConvert.BcplReal;
GetRopeFromReal: PUBLIC PROC [r: REAL] RETURNS [returnRope: Rope.ROPE] ~ {
Prints out in Hex the BCPL value of a REAL passed in
returnRope ¬ IO.PutFLR["%e is %x hex, and %x BCPL hex, and %e back to real.\n", LIST[
IO.real[r],
IO.int[LOOPHOLE[r]],
IO.int[LOOPHOLE[RealConvert.IeeeToBcpl[r]]],
IO.real[RealConvert.BcplToIeee[RealConvert.IeeeToBcpl[r]]]]];
};
TestCommander: Commander.CommandProc ~ {
s: IO.STREAM = IO.RIS[cmd.commandLine];
number: REAL = IO.GetReal[s];
IO.PutRope[cmd.out, GetRopeFromReal[number]];
};
Commander.Register["TestReal", TestCommander, "Print out real values before and after conversions."];
END.