dos_compilers/Logitech Modula-2 v1.1/STORAGE.DEF
2024-06-30 15:43:04 -07:00

79 lines
1.8 KiB
Plaintext
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(* Version 1.10, Nov 1984 *)
DEFINITION MODULE Storage;
(*
Standard dynamic storage management
Storage management for dynamic variables. Calls to the
Modula-2 standard procedures NEW and DISPOSE are
translated into calls to ALLOCATE and DEALLOCATE. The
standard way to provide these two procedures is to
import them from this module 'Storage'.
Derived from the Lilith Modula-2 system developed by the
group of Prof. N. Wirth at ETH Zurich, Switzerland.
*)
FROM SYSTEM IMPORT ADDRESS;
EXPORT QUALIFIED
ALLOCATE, DEALLOCATE, Available,
InstallHeap, RemoveHeap;
PROCEDURE ALLOCATE (VAR a: ADDRESS; size: CARDINAL);
(*
- Allocate some dynamic storage (contiguous memory area).
in: size number of bytes to allocate,
out: a ADDRESS of allocated storage.
The actual number of bytes allocated may be slightly
greater than 'size', due to administrative overhead.
Errors: If not enough space is available, or when
attempting to allocate more than 65520 (0FFF0H)
bytes at once, then the calling program is terminated
with the status 'heapovf'.
*)
PROCEDURE DEALLOCATE (VAR a: ADDRESS; size: CARDINAL);
(*
- Release some dynamic storage (contiguous memory area).
in: a ADDRESS of the area to release,
size number of bytes to be released,
out: a set to NIL.
The storage area released is made available for subsequent
calls to ALLOCATE.
*)
PROCEDURE Available (size: CARDINAL) : BOOLEAN;
(*
- Test whether some number of bytes could be allocated.
in: size number of bytes
out: TRUE if ALLOCATE (p, size) would succeed.
*)
PROCEDURE InstallHeap;
(*
- Used internally by the loader
*)
PROCEDURE RemoveHeap;
(*
- Used internally by the loader
*)
END Storage.