ETHZ_Logo RAMSES_Logo_Right   RAMSES   RAMSES_Logo_Left Systems Ecology  
Start    search button      Modules:   A-Z   Function   Layer        QuickRefs:   DM   AuxLib   AuxLibE   SciLib   EasyMW   MW   ISIS   RMSLib

DEFINITION MODULE DMStorage;

  (*******************************************************************

    Module  DMStorage     ('Dialog Machine' DM_V3.0)

      Copyright (c) 1989-2006 by Andreas Fischlin and ETH Zurich.

    Purpose   Dynamic heap allocation on any subprogram
              level for 'Dialog Machine' client programs.

    Remarks   Use only these routines to allocate resp. deallocate
              heap blocks, not the routines from the MacMETH module
              System in order to ensure correct functioning of heap
              management.  Blocks not deallocated by the calling
              program will be deallocated automatically upon exiting
              the calling program level.

              This module belongs to the 'Dialog Machine'.


    Programming

      o Design
        Andreas Fischlin          22/11/1989

      o Implementation
        Andreas Fischlin          22/11/1989


    ETH Zurich
    Systems Ecology
    CHN E 35.1
    Universitaetstrasse 16
    8092 Zurich
    SWITZERLAND

    URLs:
        <mailto:RAMSES@env.ethz.ch>
        <http://www.sysecol.ethz.ch>
        <http://www.sysecol.ethz.ch/SimSoftware/RAMSES>


    Last revision of definition:  27/08/1990  AF

  *******************************************************************)


  FROM SYSTEM IMPORT ADDRESS;

  PROCEDURE Allocate(VAR p: ADDRESS; size: LONGINT);
  (*
    Allocates on the current Dialog Machine level a heap block of
    the given size and assigns the starting address to p.  In case
    no more memory is available p becomes NIL. WARNING: No error
    message is issued, so test in the calling program always
    whether NIL has been assigned.
  *)

  PROCEDURE Deallocate(VAR p: ADDRESS);
  (*
    Deallocates on the current Dialog Machine level the memory
    block to which p points. The block must have been allocated by
    a previous and successful call to either one of the procedures
    Allocate or AllocateOnLevel from this module only. If the
    calling program does not call this routine before terminating,
    DMStorage does automatically release the occupied memory upon
    termination of the subprogram level on which the calling
    program resides.
  *)


  PROCEDURE AllocateOnLevel (VAR p: ADDRESS; size: LONGINT; level: INTEGER);
  (*
    Allocates on (sub)program level level a heap block of the given
    size and assigns the starting address to p.  In case no more
    memory is available p becomes NIL. WARNING: No error message is
    issued, so test in the calling program always whether NIL has
    been assigned.
  *)

  PROCEDURE DeallocateOnLevel (VAR p: ADDRESS; level: INTEGER);
  (*
    Deallocates on (sub)program level level the heap block memory
    block to which p points.  The block must have been allocated by
    a previous and successful call to either one of the procedures
    Allocate or AllocateOnLevel from this module only. If the
    calling program does not call this routine before terminating,
    DMStorage does automatically release the occupied memory upon
    termination of the subprogram level on which the calling
    program resides.
  *)


  (* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
    The following two procedures are just exported for
    compatibility reasons with the IBM PC version of the Dialog
    Machine.  They act exactly as the ones above, i.e. the second
    parameter in DEALLOCATE is ignored.
   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = *)

  PROCEDURE ALLOCATE (VAR p: ADDRESS; size: CARDINAL);
  PROCEDURE DEALLOCATE (VAR p: ADDRESS; size: CARDINAL);

END DMStorage.

  Contact RAMSES@env.ethz.ch Last updated: 25-Jul-2011 [Top of page]