MA_ALLOC_GET 


     NAME
	  MA_alloc_get - allocate a heap block and get the
	  corresponding	base index

     C SYNOPSIS
	  #include "macdecls.h"

	  Boolean MA_alloc_get(datatype, nelem,	name, memhandle,
	  index)
	      Integer	  datatype;	  /* read-only */
	      Integer	  nelem;	  /* read-only */
	      char	  *name;	  /* read-only */
	      Integer	  *memhandle;	  /* write-only	*/
	      Integer	  *index;	  /* write-only	*/

     FORTRAN SYNOPSIS
	  #include "mafdecls.h"

	  logical function MA_alloc_get(datatype, nelem, name,
	  memhandle, index)
	      integer	  datatype
	      integer	  nelem
	      character*(*) name
	      integer	  memhandle
	      integer	  index

     DESCRIPTION
	  MA_alloc_get() is a convenience function that	combines
	  MA_allocate_heap() and MA_get_index(). MA_alloc_get()
	  allocates a heap block large enough to hold nelem elements
	  of type datatype and associates name with the block for
	  debugging purposes. A	handle for the block is	returned in
	  memhandle and	the base index for the type-specific data
	  array	that is	appropriate for	the block is returned in
	  index.

     USAGE
	  The following	FORTRAN	code illustrates the use of
	  MA_alloc_get() by allocating a block of 5 integers on	the
	  heap and then	storing	values into the	integers.

	  #include "mafdecls.h"

	      logical ok
	      integer mhandle
	      integer index
	      integer i

	      ok = MA_alloc_get(MT_INT,	5, 'heap int block', mhandle, index)
	      if (ok) then
		  do 10	i = 0, 4
		      int_mb(index + i)	= 0
	  10	  continue
	      endif

     DIAGNOSTICS
	  block	'%s', MA not yet initialized
	       MA_init() must be called	before this routine is called.
	  block	'%s', invalid datatype:	%d
	       datatype	must be	one of those listed in macdecls.h or
	       mafdecls.h.
	  block	'%s', invalid nelem: %d
	       nelem must be greater than zero.
	  block	'%s', not enough space to allocate %d bytes
	       Recovery	may be attempted by deallocating unneeded
	       blocks and resubmitting the request, or the application
	       may be rewritten	to request more	memory initially in
	       the call	to MA_init().

	  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: .true. upon success,	.false.	upon failure.

     NOTES
	  Type-specific	data arrays are	not yet	available in C,	so
	  employ pointers instead of indices by	using
	  MA_allocate_heap() and MA_get_pointer() instead of
	  MA_alloc_get().


     SEE ALSO
	  MA(3), MA_allocate_heap(3), MA_free_heap(3),
	  MA_get_index(3), MA_get_pointer(3), MA_inquire_avail(3),
	  MA_inquire_heap(3)

     AUTHOR
	  Gregory S. Thomas, Pacific Northwest