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
Last Edited by: Christian Jacobi, March 27, 1985 3:49:50 pm PST
DIRECTORY
IO, IODefs, MessageWindow, Process, Rope, TerminalIO;
CIFIODefsImpl: CEDAR MONITOR
IMPORTS IO, MessageWindow, Process, Rope, TerminalIO
EXPORTS IODefs =
BEGIN
WriteString: PUBLIC PROC [s: Rope.ROPE] =
{TerminalIO.PutRope[s]};
WriteLine: PUBLIC PROC [s: Rope.ROPE] =
{TerminalIO.PutRopes[s, "\n"]};
WriteChar: PUBLIC PROC [c: CHARACTER] =
{TerminalIO.PutRope[Rope.FromChar[c]]};
WriteDecimal: PUBLIC PROC [n: INT] =
{TerminalIO.PutF1["%g", [integer[n]]]};
WriteReal: PUBLIC PROC [r: REAL] =
{TerminalIO.PutRope[IO.PutR[IO.real[r]]]};
PrintTime: PUBLIC PROC [msg: Rope.ROPENIL] =
{TerminalIO.PutRope[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.