SymbolOps.mesa
Copyright Ó 1985, 1986, 1987, 1988, 1991 by Xerox Corporation. All rights reserved.
Russ Atkinson (RRA) March 1, 1988 6:18:30 pm PST
Satterthwaite, June 18, 1986 10:12:35 am PDT
Sweet June 4, 1986 10:11:29 am PDT
DIRECTORY
Alloc USING [Handle],
ConvertUnsafe USING [SubString],
MobDefs USING [Link, VersionStamp],
SmallCards,
Symbols,
SymbolTable,
Target: TYPE MachineParms USING [PackedBitCount, packedFieldSize],
Tree USING [Index, Info, Link, Map];
SymbolOps: DEFINITIONS = {
OPEN SmallCards, Symbols;
STB: TYPE = REF SymbolTable.SymbolTableBaseRep;
SubString: TYPE = ConvertUnsafe.SubString;
UNSPEC: TYPE = Symbols.UNSPEC;
from/to UNSPEC and Tree.Info
DecodeBitAddr: PROC [ba: UNSPEC] RETURNS [BitAddress] = INLINE {
RETURN [LOOPHOLE[ba, BitAddress]];
};
DecodeBti: PROC [bti: UNSPEC] RETURNS [CBTIndex] = INLINE {
RETURN [LOOPHOLE[bti, CBTIndex]];
};
DecodeCard: PROC [n: UNSPEC] RETURNS [CARD] = INLINE {
RETURN [LOOPHOLE[n, CARD]];
};
DecodeInt: PROC [n: UNSPEC] RETURNS [INT] = INLINE {
RETURN [LOOPHOLE[n, INT]];
};
DecodeReal: PROC [n: UNSPEC] RETURNS [REAL] = INLINE {
RETURN [LOOPHOLE[n, REAL]];
};
DecodeLink: PROC [l: UNSPEC] RETURNS [MobDefs.Link] = INLINE {
RETURN [LOOPHOLE[l, MobDefs.Link]];
};
DecodeTreeIndex: PROC [node: UNSPEC] RETURNS [Tree.Index] = INLINE {
RETURN [LOOPHOLE[node, Tree.Index]];
};
DecodeType: PROC [t: UNSPEC] RETURNS [Type] = INLINE {
RETURN [LOOPHOLE[t, Type]];
};
EncodeBitAddr: PROC [ba: BitAddress] RETURNS [UNSPEC] = INLINE {
RETURN [LOOPHOLE[ba, UNSPEC]];
};
EncodeBti: PROC [bti: CBTIndex] RETURNS [UNSPEC] = INLINE {
RETURN [LOOPHOLE[bti, UNSPEC]];
};
EncodeCard: PROC [n: CARD] RETURNS [UNSPEC] = INLINE {
RETURN [LOOPHOLE[n, UNSPEC]];
};
EncodeInt: PROC [n: INT] RETURNS [UNSPEC] = INLINE {
RETURN [LOOPHOLE[n, UNSPEC]];
};
EncodeReal: PROC [r: REAL] RETURNS [UNSPEC] = INLINE {
RETURN [LOOPHOLE[r, UNSPEC]];
};
EncodeLink: PROC [l: MobDefs.Link] RETURNS [UNSPEC] = INLINE {
RETURN [LOOPHOLE[l, UNSPEC]];
};
EncodeTreeIndex: PROC [node: Tree.Index] RETURNS [UNSPEC] = INLINE {
RETURN [LOOPHOLE[node, UNSPEC]];
};
EncodeType: PROC [t: Type] RETURNS [UNSPEC] = INLINE {
RETURN [LOOPHOLE[t, UNSPEC]];
};
ToBti: PROC [bti: Tree.Info] RETURNS [BTIndex] = INLINE {
RETURN [LOOPHOLE[bti, BTIndex]];
};
ToCtx: PROC [ctx: Tree.Info] RETURNS [CTXIndex] = INLINE {
RETURN [LOOPHOLE[ctx, CTXIndex]];
};
ToType: PROC [type: Tree.Info] RETURNS [Type] = INLINE {
RETURN [LOOPHOLE[type, Type]];
};
FromBti: PROC [bti: BTIndex] RETURNS [Tree.Info] = INLINE {
RETURN [LOOPHOLE[bti, Tree.Info]];
};
FromCtx: PROC [ctx: CTXIndex] RETURNS [Tree.Info] = INLINE {
RETURN [LOOPHOLE[ctx, Tree.Info]];
};
FromType: PROC [type: Type] RETURNS [Tree.Info] = INLINE {
RETURN [LOOPHOLE[type, Tree.Info]];
};
implemented by SymbolOpsImpl
hash manipulation
FindString: PROC [stb: STB, s: SubString] RETURNS [Name];
HashValue: PROC [stb: STB, s: SubString] RETURNS [HVIndex];
SubStringForName: PROC [stb: STB, name: Name] RETURNS [SubString];
context management
CtxLevel: PROC [STB, CTXIndex] RETURNS [ContextLevel];
CtxEntries: PROC [STB, CTXIndex] RETURNS [CARDINAL];
FirstCtxSe: PROC [STB, CTXIndex] RETURNS [ISEIndex];
NextSe: PROC [STB, ISEIndex] RETURNS [ISEIndex];
SearchContext: PROC [stb: STB, name: Name, ctx: CTXIndex] RETURNS [ISEIndex];
SeiForValue: PROC [stb: STB, value: UNSPEC, ctx: CTXIndex] RETURNS [ISEIndex];
module management
FindMdi: PROC [STB, MobDefs.VersionStamp] RETURNS [MDIndex];
type manipulation
ArgCtx: PROC [STB, CSEIndex] RETURNS [CTXIndex];
ArgRecord: PROC [STB, CSEIndex] RETURNS [RecordSEIndex];
ClusterSe: PROC [STB, Type] RETURNS [Type];
EqTypes: PROC [STB, Type, Type] RETURNS [BOOL];
NormalType: PROC [STB, Type] RETURNS [CSEIndex];
RecordLink: PROC [STB, RecordSEIndex] RETURNS [RecordSEIndex];
RecordRoot: PROC [STB, RecordSEIndex] RETURNS [RecordSEIndex];
ReferentType: PROC [STB, Type] RETURNS [Type];
TransferTypes: PROC [STB, Type] RETURNS [typeIn, typeOut: RecordSEIndex];
TypeForm: PROC [STB, Type] RETURNS [TypeClass];
TypeLink: PROC [STB, Type] RETURNS [Type];
TypeRoot: PROC [STB, Type] RETURNS [Type];
UnderType: PROC [STB, Type] RETURNS [CSEIndex];
XferMode: PROC [STB, Type] RETURNS [TransferMode];
information returning procedures
AUsForType: PROC [STB, Type] RETURNS [CARD];
BitsForType: PROC [STB, Type] RETURNS [BitCount];
BitsPerElement: PROC [stb: STB, type: Type, packed: BOOL] RETURNS [BitCount];
Cardinality: PROC [STB, Type] RETURNS [CARD];
FindExtension: PROC [stb: STB, sei: ISEIndex]
RETURNS [type: ExtensionType, tree: Tree.Link];
FnField: PROC [STB, ISEIndex] RETURNS [offset: BitAddress, size: BitCount];
LinkMode: PROC [stb: STB, sei: ISEIndex] RETURNS [Linkage];
NameForSe: PROC [STB, ISEIndex] RETURNS [Name];
PackedSize: ARRAY Target.PackedBitCount OF NAT = Target.packedFieldSize;
RecField: PROC [STB, ISEIndex] RETURNS [offset: BitAddress, size: BitCount];
RCType: PROC [STB, Type] RETURNS [RefClass];
VariantField: PROC [STB, CSEIndex] RETURNS [ISEIndex];
body table management
EnumerateBodies: PROC [stb: STB, root: BTIndex, proc: BodyVisitor] RETURNS [BTIndex];
BodyVisitor: TYPE = PROC [BTIndex] RETURNS [stop: BOOL ¬ FALSE];
ParentBti: PROC [stb: STB, bti: BTIndex] RETURNS [BTIndex];
SiblingBti: PROC [stb: STB, bti: BTIndex] RETURNS [BTIndex];
SonBti: PROC [stb: STB, bti: BTIndex] RETURNS [BTIndex];
utilities not requiring a symbol table
BitsForRange: PROC [CARD] RETURNS [BitCount];
initialization, etc.
Initialize: PROC [Alloc.Handle, UNCOUNTED ZONE];
Reset: PROC;
Finalize: PROC;
own: STB;
Same as ComData.ownSymbols
hash manipulation
EnterString: PROC [ConvertUnsafe.SubString] RETURNS [Name];
HashBlock: PROC RETURNS [LONG POINTER TO HashVector];
context management
NextLevel: PROC [ContextLevel] RETURNS [ContextLevel];
SetCtxLevel: PROC [CTXIndex, ContextLevel];
BlockLevel: PROC [ContextLevel] RETURNS [ContextLevel];
NewCtx: PROC [ContextLevel] RETURNS [CTXIndex];
SetMainCtx: PROC [CTXIndex];
ResetCtxList: PROC [CTXIndex];
FirstVisibleSe: PROC [CTXIndex] RETURNS [ISEIndex];
NextVisibleSe: PROC [ISEIndex] RETURNS [ISEIndex];
VisibleCtxEntries: PROC [CTXIndex] RETURNS [CARDINAL];
CtxVariant: PROC [CTXIndex] RETURNS [ISEIndex];
StaticNestError: SIGNAL;
MakeCtxSe: PROC [name: Name, ctx: CTXIndex] RETURNS [ISEIndex];
MakeNonCtxSe: PROC [CARDINAL] RETURNS [CSEIndex];
MakeSeChain: PROC [CTXIndex, CARDINAL, BOOL] RETURNS [ISEIndex];
FillCtxSe: PROC [ISEIndex, Name, BOOL];
NameClash: SIGNAL [name: Name];
EnterExtension: PROC [sei: ISEIndex, type: ExtensionType, tree: Tree.Link];
SetSeLink: PROC [sei, next: ISEIndex];
body table utilities
LinkBti: PROC [bti, parent: BTIndex];
DelinkBti: PROC [BTIndex];
copying within current table
CopyArgSe: PROC [copy, master: ISEIndex];
CopyBasicType: PROC [CSEIndex] RETURNS [CSEIndex];
CopyXferType: PROC [CSEIndex, Tree.Map] RETURNS [CSEIndex];
attribute extraction
ConstantId: PROC [ISEIndex] RETURNS [BOOL];
}.