head     1.4;
branch   ;
access   ;
symbols  Version_2_1:1.4 C_Demo_1:1.3;
locks    cimarron:1.4; strict;
comment  @ * @;


1.4
date     90.09.25.16.19.44;  author kemnitz;  state Exp;
branches ;
next     1.3;

1.3
date     89.09.05.17.01.46;  author mao;  state C_Demo_1;
branches ;
next     1.2;

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

1.1
date     89.01.17.05.52.49;  author cimarron;  state Exp;
branches ;
next     ;


desc
@@


1.4
log
@Updating from revision 1.3 to revision 1.4
@
text
@/*
 * itup.c --
 *	POSTGRES index tuple code.
 */

#include "tmp/c.h"

RcsId("$Header: RCS/itup.c,v 1.4 90/08/13 18:21:17 cimarron Exp $");

#include "access/ibit.h"
#include "access/itup.h"

#include "storage/form.h"
#include "storage/itemptr.h"
#include "rules/rlock.h"

bool
IndexTupleIsValid(tuple)
	IndexTuple	tuple;
{
	return ((bool)PointerIsValid(tuple));
}

bool
GeneralInsertIndexResultIsValid(result)
	GeneralInsertIndexResult	result;
{
	return ((bool)PointerIsValid(result));
}

bool
InsertIndexResultIsValid(result)
	InsertIndexResult	result;
{
	return ((bool)PointerIsValid(result));
}

bool
GeneralRetrieveIndexResultIsValid(result)
	GeneralRetrieveIndexResult	result;
{
	return ((bool)PointerIsValid(result));
}

bool
RetrieveIndexResultIsValid(result)
	RetrieveIndexResult	result;
{
	return ((bool)PointerIsValid(result));
}

ItemPointer
IndexTupleGetRuleLockItemPointer(tuple)
	IndexTuple	tuple;
{
	Assert(IndexTupleIsValid(tuple));

	return (&tuple->t_lock.l_ltid);
}

RuleLock
IndexTupleGetRuleLock(tuple)
	IndexTuple	tuple;
{
	Assert(IndexTupleIsValid(tuple));

	return (tuple->t_lock.l_lock);
}

IndexAttributeBitMap
IndexTupleGetIndexAttributeBitMap(tuple)
	IndexTuple	tuple;
{
	Assert(IndexTupleIsValid(tuple));

	return (&tuple->bits);
}

Form
IndexTupleGetForm(tuple)
	IndexTuple	tuple;
{
	Assert(IndexTupleIsValid(tuple));

	return ((Form)&tuple[1]);
}

ItemPointer
GeneralInsertIndexResultGetItemPointer(result)
	GeneralInsertIndexResult	result;
{
	Assert(GeneralInsertIndexResultIsValid(result));

	return (&result->pointerData);
}

RuleLock
GeneralInsertIndexResultGetRuleLock(result)
	GeneralInsertIndexResult	result;
{
	Assert(GeneralInsertIndexResultIsValid(result));

	return (result->lock);
}

GeneralInsertIndexResult
ItemPointerFormGeneralInsertIndexResult(pointer, lock)
	ItemPointer	pointer;
	RuleLock	lock;
{
	GeneralInsertIndexResult	result;

	Assert(ItemPointerIsValid(pointer));
	/* XXX Assert(RuleLockIsValid(lock)); locks don't work yet */

	result = LintCast(GeneralInsertIndexResult, palloc(sizeof *result));

	result->pointerData = *pointer;
	result->lock = lock;

	return (result);
}

ItemPointer
InsertIndexResultGetItemPointer(result)
	InsertIndexResult	result;
{
	Assert(InsertIndexResultIsValid(result));

	return (&result->pointerData);
}

RuleLock
InsertIndexResultGetRuleLock(result)
	InsertIndexResult	result;
{
	Assert(InsertIndexResultIsValid(result));

	return (result->lock);
}

double
InsertIndexResultGetInsertOffset(result)
	InsertIndexResult	result;
{
	Assert(InsertIndexResultIsValid(result));

	return (result->offset);
}

InsertIndexResult
ItemPointerFormInsertIndexResult(pointer, lock, offset)
	ItemPointer	pointer;
	RuleLock	lock;
	double		offset;
{
	InsertIndexResult	result;

	Assert(ItemPointerIsValid(pointer));
	/* XXX Assert(RuleLockIsValid(lock)); locks don't work yet */
	/* Assert(InsertOffsetIsValid(offset)); */

	result = LintCast(InsertIndexResult, palloc(sizeof *result));

	result->pointerData = *pointer;
	result->lock = lock;
	result->offset = offset;

	return (result);
}

ItemPointer
GeneralRetrieveIndexResultGetHeapItemPointer(result)
	GeneralRetrieveIndexResult	result;
{
	Assert(GeneralRetrieveIndexResultIsValid(result));

	return (&result->heapItemData);
}

GeneralRetrieveIndexResult
ItemPointerFormGeneralRetrieveIndexResult(heapItemPointer)
	ItemPointer	heapItemPointer;
{
	GeneralRetrieveIndexResult	result;

	Assert(ItemPointerIsValid(heapItemPointer));

	result = LintCast(GeneralRetrieveIndexResult, palloc(sizeof *result));

	result->heapItemData = *heapItemPointer;

	return (result);
}

ItemPointer
RetrieveIndexResultGetIndexItemPointer(result)
	RetrieveIndexResult	result;
{
	Assert(RetrieveIndexResultIsValid(result));

	return (&result->indexItemData);
}

ItemPointer
RetrieveIndexResultGetHeapItemPointer(result)
	RetrieveIndexResult	result;
{
	Assert(RetrieveIndexResultIsValid(result));

	return (&result->heapItemData);
}

RetrieveIndexResult
ItemPointerFormRetrieveIndexResult(indexItemPointer, heapItemPointer)
	ItemPointer	indexItemPointer;
	ItemPointer	heapItemPointer;
{
	RetrieveIndexResult	result;

	Assert(ItemPointerIsValid(indexItemPointer));
	Assert(ItemPointerIsValid(heapItemPointer));

	result = LintCast(RetrieveIndexResult, palloc(sizeof *result));

	result->indexItemData = *indexItemPointer;
	result->heapItemData = *heapItemPointer;

	return (result);
}
@


1.3
log
@Working version of C-only demo
@
text
@d6 1
a6 1
#include "c.h"
d8 1
a8 4
#include "form.h"
#include "ibit.h"
#include "itemptr.h"
#include "rlock.h"
d10 2
a11 1
#include "itup.h"
d13 3
a15 1
RcsId("$Header: /usr6/postgres/mao/postgres/src/access/tuple/RCS/itup.c,v 1.2 89/03/22 17:31:52 muir Stab $");
@


1.2
log
@copyright removal
@
text
@d15 1
a15 1
RcsId("$Header: /usr6/postgres/muir/postgres/src/access/tuple/RCS/itup.c,v 1.1 89/01/17 05:52:49 cimarron 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.
 * 
 */



/*
d15 1
a15 1
RcsId("$Header: itup.c,v 1.1 88/11/11 16:42:01 postgres Exp $");
@
