-- KeyPrivate.Mesa  Edited by Sandman on June 30, 1980  4:57 PM
-- Copyright  Xerox Corporation 1979, 1980

DIRECTORY
  AltoDisplay USING [Coordinate],
  KeyDefs USING [KeyArray, KeyItem],
  StreamDefs USING [KeyboardHandle, StreamHandle, StreamObject];

KeyPrivate: DEFINITIONS =
  BEGIN OPEN KeyDefs, StreamDefs;

  monitor: MONITORLOCK;
  wakeup: CONDITION;
  charactersAvailable: CONDITION;
  halt: BOOLEAN;

  ks: KeyboardHandle;

  KeyTable: POINTER TO ARRAY [0..80) OF KeyItem;

  -- fixed addresses for keyboard and mouse

  keys: POINTER TO KeyArray;

  mouse: POINTER TO AltoDisplay.Coordinate;
  cursor: POINTER TO AltoDisplay.Coordinate;

  Xmax: CARDINAL = 608;
  Ymax: CARDINAL = 808;

  oldState, newState: POINTER TO KeyArray;

  ProcessKeyboard: PROCEDURE;

  ReadChar: PROCEDURE [stream: StreamHandle] RETURNS [char: UNSPECIFIED];
  InputBufferEmpty: PROCEDURE [stream: StreamHandle] RETURNS [empty: BOOLEAN];

  KeyboardData: TYPE = RECORD [
    new, old: KeyArray,
    stream: Keyboard StreamObject,
    process: PROCESS,
    table: ARRAY [0..80) OF KeyItem];

  END.