-- file SymbolSegment.Mesa
-- last modified by Satterthwaite, February 12, 1979  5:03 PM

DIRECTORY
  AltoDefs: FROM "altodefs" USING [PageCount],
  BcdDefs: FROM "bcddefs" USING [VersionStamp],
  Literals: FROM "literals" USING [ltType, stType],
  Symbols: FROM "symbols" USING [
    ISEIndex, CTXIndex, ExtensionType,
    seType, htType, ssType, ctxType, mdType, bodyType],
  Table: FROM "table" USING [Base, Selector, Limit],
  Tree: FROM "tree" USING [Link, treeType];

SymbolSegment: DEFINITIONS =
  BEGIN

  VersionID: CARDINAL = 02129;

 -- symbol table extensions

  ExtRecord: TYPE = RECORD [
    type: Symbols.ExtensionType[value..default],
    sei: Symbols.ISEIndex,	-- the key
    tree: Tree.Link];

  ExtIndex: TYPE = Table.Base RELATIVE POINTER [0..Table.Limit) TO ExtRecord;

  ExtNull: ExtIndex = LAST[ExtIndex];

 -- allocation codes

  treeType: Table.Selector = Tree.treeType;
  seType: Table.Selector = Symbols.seType;
  htType: Table.Selector = Symbols.htType;
  ssType: Table.Selector = Symbols.ssType;
  ctxType: Table.Selector = Symbols.ctxType;
  mdType: Table.Selector = Symbols.mdType;
  bodyType: Table.Selector = Symbols.bodyType;
  ltType: Table.Selector = Literals.ltType;
  stType: Table.Selector = Literals.stType;
  extType: Table.Selector = 9;
  
  Tables: TYPE = Table.Selector [treeType .. extType];

 -- symbol segment headers

  WordOffset: TYPE = CARDINAL;
  BlockDescriptor: TYPE = RECORD [offset: WordOffset, size: CARDINAL];

  STHeader: TYPE = RECORD [
    versionIdent: CARDINAL,
    version: BcdDefs.VersionStamp,
    creator: BcdDefs.VersionStamp,
    sourceVersion: BcdDefs.VersionStamp,
    definitionsFile: BOOLEAN,
    directoryCtx, importCtx, outerCtx: Symbols.CTXIndex,
    hvBlock: BlockDescriptor,
    htBlock: BlockDescriptor,
    ssBlock: BlockDescriptor,
    seBlock: BlockDescriptor,
    ctxBlock: BlockDescriptor,
    mdBlock: BlockDescriptor,
    bodyBlock: BlockDescriptor,
    extBlock: BlockDescriptor,
    treeBlock: BlockDescriptor,
    litBlock: BlockDescriptor,
    sLitBlock: BlockDescriptor,
    constBlock: BlockDescriptor,
    fgRelPgBase: CARDINAL,
    fgPgCount: AltoDefs.PageCount];

 -- fine grain table header

  FGHeader: TYPE = RECORD [
    offset: WordOffset,
    length: CARDINAL,
    sourceFile: StringBody -- text follows --];

 -- fine grain table declarations

  ByteIndex: TYPE = CARDINAL;

  FGTEntry: TYPE =  RECORD [fIndex, cIndex: ByteIndex];

  END.