DEFINITION MODULE PStorage;

FROM SYSTEM IMPORT ADDRESS;

EXPORT QUALIFIED ALLOCATE, DEALLOCATE, tNew, tClearTo;

PROCEDURE ALLOCATE(VAR A : ADDRESS;  N : CARDINAL);

PROCEDURE DEALLOCATE(VAR A : ADDRESS;  N : CARDINAL);

PROCEDURE tNew(size : CARDINAL): ADDRESS;
(* A block is allocated 'temporarily' on a stack.  This is cheaper than
   ALLOCATE.  Many blocks can be deallocated by one call to tClearTo.
*)

PROCEDURE tClearTo(A : ADDRESS);
(* Free all temporary storage occupied by the object at A and objects
   allocated by tNew AFTER the object at A was allocated.  A MUST be an
   address known in the stack of temporary storage blocks, otherwise the
   whole temporary stack is cleared.  tClearTo(NIL) deallocates all
   temporarily allocated objects.
*)

END PStorage.
