-- file LongSpaces.Mesa
-- last edited by Satterthwaite, March 5, 1981  2:54 PM

DIRECTORY
  Environment USING [wordsPerPage],
  LongStorage: TYPE USING [Free, FreeString, FreeWords, Node, Pages, String, Words];

Spaces: DEFINITIONS IMPORTS LongStorage = {

  Address: TYPE = LONG POINTER;

  Node: PROC [nwords: CARDINAL] RETURNS [p: Address] = INLINE {
    RETURN [LongStorage.Node[nwords]]};
  String: PROC [nchars: CARDINAL] RETURNS [s: LONG STRING] = INLINE {
    RETURN [LongStorage.String[nchars]]};
  Pages: PROC [npages: CARDINAL] RETURNS [base: Address] = INLINE {
    RETURN [LongStorage.Pages[npages]]};
  Words: PROC [nwords: CARDINAL] RETURNS [base: Address] = INLINE {
    RETURN [LongStorage.Words[nwords]]};
  
  Free: PROC [p: Address] = INLINE {LongStorage.Free[p]};
  FreeString: PROC [s: LONG STRING] = INLINE {LongStorage.FreeString[s]};
  FreePages, FreeWords: PROC [base: Address] = INLINE {LongStorage.FreeWords[base]};

  PagesForWords: PROC [nWords: CARDINAL] RETURNS [CARDINAL] = INLINE {
    RETURN[(nWords + (Environment.wordsPerPage-1))/Environment.wordsPerPage]};
    
  }.