CIFIODefsImpl.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
by Jim Gasbarro March 12, 1985 12:38:00 pm PST
Last Edited by: Gasbarro, March 27, 1985 3:49:50 pm PST
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.ROPENIL] =
{TerminalIO.WriteRope[IO.PutFR["%g %g\n", IO.rope[msg], IO.time[]]]};
PostIt: PUBLIC ENTRY PROC [s: Rope.ROPE] = {postee ← s};
postee: Rope.ROPENIL;
posteeReady: CONDITION;
Poster: ENTRY PROC =
BEGIN
ENABLE UNWIND => NULL;
lastPostee: Rope.ROPENIL;
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.