-- file: SystemDefs.Mesa; edited by Sandman on June 30, 1980  5:06 PM
-- Copyright  Xerox Corporation 1979, 1980

DIRECTORY
  AltoDefs USING [PageSize],
  FSPDefs USING [ZonePointer];

SystemDefs: DEFINITIONS =
  BEGIN

  -- page allocation/deallocation


  PagesForWords: PROCEDURE [nwords: CARDINAL] RETURNS [CARDINAL] = INLINE
    BEGIN RETURN[(nwords + AltoDefs.PageSize - 1)/AltoDefs.PageSize] END;

  AllocatePages: PROCEDURE [npages: CARDINAL] RETURNS [base: POINTER];
  AllocateResidentPages: PROCEDURE [npages: CARDINAL] RETURNS [base: POINTER];
  FreePages: PROCEDURE [base: POINTER];

  AllocateSegment: PROCEDURE [nwords: CARDINAL] RETURNS [base: POINTER];
  AllocateResidentSegment: PROCEDURE [nwords: CARDINAL] RETURNS [base: POINTER];
  SegmentSize: PROCEDURE [base: POINTER] RETURNS [nwords: CARDINAL];
  FreeSegment: PROCEDURE [base: POINTER];

  -- heap allocation/deallocation


  HeapZone: PROCEDURE RETURNS [FSPDefs.ZonePointer];

  AllocateHeapNode: PROCEDURE [nwords: CARDINAL] RETURNS [p: POINTER];
  FreeHeapNode: PROCEDURE [p: POINTER];

  AllocateHeapString: PROCEDURE [nchars: CARDINAL] RETURNS [STRING];
  FreeHeapString: PROCEDURE [s: STRING];
  CopyString: PROCEDURE [s: STRING, longer: CARDINAL ← 0] RETURNS [STRING];
  ExpandString: PROCEDURE [s: POINTER TO STRING, longer: CARDINAL];

  PruneHeap: PROCEDURE RETURNS [BOOLEAN];

  -- alignment routines


  Even: PROCEDURE [u: UNSPECIFIED] RETURNS [UNSPECIFIED];
  Quad: PROCEDURE [u: UNSPECIFIED] RETURNS [UNSPECIFIED];

  END.