head	1.5;
access;
symbols
	Version_2_1:1.5
	C_Demo_1:1.4;
locks; strict;
comment	@ * @;


1.5
date	90.09.25.16.23.06;	author kemnitz;	state Exp;
branches;
next	1.4;

1.4
date	89.09.05.17.02.46;	author mao;	state C_Demo_1;
branches;
next	1.3;

1.3
date	89.08.01.16.42.59;	author goh;	state Exp;
branches;
next	1.2;

1.2
date	89.03.22.17.31.58;	author muir;	state Stab;
branches;
next	1.1;

1.1
date	89.02.10.20.15.44;	author ong;	state Exp;
branches;
next	;


desc
@@


1.5
log
@Updating from revision 1.4 to revision 1.5
@
text
@/*
 * ppreserve.c --
 *	Routines to preserve palloc'd memory in LISP.
 */

#include "tmp/postgres.h"
#include "nodes/pg_lisp.h"

RcsId("$Header: RCS/ppreserve.c,v 1.5 90/08/17 08:50:30 cimarron Exp $");

/*
 *	ppreserve	- preserve palloc'd memory in LISP
 *
 *	Returns a vectori-byte containing a copy of palloc-formatted
 *	memory.  "Prestore" should be called before trying to use it.
 */
LispValue
ppreserve(pallocObject)
	char	*pallocObject;
{
	LispValue	vectori;
	int		length;

	length = PSIZEALL(pallocObject);
	LISP_GC_OFF;
	vectori = lispVectori(length);
	LISP_GC_PROTECT(vectori);
	LISP_GC_ON;
	bcopy(PSIZEFIND(pallocObject),
	      (char *) LISPVALUE_BYTEVECTOR(vectori),
	      length);
	return(vectori);
}

LispValue
lppreserve(pallocObject)
	LispValue	pallocObject;
{
	return(ppreserve((char *) LISPVALUE_INTEGER(pallocObject)));
}


/*
 *	prestore	- restore saved palloc'd memory
 *
 *	Returns a pointer to the data in a ppreserve'd object.
 *	See "ppreserve" above.
 */
char *
prestore(ppreservedObject)
	char	*ppreservedObject;
{
	return(PSIZESKIP(ppreservedObject));
}

LispValue
lprestore(ppreservedObject)
	LispValue	ppreservedObject;
{
	LispValue	newPointer;

	LISP_GC_OFF;
	newPointer = lispInteger((int)
				 prestore(LISPVALUE_BYTEVECTOR(ppreservedObject)));
	LISP_GC_PROTECT(newPointer);
	LISP_GC_ON;
	return(newPointer);
}
@


1.4
log
@Working version of C-only demo
@
text
@d6 2
a7 2
#include "postgres.h"
#include "pg_lisp.h"
d9 1
a9 1
RcsId("$Header: /usr6/postgres/mao/postgres/src/lib/C/RCS/ppreserve.c,v 1.3 89/08/01 16:42:59 goh Exp $");
@


1.3
log
@*** empty log message ***
@
text
@d9 1
a9 1
RcsId("$Header: /usr6/postgres/goh/newpost/src/lib/C/RCS/ppreserve.c,v 1.2 89/03/22 17:31:58 muir Stab $");
@


1.2
log
@copyright removal
@
text
@d7 1
a7 1
#include "lispdep.h"
d9 1
a9 1
RcsId("$Header: /usr6/postgres/muir/postgres/src/lib/C/RCS/ppreserve.c,v 1.1 89/02/10 20:15:44 ong Exp $");
@


1.1
log
@Initial revision
@
text
@a0 1

a1 26
 * 
 * POSTGRES Data Base Management System
 * 
 * Copyright (c) 1988 Regents of the University of California
 * 
 * Permission to use, copy, modify, and distribute this software and its
 * documentation for educational, research, and non-profit purposes and
 * without fee is hereby granted, provided that the above copyright
 * notice appear in all copies and that both that copyright notice and
 * this permission notice appear in supporting documentation, and that
 * the name of the University of California not be used in advertising
 * or publicity pertaining to distribution of the software without
 * specific, written prior permission.  Permission to incorporate this
 * software into commercial products can be obtained from the Campus
 * Software Office, 295 Evans Hall, University of California, Berkeley,
 * Ca., 94720 provided only that the the requestor give the University
 * of California a free licence to any derived software for educational
 * and research purposes.  The University of California makes no
 * representations about the suitability of this software for any
 * purpose.  It is provided "as is" without express or implied warranty.
 * 
 */



/*
d9 1
a9 1
RcsId("$Header: ppreserve.c,v 1.1 89/01/17 07:21:38 cimarron Exp $");
@
