-- BcdUtilDefs.Mesa
-- Last edited by Satterthwaite on June 15, 1982 9:06 am
-- Last edited by Lewis on 16-Dec-80 10:42:45

DIRECTORY
  Alloc: TYPE USING [Handle],
  BcdDefs: TYPE USING [
    CTIndex, EXPIndex, FPIndex, FTIndex, GFTIndex, IMPIndex, MTIndex,
    Namee, NameRecord, NTIndex, SGIndex, SGRecord,
    SPIndex, TMIndex, TYPIndex, VersionStamp],
  BcdOps: TYPE USING [NameString],
  Symbols: TYPE USING [CXIndex, HTIndex, STIndex],
  Strings: TYPE USING [String, SubString],
  Table: TYPE USING [Base],
  Tree: TYPE USING [Link];

BcdUtilDefs: DEFINITIONS = {
  OPEN BcdDefs;

  HTIndex: TYPE ~ Symbols.HTIndex;

  BcdBasePtr: TYPE ~ LONG POINTER TO BcdBases;
  BcdBases: TYPE ~ RECORD [
    ctb, mtb, lfb, rfb, tfb, etb, itb, sgb, ftb, evb, tyb, tmb, ntb, spb, fpb: Table.Base,
    ssb: BcdOps.NameString];

  BcdLimitPtr: TYPE ~ LONG POINTER TO BcdLimits;
  BcdLimits: TYPE ~ RECORD [
    ft: FTIndex,
    ct: CTIndex,
    mt: MTIndex,
    et: EXPIndex,
    it: IMPIndex,
    sg: SGIndex,
    nt: NTIndex,
    tm: TMIndex,
    sp: SPIndex,
    fp: FPIndex];

 -- bcd-specific operations
 
  EnterConfig: PROC [bcd: BcdBasePtr, oldCti: CTIndex, name: HTIndex]
    RETURNS [cti: CTIndex];
  EnterExport: PROC [bcd: BcdBasePtr, oldEti: EXPIndex, copyName: BOOL]
    RETURNS [eti: EXPIndex];
  EnterFramePack: PROC [bcd: BcdBasePtr, oldFpi: FPIndex]
    RETURNS [fpi: FPIndex];
  EnterImport: PROC [bcd: BcdBasePtr, oldIti: IMPIndex, copyName: BOOL]
    RETURNS [iti: IMPIndex];
  EnterModule: PROC [bcd: BcdBasePtr, oldMti: MTIndex, name: HTIndex]
    RETURNS [mti: MTIndex];
  EnterSpace: PROC [bcd: BcdBasePtr, oldSpi: SPIndex]
    RETURNS [spi: SPIndex];
  EnterType: PROC [bcd: BcdBasePtr, oldTypi: TYPIndex]
    RETURNS [typi: TYPIndex];
  EnterTypeMap: PROC [bcd: BcdBasePtr, oldTmi: TMIndex]
    RETURNS [tmi: TMIndex];

  HtiForName: PROC [bcd: BcdBasePtr, n: NameRecord] RETURNS [HTIndex];
  MapName: PROC [bcd: BcdBasePtr, n: NameRecord] RETURNS [NameRecord];
  MergeFile: PROC [bcd: BcdBasePtr, oldFti: FTIndex] RETURNS [fti: FTIndex];

 -- other operations
 
  EnterName: PROC [ss: Strings.SubString] RETURNS [NameRecord];
  NameForHti: PROC [hti: HTIndex] RETURNS [NameRecord];
  NameForSti: PROC [sti: Symbols.STIndex] RETURNS [NameRecord];
  
  EnterFile: PROC [name: Strings.String] RETURNS [fti: FTIndex];
  SetFileVersion: PROC [fti: FTIndex, v: BcdDefs.VersionStamp];
  FileForVersion: PROC [v: BcdDefs.VersionStamp] RETURNS [fti: FTIndex];
  EqVersions: PROC [fti1, fti2: FTIndex] RETURNS [BOOL];
  EquivalentVersions: PROC [v1, v2: BcdDefs.VersionStamp] RETURNS [BOOL];
  
  GftOverflow: SIGNAL;
  GetGfi: PROC [n: CARDINAL] RETURNS [gfi: GFTIndex];
  GetDummyGfi: PROC [n: CARDINAL] RETURNS [gfi: CARDINAL];
  
  NewContext: PROC RETURNS [cxi: Symbols.CXIndex];
  ContextForTree: PROC [t: Tree.Link] RETURNS [Symbols.CXIndex];
  NewSemanticEntry: PROC [hti: HTIndex] RETURNS [sti: Symbols.STIndex];
  
  CreateInstanceName: PROC [hti: HTIndex, item: Namee];
  InstanceName: PROC [item: Namee] RETURNS [NameRecord];

  EnterSegment: PROC [seg: SGRecord] RETURNS [sgi: SGIndex];

  -- Administrative Procedures

  Init: PROC [Alloc.Handle];
  Reset: PROC;

  }.