-- Runs.Mesa
-- last edited 27-Mar-81 11:01:34 by Paul Rovner

Runs: DEFINITIONS = BEGIN

-- TYPES

RunValue: TYPE = CARDINAL;

RunRec: TYPE = RECORD
  [
  rnNext: Run,
  iFrom, iTo: RunValue	-- iTo not included
  ];
Run: TYPE = LONG POINTER TO RunRec;  -- "rn"

-- PROCEDURES

SetAllocationProcs: PROCEDURE[allocProc: PROCEDURE RETURNS[Run], freeProc: PROCEDURE[Run]];

AddInterval: PROCEDURE[pRn: LONG POINTER TO Run, iFrom, n: RunValue];
  OverlappingInterval: SIGNAL;

DeleteInterval: PROCEDURE[pRn: LONG POINTER TO Run, iFrom, n: RunValue];
  MissingInterval: ERROR;

FindInterval: PROCEDURE[pRn: LONG POINTER TO Run, n: RunValue] RETURNS[iFrom: RunValue];
      -- deletes interval if found
  CantFindInterval: ERROR;

MapIntervals: PROCEDURE[pRn: LONG POINTER TO Run, proc: PROCEDURE[iFrom, n: RunValue]];


END.