MA_SIZEOF


     NAME
	  MA_sizeof - compute sizes of data types

     C SYNOPSIS
	  #include "macdecls.h"

	  Integer MA_sizeof(datatype1, nelem1, datatype2)
	      Integer	  datatype1;	  /* read-only */
	      Integer	  nelem1;	  /* read-only */
	      Integer	  datatype2;	  /* read-only */

     FORTRAN SYNOPSIS
	  #include "mafdecls.h"

	  integer function MA_sizeof(datatype1,	nelem1,	datatype2)
	      integer	  datatype1
	      integer	  nelem1
	      integer	  datatype2

     DESCRIPTION
	  MA_sizeof() returns the number of elements of	type datatype2
	  required to contain nelem1 elements of type datatype1.

     USAGE
	  The following	FORTRAN	code illustrates the use of
	  MA_sizeof() by computing the space required for 100 integers
	  in 5 allocations in the heap,	200 logicals in	4 allocations
	  in the heap, 300 reals in 3 allocations in the stack,	and
	  400 doubles in 2 allocations in the stack.

	  #include "mafdecls.h"

	      logical ok
	      integer heap_bytes_data
	      integer heap_bytes_overhead
	      integer heap_bytes_total
	      integer stack_bytes_data
	      integer stack_bytes_overhead
	      integer stack_bytes_total

	      heap_bytes_data =	MA_sizeof(MT_INT, 100, MT_BYTE)
			      +	MA_sizeof(MT_LOG, 200, MT_BYTE)
	      heap_bytes_overhead = (5 + 4) *
	                             MA_sizeof_overhead(MT_BYTE)
	      heap_bytes_total = heap_bytes_data + heap_bytes_overhead
	      stack_bytes_data = MA_sizeof(MT_REAL, 300, MT_BYTE)
			       + MA_sizeof(MT_DBL, 400,	MT_BYTE)
	      stack_bytes_overhead = (3	+ 2) *
	                             MA_sizeof_overhead(MT_BYTE)
	      stack_bytes_total	= stack_bytes_data +
	                             stack_bytes_overhead
	      ok = MA_init(MT_BYTE, stack_bytes_total, heap_bytes_total)

     DIAGNOSTICS
	  unable to set	sizes of FORTRAN datatypes
	       This indicates either that the internal state of	MA is
	       corrupted or that there is a problem in the C-FORTRAN
	       linkage.
	  invalid datatype: %d
	       datatype1 and datatype2 must be one of those listed in
	       macdecls.h or mafdecls.h.
	  invalid nelem: %d
	       nelem1 must be greater than or equal to zero.

     RETURN VALUE
	  C: The number	of elements, as	described above.
	  FORTRAN: The number of elements, as described	above.

     SEE ALSO
	  MA(3), MA_sizeof_overhead(3)

     AUTHOR
	  Gregory S. Thomas, Pacific Northwest Laboratory