-- LoadStateOps.mesa
-- Last Modified by Sandman,  June 30, 1980  4:59 PM 
-- Copyright  Xerox Corporation 1979, 1980

DIRECTORY
  AltoFileDefs USING [FP],
  BcdOps USING [BcdBase],
  ControlDefs USING [GFTIndex],
  LoadStateFormat USING [
    ConfigIndex, LoadState, ModuleInfo, ModuleTable, NullConfig],
  SegmentDefs USING [FileSegmentHandle];

LoadStateOps: DEFINITIONS =
  BEGIN OPEN ControlDefs, SegmentDefs, LoadStateFormat;

  ConfigIndex: TYPE = LoadStateFormat.ConfigIndex;
  NullConfig: ConfigIndex = LoadStateFormat.NullConfig;

  MapConfigToReal: PROCEDURE [cgfi: GFTIndex, config: ConfigIndex]
    RETURNS [rgfi: GFTIndex];
  MapRealToConfig: PROCEDURE [rgfi: GFTIndex]
    RETURNS [cgfi: GFTIndex, config: ConfigIndex];
  EnterModule: PROCEDURE [rgfi: GFTIndex, module: ModuleInfo];
  GetModule: PROCEDURE [rgfi: GFTIndex] RETURNS [module: ModuleInfo];

  Map: TYPE = DESCRIPTOR FOR ARRAY OF GFTIndex;

  GetMap: PROCEDURE [config: ConfigIndex] RETURNS [map: Map];
  ReleaseMap: PROCEDURE [map: Map];

  InputLoadState: PROCEDURE RETURNS [nbcds: ConfigIndex];
  ForceDirty: PROCEDURE = INLINE BEGIN dirty ← TRUE END;

  ReleaseLoadState: PROCEDURE;
  UpdateLoadState: PROCEDURE [config: ConfigIndex, bcd: BcdOps.BcdBase];
  RemoveConfig: PROCEDURE [map: Map, config: ConfigIndex];
  LoadStateInvalid: SIGNAL;
  LoadStateFull: SIGNAL;

  AcquireBcd: PROCEDURE [config: ConfigIndex] RETURNS [bcd: BcdOps.BcdBase];
  ReleaseBcd: PROCEDURE [bcd: BcdOps.BcdBase];
  BcdUnresolved: PROCEDURE [bcd: ConfigIndex] RETURNS [BOOLEAN];
  BcdExports: PROCEDURE [bcd: ConfigIndex] RETURNS [BOOLEAN];
  BcdExportsTypes: PROCEDURE [bcd: ConfigIndex] RETURNS [BOOLEAN];

  EnumerationDirection: TYPE = {recentfirst, recentlast};

  EnumerateModules: PROCEDURE [
    proc: PROCEDURE [rgfi: GFTIndex, module: ModuleInfo] RETURNS [BOOLEAN]]
    RETURNS [GFTIndex];
  EnumerateBcds: PROCEDURE [
    dir: EnumerationDirection, proc: PROCEDURE [ConfigIndex] RETURNS [BOOLEAN]]
    RETURNS [config: ConfigIndex];

  -- Alto specific operations

  state, initstate: FileSegmentHandle;
  loadstate: LoadState;
  gft: ModuleTable;
  dirty: BOOLEAN;

  GetBcdInfo: PROCEDURE [config: ConfigIndex]
    RETURNS [fp: POINTER TO AltoFileDefs.FP, base, pages: CARDINAL];
  SetBcdInfo: PROCEDURE [
    config: ConfigIndex, fp: POINTER TO AltoFileDefs.FP, base, pages: CARDINAL];

  END....