-- PcOps.mesa  last edit, Bruce  July 15, 1980  10:37 AM

DIRECTORY
  MachineDefs USING [GFHandle, PageSize],
  Pc USING [BytePC, EVRange],
  Symbols USING [BTIndex, CBTIndex, MDIndex],
  SymbolTable USING [Base];

PcOps: DEFINITIONS =
  BEGIN OPEN MachineDefs, Symbols;

  BytePC: TYPE = Pc.BytePC;

  CacheLimit: CARDINAL = (MachineDefs.PageSize/SIZE[ItemObject])*SIZE[ItemObject];
  CacheBase: TYPE = BASE POINTER TO UNSPECIFIED;
  ItemNull: Item = LAST[Item];
  Item: TYPE = CacheBase RELATIVE POINTER [0..256) TO ItemObject;

  ItemObject: TYPE = RECORD [
    link: Item,
    ep: Pc.EVRange,
    gf: GFHandle,
    start, end: BytePC,
    hasSons: BOOLEAN,
    inner: BOOLEAN,
    dCbti: CBTIndex,
    userCbti: CBTIndex];

  Head, Free: Item;
  cache: CacheBase;

  EpCold: PROC [pc: BytePC, gf: GFHandle] RETURNS [ep: Pc.EVRange, start: BytePC];
  EpToCBtiCold: PROC [
    ep: Pc.EVRange, gf: GFHandle, start: BytePC] RETURNS [cbti: CBTIndex];
  CacheCBtiCold: PROC [mdi: MDIndex, gf: GFHandle, cbti: CBTIndex]
    RETURNS [CBTIndex];
  ParentCbtiCold: PROC [pc: BytePC, gf: GFHandle, mdi: MDIndex] RETURNS [Item];
  ConvertCbti: PROC [lastBti: BTIndex, pc, start: BytePC, base: SymbolTable.Base]
    RETURNS [bti: BTIndex];

  FindEp: PROC [ep: Pc.EVRange, gf: GFHandle] RETURNS [Item];
  FindCbti: PROC [cbti: CBTIndex] RETURNS [i: Item];
  FindUserCbti: PROC [GFHandle, CBTIndex] RETURNS [Item];

  END.