<> <> <> <> <> 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.ROPE _ NIL] = {TerminalIO.PutRope[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.