RTWalkSymbolsImpl.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Rovner, July 6, 1983 12:29 pm
Russ Atkinson (RRA) February 11, 1985 7:29:49 pm PST
DIRECTORY
BcdDefs USING [VersionStamp],
BrandXSymbolDefs USING [SymbolTableBase, SymbolIndex, SymbolIdIndex, symbolIndexForTYPE, SymbolRecordIndex, SymbolContextIndex, nullHandle, nullModuleIndex, ExtensionClass, TreeLink, rootBodyIndex, nullBodyIndex],
BrandYSymbolDefs USING [SymbolTableBase, SymbolIndex, SymbolIdIndex, symbolIndexForTYPE, SymbolRecordIndex, SymbolContextIndex, nullHandle, nullModuleIndex, ExtensionClass, TreeLink, rootBodyIndex, nullBodyIndex],
ConvertUnsafe USING [SubString, SubStringToRope],
PrincOps USING [EPRange, MaxNGfi],
Rope USING [ROPE],
RTSymbolDefs USING [SymbolTableBase, SymbolIndex, SymbolContextIndex, SymbolIdIndex, SymbolRecordIndex, SymbolNameIndex, nullXSymbolIndex, nullYSymbolIndex, nullXSymbolNameIndex, nullYSymbolNameIndex, nullXSymbolContextIndex, nullYSymbolContextIndex, SymbolConstructorIndex, SymbolTableHandle, SymbolModuleIndex, ExtensionClass, TreeLink, BodyIndex, BlockContextLevel, CallableBodyIndex],
RTSymbolOps USING [Xfm],
RTSymbols USING [OuterFromMDI];
RTWalkSymbolsImpl:
PROGRAM
IMPORTS ConvertUnsafe, RTSymbols
EXPORTS RTSymbolOps
= BEGIN OPEN bx: BrandXSymbolDefs, by: BrandYSymbolDefs, Rope, RTSymbolDefs, RTSymbols;
Procedures
IsRC:
PUBLIC
PROC [stb: SymbolTableBase, seIndex: SymbolIndex, checkCommon:
BOOL ←
TRUE]
RETURNS [
BOOL] = {
WITH stb
SELECT
FROM
t: SymbolTableBase.x =>
RETURN[IsRCX[t.e, NARROW[seIndex, SymbolIndex.x].e, checkCommon]];
t: SymbolTableBase.y =>
RETURN[IsRCY[t.e, NARROW[seIndex, SymbolIndex.y].e, checkCommon]];
ENDCASE => ERROR};
IsRCX:
PROC [stb: bx.SymbolTableBase, seIndex: bx.SymbolIndex, checkCommon:
BOOL ←
TRUE]
RETURNS [
BOOL] = {
WITH cr: stb.seb[stb.UnderType[seIndex]]
SELECT
FROM
record => {
rcP:
PROC [stb: SymbolTableBase, isei: SymbolIdIndex]
RETURNS [stop:
BOOL] = {
sei: bx.SymbolIndex ← NARROW[ISEType[stb, isei], SymbolIndex.x].e;
nstb: bx.SymbolTableBase ← NARROW[stb, SymbolTableBase.x].e;
WITH cse1: nstb.seb[nstb.UnderType[sei]]
SELECT
FROM
union => {
urcP:
PROC [stb: SymbolTableBase, isei: SymbolIdIndex]
RETURNS [stop:
BOOL ←
FALSE] = {
stop ← IsRC[stb, LOOPHOLE[isei], FALSE]};
tagCardinality: CARDINAL ← nstb.Cardinality[nstb.seb[cse1.tagSei].idType];
RETURN[EnumerateCtxIseis[stb, [x[cse1.caseCtx]], urcP, (tagCardinality = nstb.CtxEntries[cse1.caseCtx])]]};
sequence => IF IsRC[stb, [x[cse1.componentType]]] THEN RETURN[TRUE];
ENDCASE => IF IsRC[stb, [x[sei]]] THEN RETURN[TRUE];
RETURN[FALSE]};
IF checkCommon
THEN
RETURN[cr.hints.refField]
easy if the common parts are to be included
ELSE
RETURN[EnumerateCtxIseis[[x[stb]], [x[cr.fieldCtx]], rcP]]
look individually at the fields
};
sequence, union => ERROR;
transfer => RETURN[FALSE]; -- NOTE for now
relative => RETURN[FALSE]; -- NOTE for now
long =>
RETURN[
WITH rse: stb.seb[stb.UnderType[cr.rangeType] ]
SELECT
FROM
ref => rse.counted,
ENDCASE => FALSE];
zone => RETURN[cr.counted];
array => RETURN[IsRC[[x[stb]], [x[cr.componentType]]]];
ENDCASE => RETURN[FALSE];
};
IsRCY:
PROC [stb: by.SymbolTableBase, seIndex: by.SymbolIndex, checkCommon:
BOOL ←
TRUE]
RETURNS [
BOOL] =
{
WITH cr: stb.seb[stb.UnderType[seIndex]]
SELECT
FROM
record => {
rcP:
PROC [stb: SymbolTableBase, isei: SymbolIdIndex]
RETURNS [stop:
BOOL] = {
sei: bx.SymbolIndex ← NARROW[ISEType[stb, isei], SymbolIndex.y].e;
nstb: bx.SymbolTableBase ← NARROW[stb, SymbolTableBase.y].e;
WITH cse1: nstb.seb[nstb.UnderType[sei]]
SELECT
FROM
union => {
urcP:
PROC [stb: SymbolTableBase, isei: SymbolIdIndex]
RETURNS [stop:
BOOL ←
FALSE] = {
stop ← IsRC[stb, LOOPHOLE[isei], FALSE]};
tagCardinality: CARDINAL ← nstb.Cardinality[nstb.seb[cse1.tagSei].idType];
RETURN[EnumerateCtxIseis[stb, [y[cse1.caseCtx]], urcP, (tagCardinality = nstb.CtxEntries[cse1.caseCtx])]]};
sequence => IF IsRC[stb, [y[cse1.componentType]]] THEN RETURN[TRUE];
ENDCASE => IF IsRC[stb, [y[sei]]] THEN RETURN[TRUE];
RETURN[FALSE]};
IF checkCommon
THEN
RETURN[cr.hints.refField]
easy if the common parts are to be included
ELSE
RETURN[EnumerateCtxIseis[[y[stb]], [y[cr.fieldCtx]], rcP]]
look individually at the fields
};
sequence, union => ERROR;
transfer => RETURN[FALSE]; -- NOTE for now
relative => RETURN[FALSE]; -- NOTE for now
long =>
RETURN[
WITH rse: stb.seb[stb.UnderType[cr.rangeType] ]
SELECT
FROM
ref => rse.counted,
ENDCASE => FALSE];
zone => RETURN[cr.counted];
array => RETURN[IsRC[[y[stb]], [y[cr.componentType]]]];
ENDCASE => RETURN[FALSE];
IsUnion:
PUBLIC
PROC [stb: SymbolTableBase, seIndex: SymbolIndex]
RETURNS [
BOOL] = {
WITH stb
SELECT
FROM
t: SymbolTableBase.x =>
RETURN[t.e.seb[t.e.UnderType[NARROW[seIndex, SymbolIndex.x].e]].typeTag = union];
t: SymbolTableBase.y =>
RETURN[t.e.seb[t.e.UnderType[NARROW[seIndex, SymbolIndex.y].e]].typeTag = union];
ENDCASE => ERROR};
IsSequence:
PUBLIC
PROC [stb: SymbolTableBase, seIndex: SymbolIndex]
RETURNS [
BOOL] = {
WITH stb
SELECT
FROM
t: SymbolTableBase.x =>
RETURN[t.e.seb[t.e.UnderType[NARROW[seIndex, SymbolIndex.x].e]].typeTag = sequence];
t: SymbolTableBase.y =>
RETURN[t.e.seb[t.e.UnderType[NARROW[seIndex, SymbolIndex.y].e]].typeTag = sequence];
ENDCASE => ERROR};
EnumerateRecordIseis:
PUBLIC
PROC [ stb: SymbolTableBase, rsei: SymbolRecordIndex,
p:
PROC [stb: SymbolTableBase, isei: SymbolIdIndex]
RETURNS [stop:
BOOL], level:
CARDINAL ← 0]
RETURNS [stopped:
BOOL] = {
proc:
PROC [stb: SymbolTableBase, isei: SymbolIdIndex]
RETURNS [stop:
BOOL] = {
sei: SymbolIndex ← ISEType[stb, isei];
IF
NOT (IsUnion[stb, sei]
OR IsSequence[stb, sei])
OR level = 0
THEN RETURN[p[stb, isei]];
RETURN[FALSE];
IF NullISEI[LOOPHOLE[rsei]] THEN RETURN[FALSE];
WITH stb
SELECT
FROM
t: SymbolTableBase.x => {
WITH lrc: t.e.seb[
NARROW[rsei, SymbolRecordIndex.x].e]
SELECT
FROM
linked => {
stopped ← EnumerateRecordIseis [stb, [x[LOOPHOLE[t.e.UnderType[lrc.linkType], bx.SymbolRecordIndex]]], p, level + 1];
IF stopped THEN RETURN[TRUE]};
ENDCASE;
RETURN[EnumerateCtxIseis [stb, [x[t.e.seb[NARROW[rsei, SymbolRecordIndex.x].e].fieldCtx]], proc]];
};
t: SymbolTableBase.y => {
WITH lrc: t.e.seb[
NARROW[rsei, SymbolRecordIndex.y].e]
SELECT
FROM
linked => {
stopped ← EnumerateRecordIseis [stb, [y[LOOPHOLE[t.e.UnderType[lrc.linkType], by.SymbolRecordIndex]]], p, level + 1];
IF stopped THEN RETURN[TRUE]};
ENDCASE;
RETURN[EnumerateCtxIseis [stb, [y[t.e.seb[NARROW[rsei, SymbolRecordIndex.y].e].fieldCtx]], proc]];
};
ENDCASE => ERROR};
copied in RCMapBuilderImpl
EnumerateCtxIseis:
PUBLIC
PROC [stb: SymbolTableBase, ctx: SymbolContextIndex, proc:
PROC [stb: SymbolTableBase, isei: SymbolIdIndex]
RETURNS [stop:
BOOL], reallyComplete:
BOOL ←
FALSE]
RETURNS [stopped:
BOOL] = {
isei: SymbolIdIndex;
IF NullCtx[ctx] THEN RETURN[FALSE];
IF
NOT reallyComplete
THEN {
WITH stb
SELECT
FROM
t: SymbolTableBase.x =>
WITH c: t.e.ctxb[
NARROW[ctx, SymbolContextIndex.x].e]
SELECT
FROM
included =>
IF ~c.complete THEN
{ p:
PROC [base: SymbolTableBase] =
-- called once
{stopped ← EnumerateCtxIseis[base, [x[c.map]], proc]};
OuterFromMDI[stb, [x[c.module]], p];
RETURN[stopped];
};
simple => NULL;
ENDCASE => ERROR;
t: SymbolTableBase.y =>
WITH c: t.e.ctxb[
NARROW[ctx, SymbolContextIndex.y].e]
SELECT
FROM
included =>
IF ~c.complete THEN
{ p:
PROC [base: SymbolTableBase] =
-- called once
{stopped ← EnumerateCtxIseis[base, [y[c.map]], proc]};
OuterFromMDI[stb, [y[c.module]], p];
RETURN[stopped];
};
simple => NULL;
ENDCASE => ERROR;
ENDCASE => ERROR;
};
FOR isei ← FirstCtxSe[stb, ctx], NextSe[stb, isei]
UNTIL NullISEI[isei]
DO
IF NullName[ISEName[stb, isei]] AND NullCtx[ISECtx[stb, isei]] THEN LOOP; -- padding
IF proc[stb, isei] THEN RETURN[TRUE];
ENDLOOP;
RETURN[FALSE];
};
CountComponents:
PUBLIC
PROC [stb: SymbolTableBase, rsei: SymbolRecordIndex]
RETURNS [n:
NAT] = {
n ← CountCommonComponents[stb, rsei];
IF RSEVariant[stb, rsei] THEN n ← n + 1};
CountCommonComponents:
PROC [stb: SymbolTableBase, rsei: SymbolRecordIndex]
RETURNS [n:
CARDINAL] = {
count:
PROC [stb: SymbolTableBase, isei: SymbolIdIndex]
RETURNS [stop:
BOOL] = {
sei: SymbolIndex ← ISEType[stb, isei];
IF NOT (IsUnion[stb, sei] OR IsSequence[stb, sei]) THEN n ← n + 1;
RETURN[FALSE];
};
n ← 0;
[] ← EnumerateRecordIseis[stb, rsei, count];
};
peel layers of id until the last one before either the underlying cons or a change of name
or a specification of default initialization
PeelAllButLast:
PUBLIC
PROC [stb: SymbolTableBase, isei: SymbolIdIndex]
RETURNS [SymbolIdIndex] =
{
WITH stb
SELECT
FROM
t: SymbolTableBase.x => RETURN[PeelAllButLastX[t.e, NARROW[isei, SymbolIdIndex.x].e]];
t: SymbolTableBase.y => RETURN[PeelAllButLastY[t.e, NARROW[isei, SymbolIdIndex.y].e]];
ENDCASE => ERROR};
PeelAllButLastX:
PROC [stb: bx.SymbolTableBase, isei: bx.SymbolIdIndex]
RETURNS [SymbolIdIndex] =
{
FOR sei: bx.SymbolIndex ← stb.seb[isei].idInfo, stb.seb[isei].idInfo
UNTIL stb.seb[isei].extended
-- i.e. isei has default initialization specified --
DO
WITH se: stb.seb[sei]
SELECT
FROM
id =>
IF se.idType # bx.symbolIndexForTYPE
THEN
ERROR
ELSE
IF stb.seb[isei].hash # stb.seb[
LOOPHOLE[sei, bx.SymbolIdIndex]].hash
THEN EXIT
ELSE isei ← LOOPHOLE[sei, bx.SymbolIdIndex];
cons => EXIT;
ENDCASE => ERROR;
ENDLOOP;
RETURN[[x[isei]]]
PeelAllButLastY:
PROC [stb: by.SymbolTableBase, isei: by.SymbolIdIndex]
RETURNS [SymbolIdIndex] = {
FOR sei: by.SymbolIndex ← stb.seb[isei].idInfo, stb.seb[isei].idInfo
UNTIL stb.seb[isei].extended
-- i.e. isei has default initialization specified --
DO
WITH se: stb.seb[sei]
SELECT
FROM
id =>
IF se.idType # by.symbolIndexForTYPE
THEN
ERROR
ELSE
IF stb.seb[isei].hash # stb.seb[
LOOPHOLE[sei, by.SymbolIdIndex]].hash
THEN EXIT
ELSE isei ← LOOPHOLE[sei, by.SymbolIdIndex];
cons => EXIT;
ENDCASE => ERROR;
ENDLOOP;
SEUnderType:
PUBLIC
PROC [stb: SymbolTableBase, sei: SymbolIndex]
RETURNS [SymbolConstructorIndex] = {
WITH stb
SELECT
FROM
t: SymbolTableBase.x => RETURN[[x[t.e.UnderType[NARROW[sei, SymbolIndex.x].e]]]];
t: SymbolTableBase.y => RETURN[[y[t.e.UnderType[NARROW[sei, SymbolIndex.y].e]]]];
ENDCASE => ERROR;
};
ISEType:
PUBLIC
PROC [stb: SymbolTableBase, isei: SymbolIdIndex]
RETURNS [SymbolIndex] =
{
WITH stb
SELECT
FROM
t: SymbolTableBase.x => RETURN[[x[t.e.seb[NARROW[isei, SymbolIdIndex.x].e].idType]]];
t: SymbolTableBase.y => RETURN[[y[t.e.seb[NARROW[isei, SymbolIdIndex.y].e].idType]]];
ENDCASE => ERROR;
};
BodyType:
PUBLIC
PROC [stb: SymbolTableBase, bti: BodyIndex]
RETURNS [SymbolIndex] =
{
WITH stb
SELECT
FROM
t: SymbolTableBase.x => RETURN[[x[t.e.bb[NARROW[bti, BodyIndex.x].e].type]]];
t: SymbolTableBase.y => RETURN[[y[t.e.bb[NARROW[bti, BodyIndex.y].e].type]]];
ENDCASE => ERROR;
};
CallableBodyEntryIndex:
PUBLIC
PROC [stb: SymbolTableBase, cbti: CallableBodyIndex]
RETURNS [[0..PrincOps.EPRange*PrincOps.MaxNGfi)] =
{
WITH stb
SELECT
FROM
t: SymbolTableBase.x => RETURN[t.e.bb[NARROW[cbti, CallableBodyIndex.x].e].entryIndex];
t: SymbolTableBase.y => RETURN[t.e.bb[NARROW[cbti, CallableBodyIndex.y].e].entryIndex];
ENDCASE => ERROR;
};
SEBitsForType:
PUBLIC
PROC [stb: SymbolTableBase, sei: SymbolIndex]
RETURNS [
INT] =
{
WITH stb
SELECT
FROM
t: SymbolTableBase.x => RETURN[t.e.BitsForType[NARROW[sei, SymbolIndex.x].e]];
t: SymbolTableBase.y => RETURN[t.e.BitsForType[NARROW[sei, SymbolIndex.y].e]];
ENDCASE => ERROR;
};
IDCardinalValue:
PUBLIC
PROC [stb: SymbolTableBase, isei: SymbolIdIndex]
RETURNS [
CARDINAL] =
{
WITH stb
SELECT
FROM
t: SymbolTableBase.x => RETURN[t.e.seb[NARROW[isei, SymbolIdIndex.x].e].idValue];
t: SymbolTableBase.y => RETURN[t.e.seb[NARROW[isei, SymbolIdIndex.y].e].idValue];
ENDCASE => ERROR;
};
IDCardinalInfo:
PUBLIC
PROC [stb: SymbolTableBase, isei: SymbolIdIndex]
RETURNS [
CARDINAL] =
{
WITH stb
SELECT
FROM
t: SymbolTableBase.x => RETURN[t.e.seb[NARROW[isei, SymbolIdIndex.x].e].idInfo];
t: SymbolTableBase.y => RETURN[t.e.seb[NARROW[isei, SymbolIdIndex.y].e].idInfo];
ENDCASE => ERROR;
};
BodyLevel:
PUBLIC
PROC [stb: SymbolTableBase, bti: BodyIndex]
RETURNS [BlockContextLevel] =
{
WITH stb
SELECT
FROM
t: SymbolTableBase.x => RETURN[[x[t.e.bb[NARROW[bti, BodyIndex.x].e].level]]];
t: SymbolTableBase.y => RETURN[[y[t.e.bb[NARROW[bti, BodyIndex.y].e].level]]];
ENDCASE => ERROR;
};
ParentBody:
PUBLIC
PROC [stb: SymbolTableBase, bti: BodyIndex]
RETURNS [BodyIndex] = {
WITH stb
SELECT
FROM
t: SymbolTableBase.x => RETURN[[x[t.e.ParentBti[NARROW[bti, BodyIndex.x].e]]]];
t: SymbolTableBase.y => RETURN[[y[t.e.ParentBti[NARROW[bti, BodyIndex.y].e]]]];
ENDCASE => ERROR;
};
BodyName:
PUBLIC
PROC [stb: SymbolTableBase, cbti: CallableBodyIndex]
RETURNS [SymbolNameIndex] = {
RETURN [ISEName[stb,
WITH stb
SELECT
FROM
t: SymbolTableBase.x => [x[t.e.bb[
NARROW[cbti,
CallableBodyIndex.x].e].id]],
t: SymbolTableBase.y =>[y[t.e.bb[
NARROW[cbti,
CallableBodyIndex.y].e].id]]
ENDCASE => ERROR]];
};
RootBodyType:
PUBLIC
PROC [stb: SymbolTableBase]
RETURNS [SymbolIndex] =
{
WITH stb
SELECT
FROM
t: SymbolTableBase.x => RETURN[[x[t.e.bb[bx.rootBodyIndex].type]]];
t: SymbolTableBase.y => RETURN[[y[t.e.bb[by.rootBodyIndex].type]]];
ENDCASE => ERROR;
};
ISEInfo:
PUBLIC
PROC [stb: SymbolTableBase, isei: SymbolIdIndex]
RETURNS [SymbolIndex] = {
WITH stb
SELECT
FROM
t: SymbolTableBase.x => RETURN[[x[t.e.seb[NARROW[isei, SymbolIdIndex.x].e].idInfo]]];
t: SymbolTableBase.y => RETURN[[y[t.e.seb[NARROW[isei, SymbolIdIndex.y].e].idInfo]]];
ENDCASE => ERROR;
};
ISECtx:
PUBLIC
PROC [stb: SymbolTableBase, isei: SymbolIdIndex]
RETURNS [SymbolContextIndex] =
{
WITH stb
SELECT
FROM
t: SymbolTableBase.x => RETURN[[x[t.e.seb[NARROW[isei, SymbolIdIndex.x].e].idCtx]]];
t: SymbolTableBase.y => RETURN[[y[t.e.seb[NARROW[isei, SymbolIdIndex.y].e].idCtx]]];
ENDCASE => ERROR;
};
ISEFindExtension:
PUBLIC
PROC [stb: SymbolTableBase, isei: SymbolIdIndex]
RETURNS [ec: ExtensionClass, tl: TreeLink] =
{
WITH stb
SELECT
FROM
t: SymbolTableBase.x => {
ecx: bx.ExtensionClass;
tlx: bx.TreeLink;
[ecx, tlx] ← t.e.FindExtension[NARROW[isei, SymbolIdIndex.x].e];
ec ← [x[ecx]];
tl ← [x[tlx]]};
t: SymbolTableBase.y => {
ecy: by.ExtensionClass;
tly: by.TreeLink;
[ecy, tly] ← t.e.FindExtension[NARROW[isei, SymbolIdIndex.y].e];
ec ← [y[ecy]];
tl ← [y[tly]]};
ENDCASE => ERROR;
};
STBDirectoryCtx:
PUBLIC
PROC [stb: SymbolTableBase]
RETURNS [SymbolContextIndex] =
{
WITH stb
SELECT
FROM
t: SymbolTableBase.x => RETURN[[x[t.e.stHandle.directoryCtx]]];
t: SymbolTableBase.y => RETURN[[y[t.e.stHandle.directoryCtx]]];
ENDCASE => ERROR;
};
STBVersion:
PUBLIC
PROC [stb: SymbolTableBase]
RETURNS [BcdDefs.VersionStamp] =
{
WITH stb
SELECT
FROM
t: SymbolTableBase.x => RETURN[t.e.stHandle.version];
t: SymbolTableBase.y => RETURN[t.e.stHandle.version];
ENDCASE => ERROR;
};
STBSourceVersion:
PUBLIC
PROC [stb: SymbolTableBase]
RETURNS [BcdDefs.VersionStamp] =
{
WITH stb
SELECT
FROM
t: SymbolTableBase.x => RETURN[t.e.stHandle.sourceVersion];
t: SymbolTableBase.y => RETURN[t.e.stHandle.sourceVersion];
ENDCASE => ERROR;
};
ISEName:
PUBLIC
PROC [stb: SymbolTableBase, isei: SymbolIdIndex]
RETURNS [SymbolNameIndex] =
{
WITH stb
SELECT
FROM
t: SymbolTableBase.x => RETURN[[x[t.e.seb[NARROW[isei, SymbolIdIndex.x].e].hash]]];
t: SymbolTableBase.y => RETURN[[y[t.e.seb[NARROW[isei, SymbolIdIndex.y].e].hash]]];
ENDCASE => ERROR;
};
ISEPublic:
PUBLIC
PROC [stb: SymbolTableBase, isei: SymbolIdIndex]
RETURNS [
BOOL] =
{
WITH stb
SELECT
FROM
t: SymbolTableBase.x => RETURN[t.e.seb[NARROW[isei, SymbolIdIndex.x].e].public];
t: SymbolTableBase.y => RETURN[t.e.seb[NARROW[isei, SymbolIdIndex.y].e].public];
ENDCASE => ERROR;
};
SETypeXferMode:
PUBLIC
PROC [stb: SymbolTableBase, sei: SymbolIndex]
RETURNS [RTSymbolOps.Xfm] =
{
WITH stb
SELECT
FROM
t: SymbolTableBase.x =>
RETURN[
SELECT t.e.XferMode[
NARROW[sei, SymbolIndex.x].e]
FROM
none => none,
signal, error => signalOrError,
proc => proc,
ENDCASE => other];
t: SymbolTableBase.y =>
RETURN[
SELECT t.e.XferMode[
NARROW[sei, SymbolIndex.y].e]
FROM
none => none,
signal, error => signalOrError,
proc => proc,
ENDCASE => other];
ENDCASE => ERROR;
};
SETagIDP:
PUBLIC
PROC [stb: SymbolTableBase, sei: SymbolIndex]
RETURNS [
BOOL] = {
WITH stb
SELECT
FROM
t: SymbolTableBase.x =>
RETURN[
WITH t.e.seb[
NARROW[sei, SymbolIndex.x].e]
SELECT
FROM
id => TRUE,
ENDCASE => FALSE];
t: SymbolTableBase.y =>
RETURN[
WITH t.e.seb[
NARROW[sei, SymbolIndex.y].e]
SELECT
FROM
id => TRUE,
ENDCASE => FALSE];
ENDCASE => ERROR;
};
ISEExtended:
PUBLIC
PROC [stb: SymbolTableBase, isei: SymbolIdIndex]
RETURNS [
BOOL] =
{
WITH stb
SELECT
FROM
t: SymbolTableBase.x => RETURN[t.e.seb[NARROW[isei, SymbolIdIndex.x].e].extended];
t: SymbolTableBase.y => RETURN[t.e.seb[NARROW[isei, SymbolIdIndex.y].e].extended];
ENDCASE => ERROR;
};
ISEConstant:
PUBLIC
PROC [stb: SymbolTableBase, isei: SymbolIdIndex]
RETURNS [
BOOL] =
{
WITH stb
SELECT
FROM
t: SymbolTableBase.x => RETURN[t.e.seb[NARROW[isei, SymbolIdIndex.x].e].constant];
t: SymbolTableBase.y => RETURN[t.e.seb[NARROW[isei, SymbolIdIndex.y].e].constant];
ENDCASE => ERROR;
};
ISEImmutable:
PUBLIC
PROC [stb: SymbolTableBase, isei: SymbolIdIndex]
RETURNS [
BOOL] = {
WITH stb
SELECT
FROM
t: SymbolTableBase.x => RETURN[t.e.seb[NARROW[isei, SymbolIdIndex.x].e].immutable];
t: SymbolTableBase.y => RETURN[t.e.seb[NARROW[isei, SymbolIdIndex.y].e].immutable];
ENDCASE => ERROR;
};
IsTypeSEI:
PUBLIC
PROC [sei: SymbolIndex]
RETURNS [
BOOL] = {
WITH sei
SELECT
FROM
t: SymbolIndex.x => RETURN[t.e = bx.symbolIndexForTYPE];
t: SymbolIndex.y => RETURN[t.e = by.symbolIndexForTYPE];
ENDCASE => ERROR;
};
IsTransferConstructorSEI:
PUBLIC
PROC [stb: SymbolTableBase, sei: SymbolConstructorIndex]
RETURNS [
BOOL] = {
WITH stb
SELECT
FROM
t: SymbolTableBase.x =>
RETURN[t.e.seb[NARROW[sei, SymbolConstructorIndex.x].e].typeTag = transfer];
t: SymbolTableBase.y =>
RETURN[t.e.seb[NARROW[sei, SymbolConstructorIndex.y].e].typeTag = transfer];
ENDCASE => ERROR;
};
RSEVariant:
PUBLIC
PROC [stb: SymbolTableBase, rsei: SymbolRecordIndex]
RETURNS [
BOOL] =
{
WITH stb
SELECT
FROM
t: SymbolTableBase.x => RETURN[t.e.seb[NARROW[rsei, SymbolRecordIndex.x].e].hints.variant];
t: SymbolTableBase.y => RETURN[t.e.seb[NARROW[rsei, SymbolRecordIndex.y].e].hints.variant];
ENDCASE => ERROR;
};
STBDirectoryCTX:
PUBLIC
PROC [stb: SymbolTableBase]
RETURNS [SymbolContextIndex] = {
WITH stb
SELECT
FROM
t: SymbolTableBase.x => RETURN[[x[t.e.stHandle.directoryCtx]]];
t: SymbolTableBase.y => RETURN[[y[t.e.stHandle.directoryCtx]]];
ENDCASE => ERROR;
};
FirstCtxSe:
PUBLIC
PROC [stb: SymbolTableBase, ctx: SymbolContextIndex]
RETURNS [SymbolIdIndex] = {
WITH stb
SELECT
FROM
t: SymbolTableBase.x => RETURN[[x[t.e.FirstCtxSe[NARROW[ctx, SymbolContextIndex.x].e]]]];
t: SymbolTableBase.y => RETURN[[y[t.e.FirstCtxSe[NARROW[ctx, SymbolContextIndex.y].e]]]];
ENDCASE => ERROR;
};
NextSe:
PUBLIC
PROC [stb: SymbolTableBase, isei: SymbolIdIndex]
RETURNS [SymbolIdIndex] = {
WITH stb
SELECT
FROM
t: SymbolTableBase.x => RETURN[[x[t.e.NextSe[NARROW[isei, SymbolIdIndex.x].e]]]];
t: SymbolTableBase.y => RETURN[[y[t.e.NextSe[NARROW[isei, SymbolIdIndex.y].e]]]];
ENDCASE => ERROR;
};
NullISEI:
PUBLIC
PROC [isei: SymbolIdIndex]
RETURNS [
BOOL] = {
WITH isei
SELECT
FROM
t: SymbolIdIndex.x => RETURN[t.e = nullXSymbolIndex];
t: SymbolIdIndex.y => RETURN[t.e = nullYSymbolIndex];
ENDCASE => ERROR;
};
NullSEI:
PUBLIC
PROC [sei: SymbolIndex]
RETURNS [
BOOL] = {
WITH sei
SELECT
FROM
t: SymbolIndex.x => RETURN[t.e = nullXSymbolIndex];
t: SymbolIndex.y => RETURN[t.e = nullYSymbolIndex];
ENDCASE => ERROR;
};
NullBTI:
PUBLIC
PROC [bti: BodyIndex]
RETURNS [
BOOL] = {
WITH bti
SELECT
FROM
t: BodyIndex.x => RETURN[t.e = bx.nullBodyIndex];
t: BodyIndex.y => RETURN[t.e = by.nullBodyIndex];
ENDCASE => ERROR;
};
CallableBTI:
PUBLIC
PROC [stb: SymbolTableBase, bti: BodyIndex]
RETURNS [
BOOL] = {
WITH stb
SELECT
FROM
t: SymbolTableBase.x =>
RETURN[
WITH t.e.bb[
NARROW[bti, BodyIndex.x].e]
SELECT
FROM
Callable => TRUE,
ENDCASE => FALSE];
t: SymbolTableBase.y =>
RETURN[
WITH t.e.bb[
NARROW[bti, BodyIndex.y].e]
SELECT
FROM
Callable => TRUE,
ENDCASE => FALSE];
ENDCASE => ERROR;
};
IsRootBTI:
PUBLIC
PROC [bti: BodyIndex]
RETURNS [
BOOL] = {
WITH bti
SELECT
FROM
t: BodyIndex.x => RETURN[t.e = bx.rootBodyIndex];
t: BodyIndex.y => RETURN[t.e = by.rootBodyIndex];
ENDCASE => ERROR;
};
NullName:
PUBLIC
PROC [hti: SymbolNameIndex]
RETURNS [
BOOL] = {
WITH hti
SELECT
FROM
t: SymbolNameIndex.x => RETURN[t.e = nullXSymbolNameIndex];
t: SymbolNameIndex.y => RETURN[t.e = nullYSymbolNameIndex];
ENDCASE => ERROR;
};
NullCtx:
PUBLIC
PROC [ctx: SymbolContextIndex]
RETURNS [
BOOL] = {
WITH ctx
SELECT
FROM
t: SymbolContextIndex.x => RETURN[t.e = nullXSymbolContextIndex];
t: SymbolContextIndex.y => RETURN[t.e = nullYSymbolContextIndex];
ENDCASE => ERROR;
};
NullStb:
PUBLIC
PROC [stb: SymbolTableBase]
RETURNS [
BOOL] = {
WITH stb
SELECT
FROM
t: SymbolTableBase.x => RETURN[t.e = NIL];
t: SymbolTableBase.y => RETURN[t.e = NIL];
ENDCASE => ERROR;
};
NullSth:
PUBLIC
PROC [sth: SymbolTableHandle]
RETURNS [
BOOL] = {
WITH sth
SELECT
FROM
t: SymbolTableHandle.x => RETURN[t.e = bx.nullHandle];
t: SymbolTableHandle.y => RETURN[t.e = by.nullHandle];
ENDCASE => ERROR;
};
NullModuleIndex:
PUBLIC
PROC [mdi: SymbolModuleIndex]
RETURNS [
BOOL] = {
WITH mdi
SELECT
FROM
t: SymbolModuleIndex.x => RETURN[t.e = bx.nullModuleIndex];
t: SymbolModuleIndex.y => RETURN[t.e = by.nullModuleIndex];
ENDCASE => ERROR;
};
SubStringForName:
PUBLIC
PROC [stb: SymbolTableBase, hti: SymbolNameIndex]
RETURNS [ans: ConvertUnsafe.SubString] = {
WITH stb
SELECT
FROM
t: SymbolTableBase.x =>
ans ← t.e.SubStringForName[NARROW[hti, SymbolNameIndex.x].e];
t: SymbolTableBase.y =>
ans ← t.e.SubStringForName[NARROW[hti, SymbolNameIndex.y].e];
ENDCASE => ERROR;
};
STBToModuleName:
PUBLIC
PROC [stb: SymbolTableBase]
RETURNS [
ROPE]= {
FOR isei: SymbolIdIndex ← FirstCtxSe[stb, STBDirectoryCTX[stb]], NextSe[stb, isei]
UNTIL NullISEI[isei]
DO
IF ISEPublic[stb, isei]
THEN
RETURN[ConvertUnsafe.SubStringToRope[SubStringForName[stb, ISEName[stb, isei]]]];
ENDLOOP;
ERROR;
};
END.