MA_GET_POINTER
NAME
MA_get_pointer - get the base pointer for a block
C SYNOPSIS
#include "macdecls.h"
Boolean MA_get_pointer(memhandle, pointer)
Integer memhandle; /* read-only */
Pointer *pointer; /* write-only */
FORTRAN SYNOPSIS
Not available.
DESCRIPTION
MA_get_pointer() returns in pointer the base pointer for the
block corresponding to the handle memhandle (which was
returned by MA_allocate_heap() or MA_push_stack() when the
block was allocated).
USAGE
The following C code illustrates the use of MA_get_pointer()
by allocating a block of 5 integers on the heap and then
storing values into the integers.
#include "macdecls.h"
Boolean ok;
Integer mhandle;
Pointer pointer;
int i;
ok = MA_allocate_heap(MT_INT, 5, "heap int block",
&mhandle);
if (ok)
{
ok = MA_get_pointer(mhandle, &pointer);
if (ok)
for (i = 0; i < 5; i++)
*((int *)pointer + i) = 0;
}
DIAGNOSTICS
invalid memhandle: %d
memhandle is not a valid handle.
invalid checksum for memhandle %d (name: '%s')
The block's computed checksum does not match its stored
checksum. This indicates that the block has been
corrupted by having its internal state overwritten.
invalid guard(s) for memhandle %d (name: '%s')
This indicates that the block has been corrupted by
being overwritten at one or both ends. The likely cause
of this is an application indexing bug.
memhandle %d (name: '%s') not in heap or stack
The block is not currently allocated in the heap or the
stack.
Other diagnostics are possible. If seen, they indicate
corruption of the internal state of MA, caused by bugs in
either MA or the application.
RETURN VALUE
C: MA_TRUE upon success, MA_FALSE upon failure.
FORTRAN: Not available.
NOTES
MA_get_pointer() is not available in FORTRAN, because
FORTRAN does not support pointers.
SEE ALSO
MA(3), MA_alloc_get(3), MA_allocate_heap(3),
MA_get_index(3), MA_push_get(3), MA_push_stack(3)
AUTHOR
Gregory S. Thomas, Pacific Northwest Laboratory