DIRECTORY Convert USING [CardFromRope], Process USING [Detach], RavenCodes USING [PrinterCommand], RavenConsole USING [Character, DisplayCode, KeyPadCode], RavenControl USING [ConsoleKey, SendEngineCommand, WaitConsoleKey, WaitEngineStatus], RefText USING [AppendChar, TrustTextAsRope]; RavenConsoleImpl: CEDAR PROGRAM IMPORTS Convert, Process, RavenControl, RefText EXPORTS RavenConsole = BEGIN DisplayCommand: TYPE = RavenCodes.PrinterCommand[displayF..displayBlank]; displayBuffer: ARRAY BOOLEAN OF DisplayCommand _ [displayBlank, displayBlank]; displayIndex: BOOLEAN _ FIRST[BOOLEAN]; -- corresponds to left and right display character positions echoingKeyPad: BOOLEAN _ FALSE; BlankDisplay: PUBLIC PROCEDURE = BEGIN IF NOT echoingKeyPad THEN BEGIN RavenControl.SendEngineCommand[displayBuffer[displayIndex] _ displayBlank]; displayIndex _ NOT displayIndex; END; END; UpdateDisplay: PUBLIC PROCEDURE [code: RavenConsole.DisplayCode] = BEGIN IF NOT echoingKeyPad THEN BEGIN RavenControl.SendEngineCommand[ displayBuffer[displayIndex] _ IF code.left = letterF THEN displayF ELSE LOOPHOLE[ORD[code.left] + ORD[RavenCodes.PrinterCommand[display0]]]]; displayIndex _ NOT displayIndex; RavenControl.SendEngineCommand[ displayBuffer[displayIndex] _ IF code.right = letterF THEN displayF ELSE LOOPHOLE[ORD[code.right] + ORD[RavenCodes.PrinterCommand[display0]]]]; displayIndex _ NOT displayIndex; END; END; WaitKeyPadCode: PUBLIC PROCEDURE RETURNS [code: RavenConsole.KeyPadCode] = BEGIN key: RavenControl.ConsoleKey; string: REF TEXT _ NEW[TEXT[5]]; char: CHAR; DO key _ RavenControl.WaitConsoleKey[]; -- pops console queue, waiting till non-empty SELECT key FROM IN [key0..key9] => BEGIN IF NOT echoingKeyPad THEN BEGIN -- display blank RavenControl.SendEngineCommand[displayBuffer[displayIndex] _ displayBlank]; displayIndex _ NOT displayIndex; echoingKeyPad _ TRUE; END; RavenControl.SendEngineCommand[displayBuffer[displayIndex] _ LOOPHOLE[key]]; displayIndex _ NOT displayIndex; IF string.length # string.maxLength THEN -- append numeral to string char _ '0 + ORD[key] - ORD[RavenControl.ConsoleKey[key0]]; string _ RefText.AppendChar[string, char]; END; keyClear => BEGIN -- blank display and return echoingKeyPad _ FALSE; RavenControl.SendEngineCommand[displayBuffer[displayIndex] _ displayBlank]; displayIndex _ NOT displayIndex; RETURN[code: [clear]]; END; keyTest => BEGIN -- convert numerals entered to number and return echoingKeyPad _ FALSE; IF string.length # FIRST[CARDINAL] THEN RETURN[code: [test, Convert.CardFromRope[RefText.TrustTextAsRope[string]]]] ELSE RETURN[code: [test]]; END; ENDCASE; ENDLOOP; END; RestoreDisplay: PUBLIC PROCEDURE = BEGIN RavenControl.SendEngineCommand[displayBuffer[displayIndex]]; displayIndex _ NOT displayIndex; RavenControl.SendEngineCommand[displayBuffer[displayIndex]]; displayIndex _ NOT displayIndex; END; Initialize: PROCEDURE = TRUSTED {Process.Detach[FORK WatchEngineStatus]}; WatchEngineStatus: PROCEDURE = BEGIN DO IF RavenControl.WaitEngineStatus[] IN [tonerLow..doorOpen] THEN DO -- loop until status is okay IF RavenControl.WaitEngineStatus[] = okay THEN {RestoreDisplay[]; EXIT}; ENDLOOP; ENDLOOP; END; Initialize[]; END. LOG When / Who / What 1981/Claude Pany/Created. 1-Oct-82 17:55:11 - Trowell - added documentation 9-Apr-85 23:20:37 - Strickberger - Update for Raven engine driver redesign. Add copyright. 19-Jul-85 0:09:18 - Strickberger - Update for Euclid. RavenConsoleImpl.mesa Copyright (C) Xerox Corporation 1981, 1982, 1983, 1984, 1985, 1986. All rights reserved. Last edited by Strickberger 19-Jul-85 0:09:18 Tim Diebert: October 1, 1986 12:22:22 pm PDT TYPEs: Variables: commands used to display the character in each position RavenConsole PUBLIC PROCEDUREs: blank one of the positions and set displayIndex to the other position called in MarkerControlImpl by Start and Queue display code.left in position for displayIndex, and code.right in ~displayIndex called in MarkerControl by RavenStatusChangeWatcher done separately because F in ConsoleCharacter # zero + 15 (zero = 30H, F = 2FH) display numeral redisplay console characters which were up before error PRIVATE PROCEDUREs: wait for a new status and if status indicates intervention is needed, waits till another status indicates things are ok something needs to be done externally MAINLINE CODE: ΚΧ˜codešœ™KšœY™YKšœ.™.K™,—K˜šΟk ˜ Kšœœ˜Kšœœ ˜Kšœ œ˜"Kšœ œ&˜8Kšœ œC˜UKšœœ˜,—K˜šΟnœœ˜Kšœ)œ˜L—˜Kšœ™—˜Kšœœ5˜I—˜Kšœ ™ —˜Kšœœœœ/˜NKšœ7™7KšœœœœΟc<˜eKšœœœ˜—˜Kšœ™—˜šž œœ œ˜&KšœE™EKšœ.™.šœœ˜Kš˜K˜KKšœœ˜ Kšœ˜—Kšœ˜——˜šž œœ œ#˜HKšœO™OKšœ3™3šœœ ˜˜K˜šœ˜Kšœ ˜ KšœO™OKšœœœœ(˜J——Kšœœ˜ ˜K˜šœ˜Kšœ ˜ Kšœœœœ(˜K——Kšœœ˜ Kšœ˜—Kšœ˜——˜š žœœ œœ"˜PK˜Kš œœœœœ œ˜,K˜š˜Kšœ&Ÿ-˜Sšœ˜šœ˜šœœ œŸ˜1K˜KKšœœ˜ Kšœœ˜Kšœ˜—Kšœ™Kšœ=œ˜LKšœœ˜ šœ"œŸ˜EKšœ œœ ˜:Kšœ*˜*—Kšœ˜—šœ œŸ˜.Kšœœ˜K˜KKšœœ˜ Kšœ˜Kšœ˜—šœ œŸ0˜BKšœœ˜šœœœ˜"KšœœE˜PKšœœ˜—Kšœ˜—Kšœ˜—Kšœ˜—Kšœ˜——K˜˜šžœœ œ˜(Kšœ7™7K˜