-- file Copier.Mesa
-- last modified by Satterthwaite, February 24, 1983 12:49 pm

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: Name, defaultFile: Strings.String] RETURNS [MDIndex];
  FindMdEntry: PROC [id: Name, version: TimeStamp.Stamp, file: Name]
    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 [name: Name] RETURNS [BOOL];
  FileVersion: SIGNAL [name: Name] RETURNS [BOOL];
  FileVersionMix: SIGNAL [name: Name];

 -- 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: Name, mdi: MDIndex];
  FindExternalCtx: PROC [MDIndex, CTXIndex] RETURNS [IncludedCTXIndex];
  Outer: PROC [mdi: MDIndex, inner: PROC [SymbolTable.Base]];
  SearchFileCtx: PROC [Name, IncludedCTXIndex] RETURNS [BOOL, ISEIndex];
  TokenName: PROC [CTXIndex, SEToken] RETURNS [Name];
  TokenSymbol: PROC [CTXIndex, SEToken] RETURNS [ISEIndex];
  TokenValue: PROC [CTXIndex, SEToken] RETURNS [CARDINAL];

  TableRelocated: SIGNAL;
  UnknownModule: SIGNAL [name: Name];

  }.