-- Region.Mesa  Edited by Sandman on June 30, 1980  5:01 PM
-- Copyright  Xerox Corporation 1979, 1980

DIRECTORY
  AllocDefs USING [SwappingProcedure],
  SegmentDefs USING [AllocInfo, BankIndex, PageNumber, SegmentHandle];

Region: DEFINITIONS =
  BEGIN OPEN SegmentDefs;

  MaxRegionPage: CARDINAL = 377B;
  PagesPerRegion: CARDINAL = MaxRegionPage + 1;

  Page: TYPE = [0..MaxRegionPage];
  Count: TYPE = [0..PagesPerRegion];

  PageStatus: TYPE = {inuse, busy, free};

  Index: TYPE = BankIndex;

  Object: TYPE = RECORD [
    basePage: CARDINAL,
    alloc: PROCEDURE [
      base: PageNumber, pages: Count, info: AllocInfo, anyWhere: BOOLEAN]
      RETURNS [success: BOOLEAN, page: Page],
    update: PROCEDURE [
      base: Page, pages: Count, seg: SegmentHandle, simple: BOOLEAN],
    available: PROCEDURE [page: Page, info: AllocInfo] RETURNS [BOOLEAN],
    status: PROCEDURE [page: Page]
      RETURNS [seg: SegmentHandle, status: PageStatus],
    swap: AllocDefs.SwappingProcedure,
    disable: PROCEDURE [abandon: BOOLEAN],
    hole: Count];

  Handle: TYPE = POINTER TO Region.Object;

  Node: TYPE = POINTER TO NodeObject;

  NodeObject: TYPE = RECORD [
    base, pages: CARDINAL, fwd: Node, back: Node, seal: CARDINAL ← NodeSeal];

  NodeSeal: CARDINAL = 111222B;

  InvalidNode: ERROR [node: UNSPECIFIED];

  HyperRegion: PROGRAM [region: Region.Index] RETURNS [Region.Handle];

  END.....