-- RTStorageOps.Mesa
-- Various goodies for system-internal or temporary purposes.
-- This interface is volatile.
-- last edited May 20, 1982 1:56 pm by Paul Rovner

DIRECTORY
  RTBasic USING[Pointer, Type];

RTStorageOps: DEFINITIONS
= BEGIN OPEN RTBasic;

-- PROCs
    -- For reference counting
  AssignRef: PROC[refNew: REF ANY, ptrRef: Pointer];
  AssignComposite: PROC[rhs, lhs: Pointer, type: Type, nwords: CARDINAL];

        -- The following procedures are used for initializing new objects
  AssignRefNew: PROC[refNew: REF ANY, ptrRef: Pointer];
  AssignCompositeNew: PROC[rhs, lhs: Pointer, type: Type, nwords: CARDINAL];

  FreeCollectibleObject: PROC[refObj: REF ANY];  -- nilifies REFs within

    -- For clever clients
  NewObject: PROC[type: Type, size: CARDINAL, zone: ZONE ← NIL]
        RETURNS[REF ANY];  -- CLEARED

  NewCollectibleSubspace: PROC[nPages: CARDINAL, type: Type, zone: ZONE ← NIL]
        RETURNS[REF ANY];
      -- The result will point to the beginning of a subspace (a page boundary) 
      -- zone must be a prefixed ZONE
      -- type must not be RC
      -- Pages will all be from the same space

  ValidateRef: PROC [ref: REF ANY];
      -- raises InvalidRef if ref does not point to the top of a valid object,
      -- else returns.

  DisableReferenceCounting: PROC;  -- TandS will try next time around

-- ERRORs
  OutOfOverflowTable:  ERROR;
  NotImplemented: ERROR[msg: STRING];
  InvalidRef: ERROR[ref: REF ANY];

END.