/* ptrmem.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_

/* Table of constant values */

static integer c__4 = 4;

/*<       subroutine ptrmem(ipntr,ipntr2) >*/
/* Subroutine */ int ptrmem_(ipntr, ipntr2)
integer *ipntr, *ipntr2;
{
    extern integer locf_();
    extern /* Subroutine */ int memadj_(), errmem_();
    extern logical memptr_();

    /* Parameter adjustments */
    --ipntr;
    --ipntr2;

    /* Function Body */
/*<       implicit double precision (a-h,o-z) >*/
/*<       dimension ipntr(1),ipntr2(1) >*/
/* 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 >*/
/*<       logical memptr >*/

/* ***  ptrmem - reset memory pointer */

/* ...  verify that pointer is valid */
/*<       if (memptr(ipntr(1))) go to 10 >*/
    if (memptr_(&ipntr[1])) {
	goto L10;
    }
/*<       memerr=5 >*/
    memmgr_1.memerr = 5;
/*<       call errmem(4,memerr,ipntr(1)) >*/
    errmem_(&c__4, &memmgr_1.memerr, &ipntr[1]);
/* ...  reset block pointer to be *ipntr2* */
/*<    10 ipntr2(1)=ipntr(1) >*/
L10:
    ipntr2[1] = ipntr[1];
/*<       istack(ltab+4)=locf(ipntr2(1)) >*/
    memmgr_1.istack[memmgr_1.ltab + 3] = locf_(&ipntr2[1]);
/*<       call memadj >*/
    memadj_();
/*<       return >*/
    return 0;
/*<       end >*/
} /* ptrmem_ */

