-- file SymbolOps.Mesa
-- last modified by Satterthwaite, February 11, 1979  9:44 PM

DIRECTORY
  StringDefs: FROM "stringdefs" USING [SubString],
  Symbols: FROM "symbols",
  Tree: FROM "tree" USING [Link];

SymbolOps: DEFINITIONS =
  BEGIN
  OPEN Symbols;

-- implemented by SymbolPack

 -- hash manipulation
  FindString: PROCEDURE [StringDefs.SubString] RETURNS [HTIndex];
  HashValue: PROCEDURE [StringDefs.SubString] RETURNS [HVIndex];
  SubStringForHash: PROCEDURE [StringDefs.SubString, HTIndex];

 -- context management
  CtxEntries: PROCEDURE [CTXIndex] RETURNS [CARDINAL];
  FirstCtxSe: PROCEDURE [CTXIndex] RETURNS [ISEIndex];
  NextSe: PROCEDURE [ISEIndex] RETURNS [ISEIndex];
  SearchContext: PROCEDURE [hti: HTIndex, ctx: CTXIndex] RETURNS [ISEIndex];

 -- type manipulation
  NormalType: PROCEDURE [CSEIndex] RETURNS [CSEIndex];
  RecordLink: PROCEDURE [RecordSEIndex] RETURNS [RecordSEIndex];
  RecordRoot: PROCEDURE [RecordSEIndex] RETURNS [RecordSEIndex];
  TransferTypes: PROCEDURE [SEIndex] RETURNS [typeIn, typeOut: RecordSEIndex];
  TypeForm: PROCEDURE [SEIndex] RETURNS [TypeClass];
  TypeLink: PROCEDURE [SEIndex] RETURNS [SEIndex];
  TypeRoot: PROCEDURE [SEIndex] RETURNS [CSEIndex];
  UnderType: PROCEDURE [SEIndex] RETURNS [CSEIndex];
  XferMode: PROCEDURE [SEIndex] RETURNS [TransferMode];

 -- information returning procedures
  BitsForRange: PROCEDURE [CARDINAL] RETURNS [CARDINAL];
  BitsForType: PROCEDURE [SEIndex] RETURNS [CARDINAL];
  Cardinality: PROCEDURE [SEIndex] RETURNS [CARDINAL];
  FindExtension: PROCEDURE [sei: ISEIndex]
    RETURNS [type: ExtensionType, tree: Tree.Link];
  FnField: PROCEDURE [ISEIndex] RETURNS [offset: BitAddress, size: CARDINAL];
  LinkMode: PROCEDURE [sei: ISEIndex] RETURNS [Linkage];
  WordsForType: PROCEDURE [SEIndex] RETURNS [CARDINAL];


-- implemented by SymbolPackExt (extensions for building tables)

  Initialize, Finalize: PROCEDURE; 

 -- hash manipulation
  EnterString: PROCEDURE [StringDefs.SubString] RETURNS [HTIndex];
  HashBlock: PROCEDURE RETURNS [base: POINTER, length: CARDINAL];

 -- context management
  NextLevel: PROCEDURE [ContextLevel] RETURNS [ContextLevel];
  NewCtx: PROCEDURE [ContextLevel] RETURNS [CTXIndex];
  ResetCtxList: PROCEDURE [CTXIndex];
  FirstVisibleSe: PROCEDURE[CTXIndex] RETURNS [ISEIndex];
  VisibleCtxEntries: PROCEDURE [CTXIndex] RETURNS [CARDINAL];
  ContextVariant: PROCEDURE [CTXIndex] RETURNS [ISEIndex];

  StaticNestError: SIGNAL;

  MakeCtxSe: PROCEDURE [hti: HTIndex, ctx: CTXIndex] RETURNS [ISEIndex];
  MakeNonCtxSe: PROCEDURE [CARDINAL] RETURNS [CSEIndex];

  MakeSeChain: PROCEDURE [CTXIndex, CARDINAL, BOOLEAN] RETURNS [ISEIndex];
  FillCtxSe: PROCEDURE [ISEIndex, HTIndex, BOOLEAN];
  NameClash: SIGNAL [hti: HTIndex];
  EnterExtension: PROCEDURE [sei: ISEIndex, type: ExtensionType, tree: Tree.Link];
  SetSeLink: PROCEDURE [sei, next: ISEIndex];

  ConstantId: PROCEDURE [ISEIndex] RETURNS [BOOLEAN];

 -- body table utilities
  ParentBti: PROCEDURE [BTIndex] RETURNS [BTIndex];
  LinkBti: PROCEDURE [bti, parent: BTIndex];
  DelinkBti: PROCEDURE [BTIndex];

  END.