-- file Copier.Mesa
-- last modified by Satterthwaite, February 18, 1983 9:19 am

DIRECTORY
  Alloc: TYPE USING [Handle],
  FileParms: TYPE USING [ActualId, Ops],
  Strings: TYPE USING [String],
  Symbols: TYPE,
  SymbolTable: TYPE USING [Base, Handle],
  TimeStamp: TYPE USING [Stamp];

Copier: DEFINITIONS = {
  OPEN Symbols;

  SEToken: TYPE [1];
  nullSEToken: READONLY SEToken;

 -- implemented by FilePack

  FileInit: PROC [
    self: FileParms.ActualId,
    ownTable: Alloc.Handle, scratchZone: UNCOUNTED ZONE,
    ops: FileParms.Ops];
  FileReset: PROC;

  CreateFileTable: PROC [CARDINAL];
  EnterFile: PROC [formalId, typeId: HTIndex, defaultFile: Strings.String] RETURNS [MDIndex];
  FindMdEntry: PROC [id: HTIndex, version: TimeStamp.Stamp, file: HTIndex]
    RETURNS [MDIndex];
  FreeSymbolTable: PROC [SymbolTable.Base];
  GetSymbolTable: PROC [MDIndex] RETURNS [SymbolTable.Base];
  MapSymbols: PROC [FileParms.ActualId] RETURNS [SymbolTable.Base];
  TableForModule: PROC [MDIndex] RETURNS [SymbolTable.Handle]; 
  UnmapSymbols: PROC [SymbolTable.Base];
  
  FileProblem: SIGNAL [hti: HTIndex] RETURNS [BOOL];
  FileVersion: SIGNAL [hti: HTIndex] RETURNS [BOOL];
  FileVersionMix: SIGNAL [hti: HTIndex];

 -- implemented by SymbolCopier

  CopierInit: PROC [
    ownTable: Alloc.Handle, symbolCachePages: CARDINAL, useMemo: BOOL←TRUE];
  CopierReset: PROC;

  AugmentContext: PROC [IncludedCTXIndex, MDIndex];
  CompleteContext: PROC [ctx: IncludedCTXIndex, depth: Closure←unit];
  CopyExternalBody: PROC [MDIndex, CBTIndex] RETURNS [CBTIndex];
  CopySymbol: PROC [mdi: MDIndex, iSei: SEIndex, depth: Closure←full] RETURNS [sei: SEIndex];
  CopyUnion: PROC [ctx: CTXIndex, depth: Closure←none];
  CtxFirst: PROC [CTXIndex] RETURNS [SEToken];
  CtxNext: PROC [CTXIndex, SEToken] RETURNS [SEToken];
  CtxValue: PROC [CTXIndex, CARDINAL] RETURNS [SEToken];
  Delink: PROC [ISEIndex];
  FillModule: PROC [sei: ISEIndex, typeId: HTIndex, mdi: MDIndex];
  FindExternalCtx: PROC [MDIndex, CTXIndex] RETURNS [IncludedCTXIndex];
  Outer: PROC [mdi: MDIndex, inner: PROC [SymbolTable.Base]];
  SearchFileCtx: PROC [HTIndex, IncludedCTXIndex] RETURNS [BOOL, ISEIndex];
  TokenHash: PROC [CTXIndex, SEToken] RETURNS [HTIndex];
  TokenSymbol: PROC [CTXIndex, SEToken] RETURNS [ISEIndex];
  TokenValue: PROC [CTXIndex, SEToken] RETURNS [CARDINAL];

  TableRelocated: SIGNAL;
  UnknownModule: SIGNAL [hti: HTIndex];

  }.