-- file PackageSymbols.Mesa
-- last modified by Sweet,  1-Nov-81 22:34:54
-- last modified by Satterthwaite, August 27, 1980  9:40 AM

DIRECTORY
  PrincOps: TYPE USING [BytePC, EPRange, MaxNGfi],
  Symbols: TYPE USING [HTIndex],
  SymbolSegment: TYPE USING [constType],
  Table: TYPE USING [Limit, Selector];

PackageSymbols: DEFINITIONS =
  BEGIN

  MaxEntries: CARDINAL = PrincOps.EPRange*PrincOps.MaxNGfi;

 -- constant table declarations

  WordIndex: TYPE = CARDINAL;
  
  PCSeqBody: TYPE = RECORD[
    SEQUENCE length: CARDINAL OF PrincOps.BytePC];
  PCSeq: TYPE = LONG POINTER TO PCSeqBody;
  
  JIData: TYPE = RECORD [pc: PrincOps.BytePC, tableSize: CARDINAL];
  JISeqBody: TYPE = RECORD [
    SEQUENCE length: CARDINAL OF JIData];
  JISeq: TYPE = LONG POINTER TO JISeqBody;

  ConstRecord: TYPE = RECORD [
    offset: WordIndex,
    length: CARDINAL];

  ConstIndex: TYPE = CARDINAL [0..Table.Limit/SIZE[ConstRecord]);

  constType: Table.Selector = SymbolSegment.constType;
  
  -- symbol table region contains:
  --   count of ConstRecords
  --     ConstRecords
  --  PCSeqBody for LCO's
  --  PCSeqBody for LIO's
  --  JISeqBody for JIB's or JIW's  (one table serves both)

 -- body data for outer callable bodies

  OuterPackRecord: TYPE = MACHINE DEPENDENT RECORD [
    hti: Symbols.HTIndex,
    placed, resident: BOOLEAN ← FALSE,
    needsFixup: BOOLEAN,
    length: CARDINAL,
    firstSon: IPIndex,
    entryIndex: [0..MaxEntries]];

  OPIndex: TYPE = CARDINAL [0..MaxEntries+2];
  OPMain: OPIndex = 0;
  OPCatch: OPIndex = MaxEntries;
  OPEntry: OPIndex = MaxEntries+1;
  OPNull: OPIndex = LAST[OPIndex]; 

 -- body data for inner callable bodies

  InnerPackRecord: TYPE = RECORD [
    length: CARDINAL,
    lastSon, needsFixup: BOOLEAN,
    entryIndex: [0..MaxEntries)];

  IPIndex: TYPE = CARDINAL [0..MaxEntries]; -- waste a bit to get a null
  IPNull: IPIndex = LAST[IPIndex]; 

  END.