dos_compilers/Logitech Modula-2 v1/STORAGE.DEF
2024-06-30 15:16:10 -07:00

54 lines
1.5 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.

DEFINITION MODULE Storage;
(*
Standard dynamic storage management
Derived from the Lilith Modula-2 system developed by the
group of Prof. N. Wirth at ETH Zurich, Switzerland.
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'.
*)
FROM SYSTEM IMPORT ADDRESS;
EXPORT QUALIFIED
ALLOCATE, DEALLOCATE, Available, InstallHeap, RemoveHeap;
PROCEDURE ALLOCATE (VAR a: ADDRESS; size: CARDINAL);
(*- Allocate some dynamic storage.
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.
If not enough space is available, the calling program is
terminated with the status 'heapovf'.
*)
PROCEDURE DEALLOCATE (VAR a: ADDRESS; size: CARDINAL);
(*- Release some dynamic storage.
in: a ADDRESS of the area to release,
size number of bytes to be released,
out: a set to NIL.
*)
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 by the loader -*)
PROCEDURE RemoveHeap;
(*- Used by the loader -*)
END Storage.