
    <<SymbolSegment.Mesa>>
        <<Copyright © 1985 by Xerox Corporation.  All rights reserved.>>
        <<Satterthwaite, June 10, 1986 3:03:34 pm PDT>>
    <<Russ Atkinson (RRA) January 31, 1985 1:06:12 pm PST>>

    DIRECTORY
        Literals USING [ltTag, ltType, stTag, stType],
        Symbols USING [ISEIndex, CTXIndex, ExtensionType, seTag, seType, htTag, htType, ssType, ctxType, mdType, bodyType],
        Table USING [Base, IndexRep, Selector],
        TimeStamp USING [Stamp],
        Tree USING [Link, treeTag, treeType];

    SymbolSegment: DEFINITIONS = {

        VersionID: CARDINAL = 08140;

        Base: TYPE = Table.Base;

    <<symbol table extensions>>

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

        ExtIndex: TYPE = Base RELATIVE LONG POINTER TO ExtRecord;
        ExtFirst: ExtIndex = LOOPHOLE[Table.IndexRep[tag: 0, highBits:0, lowBits:0]];
        ExtNull: ExtIndex = LOOPHOLE[Table.IndexRep[tag: 0]];


    <<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;
        atType: Table.Selector = 10;        -- atom and typeId table
        constType: Table.Selector = 11;

        Tables: TYPE = Table.Selector[treeType..constType];

        biases: ARRAY Tables OF CARD = [
            LOOPHOLE[Table.IndexRep[Tree.treeTag, 0, 0]],    -- 0    treeType
            LOOPHOLE[Table.IndexRep[Symbols.seTag, 0, 0]],    -- 1    seType
            LOOPHOLE[Table.IndexRep[Symbols.htTag, 0, 0]],    -- 2    htType
            LOOPHOLE[Table.IndexRep[0, 0, 0]],        -- 3    ssType
            LOOPHOLE[Table.IndexRep[0, 0, 0]],        -- 4    ctxType
            LOOPHOLE[Table.IndexRep[0, 0, 0]],        -- 5    mdType
            LOOPHOLE[Table.IndexRep[0, 0, 0]],        -- 6    bodyType
            LOOPHOLE[Table.IndexRep[Literals.ltTag, 0, 0]],    -- 7    ltType
            LOOPHOLE[Table.IndexRep[Literals.stTag, 0, 0]],    -- 8    stType
            LOOPHOLE[Table.IndexRep[0, 0, 0]],        -- 9    extType
            LOOPHOLE[Table.IndexRep[0, 0, 0]],        -- 10    atType
            LOOPHOLE[Table.IndexRep[0, 0, 0]]];        -- 11    constType


    <<symbol segment headers>>

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

        STHeader: TYPE = RECORD [
            versionIdent: CARDINAL,
            version: TimeStamp.Stamp,
            creator: TimeStamp.Stamp,
            sourceVersion: TimeStamp.Stamp,
            definitionsFile: BOOL,
            extended: BOOL,
            directoryCtx, importCtx, outerCtx: Symbols.CTXIndex,
            hvBlock: BlockDescriptor,
            htBlock: BlockDescriptor,
            ssBlock: BlockDescriptor,
            outerPackBlock: BlockDescriptor,
            innerPackBlock: BlockDescriptor,
            constBlock: BlockDescriptor,
            seBlock: BlockDescriptor,
            ctxBlock: BlockDescriptor,
            mdBlock: BlockDescriptor,
            bodyBlock: BlockDescriptor,
            extBlock: BlockDescriptor,
            treeBlock: BlockDescriptor,
            litBlock: BlockDescriptor,
            sLitBlock: BlockDescriptor,
            epMapBlock: BlockDescriptor,
            spareBlock: BlockDescriptor,
            fgRelPgBase: CARD,
            fgPgCount: [0..256]];

    <<fine grain table header>>

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

    <<fine grain table declarations>>

        SourceStep: CARDINAL = 0FFh;
        ObjectStep: CARDINAL = 07Fh;
        Stride: CARDINAL = 03FFFh;

        FGTEntry: TYPE = RECORD [SELECT tag: * FROM
            normal => [deltaObject: [0..ObjectStep], deltaSource: [0..SourceStep]],
            step => [which: {source, object}, delta: [0..Stride]]
            ENDCASE];

        }.

