-- RTSymbols.mesa
-- An interface to operations that acquire and release SymbolTableBases and SymbolTableHandles.
-- Bifurcation for symbol table bootstrapping occurs below this (and the RTSymbolOps) level of
-- abstraction.
-- Last Modified By Paul Rovner On July 22, 1983 5:36 pm

DIRECTORY
BcdDefs USING[SGIndex, VersionStamp, NullVersion, BcdBase],
PrincOps USING[GlobalFrameHandle],
Rope USING[ROPE],
SafeStorage USING[Type],
RTSymbolDefs USING[SymbolTableHandle, SymbolTableBase, SymbolModuleIndex,
SymbolIndex];

RTSymbols: DEFINITIONS
= BEGIN OPEN Rope, RTSymbolDefs;


-- STB's
AcquireSTB: PROC[sth: SymbolTableHandle] RETURNS[SymbolTableBase];

ReleaseSTB: PROC[stb: SymbolTableBase];
-- BEWARE. The client is responsible for matching each AcquireSTB with exactly
-- one ReleaseSTB. In particular, one should be very careful to catch UNWIND
-- in appropriate places and ReleaseSTB. All the awfulness of dangling
-- reference problems obtain at this level in the system.

AcquireSTBFromGFH: PROC[gfh: PrincOps.GlobalFrameHandle]
RETURNS[SymbolTableBase];

AcquireSTBFromMDI: PROC[stb: SymbolTableBase, mdi: SymbolModuleIndex]
RETURNS[SymbolTableBase];

AcquireSTBFromSGI: PROC[bcd: BcdDefs.BcdBase,
sgi: BcdDefs.SGIndex]
RETURNS[SymbolTableBase];

Outer: PROC[stb: SymbolTableBase,
mdi: SymbolModuleIndex,
inner: PROC[base: SymbolTableBase]];
-- Outer uses AcquireSTBFromMDI to find the stb referenced by (stb, mdi).
-- It will then pass this stb to inner. Outer is useful when the caller
-- is unable or unwilling to make sure that the stb gets released properly.
-- mesaSymbolsOK = TRUE is an feature used only by the RPC stub generator.
-- It enables acquisition of pre-Cedar symbol tables.


-- STH's
NewSymbolHandle: PROC[fileName: ROPE,
base: CARDINAL,
pages: CARDINAL,
version: BcdDefs.VersionStamp ← BcdDefs.NullVersion]
RETURNS[SymbolTableHandle];
-- If version # AnyVersion, NewSymbolHandle may
-- return a SymbolTableHandle that identifies a different
-- file and span.

GetSTHForModule: PROC[stamp: BcdDefs.VersionStamp,
fileName: ROPE, -- maybe NIL
moduleName: ROPE -- maybe NIL
]
RETURNS[SymbolTableHandle];

BaseToHandle: PROC[stb: SymbolTableBase] RETURNS[SymbolTableHandle];

STPages
: PROC[sth: SymbolTableHandle] RETURNS[CARDINAL];
-- STPages returns the number of pages in the specified symbol table

-- Types

GetTypeSymbols: PROC[type: SafeStorage.Type] RETURNS[stb: SymbolTableBase, sei: SymbolIndex];

GetOriginalTypeSymbols: PROC[type: SafeStorage.Type]
RETURNS[stb: SymbolTableBase, sei: SymbolIndex];

END.