-- File: CacheOps.Mesa
-- Last edited by Sandman; July 10, 1980  7:37 AM
-- Copyright  Xerox Corporation 1979, 1980

DIRECTORY
  AllocDefs USING [SwappingProcedure],
  AltoDefs USING [PageNumber],
  AltoFileDefs USING [vDA],
  SegmentDefs USING [FileHandle, FileSegmentHandle];

CacheOps: DEFINITIONS =
  BEGIN
  
  CoreSegmentObject: TYPE = RECORD [
    segment: SegmentDefs.FileSegmentHandle, old: BOOLEAN, page: [0..256)];
  
  CoreSegment: TYPE = POINTER TO CoreSegmentObject;
  
  PageNumber: TYPE = AltoDefs.PageNumber;
  vDA: TYPE = AltoFileDefs.vDA;
  PageItem: TYPE = RECORD [page: PageNumber, da: vDA];
  PageItemPtr: TYPE = POINTER TO PageItem;
  
  Init: PROCEDURE [name: STRING, firstPage, lastPage: PageNumber];
  Close: PROCEDURE;
  Flush: AllocDefs.SwappingProcedure;
  NewCoreSegment: PROCEDURE [p: POINTER TO PageItem, cs: CoreSegment];
  GetCS: PROCEDURE [p: PageItem] RETURNS [SegmentDefs.FileSegmentHandle];
  BadReadWrite: ERROR;
  GetPageItem: PROCEDURE [page: CARDINAL] RETURNS [p: PageItem];
  SetPageItem: PROCEDURE [page: CARDINAL, p: PageItem];
  
  GetCoreFile: PROCEDURE RETURNS [SegmentDefs.FileHandle];
  SetCoreFile: PROCEDURE [file: SegmentDefs.FileHandle];
  
  READ: PROCEDURE [UNSPECIFIED] RETURNS [UNSPECIFIED];
  WRITE: PROCEDURE [a, v: UNSPECIFIED];
  CopyRead: PROCEDURE [from, to: POINTER, size: CARDINAL];
  CopyWrite: PROCEDURE [from, to: POINTER, size: CARDINAL];
  
  SetDefaultCacheSize: PROCEDURE [CARDINAL];
  
  Cache: PROGRAM;
  
  END.