CoreIOIFUPropsImpl.mesa
Last edited by Curry September 25, 1986 9:56:25 am PDT
Don Curry October 24, 1986 5:48:44 pm PDT
DIRECTORY Core, CoreBlock, CoreIO, CoreIOIFUProps, CoreProperties, IO;
CoreIOIFUPropsImpl: CEDAR PROGRAM
IMPORTS CoreBlock, CoreIO, CoreProperties, IO
EXPORTS CoreIOIFUProps =
BEGIN
ROPE: TYPE = Core.ROPE;
Sides: TYPE = CoreBlock.Sides;
sides: PUBLIC ATOM ← CoreIO.RegisterProperty[
CoreProperties.RegisterProperty[ $CoreBlockSides, CoreProperties.Props[
[CoreProperties.propPrint, NEW[CoreProperties.PropPrintProc ← PrintSides ]] ] ],
WriteSides,
ReadSides ];
WriteSides: CoreIO.PropWriteProc = {
refSides: REF Sides  ← NARROW[value];
card:  CARDINAL ← CoreBlock.SidesToWord[refSides^];
IO.PutF[h.stream, "%g ", IO.card[card]]};
ReadSides: CoreIO.PropReadProc = {
card: CARDINAL ← IO.GetCard[h.stream];
max: CARDINAL ← CoreBlock.SidesToWord[all];
IF card > max THEN Signal[];
RETURN[ NEW[Sides ← CoreBlock.SidesFmWord[card]] ]};
PrintSides: CoreProperties.PropPrintProc = {
refSides: REF Sides ← NARROW[val];
CoreOps.PrintIndent[indent, to];
to.PutRope[" Sides: "];
IF refSides^=all     THEN {to.PutRope[" All"];  RETURN};
IF refSides^=none    THEN {to.PutRope[" None"]; RETURN};
IF CoreBlock.OnSide[bottom, refSides^] THEN to.PutRope[" Bottom"];
IF CoreBlock.OnSide[right,  refSides^] THEN to.PutRope[" Right"];
IF CoreBlock.OnSide[top,  refSides^] THEN to.PutRope[" Top"];
IF CoreBlock.OnSide[left,  refSides^] THEN to.PutRope[" Left"]};
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.