
    <<Literals.mesa>>
        <<Copyright © 1985 by Xerox Corporation.  All rights reserved.>>
        <<Satterthwaite, June 25, 1986 9:34:11 am PDT>>
    <<Russ Atkinson (RRA) January 31, 1985 1:02:07 pm PST>>

    DIRECTORY
        Symbols: TYPE USING [Type],
        Table: TYPE USING [Base, Finger, IndexRep, Selector, Tag],
        Target: TYPE MachineParms USING [bitsPerByte];

    Literals: DEFINITIONS = {

        Base: TYPE = Table.Base;
        Finger: TYPE = Table.Finger;

    <<tag codes    (0-2 reserved)>>

        ltTag: Table.Tag = 3;
        stTag: Table.Tag = 4;

    <<literal constants>>

        Byte: TYPE = [0..256);    -- limited to 8-bit bytes (source and target) for now
            byteCheck: BOOL[TRUE .. Target.bitsPerByte=8] = TRUE;
        ByteSequence: TYPE = PACKED ARRAY [0..0) OF Byte;

        LTRecord: TYPE = RECORD[
            link: LTIndex,
            datum: SELECT kind: * FROM
                short => [value: CARD],    -- numeric unsigned, but may represent 2's complement signed
                long => [
                    codeIndex: [0..CARDINAL.LAST/2],
                    length: CARDINAL,
                    value: ByteSequence]
                ENDCASE];

        LTIndex: TYPE = Base RELATIVE LONG POINTER TO LTRecord;
            LTFirst: LTIndex = LOOPHOLE[Table.IndexRep[tag: ltTag, highBits:0, lowBits:0]];
            LTLast: LTIndex = LOOPHOLE[Table.IndexRep[tag: ltTag]];
            LTNull: LTIndex = LTLast;

        LTId: TYPE = RECORD [baseP: Finger, index: LTIndex];

        LitDescriptor: TYPE = RECORD[
            offset: Base RELATIVE LONG POINTER TO ByteSequence,
            length: CARDINAL];


    <<string literals>>

        STRecord: TYPE = RECORD[
            SELECT kind: * FROM
                master => [
                    link: MSTIndex,
                    local: BOOL,
                    info: CARDINAL,
                    codeIndex: CARDINAL,
                    string: StringBody],
                    <<the actual string text follows here>>
                copy => [
                    mark: BOOL,
                    link: MSTIndex],
                heap => [
                    link: MSTIndex,
                    type: Symbols.Type,
                    info: CARDINAL]
                ENDCASE];

        STIndex: TYPE = Base RELATIVE LONG POINTER TO STRecord;
            STFirst: STIndex = LOOPHOLE[Table.IndexRep[tag: stTag, highBits:0, lowBits:0]];
            STLast: STIndex = LOOPHOLE[Table.IndexRep[tag: stTag]];
            STNull: STIndex = STLast;
        MSTIndex: TYPE = Base RELATIVE LONG POINTER TO STRecord.master;

    <<table allocation codes>>

        ltType: Table.Selector = 7;
        stType: Table.Selector = 8;

        }.

