SymbolOperations.mesa
Russ Atkinson, October 17, 1983 4:13 pm
This file has been shamelessly ripped off from SymbolOps.mesa of July 6, 1983 1:36 pm. It is meant as an eventual replacement, which would permit symbol tables to exist without the use of global frames or excessive MDS (hooray!). There is NO provision for table movement!
DIRECTORY
ConvertUnsafe USING [LS, SubString],
FS USING [nullOpenFile, OpenFile],
Symbols,
SymbolSegment,
TimeStamp USING [Stamp],
Tree USING [Link],
VM USING [Interval, nullInterval];
SymbolOperations: DEFINITIONS
= BEGIN
Base: TYPE = Symbols.Base;
BitAddress: TYPE = Symbols.BitAddress;
BitCount: TYPE = Symbols.BitCount;
BTIndex: TYPE = Symbols.BTIndex;
CSEIndex: TYPE = Symbols.CSEIndex;
CTXIndex: TYPE = Symbols.CTXIndex;
CTXNull: CTXIndex = Symbols.CTXNull;
ExtIndex: TYPE = SymbolSegment.ExtIndex;
ExtNull: ExtIndex = SymbolSegment.ExtNull;
ExtensionType: TYPE = Symbols.ExtensionType;
FGTEntry: TYPE = SymbolSegment.FGTEntry;
FieldBitCount: TYPE = Symbols.FieldBitCount;
ISEIndex: TYPE = Symbols.ISEIndex;
ISENull: ISEIndex = Symbols.ISENull;
HashVector: TYPE = Symbols.HashVector;
HTRecord: TYPE = Symbols.HTRecord;
HVIndex: TYPE = Symbols.HVIndex;
Linkage: TYPE = Symbols.Linkage;
LongString: TYPE = ConvertUnsafe.LS;
MDIndex: TYPE = Symbols.MDIndex;
MDNull: MDIndex = Symbols.MDNull;
Name: TYPE = Symbols.Name;
nullName: Name = Symbols.nullName;
RecordSEIndex: TYPE = Symbols.RecordSEIndex;
RefClass: TYPE = Symbols.RefClass;
STHeader: TYPE = SymbolSegment.STHeader;
STHeaderPtr: TYPE = LONG POINTER TO STHeader;
SubString: TYPE = ConvertUnsafe.SubString;
TransferMode: TYPE = Symbols.TransferMode;
Type: TYPE = Symbols.Type;
TypeClass: TYPE = Symbols.TypeClass;
WordCount: TYPE = Symbols.WordCount;
SymbolTableBase: TYPE = REF SymbolTableBaseRep;
SymbolTableBaseRep: TYPE = RECORD [
the basis for our symbols
interval: VM.Interval ← VM.nullInterval,
file: FS.OpenFile ← FS.nullOpenFile,
tables defining the current symbol table
hashVec: LONG POINTER TO HashVector ← NIL, -- hash index
ht: LONG DESCRIPTOR FOR ARRAY Name OF HTRecord ← NIL, -- hash table
ssb: LongString ← NIL, -- id string
seb: Base ← NIL, -- se table
ctxb: Base ← NIL, -- context table
mdb: Base ← NIL, -- module directory base
bb: Base ← NIL, -- body table
tb: Base ← NIL, -- tree area
ltb: Base ← NIL, -- literal area
extb: Base ← NIL, -- extension map
mdLimit: MDIndex ← MDNull, -- module directory size
extLimit: ExtIndex ← ExtNull, -- extension size
mainCtx: CTXIndex ← CTXNull,
stHandle: STHeaderPtr ← NIL,
info defining the source file links
sourceFile: LongString ← NIL,
fgTable: LONG DESCRIPTOR FOR ARRAY OF FGTEntry ← NIL
];
Acquire: PROC
[file: FS.OpenFile, startPage: CARDINAL, pages: CARDINAL]
RETURNS [stb: SymbolTableBase ← NIL];
Release: PROC [stb: SymbolTableBase];
hash manipulation
FindString: PROC [stb: SymbolTableBase, s: SubString] RETURNS [name: Name];
HashValue: PROC [stb: SymbolTableBase, s: SubString] RETURNS [HVIndex];
SubStringForName: PROC [stb: SymbolTableBase, name: Name] RETURNS[s: SubString];
context management
CtxEntries: PROC [stb: SymbolTableBase, ctx: CTXIndex] RETURNS [n: CARDINAL];
FirstCtxSe: PROC [stb: SymbolTableBase, ctx: CTXIndex] RETURNS [ISEIndex];
NextSe: PROC [stb: SymbolTableBase, sei: ISEIndex] RETURNS [ISEIndex];
SearchContext: PROC
[stb: SymbolTableBase, name: Name, ctx: CTXIndex] RETURNS [ISEIndex];
SeiForValue: PROC
[stb: SymbolTableBase, value: CARDINAL, ctx: CTXIndex] RETURNS [ISEIndex];
module management
FindMdi: PROC
[stb: SymbolTableBase, stamp: TimeStamp.Stamp] RETURNS [MDIndex];
type manipulation
ArgCtx: PROC [stb: SymbolTableBase, type: CSEIndex] RETURNS [CTXIndex];
ArgRecord: PROC
[stb: SymbolTableBase, type: CSEIndex] RETURNS [RecordSEIndex];
ClusterSe: PROC [stb: SymbolTableBase, type: Type] RETURNS [Type];
NormalType: PROC [stb: SymbolTableBase, type: CSEIndex] RETURNS [CSEIndex];
RecordLink: PROC
[stb: SymbolTableBase, type: RecordSEIndex] RETURNS [RecordSEIndex];
RecordRoot: PROC
[stb: SymbolTableBase, type: RecordSEIndex] RETURNS [root: RecordSEIndex];
ReferentType: PROC
[stb: SymbolTableBase, type: CSEIndex] RETURNS [CSEIndex];
TransferTypes: PROC
[stb: SymbolTableBase, type: Type] RETURNS [typeIn, typeOut: RecordSEIndex];
TypeForm: PROC [stb: SymbolTableBase, type: Type] RETURNS [TypeClass];
TypeLink: PROC [stb: SymbolTableBase, type: Type] RETURNS [Type];
TypeRoot: PROC [stb: SymbolTableBase, type: Type] RETURNS [root: Type];
UnderType: PROC [stb: SymbolTableBase, type: Type] RETURNS [CSEIndex];
XferMode: PROC [stb: SymbolTableBase, type: Type] RETURNS [TransferMode];
information returning procedures
BitsForRange: PROC
[stb: SymbolTableBase, maxValue: CARDINAL] RETURNS [nBits: CARDINAL ← 1];
BitsForType: PROC [stb: SymbolTableBase, type: Type] RETURNS [BitCount ← 0];
BitsPerElement: PROC
[stb: SymbolTableBase, type: Type, packed: BOOL] RETURNS [BitCount];
Cardinality: PROC [stb: SymbolTableBase, type: Type] RETURNS [LONG CARDINAL];
FindExtension: PROC
[stb: SymbolTableBase, sei: ISEIndex] RETURNS [type: ExtensionType, tree: Tree.Link];
FnField: PROC
[stb: SymbolTableBase, field: ISEIndex] RETURNS [offset: BitAddress, size: FieldBitCount];
NameForSe: PROC [stb: SymbolTableBase, sei: ISEIndex] RETURNS [Name];
LinkMode: PROC [stb: SymbolTableBase, sei: ISEIndex] RETURNS [Linkage];
RecField: PROC
[stb: SymbolTableBase, field: ISEIndex] RETURNS [offset: BitAddress, size: FieldBitCount];
RCType: PROC [stb: SymbolTableBase, type: CSEIndex] RETURNS [RefClass];
VariantField: PROC [stb: SymbolTableBase, type: CSEIndex] RETURNS [ISEIndex];
WordsForType: PROC [stb: SymbolTableBase, type: Type] RETURNS [WordCount];
body table management
ParentBti: PROC [stb: SymbolTableBase, bti: BTIndex] RETURNS [BTIndex];
SiblingBti: PROC [stb: SymbolTableBase, bti: BTIndex] RETURNS [BTIndex];
SonBti: PROC [stb: SymbolTableBase, bti: BTIndex] RETURNS [BTIndex];
EnumerateBodies: PROC
[stb: SymbolTableBase, root: BTIndex, proc: PROC [BTIndex] RETURNS [stop: BOOL]]
RETURNS [bti: BTIndex];
END.