DIRECTORY
IO, IODefs, MessageWindow, Process, Rope, TerminalIO;
CIFIODefsImpl:
CEDAR
MONITOR
IMPORTS IO, MessageWindow, Process, TerminalIO
EXPORTS IODefs =
BEGIN
WriteString:
PUBLIC
PROC [s: Rope.
ROPE] =
{TerminalIO.WriteRope[s]};
WriteLine:
PUBLIC
PROC [s: Rope.
ROPE] =
{TerminalIO.WriteRope[s]; TerminalIO.WriteLn[]};
WriteChar:
PUBLIC
PROC [c:
CHARACTER] =
{TerminalIO.WriteChar[c]};
WriteDecimal:
PUBLIC
PROC [n:
INT] =
{TerminalIO.WriteInt[n]};
WriteReal:
PUBLIC
PROC [r:
REAL] =
{TerminalIO.WriteRope[IO.PutR[IO.real[r]]]};
PrintTime:
PUBLIC
PROC [msg: Rope.
ROPE ←
NIL] =
{TerminalIO.WriteRope[IO.PutFR["%g %g\n", IO.rope[msg], IO.time[]]]};
PostIt:
PUBLIC
ENTRY
PROC [s: Rope.
ROPE] = {postee ← s};
postee: Rope.ROPE ← NIL;
posteeReady: CONDITION;
Poster:
ENTRY
PROC =
BEGIN
ENABLE UNWIND => NULL;
lastPostee: Rope.ROPE ← NIL;
DO
IF postee #
NIL
OR lastPostee #
NIL
THEN
BEGIN
MessageWindow.Append[message: postee, clearFirst: TRUE];
lastPostee ← postee;
postee ← NIL;
END;
WAIT posteeReady;
ENDLOOP;
END;
TRUSTED
BEGIN
Process.InitializeCondition[condition: @posteeReady, ticks: Process.SecondsToTicks[2]];
Process.Detach[FORK Poster[]];
END;
END.