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


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

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

1.3
date     89.04.14.18.31.37;  author dillon;  state Exp;
branches ;
next     1.2;

1.2
date     89.02.02.15.35.22;  author dillon;  state Stab;
branches ;
next     1.1;

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


desc
@@


1.5
log
@Updating from revision 1.4 to revision 1.5
@
text
@/*
 * pos.c --
 *	POSTGRES "position" code.
 */

#include "tmp/c.h"

#include "storage/block.h"
#include "storage/off.h"
#include "storage/part.h"
#include "storage/pos.h"

#include "internal.h"

RcsId("$Header: RCS/pos.c,v 1.5 90/08/14 16:05:14 cimarron Exp $");

/*
 *	A "position" ocnsists of "pageNumber ... offsetNumber"
 *	where pageNumber occupies a number of page bits determined
 *	by a PagePartition.
 */

bool
PositionIdIsValid(positionId, partition)
	PositionId	positionId;
	PagePartition	partition;
{
	return ((bool)(PointerIsValid(positionId) &&
			(*positionId & OffsetNumberMask(partition))));
}

void
PositionIdSet(positionId, partition, pageNumber, offsetNumber)
	PositionId	positionId;
	PagePartition	partition;
	PageNumber	pageNumber;
	OffsetNumber	offsetNumber;
{
    Assert((pageNumber >> PagePartitionGetNumberOfPageBits(partition)) == 0);
    Assert((offsetNumber >> PagePartitionGetNumberOfOffsetBits(partition))==0);

	*positionId = offsetNumber |
		(pageNumber << PagePartitionGetNumberOfOffsetBits(partition));
}

PageNumber
PositionIdGetPageNumber(positionId, partition)
	PositionId	positionId;
	PagePartition	partition;
{
/*
	Assert(PositionIdIsValid(positionId, partition));
*/

	return (0xffff &
		(*positionId >> PagePartitionGetNumberOfOffsetBits(partition)));
}

OffsetNumber
PositionIdGetOffsetNumber(positionId, partition)
	PositionId	positionId;
	PagePartition	partition;
{
	Assert(PositionIdIsValid(positionId, partition));

	return (*positionId & OffsetNumberMask(partition));
}
@


1.4
log
@Working version of C-only demo
@
text
@d6 1
a6 1
#include "c.h"
d8 4
a11 3
#include "block.h"
#include "off.h"
#include "part.h"
a12 1
#include "pos.h"
d15 1
a15 1
RcsId("$Header: /usr6/postgres/mao/postgres/src/storage/page/RCS/pos.c,v 1.3 89/04/14 18:31:37 dillon Exp $");
@


1.3
log
@*** empty log message ***
@
text
@d15 1
a15 1
RcsId("$Header: pos.c,v 1.2 89/02/02 15:35:22 dillon Locked $");
@


1.2
log
@Txfer From old tree
@
text
@d15 1
a15 1
RcsId("$Header: pos.c,v 1.4 88/08/18 18:21:02 dillon Locked $");
d39 2
a40 4
	Assert((pageNumber >> PagePartitionGetNumberOfPageBits(partition)) ==
		0);
	Assert((offsetNumber >> PagePartitionGetNumberOfOffsetBits(partition))
		== 0);
@


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: pos.c,v 1.1 88/11/11 16:37:43 postgres Exp $");
@
