(*======================================================================*)
(*                   Amiga Modula-2 support routines                    *)
(*======================================================================*)
(*      Version: 1.00           Author : Dennis Brueni                  *)
(*      Date   : 08-03-91       Changes: Original                       *)
(*======================================================================*)
(* FStorage implements a Freelist based storage strategy which works to *)
(* minimize calls to the system allocate and deallocate procedures.     *)
(* For storage requests under 512 bytes, it will use the FreeLists, for *)
(* larger requests, it will directly use the Amiga AllocMem or FreeMem. *)
(* On non-amiga systems, it will use the Storage module in these cases  *)
(*======================================================================*)

DEFINITION MODULE FStorage;

IMPORT SYSTEM;

(*----------------------------------------------------------------------*)
(*  ALLOCATE    Allocate a contiguous block of memory                   *)
(*                                                                      *)
(*  PARAMETERS  addr --   Variable to receive the address of the        *)
(*                        allocated memory block.  Will contain NIL if  *)
(*                        there was not enough memory.                  *)
(*              amount -- Amount of memory to allocate in bytes.        *)
(*----------------------------------------------------------------------*)

PROCEDURE ALLOCATE(VAR addr:SYSTEM.ADDRESS; amount: LONGCARD);

(*----------------------------------------------------------------------*)
(*  DEALLOCATE  Return a memory block to the system.                    *)
(*                                                                      *)
(*  PARAMETERS  addr -- Address of a memory block, obtained from NEW(). *)
(*              amnt -- the amount to deallocate                        *)
(*----------------------------------------------------------------------*)

PROCEDURE DEALLOCATE(VAR addr:SYSTEM.ADDRESS; amnt: LONGCARD);

(*----------------------------------------------------------------------*)
(*  DUPLICATE   Easy way to obtain a pointer to a new copy of something *)
(*----------------------------------------------------------------------*)

PROCEDURE DUPLICATE(block: ARRAY OF SYSTEM.BYTE):SYSTEM.ADDRESS;

(*----------------------------------------------------------------------*)
(*  DISPOSEALL  Return all memory allocated                             *)
(*----------------------------------------------------------------------*)

PROCEDURE DISPOSEALL;

END FStorage.
