/* slpmem.f -- translated by f2c (version of 3 February 1990  3:36:42).
   You must link the resulting object file with the libraries:
	-lF77 -lI77 -lm -lc   (in that order)
*/

#include "f2c.h"

/* Common Block Declarations */

struct {
    doublereal cpyknt;
    integer istack[1], lorg, icore, maxcor, maxuse, memavl, ldval, numblk, 
	    loctab, ltab, ifwa, nwoff, ntab, maxmem, memerr, nwd4, nwd8, 
	    nwd16;
} memmgr_;

#define memmgr_1 memmgr_

struct {
    integer iprnta, iprntl, iprntm, iprntn, iprnto, limtim, limpts, lvlcod, 
	    lvltim, itl1, itl2, itl3, itl4, itl5, itl6, igoof, nogo, keof;
} flags_;

#define flags_1 flags_

/*<       subroutine slpmem(ipntr,ksize) >*/
/* Subroutine */ int slpmem_(ipntr, ksize)
integer *ipntr, *ksize;
{
    static integer islp;
    extern /* Subroutine */ int extmem_();
    extern integer nxtevn_();

    /* Parameter adjustments */
    --ipntr;

    /* Function Body */
/*<       implicit double precision (a-h,o-z) >*/

/*      this routine may be used to define a certain amount of `slop
' to */
/* be associated with a particular table managed by the memory manager. */

/* this *slop* is defined as a number of entries in the table for which */

/* space is to be held ***if possible*** during compaction of the managed 
*/
/* area of memory.  this feature can eliminate the overhead incurred by */

/* alternatively extending more than one table at a time.  (for example, 
*/
/* if the program contains a code sequence */

/*                  do 100 i=1,500 */
/*                     ... */
/*                  call extmem(table1,1) */
/*                     ... */
/*                  call extmem(table2,1) */
/*                     ... */
/*              100 continue */

/* then the overhead incurred by this memory manager can be reduced to */
/* essentially nothing if prior to the above code sequence the program */
/* executes */

/*                  call slpmem(table1,20) */
/*                  call slpmem(table2,20) */

/* where `20
' is a typical number (for the above example, the memory-to- */
/* memory copying overhead of the memory manager would be reduced by a */
/* factor of 20). */

/* spice version 2g.6  sccsid=memmgr 3/15/83 */
/*<       common /memmgr/ cpyknt,istack(1),lorg,icore,maxcor,maxuse,memavl, >*/
/*<      1   ldval,numblk,loctab,ltab,ifwa,nwoff,ntab,maxmem,memerr,nwd4, >*/
/*<      2   nwd8,nwd16 >*/
/* spice version 2g.6  sccsid=flags 3/15/83 */
/*<       common /flags/ iprnta,iprntl,iprntm,iprntn,iprnto,limtim,limpts, >*/
/*<      1   lvlcod,lvltim,itl1,itl2,itl3,itl4,itl5,itl6,igoof,nogo,keof >*/
/*<       dimension ipntr(1) >*/
/*<       islp=nxtevn(ksize) >*/
    islp = nxtevn_(ksize);
/*<       call extmem(ipntr,islp) >*/
    extmem_(&ipntr[1], &islp);
/*<       islp=islp*istack(ltab+5) >*/
    islp *= memmgr_1.istack[memmgr_1.ltab + 4];
/*<       istack(ltab+3)=istack(ltab+3)-islp >*/
    memmgr_1.istack[memmgr_1.ltab + 2] -= islp;
/*<       memavl=memavl+istack(ltab+6) >*/
    memmgr_1.memavl += memmgr_1.istack[memmgr_1.ltab + 5];
/*<       istack(ltab+6)=islp >*/
    memmgr_1.istack[memmgr_1.ltab + 5] = islp;
/*<       return >*/
    return 0;
/*<       end >*/
} /* slpmem_ */

