/* 29-Sep-1993

   Dynamic memory allocation for Unix systems.
     January 1990 - implemented by Steve Elbert.
   August 1, 1990 - AIX requires 'laddrs' by John Montgomery
 
   Unix FORTRAN compilers may require that C subprograms be
   spelled in lower or upper case, and with or without a trailing
   underscore, so the code is duplicated for all possibilities.
 
   ======
   MEMGET
   ======
   function invocation only: LOCMEM = MEMGET(NWORDS)
          NWORDS is the no. of 8-byte words of memory requested.
          The return value is the address of the allocated memory,
          zero means failure.
*/
memget_(nwords) int *nwords;
   { return malloc((*nwords+2)*8); }
 
MEMGET_(nwords) int *nwords;
   { return malloc((*nwords+2)*8); }
 
MEMGET(nwords) int *nwords;
   { return malloc((*nwords+2)*8); }
 
memget(nwords) int *nwords;
   { return malloc((*nwords+2)*8); }
 
/*   the following is used on KSR system with a 64 bit integer  */
long memg64_(nwords) long *nwords;
   { return malloc ((*nwords+2)*8);}

/*
   ======
   MEMREL
   ======
   subroutine call only: CALL MEMREL(LOCMEM)
          Deallocate all memory above the address LOCMEM.
          (deallocated memory is not returned to system)
*/
memrel_(locmem) int *locmem;
   { free(*locmem); }
 
MEMREL_(locmem) int *locmem;
   { free(*locmem); }
 
MEMREL(locmem) int *locmem;
   { free(*locmem); }

memrel(locmem) int *locmem;
   { free(*locmem); }

/*   the following is used on KSR system with a 64 bit integer  */
memr64_(locmem) long *locmem;
   { free(*locmem); }

/*
   ======
   LADDRS
   ======
   function invocation only: LOCX = LADDRS(X)
          Returns the absolute address of X, in bytes.
          This clone of LOC is used only when the FORTRAN 
          library does not include LOC already.
*/
laddrs_(arg) int arg;
   { return(arg); }

laddrs(arg) int arg;
   { return(arg); }
