english
version "1.0"
identify "%Z%%M% %I% %E%"
#: Copyright (c) 1995, 2002 by Wayne C. Gramlich.
#, All rights reserved.
#,
#, Permission to use, copy, modify, distribute, and sell this software
#, for any purpose is hereby granted without fee provided that the above
#, copyright notice and this permission are retained. The author makes
#, no representations about the suitability of this software for any purpose.
#, It is provided "as is" without express or implied warranty.
module manage
#: This module implements the {manage
} storage management type.
define manage[object] #: Storage manager for {object
}'s
record
allocated vector[object] #: Outstanding objects
count unsigned #: Total number of objects out
debug logical #: {true
}=>check deallocs. carefully
errors errors #: Place to print errors
name string #: Name of object being managed
objects vector[object] #: Free list
generate allocate, erase, identical, print
#: {manage
} procedures:
procedure xallocate@manage[object]
takes
manage manage[object]
returns object
needs
procedure allocate@object
takes_nothing
returns object
#: This procedure will allocate an object from {manage
}.
procedure free_append@manage[object]
takes
manage manage[object]
object object
returns_nothing
needs
procedure identical@object
takes object, object
returns logical
#: This procedure will append {object
} to {manage
}'s free list.
procedure create@manage[object]
takes
name string
debug logical
errors errors
returns manage[object]
#: This procedure will create and return a storage manager object.
procedure deallocate@manage[object]
takes
manage manage[object]
object object
returns_nothing
needs
procedure identical@object
takes object, object
returns logical
procedure address_get@object
takes object
returns address
#: This procedure will return {object
} to {manage
} for subsequent
#, reallocation.
procedure leaks_check@manage[object]
takes
manage manage[object]
returns logical
needs
procedure address_get@object
takes object
returns address
#: This procedure will verify that the number of out-standing objects
#, of type {object
} is zero; if not, an error message is output to
#, {error_stream
} and {true
} is returned.
procedure free_count_get@manage[object]
takes
manage manage[object]
returns unsigned
#: This procedure will return the number of available free objects
#, in {manage
}.