home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / xco212p.zip / ISODEF / storage.def < prev    next >
Text File  |  1994-12-22  |  1KB  |  39 lines

  1. DEFINITION MODULE Storage;
  2.  
  3.   (* Facilities for dynamically allocating and deallocating storage *)
  4.  
  5. IMPORT SYSTEM;
  6.  
  7. PROCEDURE ALLOCATE (VAR addr: SYSTEM.ADDRESS; amount: CARDINAL);
  8.   (* Allocates storage for a variable of size amount and assigns the address of this
  9.      variable to addr. If there is insufficient unallocated storage to do this, the
  10.      value NIL is assigned to addr.
  11.   *)
  12.  
  13. PROCEDURE DEALLOCATE (VAR addr: SYSTEM.ADDRESS; amount: CARDINAL);
  14.   (* Deallocates amount locations allocated by ALLOCATE for the storage of the variable
  15.      addressed by addr and assigns the value NIL to addr.
  16.   *)
  17.  
  18. TYPE
  19.   StorageExceptions = (
  20.     nilDeallocation,             (* first argument to DEALLOCATE is NIL *)
  21.     pointerToUnallocatedStorage, (* storage to deallocate not allocated by ALLOCATE *)
  22.     wrongStorageToUnallocate     (* amount to deallocate is not amount allocated *)
  23.   );
  24.  
  25. PROCEDURE IsStorageException (): BOOLEAN;
  26.   (* Returns TRUE if the current coroutine is in the exceptional execution state
  27.      because of the raising of an exception from StorageExceptions;
  28.      otherwise returns FALSE.
  29.   *)
  30.  
  31. PROCEDURE StorageException (): StorageExceptions;
  32.   (* If the current coroutine is in the exceptional execution state because of the
  33.      raising of an exception from StorageExceptions, returns the corresponding
  34.      enumeration value, and otherwise raises an exception.
  35.   *)
  36.  
  37. END Storage.
  38.  
  39.