BSCoreIOIFUPropsImpl.mesa
Last edited by Curry September 25, 1986 9:56:25 am PDT
Don Curry October 24, 1986 5:48:44 pm PDT
Bertrand Serlet November 25, 1986 11:34:11 pm PST
DIRECTORY Basics, Core, CoreIO, CoreProperties, IO;
BSCoreIOIFUPropsImpl:
CEDAR
PROGRAM
IMPORTS Basics, CoreIO, CoreProperties, IO =
BEGIN
ROPE: TYPE = Core.ROPE;
Sides: TYPE = MACHINE DEPENDENT {none(0), bottom(1), right(2), top(4), left(8), all(15)};
sides:
PUBLIC
ATOM ← CoreIO.RegisterProperty[
$CoreBlockSides,
WriteSides,
ReadSides ];
WriteSides: CoreIO.PropWriteProc = {
refSides: REF Sides ← NARROW[value];
card: CARDINAL ← LOOPHOLE[refSides^];
IO.PutF[h.stream, "%g ", IO.card[card]]};
ReadSides: CoreIO.PropReadProc = {
card: CARDINAL ← IO.GetCard[h.stream];
max: CARDINAL ← 15;
IF card > max THEN Signal[];
RETURN[ NEW[Sides ← LOOPHOLE[Basics.BITAND[card, 15] ] ] ]};
drShiftIn:
PUBLIC
ATOM ← CoreIO.RegisterProperty[
CoreProperties.RegisterProperty[ $DShiftIn, CoreProperties.Props[
[CoreProperties.propPrint, NEW[CoreProperties.PropPrintProc ← PrintRopeIn ]] ]],
WriteRope,
ReadRope ];
drShiftOut:
PUBLIC
ATOM ← CoreIO.RegisterProperty[
CoreProperties.RegisterProperty[ $DShiftOut, CoreProperties.Props[
[CoreProperties.propPrint, NEW[CoreProperties.PropPrintProc ← PrintRopeOut]]]],
WriteRope,
ReadRope ];
WriteRope: CoreIO.PropWriteProc =
{rope: ROPE ← NARROW[value]; CoreIO.WriteRope[h, rope]};
ReadRope: CoreIO.PropReadProc = {rope: ROPE ← CoreIO.ReadRope[h]; RETURN[ rope ]};
PrintRopeIn: CoreProperties.PropPrintProc =
{rope: ROPE ← NARROW[val]; to.PutF["DShiftIn: %g", IO.rope[rope]]};
PrintRopeOut: CoreProperties.PropPrintProc =
{rope: ROPE ← NARROW[val]; to.PutF["DShiftOut: %g", IO.rope[rope]]};
Signal: SIGNAL = CODE;
END.