head	1.10;
access;
symbols
	release_4_2:1.10
	aix_ok:1.10
	Version_2_1:1.7
	Version_2:1.6
	C_Demo_1:1.4;
locks; strict;
comment	@ * @;


1.10
date	91.07.31.19.37.50;	author mer;	state Exp;
branches;
next	1.9;

1.9
date	91.07.29.07.09.18;	author mer;	state Exp;
branches;
next	1.8;

1.8
date	91.05.01.02.50.29;	author cimarron;	state Exp;
branches;
next	1.7;

1.7
date	90.08.17.08.53.40;	author cimarron;	state Exp;
branches;
next	1.6;

1.6
date	89.09.25.11.25.02;	author cimarron;	state Version_2;
branches;
next	1.5;

1.5
date	89.09.21.19.13.03;	author hirohama;	state Exp;
branches;
next	1.4;

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

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

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

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


desc
@@


1.10
log
@minor problem fixes
@
text
@/* ----------------------------------------------------------------
 *   FILE
 *	pos.h
 *
 *   DESCRIPTION
 *	POSTGRES "position" definitions.
 *
 *	A "position" ocnsists of "pageNumber ... offsetNumber"
 *	where pageNumber occupies a number of page bits determined
 *	by a PagePartition.
 *
 *   IDENTIFICATION
 *	$Header: RCS/pos.h,v 1.9 91/07/29 07:09:18 mer Exp Locker: mer $
 * ----------------------------------------------------------------
 */

#ifndef	PosIncluded		/* Include this file only once */
#define PosIncluded	1

#define POS_H	"$Header: RCS/pos.h,v 1.9 91/07/29 07:09:18 mer Exp Locker: mer $"

#include "tmp/c.h"
#include "storage/part.h"
#include "storage/pagenum.h"

typedef bits16	PositionIdData;	/* internal position identifier */
typedef PositionIdData	*PositionId;	/* position identifier */

/* ----------------
 *	support macros
 * ----------------
 */
/*
 * PositionIdIsValid --
 *	True iff the position identifier is valid.
 */
#define PositionIdIsValid(positionId, partition) \
    ((bool) (PointerIsValid(positionId) && \
	     (*(positionId) & OffsetNumberMask(partition))))

/*
 * PositionIdSetInValid --
 *      Make an invalid postion.
 */
#define PositionIdSetInvalid(positionId) *(positionId) = *(positionId) & 0x0

/*
 * PositionIdSet --
 *	Sets a position identifier to the specified value.
 */
#define PositionIdSet(positionId, partition, pageNumber, offsetNumber) \
   Assert((pageNumber >> PagePartitionGetNumberOfPageBits(partition)) == 0); \
   Assert((offsetNumber >> PagePartitionGetNumberOfOffsetBits(partition))==0);\
    *(positionId) = offsetNumber | \
     (pageNumber << PagePartitionGetNumberOfOffsetBits(partition))

/*
 * PositionIdGetPageNumber --
 *	Retrieve the page number from a position identifier.
 */
#define PositionIdGetPageNumber(positionId, partition) \
    ((PageNumber) \
     (0xffff & \
      (*(positionId) >> PagePartitionGetNumberOfOffsetBits(partition))))

/*
 * PositionIdGetOffsetNumber --
 *	Retrieve the offset number from a position identifier.
 */
#define PositionIdGetOffsetNumber(positionId, partition) \
    (AssertMacro(PositionIdIsValid(positionId, partition)) ? \
     ((OffsetNumber) (*(positionId) & OffsetNumberMask(partition))) : \
     (OffsetNumber) 0)

#endif	/* !defined(PosIncluded) */
@


1.9
log
@set invalid macro
@
text
@d13 1
a13 1
 *	$Header: /users/mer/postgres/src/lib/H/storage/RCS/pos.h,v 1.8 91/05/01 02:50:29 cimarron Exp Locker: mer $
