-- PDTTYImpl.mesa -- Copyright (C) 1984, Xerox Corporation. All rights reserved. -- Michael Plass, September 20, 1984 10:02:29 am PDT -- Tim Diebert, 5-Sep-86 16:31:53 DIRECTORY PDQueue, PDUser, Process, Stream, TTY; PDTTYImpl: PROGRAM IMPORTS PDQueue, PDUser, Process, Stream, TTY = BEGIN ttyStream: Stream.Handle ← NIL; WriteLine: PROC [line: LONG STRING] = { ttyStream.PutString[line]; ttyStream.PutChar['\n]; }; KeyWatcher: PROC = { DO [] ← ttyStream.GetChar[]; [] ← PDQueue.SetLogState[FALSE]; PDUser.TalkWithUser[ttyStream, TRUE]; [] ← PDQueue.SetLogState[TRUE]; ENDLOOP; }; Init: PROCEDURE = BEGIN name: STRING = "Peach.log"L; ttyImpl, backing: Stream.Handle; [ttyImpl, backing] ← TTY.CreateTTYInstance[name, NIL, TTY.nullHandle]; ttyStream ← ttyImpl; PDQueue.RegisterTTY[WriteLine]; [] ← PDQueue.SetLogState[TRUE]; Process.Detach[FORK KeyWatcher[]]; END; Init[]; END.