-- file Symbols.mesa -- last modified by Satterthwaite, February 18, 1983 11:03 am DIRECTORY PrincOps: TYPE USING [EPRange, MaxFrameSize, MaxNGfi], Table: TYPE USING [Base, Selector, Limit], TimeStamp: TYPE USING [Stamp]; Symbols: DEFINITIONS = { Base: TYPE = Table.Base; Limit: NAT = Table.Limit; ByteLength: NAT = 8; WordLength: NAT = 16; -- hash table declarations Name: TYPE = [0..Limit/2); nullName: Name = Name.FIRST; HTIndex: TYPE = Name; HTNull: Name = nullName; HTRecord: TYPE = RECORD [ anyInternal, anyPublic: BOOL, link: HTIndex, ssIndex: CARDINAL]; HVIndex: TYPE = [0..71); HashVector: TYPE = ARRAY HVIndex OF HTIndex; -- semantic entry table declarations TypeClass: TYPE = { mode, basic, enumerated, record, ref, array, arraydesc, transfer, definition, union, sequence, relative, subrange, long, real, opaque, zone, any, nil}; TransferMode: TYPE = {proc, port, signal, error, process, program, none}; SERecord: TYPE = RECORD [ mark3, mark4: BOOL, body: SELECT seTag: * FROM id => [ extended: BOOL, public: BOOL, idCtx: CTXIndex, immutable, constant: BOOL, idType: Type, idInfo: UNSPECIFIED, idValue: UNSPECIFIED, hash: Name, linkSpace: BOOL, ctxLink: SELECT linkTag: * FROM terminal => [], sequential => [], linked => [link: ISEIndex] ENDCASE], cons => [ typeInfo: SELECT typeTag: TypeClass FROM mode => [], basic => [ ordered: BOOL, code: [0..16), length: CARDINAL], enumerated => [ ordered, machineDep: BOOL, unpainted: BOOL, -- un- for backward compatiblity empty: BOOL, sparse: BOOL, valueCtx: CTXIndex, nValues: CARDINAL], -- should be range: CARDINAL record => [ hints: RECORD [ comparable, assignable: BOOL, unifield, variant, privateFields: BOOL, refField, default, voidable: BOOL], length: CARDINAL, argument, monitored, machineDep: BOOL, painted: BOOL, fieldCtx: CTXIndex, linkPart: SELECT linkTag: * FROM notLinked => [], linked => [linkType: Type] ENDCASE], ref => [ counted, ordered, readOnly, list, var, basing: BOOL, refType: Type], array => [ packed: BOOL, indexType: Type, componentType: Type], arraydesc => [ var, readOnly: BOOL, describedType: Type], transfer => [ safe: BOOL, mode: TransferMode, typeIn, typeOut: CSEIndex], definition => [ nGfi: [1 .. PrincOps.MaxNGfi], named: BOOL, defCtx: CTXIndex], union => [ hints: RECORD [ equalLengths: BOOL, refField, default, voidable: BOOL], overlaid, controlled, machineDep: BOOL, caseCtx: CTXIndex, tagSei: ISEIndex], sequence => [ packed: BOOL, controlled, machineDep: BOOL, tagSei: ISEIndex, componentType: Type], relative => [ baseType: Type, offsetType: Type, resultType: Type], subrange => [ filled, empty: BOOL, rangeType: Type, origin: INTEGER, range: CARDINAL], long, real => [rangeType: Type], opaque => [ lengthKnown: BOOL, length: CARDINAL, id: ISEIndex], zone => [counted, mds: BOOL], any => [], nil => [] ENDCASE], ENDCASE]; SEIndex: TYPE = Base RELATIVE POINTER [0..Limit) TO SERecord; Type: TYPE = SEIndex; ISEIndex: TYPE = Base RELATIVE POINTER [0..Limit) TO SERecord.id; CSEIndex: TYPE = Base RELATIVE POINTER [0..Limit) TO SERecord.cons; RecordSEIndex: TYPE = Base RELATIVE POINTER [0..Limit) TO SERecord.cons.record; RefSEIndex: TYPE = Base RELATIVE POINTER [0..Limit) TO SERecord.cons.ref; ArraySEIndex: TYPE = Base RELATIVE POINTER [0..Limit) TO SERecord.cons.array; SENull: SEIndex = SEIndex.FIRST; nullType: Type = SENull; ISENull: ISEIndex = LOOPHOLE[SENull]; CSENull: CSEIndex = LOOPHOLE[SENull]; RecordSENull: RecordSEIndex = LOOPHOLE[SENull]; RefSENull: RefSEIndex = LOOPHOLE[SENull]; ArraySENull: ArraySEIndex = LOOPHOLE[SENull]; -- the following two values are guaranteed by the compiler typeTYPE: CSEIndex = CSEIndex.FIRST + SERecord.cons.nil.SIZE; typeANY: CSEIndex = typeTYPE + SERecord.cons.mode.SIZE; -- codes identifying the basic types (extensible) codeANY: NAT = 0; codeINT: NAT = 1; codeCHAR: NAT = 2; WordCount: TYPE = LONG CARDINAL; -- sizes in words BitCount: TYPE = LONG CARDINAL; -- sizes in bits FieldBitCount: TYPE = CARDINAL; PackedBitCount: TYPE = [1..ByteLength]; BitAddress: TYPE = RECORD[ wd: [0..CARDINAL.LAST/WordLength], -- word displacement bd: [0..WordLength)]; -- bit displacement ExtensionType: TYPE = {value, form, default, none}; Linkage: TYPE = {val, ref, type, manifest, none}; -- for import/export RefClass: TYPE = {none, simple, composite}; -- context table declarations ContextLevel: TYPE = [0..7]; lZ: ContextLevel = 0; -- context level of non-frame records lG: ContextLevel = 1; -- context level of global frame lL: ContextLevel = lG.SUCC; -- context level of outer procedures Closure: TYPE = {none, unit, rc, full}; -- completeness of copied contexts CTXRecord: TYPE = RECORD [ rePainted, varUpdated: BOOL, seList: ISEIndex, level: ContextLevel, extension: SELECT ctxType: * FROM simple => [ctxNew: CTXIndex], -- for DeSoto included => [ chain: IncludedCTXIndex, copied: Closure ← $none, module: MDIndex, map: CTXIndex, closed, complete, restricted: BOOL, reset: BOOL], imported => [includeLink: IncludedCTXIndex], nil => [] ENDCASE]; CTXIndex: TYPE = Base RELATIVE ORDERED POINTER [0..7FFh] TO CTXRecord; IncludedCTXIndex: TYPE = Base RELATIVE ORDERED POINTER [0..7FFh] TO CTXRecord.included; CTXNull: CTXIndex = CTXIndex.FIRST; IncludedCTXNull: IncludedCTXIndex = LOOPHOLE[CTXNull]; StandardContext: TYPE = CTXIndex[CTXNull+CTXRecord.simple.SIZE .. CTXNull+6*CTXRecord.simple.SIZE]; -- module table declarations FileIndex: TYPE = NAT; -- internal file handle nullFileIndex: FileIndex = FileIndex.LAST; MDRecord: TYPE = RECORD [ stamp: TimeStamp.Stamp, moduleId: Name, -- hash entry for module name fileId: HTIndex, -- hash entry for file name shared: BOOL, -- overrides PRIVATE, etc. exported: BOOL, ctx: IncludedCTXIndex, -- context of copied entries defaultImport: CTXIndex, -- unnamed imported instance file: FileIndex]; -- associated file MDIndex: TYPE = Base RELATIVE ORDERED POINTER [0..Limit) TO MDRecord; MDNull: MDIndex = MDIndex.LAST; OwnMdi: MDIndex = MDIndex.FIRST; -- body table declarations BodyLink: TYPE = RECORD [which: {sibling, parent}, index: BTIndex]; BodyRecord: TYPE = RECORD [ link: BodyLink, firstSon: BTIndex, type: RecordSEIndex, localCtx: CTXIndex, level: ContextLevel, sourceIndex: CARDINAL, info: BodyInfo, extension: SELECT kind: * FROM Callable => [ inline: BOOL, id: ISEIndex, ioType: CSEIndex, monitored, noXfers, resident: BOOL, entry, internal: BOOL, entryIndex: [0..PrincOps.EPRange*PrincOps.MaxNGfi), hints: RECORD [safe, argUpdated, nameSafe, noStrings: BOOL], closure: SELECT nesting: * FROM Outer => [], Inner => [frameOffset: [0..PrincOps.MaxFrameSize)], Catch => [index: CatchIndex] -- used only in Trinity ENDCASE], Other => [relOffset: [0..CARDINAL.LAST/2]] ENDCASE]; BodyInfo: TYPE = RECORD [ SELECT mark: * FROM Internal => [ bodyTree: Base RELATIVE POINTER [0..Limit), --Tree.Index-- thread: Base RELATIVE POINTER [0..Limit), --Tree.Index / LitDefs.STIndex-- frameSize: [0..PrincOps.MaxFrameSize]], External => [ bytes: [0..CARDINAL.LAST/2], startIndex, indexLength: CARDINAL] ENDCASE]; BTIndex: TYPE = Base RELATIVE POINTER [0..Limit) TO BodyRecord; CBTIndex: TYPE = Base RELATIVE POINTER [0..Limit) TO BodyRecord.Callable; ICBTIndex: TYPE = Base RELATIVE POINTER [0..Limit) TO BodyRecord.Callable.Inner; OCBTIndex: TYPE = Base RELATIVE POINTER [0..Limit) TO BodyRecord.Callable.Outer; CCBTIndex: TYPE = Base RELATIVE POINTER [0..Limit) TO BodyRecord.Callable.Catch; BTNull: BTIndex = BTIndex.LAST; CBTNull: CBTIndex = LOOPHOLE[BTNull]; CCBTNull: CCBTIndex = LOOPHOLE[CBTNull]; RootBti: CBTIndex = CBTIndex.FIRST; CatchIndex: TYPE = NAT; -- allocation codes for table components seType: Table.Selector = 1; htType: Table.Selector = 2; ssType: Table.Selector = 3; ctxType: Table.Selector = 4; mdType: Table.Selector = 5; bodyType: Table.Selector = 6; }.