d20 1
a20 1
#define POS_H	"$Header: /users/mer/postgres/src/lib/H/storage/RCS/pos.h,v 1.8 91/05/01 02:50:29 cimarron Exp Locker: mer $"
d45 1
a45 1
#define PositionIdSetInvalid(positionId) *(positionId) & 0x0
@


1.8
log
@round II of converting simple functions to macros + code cleaning in general
@
text
@d13 1
a13 1
 *	$Header$
d20 1
a20 1
#define POS_H	"$Header: RCS/pos.h,v 1.7 90/08/17 08:53:40 cimarron Exp Locker: cimarron $"
d40 6
@


1.7
log
@added pathnames to #include statements
@
text
@d1 5
a5 2
/*
 * pos.h --
d7 8
d20 1
a20 4
/*
 * Identification:
 */
#define POS_H	"$Header: RCS/pos.h,v 1.6 89/09/25 11:25:02 cimarron Version_2 Locker: cimarron $"
d29 4
d37 3
a39 6
extern
bool
PositionIdIsValid ARGS((
	PositionId	positionId,
	PagePartition	partition
));
d45 5
a49 8
extern
void
PositionIdSet ARGS((
	PositionId	positionId,
	PagePartition	partition,
	PageNumber	pageNumber,
	OffsetNumber	offsetNumber
));
d55 4
a58 6
extern
PageNumber
PositionIdGetPageNumber ARGS((
	PositionId	positionId,
	PagePartition	partition
));
d64 4
a67 6
extern
OffsetNumber
PositionIdGetOffsetNumber ARGS((
	PositionId	positionId,
	PagePartition	partition
));
@


1.6
log
@moved dynamic symbol stuff to syms.h
@
text
@d12 1
a12 1
#define POS_H	"$Header: RCS/pos.h,v 1.5 89/09/21 19:13:03 hirohama Exp $"
d14 3
a16 10
#ifndef C_H
#include "c.h"
#endif

#ifndef	PART_H
# include "part.h"
#endif
#ifndef	PAGENUM_H
# include "pagenum.h"
#endif
@


1.5
log
@added ...SYMBOLS declarations
miscellaneous cleanup
@
text
@d12 1
a12 1
#define POS_H	"$Header: RCS/pos.h,v 1.4 89/09/05 17:10:34 mao C_Demo_1 Locker: hirohama $"
a72 6

#define POS_SYMBOLS \
	SymbolDecl(PositionIdIsValid, "_PositionIdIsValid"), \
	SymbolDecl(PositionIdSet, "_PositionIdSet"), \
	SymbolDecl(PositionIdGetPageNumber, "_PositionIdGetPageNumber"), \
	SymbolDecl(PositionIdGetOffsetNumber, "_PositionIdGetOffsetNumber")
@


1.4
log
@Working version of C-only demo
@
text
@a3 3
 *
 * Identification:
 *	$Header: /usr6/postgres/mao/postgres/src/lib/H/RCS/pos.h,v 1.3 89/04/12 19:55:48 dillon Exp $
d6 1
a6 1
#ifndef	PosIncluded	/* Include this file only once. */
d9 5
d18 6
a23 2
#include "part.h"
#include "pagenum.h"
d73 6
@


1.3
log
@c.h
@
text
@d6 1
a6 1
 *	$Header: /usr6/postgres/dillon/ptree/src/lib/H/RCS/pos.h,v 1.2 89/03/22 17:34:16 muir Stab $
@


1.2
log
@copyright removal
@
text
@d6 1
a6 1
 *	$Header: /usr6/postgres/muir/postgres/src/lib/H/RCS/pos.h,v 1.1 89/01/17 05:54:41 cimarron Exp $
d12 1
d14 1
@


1.1
log
@Initial revision
@
text
@a0 27

; /*
; * 
; * 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.
; * 
; */



d6 1
a6 1
 *	$Header: pos.h,v 1.1 88/11/11 16:37:20 postgres Exp $
@
