-- Copyright (C) 1983 by Xerox Corporation. All rights reserved. -- OscarLF.mesa, HGM, 18-Apr-83 14:17:16 DIRECTORY Ascii USING [BS, CR], Inline USING [BITNOT], OthelloDefs USING [Cursor], OthelloForgot USING [], TTY USING [ BlinkDisplay, Create, GetChar, Handle, PutChar, ResetUserAbort, UserAbort], UserTerminal USING [ CursorArray, GetCursorPattern, SetCursorPattern]; OscarLF: PROGRAM IMPORTS Inline, TTY, UserTerminal EXPORTS OthelloDefs, OthelloForgot = BEGIN -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- TTY Interface Stuff -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ttyHandle: TTY.Handle = TTY.Create["Othello"L]; BlinkDisplay: PUBLIC PROC = {TTY.BlinkDisplay[ttyHandle]}; CheckUserAbort: PUBLIC PROC = { IF TTY.UserAbort[ttyHandle] THEN {ResetAbort[]; ERROR ABORTED}}; EraseTTYChar: PUBLIC PROC [c: CHARACTER] = { SELECT c FROM IN [' ..'~] => NULL; Ascii.CR => RETURN; ENDCASE => EraseTTYChar[' ]; WriteChar[Ascii.BS]; WriteChar[' ]; WriteChar[Ascii.BS]}; ReadChar: PUBLIC PROC RETURNS [c: CHARACTER] = { RETURN[TTY.GetChar[ttyHandle]]}; SetCursor: PUBLIC PROC [c: OthelloDefs.Cursor] = { cursor: ARRAY OthelloDefs.Cursor OF UserTerminal.CursorArray = [ pointer: [ 100000B, 140000B, 160000B, 170000B, 174000B, 176000B, 177000B, 170000B, 154000B, 114000B, 006000B, 006000B, 003000B, 003000B, 001400B, 001400B], ftp: [ 000177B, 076077B, 040037B, 040017B, 070007B, 043703B, 040401B, 040400B, 000400B, 100436B, 140421B, 160421B, 170036B, 174020B, 176020B, 177020B]]; UserTerminal.SetCursorPattern[cursor[c]]}; FlipCursor: PUBLIC PROC = { c: UserTerminal.CursorArray ← UserTerminal.GetCursorPattern[]; FOR i: CARDINAL IN [0..LENGTH[c]) DO c[i] ← Inline.BITNOT[c[i]] ENDLOOP; UserTerminal.SetCursorPattern[c] }; NewLine: PUBLIC PROC = {WriteChar[Ascii.CR]}; ResetAbort: PUBLIC PROC = {TTY.ResetUserAbort[ttyHandle]}; WriteChar: PUBLIC PROC [c: CHARACTER] = {TTY.PutChar[ttyHandle, c]}; WriteLine: PUBLIC PROC [s: LONG STRING] = {WriteString[s]; NewLine[]}; WriteString: PUBLIC PROC [s: LONG STRING] = { i: CARDINAL; IF s # NIL THEN FOR i ← 0, i + 1 WHILE i < s.length DO IF s[i] = '\\ AND s[i + 1] = 'r THEN { NewLine[]; i ← i + 1} ELSE WriteChar[s[i]]; ENDLOOP}; END..