-- DebugUsefulDefs.mesa  last edit, Bruce  June 3, 1980  6:31 PM
-- Copyright Xerox Corporation 1979, 1980

DIRECTORY
  ControlDefs USING [GlobalFrameHandle];

DebugUsefulDefs: DEFINITIONS =
  BEGIN

  GFHandle: TYPE = ControlDefs.GlobalFrameHandle;

  -- READing and WRITEing

  LongREAD: PROC [loc: LONG POINTER] RETURNS [val: UNSPECIFIED];
  LongWRITE: PROC [loc: LONG POINTER, val: UNSPECIFIED];
  LongCopyREAD: PROC [from: LONG POINTER, nwords: CARDINAL, to: LONG POINTER];
  LongCopyWRITE: PROC [from: LONG POINTER, nwords: CARDINAL, to: LONG POINTER];

  ShortREAD: PROC [loc: POINTER] RETURNS [val: UNSPECIFIED] = INLINE
    BEGIN RETURN[LongREAD[Lengthen[loc]]] END;

  ShortWRITE: PROC [loc: POINTER, val: UNSPECIFIED] = INLINE
    BEGIN LongWRITE[Lengthen[loc], val] END;

  ShortCopyREAD: PROC [from: POINTER, nwords: CARDINAL, to: POINTER] = INLINE
    BEGIN LongCopyREAD[Lengthen[from], nwords, to] END;

  ShortCopyWRITE: PROC [from: POINTER, nwords: CARDINAL, to: POINTER] = INLINE
    BEGIN LongCopyWRITE[from, nwords, Lengthen[to]] END;

  Lengthen: PROC [POINTER] RETURNS [LONG POINTER];

  -- Global frames

  Enumerate: PROC [proc: PROC [GFHandle] RETURNS [BOOLEAN]]
    RETURNS [gf: GFHandle];
  Name: PROC [name: STRING, gf: GFHandle ← NIL];
  Frame: PROC [name: STRING ← NIL] RETURNS [GFHandle];

  -- Debug Window

  window: READONLY POINTER;
  fileSW: READONLY POINTER;

  -- Interpreter

  Interpreter: PROC [exp: STRING];
  StringExpToNum: PROC [exp: STRING, radix: CARDINAL] RETURNS [UNSPECIFIED];
  StringExpToLNum: PROC [exp: STRING, radix: CARDINAL] RETURNS [LONG UNSPECIFIED];
  StringExpToOctal: PROC [STRING] RETURNS [CARDINAL];
  StringExpToLOctal: PROC [STRING] RETURNS [LONG CARDINAL];
  StringExpToDecimal: PROC [STRING] RETURNS [INTEGER];
  StringExpToLDecimal: PROC [STRING] RETURNS [LONG INTEGER];

  -- Signals

  InvalidAddress: ERROR [address: LONG POINTER];
  InvalidNumber: SIGNAL [p: POINTER];
  UserAborted: SIGNAL;

  END.