1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-25 13:17:41 +03:00

Massive commit to run PGINDENT on all *.c and *.h files.

This commit is contained in:
Bruce Momjian
1997-09-07 05:04:48 +00:00
parent 8fecd4febf
commit 1ccd423235
687 changed files with 150775 additions and 136888 deletions

View File

@@ -1,21 +1,21 @@
/*-------------------------------------------------------------------------
*
* acl.h--
* Definition of (and support for) access control list data structures.
* Definition of (and support for) access control list data structures.
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: acl.h,v 1.7 1997/08/19 21:40:18 momjian Exp $
* $Id: acl.h,v 1.8 1997/09/07 05:02:05 momjian Exp $
*
* NOTES
* For backward-compatability purposes we have to allow there
* to be a null ACL in a pg_class tuple. This will be defined as
* meaning "no protection" (i.e., old catalogs get old semantics).
* For backward-compatability purposes we have to allow there
* to be a null ACL in a pg_class tuple. This will be defined as
* meaning "no protection" (i.e., old catalogs get old semantics).
*
* The AclItems in an ACL array are currently kept in sorted order.
* Things will break hard if you change that without changing the
* code wherever this is included.
* The AclItems in an ACL array are currently kept in sorted order.
* Things will break hard if you change that without changing the
* code wherever this is included.
*
*-------------------------------------------------------------------------
*/
@@ -26,99 +26,106 @@
#include <utils/array.h>
/*
* AclId system identifier for the user, group, etc.
* XXX currently UNIX uid for users...
* AclId system identifier for the user, group, etc.
* XXX currently UNIX uid for users...
*/
typedef uint32 AclId;
#define ACL_ID_WORLD 0 /* XXX only idtype should be checked */
typedef uint32 AclId;
#define ACL_ID_WORLD 0 /* XXX only idtype should be checked */
/*
* AclIdType tag that describes if the AclId is a user, group, etc.
*/
typedef uint8 AclIdType;
#define ACL_IDTYPE_WORLD 0x00
#define ACL_IDTYPE_UID 0x01 /* user id - from pg_user */
#define ACL_IDTYPE_GID 0x02 /* group id - from pg_group */
typedef uint8 AclIdType;
#define ACL_IDTYPE_WORLD 0x00
#define ACL_IDTYPE_UID 0x01 /* user id - from pg_user */
#define ACL_IDTYPE_GID 0x02 /* group id - from pg_group */
/*
* AclMode the actual permissions
* XXX should probably use bit.h routines.
* XXX should probably also stuff the modechg cruft in the
* high bits, too.
* AclMode the actual permissions
* XXX should probably use bit.h routines.
* XXX should probably also stuff the modechg cruft in the
* high bits, too.
*/
typedef uint8 AclMode;
#define ACL_NO 0 /* no permissions */
#define ACL_AP (1<<0) /* append */
#define ACL_RD (1<<1) /* read */
#define ACL_WR (1<<2) /* write (append/delete/replace) */
#define ACL_RU (1<<3) /* place rules */
#define N_ACL_MODES 4
typedef uint8 AclMode;
#define ACL_MODECHG_ADD 1
#define ACL_MODECHG_DEL 2
#define ACL_MODECHG_EQL 3
#define ACL_NO 0 /* no permissions */
#define ACL_AP (1<<0) /* append */
#define ACL_RD (1<<1) /* read */
#define ACL_WR (1<<2) /* write (append/delete/replace) */
#define ACL_RU (1<<3) /* place rules */
#define N_ACL_MODES 4
#define ACL_MODECHG_ADD 1
#define ACL_MODECHG_DEL 2
#define ACL_MODECHG_EQL 3
/* change this line if you want to set the default acl permission */
#define ACL_WORLD_DEFAULT (ACL_RD)
/* #define ACL_WORLD_DEFAULT (ACL_RD|ACL_WR|ACL_AP|ACL_RU) */
#define ACL_OWNER_DEFAULT (ACL_RD|ACL_WR|ACL_AP|ACL_RU)
#define ACL_WORLD_DEFAULT (ACL_RD)
/* #define ACL_WORLD_DEFAULT (ACL_RD|ACL_WR|ACL_AP|ACL_RU) */
#define ACL_OWNER_DEFAULT (ACL_RD|ACL_WR|ACL_AP|ACL_RU)
/*
* AclItem
*/
typedef struct AclItem {
AclId ai_id;
AclIdType ai_idtype;
AclMode ai_mode;
} AclItem;
/* Note: if the size of AclItem changes,
typedef struct AclItem
{
AclId ai_id;
AclIdType ai_idtype;
AclMode ai_mode;
} AclItem;
/* Note: if the size of AclItem changes,
change the aclitem typlen in pg_type.h */
/*
* The value of the first dimension-array element. Since these arrays
* The value of the first dimension-array element. Since these arrays
* always have a lower-bound of 0, this is the same as the number of
* elements in the array.
*/
#define ARR_DIM0(a) (((unsigned *) (((char *) a) + sizeof(ArrayType)))[0])
#define ARR_DIM0(a) (((unsigned *) (((char *) a) + sizeof(ArrayType)))[0])
/*
* Acl a one-dimensional POSTGRES array of AclItem
* Acl a one-dimensional POSTGRES array of AclItem
*/
typedef ArrayType Acl;
#define ACL_NUM(ACL) ARR_DIM0(ACL)
#define ACL_DAT(ACL) ((AclItem *) ARR_DATA_PTR(ACL))
#define ACL_N_SIZE(N) \
((unsigned) (ARR_OVERHEAD(1) + ((N) * sizeof(AclItem))))
#define ACL_SIZE(ACL) ARR_SIZE(ACL)
#define ACL_NUM(ACL) ARR_DIM0(ACL)
#define ACL_DAT(ACL) ((AclItem *) ARR_DATA_PTR(ACL))
#define ACL_N_SIZE(N) \
((unsigned) (ARR_OVERHEAD(1) + ((N) * sizeof(AclItem))))
#define ACL_SIZE(ACL) ARR_SIZE(ACL)
/*
* IdList a one-dimensional POSTGRES array of AclId
* IdList a one-dimensional POSTGRES array of AclId
*/
typedef ArrayType IdList;
#define IDLIST_NUM(IDL) ARR_DIM0(IDL)
#define IDLIST_DAT(IDL) ((AclId *) ARR_DATA_PTR(IDL))
#define IDLIST_N_SIZE(N) \
((unsigned) (ARR_OVERHEAD(1) + ((N) * sizeof(AclId))))
#define IDLIST_SIZE(IDL) ARR_SIZE(IDL)
#define ACL_MODECHG_STR "+-=" /* list of valid characters */
#define ACL_MODECHG_ADD_CHR '+'
#define ACL_MODECHG_DEL_CHR '-'
#define ACL_MODECHG_EQL_CHR '='
#define ACL_MODE_STR "arwR" /* list of valid characters */
#define ACL_MODE_AP_CHR 'a'
#define ACL_MODE_RD_CHR 'r'
#define ACL_MODE_WR_CHR 'w'
#define ACL_MODE_RU_CHR 'R'
#define IDLIST_NUM(IDL) ARR_DIM0(IDL)
#define IDLIST_DAT(IDL) ((AclId *) ARR_DATA_PTR(IDL))
#define IDLIST_N_SIZE(N) \
((unsigned) (ARR_OVERHEAD(1) + ((N) * sizeof(AclId))))
#define IDLIST_SIZE(IDL) ARR_SIZE(IDL)
#define ACL_MODECHG_STR "+-=" /* list of valid characters */
#define ACL_MODECHG_ADD_CHR '+'
#define ACL_MODECHG_DEL_CHR '-'
#define ACL_MODECHG_EQL_CHR '='
#define ACL_MODE_STR "arwR" /* list of valid characters */
#define ACL_MODE_AP_CHR 'a'
#define ACL_MODE_RD_CHR 'r'
#define ACL_MODE_WR_CHR 'w'
#define ACL_MODE_RU_CHR 'R'
/* result codes for pg_aclcheck */
#define ACLCHECK_OK 0
#define ACLCHECK_NO_PRIV 1
#define ACLCHECK_NO_CLASS 2
#define ACLCHECK_NOT_OWNER 3
#define ACLCHECK_OK 0
#define ACLCHECK_NO_PRIV 1
#define ACLCHECK_NO_CLASS 2
#define ACLCHECK_NOT_OWNER 3
/* warning messages. set these in aclchk.c. */
extern char *aclcheck_error_strings[];
extern char *aclcheck_error_strings[];
/*
* Enable ACL execution tracing and table dumps
@@ -126,41 +133,43 @@ extern char *aclcheck_error_strings[];
/*#define ACLDEBUG_TRACE*/
/*
* routines used internally (parser, etc.)
* routines used internally (parser, etc.)
*/
extern Acl *aclownerdefault(AclId ownerid);
extern Acl *acldefault(void);
extern Acl *aclinsert3(Acl *old_acl, AclItem *mod_aip, unsigned modechg);
extern Acl *aclownerdefault(AclId ownerid);
extern Acl *acldefault(void);
extern Acl *aclinsert3(Acl * old_acl, AclItem * mod_aip, unsigned modechg);
extern char* aclmakepriv(char* old_privlist, char new_priv);
extern char* aclmakeuser(char* user_type, char* user);
extern ChangeACLStmt* makeAclStmt(char* privs, List* rel_list, char* grantee,
char grant_or_revoke);
extern char *aclmakepriv(char *old_privlist, char new_priv);
extern char *aclmakeuser(char *user_type, char *user);
extern ChangeACLStmt *
makeAclStmt(char *privs, List * rel_list, char *grantee,
char grant_or_revoke);
/*
* exported routines (from acl.c)
*/
extern Acl *makeacl(int n);
extern Acl *makeacl(int n);
extern AclItem *aclitemin(char *s);
extern char *aclitemout(AclItem *aip);
extern Acl *aclinsert(Acl *old_acl, AclItem *mod_aip);
extern Acl *aclremove(Acl *old_acl, AclItem *mod_aip);
extern int32 aclcontains(Acl *acl, AclItem *aip);
extern char *aclitemout(AclItem * aip);
extern Acl *aclinsert(Acl * old_acl, AclItem * mod_aip);
extern Acl *aclremove(Acl * old_acl, AclItem * mod_aip);
extern int32 aclcontains(Acl * acl, AclItem * aip);
/*
* prototypes for functions in aclchk.c
*/
extern void ChangeAcl(char *relname, AclItem *mod_aip, unsigned modechg);
extern AclId get_grosysid(char *groname);
extern char *get_groname(AclId grosysid);
extern void ChangeAcl(char *relname, AclItem * mod_aip, unsigned modechg);
extern AclId get_grosysid(char *groname);
extern char *get_groname(AclId grosysid);
/* XXX move these elsewhere -pma */
extern int32 pg_aclcheck(char *relname, char *usename, AclMode mode);
extern int32 pg_ownercheck(char *usename, char *value, int cacheid);
extern int32 pg_func_ownercheck(char *usename, char *funcname,
int nargs, Oid *arglist);
extern int32 pg_aggr_ownercheck(char *usename, char *aggname,
Oid basetypeID);
#endif /* ACL_H */
extern int32 pg_aclcheck(char *relname, char *usename, AclMode mode);
extern int32 pg_ownercheck(char *usename, char *value, int cacheid);
extern int32
pg_func_ownercheck(char *usename, char *funcname,
int nargs, Oid * arglist);
extern int32
pg_aggr_ownercheck(char *usename, char *aggname,
Oid basetypeID);
#endif /* ACL_H */

View File

@@ -1,21 +1,21 @@
/*-------------------------------------------------------------------------
*
* array.h--
* Utilities for the new array code. Contain prototypes from the
* following files:
* utils/adt/arrayfuncs.c
* utils/adt/arrayutils.c
* utils/adt/chunk.c
* Utilities for the new array code. Contain prototypes from the
* following files:
* utils/adt/arrayfuncs.c
* utils/adt/arrayutils.c
* utils/adt/chunk.c
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: array.h,v 1.4 1997/08/19 21:40:21 momjian Exp $
* $Id: array.h,v 1.5 1997/09/07 05:02:07 momjian Exp $
*
* NOTES
* XXX the data array should be LONGALIGN'd -- notice that the array
* allocation code does not allocate the extra space required for this,
* even though the array-packing code does the LONGALIGNs.
* XXX the data array should be LONGALIGN'd -- notice that the array
* allocation code does not allocate the extra space required for this,
* even though the array-packing code does the LONGALIGNs.
*
*-------------------------------------------------------------------------
*/
@@ -24,11 +24,12 @@
#include <stdio.h>
typedef struct {
int size; /* total array size (in bytes) */
int ndim; /* # of dimensions */
int flags; /* implementation flags */
} ArrayType;
typedef struct
{
int size; /* total array size (in bytes) */
int ndim; /* # of dimensions */
int flags; /* implementation flags */
} ArrayType;
/*
* bitmask of ArrayType flags field:
@@ -36,30 +37,30 @@ typedef struct {
* 2nd bit - chunk flag (array is chunked if set)
* 3rd,4th,&5th bit - large object type (used only if bit 1 is set)
*/
#define ARR_LOB_FLAG (0x1)
#define ARR_CHK_FLAG (0x2)
#define ARR_OBJ_MASK (0x1c)
#define ARR_LOB_FLAG (0x1)
#define ARR_CHK_FLAG (0x2)
#define ARR_OBJ_MASK (0x1c)
#define ARR_FLAGS(a) ((ArrayType *) a)->flags
#define ARR_SIZE(a) (((ArrayType *) a)->size)
#define ARR_FLAGS(a) ((ArrayType *) a)->flags
#define ARR_SIZE(a) (((ArrayType *) a)->size)
#define ARR_NDIM(a) (((ArrayType *) a)->ndim)
#define ARR_NDIM_PTR(a) (&(((ArrayType *) a)->ndim))
#define ARR_NDIM(a) (((ArrayType *) a)->ndim)
#define ARR_NDIM_PTR(a) (&(((ArrayType *) a)->ndim))
#define ARR_IS_LO(a) \
(((ArrayType *) a)->flags & ARR_LOB_FLAG)
(((ArrayType *) a)->flags & ARR_LOB_FLAG)
#define SET_LO_FLAG(f,a) \
(((ArrayType *) a)->flags |= ((f) ? ARR_LOB_FLAG : 0x0))
(((ArrayType *) a)->flags |= ((f) ? ARR_LOB_FLAG : 0x0))
#define ARR_IS_CHUNKED(a) \
(((ArrayType *) a)->flags & ARR_CHK_FLAG)
(((ArrayType *) a)->flags & ARR_CHK_FLAG)
#define SET_CHUNK_FLAG(f,a) \
(((ArrayType *) a)->flags |= ((f) ? ARR_CHK_FLAG : 0x0))
(((ArrayType *) a)->flags |= ((f) ? ARR_CHK_FLAG : 0x0))
#define ARR_OBJ_TYPE(a) \
((ARR_FLAGS(a) & ARR_OBJ_MASK) >> 2)
((ARR_FLAGS(a) & ARR_OBJ_MASK) >> 2)
#define SET_OBJ_TYPE(f,a) \
((ARR_FLAGS(a)&= ~ARR_OBJ_MASK), (ARR_FLAGS(a)|=((f<<2)&ARR_OBJ_MASK)))
((ARR_FLAGS(a)&= ~ARR_OBJ_MASK), (ARR_FLAGS(a)|=((f<<2)&ARR_OBJ_MASK)))
/*
* ARR_DIMS returns a pointer to an array of array dimensions (number of
@@ -73,23 +74,23 @@ typedef struct {
* Unlike C, the default lower bound is 1.
*/
#define ARR_DIMS(a) \
((int *) (((char *) a) + sizeof(ArrayType)))
((int *) (((char *) a) + sizeof(ArrayType)))
#define ARR_LBOUND(a) \
((int *) (((char *) a) + sizeof(ArrayType) + \
(sizeof(int) * (((ArrayType *) a)->ndim))))
((int *) (((char *) a) + sizeof(ArrayType) + \
(sizeof(int) * (((ArrayType *) a)->ndim))))
/*
* Returns a pointer to the actual array data.
*/
#define ARR_DATA_PTR(a) \
(((char *) a) + \
DOUBLEALIGN(sizeof(ArrayType) + 2 * (sizeof(int) * (a)->ndim)))
(((char *) a) + \
DOUBLEALIGN(sizeof(ArrayType) + 2 * (sizeof(int) * (a)->ndim)))
/*
* The total array header size for an array of dimension n (in bytes).
*/
#define ARR_OVERHEAD(n) \
(DOUBLEALIGN(sizeof(ArrayType) + 2 * (n) * sizeof(int)))
#define ARR_OVERHEAD(n) \
(DOUBLEALIGN(sizeof(ArrayType) + 2 * (n) * sizeof(int)))
/*------------------------------------------------------------------------
* Miscellaneous helper definitions and routines for arrayfuncs.c
@@ -98,37 +99,43 @@ typedef struct {
/* #if defined(irix5) */
/* #define RETURN_NULL {*isNull = true; return(0); }*/
/* #else*/ /* irix5 */
/* #else*//* irix5 */
#define RETURN_NULL {*isNull = true; return(0); }
/* #endif */ /* irix5 */
#define NAME_LEN 30
/* #endif *//* irix5 */
#define NAME_LEN 30
#define MAX_BUFF_SIZE (1 << 13)
typedef struct {
char lo_name[NAME_LEN];
int C[MAXDIM];
} CHUNK_INFO;
typedef struct
{
char lo_name[NAME_LEN];
int C[MAXDIM];
} CHUNK_INFO;
/*
* prototypes for functions defined in arrayfuncs.c
*/
extern char *array_in(char *string, Oid element_type);
extern char *array_out(ArrayType *v, Oid element_type);
extern char *array_dims(ArrayType *v, bool *isNull);
extern Datum array_ref(ArrayType *array, int n, int indx[], int reftype,
int elmlen, int arraylen, bool *isNull);
extern Datum array_clip(ArrayType *array, int n, int upperIndx[],
int lowerIndx[], int reftype, int len, bool *isNull);
extern char *array_set(ArrayType *array, int n, int indx[], char *dataPtr,
int reftype, int elmlen, int arraylen, bool *isNull);
extern char *array_assgn(ArrayType *array, int n, int upperIndx[],
int lowerIndx[], ArrayType *newArr, int reftype,
int len, bool *isNull);
extern int array_eq (ArrayType *array1, ArrayType *array2);
extern int _LOtransfer(char **destfd, int size, int nitems, char **srcfd,
int isSrcLO, int isDestLO);
extern char *array_in(char *string, Oid element_type);
extern char *array_out(ArrayType * v, Oid element_type);
extern char *array_dims(ArrayType * v, bool * isNull);
extern Datum
array_ref(ArrayType * array, int n, int indx[], int reftype,
int elmlen, int arraylen, bool * isNull);
extern Datum
array_clip(ArrayType * array, int n, int upperIndx[],
int lowerIndx[], int reftype, int len, bool * isNull);
extern char *
array_set(ArrayType * array, int n, int indx[], char *dataPtr,
int reftype, int elmlen, int arraylen, bool * isNull);
extern char *
array_assgn(ArrayType * array, int n, int upperIndx[],
int lowerIndx[], ArrayType * newArr, int reftype,
int len, bool * isNull);
extern int array_eq(ArrayType * array1, ArrayType * array2);
extern int
_LOtransfer(char **destfd, int size, int nitems, char **srcfd,
int isSrcLO, int isDestLO);
extern char * _array_newLO(int *fd, int flag);
extern char *_array_newLO(int *fd, int flag);
/*
@@ -136,25 +143,28 @@ extern char * _array_newLO(int *fd, int flag);
* [these names seem to be too generic. Add prefix for arrays? -- AY]
*/
extern int GetOffset(int n, int dim[], int lb[], int indx[]);
extern int getNitems(int n, int a[]);
extern int compute_size(int st[], int endp[], int n, int base);
extern void mda_get_offset_values(int n, int dist[], int PC[], int span[]);
extern void mda_get_range(int n, int span[], int st[], int endp[]);
extern void mda_get_prod(int n, int range[], int P[]);
extern int tuple2linear(int n, int tup[], int scale[]);
extern void array2chunk_coord(int n, int C[], int a_coord[], int c_coord[]);
extern int next_tuple(int n, int curr[], int span[]);
extern int GetOffset(int n, int dim[], int lb[], int indx[]);
extern int getNitems(int n, int a[]);
extern int compute_size(int st[], int endp[], int n, int base);
extern void mda_get_offset_values(int n, int dist[], int PC[], int span[]);
extern void mda_get_range(int n, int span[], int st[], int endp[]);
extern void mda_get_prod(int n, int range[], int P[]);
extern int tuple2linear(int n, int tup[], int scale[]);
extern void array2chunk_coord(int n, int C[], int a_coord[], int c_coord[]);
extern int next_tuple(int n, int curr[], int span[]);
/*
* prototypes for functions defined in chunk.c
*/
extern char * _ChunkArray(int fd, FILE *afd, int ndim, int dim[], int baseSize,
int *nbytes, char *chunkfile);
extern int _ReadChunkArray(int st[], int endp[], int bsize, int fp,
char *destfp, ArrayType *array, int isDestLO, bool *isNull);
extern struct varlena *_ReadChunkArray1El(int st[], int bsize, int fp,
ArrayType *array, bool *isNull);
extern char *
_ChunkArray(int fd, FILE * afd, int ndim, int dim[], int baseSize,
int *nbytes, char *chunkfile);
extern int
_ReadChunkArray(int st[], int endp[], int bsize, int fp,
char *destfp, ArrayType * array, int isDestLO, bool * isNull);
extern struct varlena *
_ReadChunkArray1El(int st[], int bsize, int fp,
ArrayType * array, bool * isNull);
#endif /* ARRAY_H */
#endif /* ARRAY_H */

View File

@@ -1,39 +1,39 @@
/*-------------------------------------------------------------------------
*
* bit.h--
* Standard bit array definitions.
* Standard bit array definitions.
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: bit.h,v 1.1 1996/08/28 01:58:43 scrappy Exp $
* $Id: bit.h,v 1.2 1997/09/07 05:02:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef BIT_H
#ifndef BIT_H
#define BIT_H
typedef bits8 *BitArray;
typedef bits8 *BitArray;
typedef uint32 BitIndex;
#define BitsPerByte 8
#define BitsPerByte 8
/*
* BitArraySetBit --
* Sets (to 1) the value of a bit in a bit array.
* Sets (to 1) the value of a bit in a bit array.
*/
extern void BitArraySetBit(BitArray bitArray, BitIndex bitIndex);
extern void BitArraySetBit(BitArray bitArray, BitIndex bitIndex);
/*
* BitArrayClearBit --
* Clears (to 0) the value of a bit in a bit array.
* Clears (to 0) the value of a bit in a bit array.
*/
extern void BitArrayClearBit(BitArray bitArray, BitIndex bitIndex);
extern void BitArrayClearBit(BitArray bitArray, BitIndex bitIndex);
/*
* BitArrayBitIsSet --
* True iff the bit is set (1) in a bit array.
* True iff the bit is set (1) in a bit array.
*/
extern bool BitArrayBitIsSet(BitArray bitArray, BitIndex bitIndex);
extern bool BitArrayBitIsSet(BitArray bitArray, BitIndex bitIndex);
#endif /* BIT_H */
#endif /* BIT_H */

View File

@@ -1,17 +1,17 @@
/*-------------------------------------------------------------------------
*
* builtins.h--
* Declarations for operations on built-in types.
* Declarations for operations on built-in types.
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: builtins.h,v 1.21 1997/08/19 21:40:26 momjian Exp $
* $Id: builtins.h,v 1.22 1997/09/07 05:02:11 momjian Exp $
*
* NOTES
* This should normally only be included by fmgr.h.
* Under no circumstances should it ever be included before
* including fmgr.h!
* This should normally only be included by fmgr.h.
* Under no circumstances should it ever be included before
* including fmgr.h!
*
*-------------------------------------------------------------------------
*/
@@ -26,161 +26,161 @@
#include <utils/rel.h>
/*
* Defined in adt/
* Defined in adt/
*/
/* bool.c */
extern bool boolin(char *b);
extern char *boolout(long b);
extern bool booleq(int8 arg1, int8 arg2);
extern bool boolne(int8 arg1, int8 arg2);
extern bool boollt(int8 arg1, int8 arg2);
extern bool boolgt(int8 arg1, int8 arg2);
extern bool boolin(char *b);
extern char *boolout(long b);
extern bool booleq(int8 arg1, int8 arg2);
extern bool boolne(int8 arg1, int8 arg2);
extern bool boollt(int8 arg1, int8 arg2);
extern bool boolgt(int8 arg1, int8 arg2);
/* char.c */
extern int32 charin(char *ch);
extern char *charout(int32 ch);
extern int32 cidin(char *s);
extern char *cidout(int32 c);
extern char *char16in(char *s);
extern char *char16out(char *s);
extern bool chareq(int8 arg1, int8 arg2);
extern bool charne(int8 arg1, int8 arg2);
extern bool charlt(int8 arg1, int8 arg2);
extern bool charle(int8 arg1, int8 arg2);
extern bool chargt(int8 arg1, int8 arg2);
extern bool charge(int8 arg1, int8 arg2);
extern int8 charpl(int8 arg1, int8 arg2);
extern int8 charmi(int8 arg1, int8 arg2);
extern int8 charmul(int8 arg1, int8 arg2);
extern int8 chardiv(int8 arg1, int8 arg2);
extern bool cideq(int8 arg1, int8 arg2);
extern bool char16eq(char *arg1, char *arg2);
extern bool char16ne(char *arg1, char *arg2);
extern bool char16lt(char *arg1, char *arg2);
extern bool char16le(char *arg1, char *arg2);
extern bool char16gt(char *arg1, char *arg2);
extern bool char16ge(char *arg1, char *arg2);
extern uint16 char2in(char *s);
extern char *char2out(uint16 s);
extern bool char2eq(uint16 a, uint16 b);
extern bool char2ne(uint16 a, uint16 b);
extern bool char2lt(uint16 a, uint16 b);
extern bool char2le(uint16 a, uint16 b);
extern bool char2gt(uint16 a, uint16 b);
extern bool char2ge(uint16 a, uint16 b);
extern int32 char2cmp(uint16 a, uint16 b);
extern uint32 char4in(char *s);
extern char *char4out(uint32 s);
extern bool char4eq(uint32 a, uint32 b);
extern bool char4ne(uint32 a, uint32 b);
extern bool char4lt(uint32 a, uint32 b);
extern bool char4le(uint32 a, uint32 b);
extern bool char4gt(uint32 a, uint32 b);
extern bool char4ge(uint32 a, uint32 b);
extern int32 char4cmp(uint32 a, uint32 b);
extern char *char8in(char *s);
extern char *char8out(char *s);
extern bool char8eq(char *arg1, char *arg2);
extern bool char8ne(char *arg1, char *arg2);
extern bool char8lt(char *arg1, char *arg2);
extern bool char8le(char *arg1, char *arg2);
extern bool char8gt(char *arg1, char *arg2);
extern bool char8ge(char *arg1, char *arg2);
extern int32 char8cmp(char *arg1, char *arg2);
extern int32 charin(char *ch);
extern char *charout(int32 ch);
extern int32 cidin(char *s);
extern char *cidout(int32 c);
extern char *char16in(char *s);
extern char *char16out(char *s);
extern bool chareq(int8 arg1, int8 arg2);
extern bool charne(int8 arg1, int8 arg2);
extern bool charlt(int8 arg1, int8 arg2);
extern bool charle(int8 arg1, int8 arg2);
extern bool chargt(int8 arg1, int8 arg2);
extern bool charge(int8 arg1, int8 arg2);
extern int8 charpl(int8 arg1, int8 arg2);
extern int8 charmi(int8 arg1, int8 arg2);
extern int8 charmul(int8 arg1, int8 arg2);
extern int8 chardiv(int8 arg1, int8 arg2);
extern bool cideq(int8 arg1, int8 arg2);
extern bool char16eq(char *arg1, char *arg2);
extern bool char16ne(char *arg1, char *arg2);
extern bool char16lt(char *arg1, char *arg2);
extern bool char16le(char *arg1, char *arg2);
extern bool char16gt(char *arg1, char *arg2);
extern bool char16ge(char *arg1, char *arg2);
extern uint16 char2in(char *s);
extern char *char2out(uint16 s);
extern bool char2eq(uint16 a, uint16 b);
extern bool char2ne(uint16 a, uint16 b);
extern bool char2lt(uint16 a, uint16 b);
extern bool char2le(uint16 a, uint16 b);
extern bool char2gt(uint16 a, uint16 b);
extern bool char2ge(uint16 a, uint16 b);
extern int32 char2cmp(uint16 a, uint16 b);
extern uint32 char4in(char *s);
extern char *char4out(uint32 s);
extern bool char4eq(uint32 a, uint32 b);
extern bool char4ne(uint32 a, uint32 b);
extern bool char4lt(uint32 a, uint32 b);
extern bool char4le(uint32 a, uint32 b);
extern bool char4gt(uint32 a, uint32 b);
extern bool char4ge(uint32 a, uint32 b);
extern int32 char4cmp(uint32 a, uint32 b);
extern char *char8in(char *s);
extern char *char8out(char *s);
extern bool char8eq(char *arg1, char *arg2);
extern bool char8ne(char *arg1, char *arg2);
extern bool char8lt(char *arg1, char *arg2);
extern bool char8le(char *arg1, char *arg2);
extern bool char8gt(char *arg1, char *arg2);
extern bool char8ge(char *arg1, char *arg2);
extern int32 char8cmp(char *arg1, char *arg2);
/* int.c */
extern int32 int2in(char *num);
extern char *int2out(int16 sh);
extern int16 *int28in(char *shs);
extern char *int28out(int16 (*shs)[]);
extern int32 *int44in(char *input_string);
extern char *int44out(int32 an_array[]);
extern int32 int4in(char *num);
extern char *int4out(int32 l);
extern int32 i2toi4(int16 arg1);
extern int16 i4toi2(int32 arg1);
extern bool int4eq(int32 arg1, int32 arg2);
extern bool int4ne(int32 arg1, int32 arg2);
extern bool int4lt(int32 arg1, int32 arg2);
extern bool int4le(int32 arg1, int32 arg2);
extern bool int4gt(int32 arg1, int32 arg2);
extern bool int4ge(int32 arg1, int32 arg2);
extern bool int2eq(int16 arg1, int16 arg2);
extern bool int2ne(int16 arg1, int16 arg2);
extern bool int2lt(int16 arg1, int16 arg2);
extern bool int2le(int16 arg1, int16 arg2);
extern bool int2gt(int16 arg1, int16 arg2);
extern bool int2ge(int16 arg1, int16 arg2);
extern bool int24eq(int32 arg1, int32 arg2);
extern bool int24ne(int32 arg1, int32 arg2);
extern bool int24lt(int32 arg1, int32 arg2);
extern bool int24le(int32 arg1, int32 arg2);
extern bool int24gt(int32 arg1, int32 arg2);
extern bool int24ge(int32 arg1, int32 arg2);
extern bool int42eq(int32 arg1, int32 arg2);
extern bool int42ne(int32 arg1, int32 arg2);
extern bool int42lt(int32 arg1, int32 arg2);
extern bool int42le(int32 arg1, int32 arg2);
extern bool int42gt(int32 arg1, int32 arg2);
extern bool int42ge(int32 arg1, int32 arg2);
extern bool keyfirsteq(int16 *arg1, int16 arg2);
extern int32 int4um(int32 arg);
extern int32 int4pl(int32 arg1, int32 arg2);
extern int32 int4mi(int32 arg1, int32 arg2);
extern int32 int4mul(int32 arg1, int32 arg2);
extern int32 int4div(int32 arg1, int32 arg2);
extern int32 int4inc(int32 arg);
extern int16 int2um(int16 arg);
extern int16 int2pl(int16 arg1, int16 arg2);
extern int16 int2mi(int16 arg1, int16 arg2);
extern int16 int2mul(int16 arg1, int16 arg2);
extern int16 int2div(int16 arg1, int16 arg2);
extern int16 int2inc(int16 arg);
extern int32 int24pl(int32 arg1, int32 arg2);
extern int32 int24mi(int32 arg1, int32 arg2);
extern int32 int24mul(int32 arg1, int32 arg2);
extern int32 int24div(int32 arg1, int32 arg2);
extern int32 int42pl(int32 arg1, int32 arg2);
extern int32 int42mi(int32 arg1, int32 arg2);
extern int32 int42mul(int32 arg1, int32 arg2);
extern int32 int42div(int32 arg1, int32 arg2);
extern int32 int4mod(int32 arg1, int32 arg2);
extern int32 int2mod(int16 arg1, int16 arg2);
extern int32 int24mod(int32 arg1, int32 arg2);
extern int32 int42mod(int32 arg1, int32 arg2);
extern int32 int4fac(int32 arg1);
extern int32 int2fac(int16 arg1);
extern int16 int2larger(int16 arg1, int16 arg2);
extern int16 int2smaller(int16 arg1, int16 arg2);
extern int32 int4larger(int32 arg1, int32 arg2);
extern int32 int4smaller(int32 arg1, int32 arg2);
extern int32 int2in(char *num);
extern char *int2out(int16 sh);
extern int16 *int28in(char *shs);
extern char *int28out(int16(*shs)[]);
extern int32 *int44in(char *input_string);
extern char *int44out(int32 an_array[]);
extern int32 int4in(char *num);
extern char *int4out(int32 l);
extern int32 i2toi4(int16 arg1);
extern int16 i4toi2(int32 arg1);
extern bool int4eq(int32 arg1, int32 arg2);
extern bool int4ne(int32 arg1, int32 arg2);
extern bool int4lt(int32 arg1, int32 arg2);
extern bool int4le(int32 arg1, int32 arg2);
extern bool int4gt(int32 arg1, int32 arg2);
extern bool int4ge(int32 arg1, int32 arg2);
extern bool int2eq(int16 arg1, int16 arg2);
extern bool int2ne(int16 arg1, int16 arg2);
extern bool int2lt(int16 arg1, int16 arg2);
extern bool int2le(int16 arg1, int16 arg2);
extern bool int2gt(int16 arg1, int16 arg2);
extern bool int2ge(int16 arg1, int16 arg2);
extern bool int24eq(int32 arg1, int32 arg2);
extern bool int24ne(int32 arg1, int32 arg2);
extern bool int24lt(int32 arg1, int32 arg2);
extern bool int24le(int32 arg1, int32 arg2);
extern bool int24gt(int32 arg1, int32 arg2);
extern bool int24ge(int32 arg1, int32 arg2);
extern bool int42eq(int32 arg1, int32 arg2);
extern bool int42ne(int32 arg1, int32 arg2);
extern bool int42lt(int32 arg1, int32 arg2);
extern bool int42le(int32 arg1, int32 arg2);
extern bool int42gt(int32 arg1, int32 arg2);
extern bool int42ge(int32 arg1, int32 arg2);
extern bool keyfirsteq(int16 * arg1, int16 arg2);
extern int32 int4um(int32 arg);
extern int32 int4pl(int32 arg1, int32 arg2);
extern int32 int4mi(int32 arg1, int32 arg2);
extern int32 int4mul(int32 arg1, int32 arg2);
extern int32 int4div(int32 arg1, int32 arg2);
extern int32 int4inc(int32 arg);
extern int16 int2um(int16 arg);
extern int16 int2pl(int16 arg1, int16 arg2);
extern int16 int2mi(int16 arg1, int16 arg2);
extern int16 int2mul(int16 arg1, int16 arg2);
extern int16 int2div(int16 arg1, int16 arg2);
extern int16 int2inc(int16 arg);
extern int32 int24pl(int32 arg1, int32 arg2);
extern int32 int24mi(int32 arg1, int32 arg2);
extern int32 int24mul(int32 arg1, int32 arg2);
extern int32 int24div(int32 arg1, int32 arg2);
extern int32 int42pl(int32 arg1, int32 arg2);
extern int32 int42mi(int32 arg1, int32 arg2);
extern int32 int42mul(int32 arg1, int32 arg2);
extern int32 int42div(int32 arg1, int32 arg2);
extern int32 int4mod(int32 arg1, int32 arg2);
extern int32 int2mod(int16 arg1, int16 arg2);
extern int32 int24mod(int32 arg1, int32 arg2);
extern int32 int42mod(int32 arg1, int32 arg2);
extern int32 int4fac(int32 arg1);
extern int32 int2fac(int16 arg1);
extern int16 int2larger(int16 arg1, int16 arg2);
extern int16 int2smaller(int16 arg1, int16 arg2);
extern int32 int4larger(int32 arg1, int32 arg2);
extern int32 int4smaller(int32 arg1, int32 arg2);
/* name.c */
extern NameData *namein(char *s);
extern char *nameout(NameData *s);
extern bool nameeq(NameData *arg1, NameData *arg2);
extern bool namene(NameData *arg1, NameData *arg2);
extern bool namelt(NameData *arg1, NameData *arg2);
extern bool namele(NameData *arg1, NameData *arg2);
extern bool namegt(NameData *arg1, NameData *arg2);
extern bool namege(NameData *arg1, NameData *arg2);
extern int namecmp(Name n1, Name n2);
extern int namecpy(Name n1, Name n2);
extern int namestrcpy(Name name, char *str);
extern int namestrcmp(Name name, char *str);
extern char *nameout(NameData * s);
extern bool nameeq(NameData * arg1, NameData * arg2);
extern bool namene(NameData * arg1, NameData * arg2);
extern bool namelt(NameData * arg1, NameData * arg2);
extern bool namele(NameData * arg1, NameData * arg2);
extern bool namegt(NameData * arg1, NameData * arg2);
extern bool namege(NameData * arg1, NameData * arg2);
extern int namecmp(Name n1, Name n2);
extern int namecpy(Name n1, Name n2);
extern int namestrcpy(Name name, char *str);
extern int namestrcmp(Name name, char *str);
/* numutils.c */
/* XXX hack. HP-UX has a ltoa (with different arguments) already. */
#ifdef hpux
#define ltoa pg_ltoa
#endif /* hpux */
extern int32 pg_atoi(char *s, int size, int c);
extern void itoa(int i, char *a);
extern void ltoa(int32 l, char *a);
#endif /* hpux */
extern int32 pg_atoi(char *s, int size, int c);
extern void itoa(int i, char *a);
extern void ltoa(int32 l, char *a);
/*
* Per-opclass comparison functions for new btrees. These are
* stored in pg_amproc and defined in nbtree/
* Per-opclass comparison functions for new btrees. These are
* stored in pg_amproc and defined in nbtree/
*/
extern int32 btint2cmp(int16 a, int16 b);
extern int32 btint4cmp(int32 a, int32 b);
@@ -195,343 +195,344 @@ extern int32 btchar2cmp(uint16 a, uint16 b);
extern int32 btchar4cmp(uint32 a, uint32 b);
extern int32 btchar8cmp(char *a, char *b);
extern int32 btchar16cmp(char *a, char *b);
extern int32 btnamecmp(NameData *a, NameData *b);
extern int32 bttextcmp(struct varlena *a, struct varlena *b);
extern int32 btnamecmp(NameData * a, NameData * b);
extern int32 bttextcmp(struct varlena * a, struct varlena * b);
/* support routines for the rtree access method, by opclass */
extern BOX *rt_box_union(BOX *a,BOX *b);
extern BOX *rt_box_inter(BOX *a, BOX *b);
extern void rt_box_size(BOX *a, float *size);
extern void rt_bigbox_size(BOX *a,float *size);
extern void rt_poly_size(POLYGON *a, float *size);
extern POLYGON *rt_poly_union(POLYGON *a, POLYGON *b);
extern POLYGON *rt_poly_inter(POLYGON *a, POLYGON *b);
extern BOX *rt_box_union(BOX * a, BOX * b);
extern BOX *rt_box_inter(BOX * a, BOX * b);
extern void rt_box_size(BOX * a, float *size);
extern void rt_bigbox_size(BOX * a, float *size);
extern void rt_poly_size(POLYGON * a, float *size);
extern POLYGON *rt_poly_union(POLYGON * a, POLYGON * b);
extern POLYGON *rt_poly_inter(POLYGON * a, POLYGON * b);
/* projection utilities */
/* extern char *GetAttributeByName();
/* extern char *GetAttributeByName();
extern char *GetAttributeByNum(); ,
in executor/executor.h*/
extern int32 pqtest(struct varlena *vlena);
extern int32 pqtest(struct varlena * vlena);
/* arrayfuncs.c */
/* date.c */
extern int32 reltimein(char *timestring);
extern char *reltimeout(int32 timevalue);
extern int32 reltimein(char *timestring);
extern char *reltimeout(int32 timevalue);
extern TimeInterval tintervalin(char *intervalstr);
extern char *tintervalout(TimeInterval interval);
extern RelativeTime timespan_reltime(TimeSpan *timespan);
extern char *tintervalout(TimeInterval interval);
extern RelativeTime timespan_reltime(TimeSpan * timespan);
extern TimeSpan *reltime_timespan(RelativeTime reltime);
extern TimeInterval mktinterval(AbsoluteTime t1, AbsoluteTime t2);
extern AbsoluteTime timepl(AbsoluteTime t1, RelativeTime t2);
extern AbsoluteTime timemi(AbsoluteTime t1, RelativeTime t2);
/* extern RelativeTime abstimemi(AbsoluteTime t1, AbsoluteTime t2); static*/
extern int ininterval(AbsoluteTime t, TimeInterval interval);
extern int ininterval(AbsoluteTime t, TimeInterval interval);
extern RelativeTime intervalrel(TimeInterval interval);
extern AbsoluteTime timenow(void);
extern bool reltimeeq(RelativeTime t1, RelativeTime t2);
extern bool reltimene(RelativeTime t1, RelativeTime t2);
extern bool reltimelt(RelativeTime t1, RelativeTime t2);
extern bool reltimegt(RelativeTime t1, RelativeTime t2);
extern bool reltimele(RelativeTime t1, RelativeTime t2);
extern bool reltimege(RelativeTime t1, RelativeTime t2);
extern bool intervaleq(TimeInterval i1, TimeInterval i2);
extern bool intervalleneq(TimeInterval i, RelativeTime t);
extern bool intervallenne(TimeInterval i, RelativeTime t);
extern bool intervallenlt(TimeInterval i, RelativeTime t);
extern bool intervallengt(TimeInterval i, RelativeTime t);
extern bool intervallenle(TimeInterval i, RelativeTime t);
extern bool intervallenge(TimeInterval i, RelativeTime t);
extern bool intervalct(TimeInterval i1, TimeInterval i2);
extern bool intervalov(TimeInterval i1, TimeInterval i2);
extern bool reltimeeq(RelativeTime t1, RelativeTime t2);
extern bool reltimene(RelativeTime t1, RelativeTime t2);
extern bool reltimelt(RelativeTime t1, RelativeTime t2);
extern bool reltimegt(RelativeTime t1, RelativeTime t2);
extern bool reltimele(RelativeTime t1, RelativeTime t2);
extern bool reltimege(RelativeTime t1, RelativeTime t2);
extern bool intervaleq(TimeInterval i1, TimeInterval i2);
extern bool intervalleneq(TimeInterval i, RelativeTime t);
extern bool intervallenne(TimeInterval i, RelativeTime t);
extern bool intervallenlt(TimeInterval i, RelativeTime t);
extern bool intervallengt(TimeInterval i, RelativeTime t);
extern bool intervallenle(TimeInterval i, RelativeTime t);
extern bool intervallenge(TimeInterval i, RelativeTime t);
extern bool intervalct(TimeInterval i1, TimeInterval i2);
extern bool intervalov(TimeInterval i1, TimeInterval i2);
extern AbsoluteTime intervalstart(TimeInterval i);
extern AbsoluteTime intervalend(TimeInterval i);
extern int isreltime(char *timestring);
extern text *timeofday(void);
extern int isreltime(char *timestring);
extern text *timeofday(void);
/* dt.c */
extern DateTime *datetime_in(char *str);
extern char *datetime_out(DateTime *datetime);
extern char *datetime_out(DateTime * datetime);
extern TimeSpan *timespan_in(char *str);
extern char *timespan_out(TimeSpan *timespan);
extern int datetime2tm( DateTime dt, int *tzp, struct tm *tm, double *fsec, char **tzn);
extern char *timespan_out(TimeSpan * timespan);
extern int datetime2tm(DateTime dt, int *tzp, struct tm * tm, double *fsec, char **tzn);
/* filename.c */
extern char *filename_in(char *file);
extern char *filename_out(char *s);
extern char *filename_in(char *file);
extern char *filename_out(char *s);
/* float.c */
extern void CheckFloat8Val(double val); /* used by lex */
extern float32 float4in(char *num);
extern char *float4out(float32 num);
extern float64 float8in(char *num);
extern char *float8out(float64 num);
extern float32 float4abs(float32 arg1);
extern float32 float4um(float32 arg1);
extern float32 float4larger(float32 arg1, float32 arg2);
extern float32 float4smaller(float32 arg1, float32 arg2);
extern float64 float8abs(float64 arg1);
extern float64 float8um(float64 arg1);
extern float64 float8larger(float64 arg1, float64 arg2);
extern float64 float8smaller(float64 arg1, float64 arg2);
extern float32 float4pl(float32 arg1, float32 arg2);
extern float32 float4mi(float32 arg1, float32 arg2);
extern float32 float4mul(float32 arg1, float32 arg2);
extern float32 float4div(float32 arg1, float32 arg2);
extern float32 float4inc(float32 arg1);
extern float64 float8pl(float64 arg1, float64 arg2);
extern float64 float8mi(float64 arg1, float64 arg2);
extern float64 float8mul(float64 arg1, float64 arg2);
extern float64 float8div(float64 arg1, float64 arg2);
extern float64 float8inc(float64 arg1);
extern bool float4eq(float32 arg1, float32 arg2);
extern bool float4ne(float32 arg1, float32 arg2);
extern bool float4lt(float32 arg1, float32 arg2);
extern bool float4le(float32 arg1, float32 arg2);
extern bool float4gt(float32 arg1, float32 arg2);
extern bool float4ge(float32 arg1, float32 arg2);
extern bool float8eq(float64 arg1, float64 arg2);
extern bool float8ne(float64 arg1, float64 arg2);
extern bool float8lt(float64 arg1, float64 arg2);
extern bool float8le(float64 arg1, float64 arg2);
extern bool float8gt(float64 arg1, float64 arg2);
extern bool float8ge(float64 arg1, float64 arg2);
extern float64 ftod(float32 num);
extern float64 i4tod(int32 num);
extern float64 i2tod(int16 num);
extern float32 dtof(float64 num);
extern int32 dtoi4(float64 num);
extern int16 dtoi2(float64 num);
extern float32 i4tof(int32 num);
extern float32 i2tof(int16 num);
extern int32 ftoi4(float32 num);
extern int16 ftoi2(float32 num);
extern float64 dround(float64 arg1);
extern float64 dtrunc(float64 arg1);
extern float64 dsqrt(float64 arg1);
extern float64 dcbrt(float64 arg1);
extern float64 dpow(float64 arg1, float64 arg2);
extern float64 dexp(float64 arg1);
extern float64 dlog1(float64 arg1);
extern float64 float48pl(float32 arg1, float64 arg2);
extern float64 float48mi(float32 arg1, float64 arg2);
extern float64 float48mul(float32 arg1, float64 arg2);
extern float64 float48div(float32 arg1, float64 arg2);
extern float64 float84pl(float64 arg1, float32 arg2);
extern float64 float84mi(float64 arg1, float32 arg2);
extern float64 float84mul(float64 arg1, float32 arg2);
extern float64 float84div(float64 arg1, float32 arg2);
extern bool float48eq(float32 arg1, float64 arg2);
extern bool float48ne(float32 arg1, float64 arg2);
extern bool float48lt(float32 arg1, float64 arg2);
extern bool float48le(float32 arg1, float64 arg2);
extern bool float48gt(float32 arg1, float64 arg2);
extern bool float48ge(float32 arg1, float64 arg2);
extern bool float84eq(float64 arg1, float32 arg2);
extern bool float84ne(float64 arg1, float32 arg2);
extern bool float84lt(float64 arg1, float32 arg2);
extern bool float84le(float64 arg1, float32 arg2);
extern bool float84gt(float64 arg1, float32 arg2);
extern bool float84ge(float64 arg1, float32 arg2);
extern void CheckFloat8Val(double val); /* used by lex */
extern float32 float4in(char *num);
extern char *float4out(float32 num);
extern float64 float8in(char *num);
extern char *float8out(float64 num);
extern float32 float4abs(float32 arg1);
extern float32 float4um(float32 arg1);
extern float32 float4larger(float32 arg1, float32 arg2);
extern float32 float4smaller(float32 arg1, float32 arg2);
extern float64 float8abs(float64 arg1);
extern float64 float8um(float64 arg1);
extern float64 float8larger(float64 arg1, float64 arg2);
extern float64 float8smaller(float64 arg1, float64 arg2);
extern float32 float4pl(float32 arg1, float32 arg2);
extern float32 float4mi(float32 arg1, float32 arg2);
extern float32 float4mul(float32 arg1, float32 arg2);
extern float32 float4div(float32 arg1, float32 arg2);
extern float32 float4inc(float32 arg1);
extern float64 float8pl(float64 arg1, float64 arg2);
extern float64 float8mi(float64 arg1, float64 arg2);
extern float64 float8mul(float64 arg1, float64 arg2);
extern float64 float8div(float64 arg1, float64 arg2);
extern float64 float8inc(float64 arg1);
extern bool float4eq(float32 arg1, float32 arg2);
extern bool float4ne(float32 arg1, float32 arg2);
extern bool float4lt(float32 arg1, float32 arg2);
extern bool float4le(float32 arg1, float32 arg2);
extern bool float4gt(float32 arg1, float32 arg2);
extern bool float4ge(float32 arg1, float32 arg2);
extern bool float8eq(float64 arg1, float64 arg2);
extern bool float8ne(float64 arg1, float64 arg2);
extern bool float8lt(float64 arg1, float64 arg2);
extern bool float8le(float64 arg1, float64 arg2);
extern bool float8gt(float64 arg1, float64 arg2);
extern bool float8ge(float64 arg1, float64 arg2);
extern float64 ftod(float32 num);
extern float64 i4tod(int32 num);
extern float64 i2tod(int16 num);
extern float32 dtof(float64 num);
extern int32 dtoi4(float64 num);
extern int16 dtoi2(float64 num);
extern float32 i4tof(int32 num);
extern float32 i2tof(int16 num);
extern int32 ftoi4(float32 num);
extern int16 ftoi2(float32 num);
extern float64 dround(float64 arg1);
extern float64 dtrunc(float64 arg1);
extern float64 dsqrt(float64 arg1);
extern float64 dcbrt(float64 arg1);
extern float64 dpow(float64 arg1, float64 arg2);
extern float64 dexp(float64 arg1);
extern float64 dlog1(float64 arg1);
extern float64 float48pl(float32 arg1, float64 arg2);
extern float64 float48mi(float32 arg1, float64 arg2);
extern float64 float48mul(float32 arg1, float64 arg2);
extern float64 float48div(float32 arg1, float64 arg2);
extern float64 float84pl(float64 arg1, float32 arg2);
extern float64 float84mi(float64 arg1, float32 arg2);
extern float64 float84mul(float64 arg1, float32 arg2);
extern float64 float84div(float64 arg1, float32 arg2);
extern bool float48eq(float32 arg1, float64 arg2);
extern bool float48ne(float32 arg1, float64 arg2);
extern bool float48lt(float32 arg1, float64 arg2);
extern bool float48le(float32 arg1, float64 arg2);
extern bool float48gt(float32 arg1, float64 arg2);
extern bool float48ge(float32 arg1, float64 arg2);
extern bool float84eq(float64 arg1, float32 arg2);
extern bool float84ne(float64 arg1, float32 arg2);
extern bool float84lt(float64 arg1, float32 arg2);
extern bool float84le(float64 arg1, float32 arg2);
extern bool float84gt(float64 arg1, float32 arg2);
extern bool float84ge(float64 arg1, float32 arg2);
/* geo_ops.c, geo_selfuncs.c */
extern double *box_area(BOX *box);
extern double *box_area(BOX * box);
/* misc.c */
extern bool nullvalue(Datum value, bool *isNull);
extern bool nonnullvalue(Datum value, bool *isNull);
extern bool oidrand(Oid o, int32 X);
extern bool oidsrand(int32 X);
extern int32 userfntest(int i);
extern bool nullvalue(Datum value, bool * isNull);
extern bool nonnullvalue(Datum value, bool * isNull);
extern bool oidrand(Oid o, int32 X);
extern bool oidsrand(int32 X);
extern int32 userfntest(int i);
/* define macros to replace mixed-case function calls - tgl 97/04/27 */
#define NullValue(v,b) nullvalue(v,b)
#define NonNullValue(v,b) nonnullvalue(v,b)
/* not_in.c */
extern bool int4notin(int16 not_in_arg, char *relation_and_attr);
extern bool oidnotin(Oid the_oid, char *compare);
extern bool int4notin(int16 not_in_arg, char *relation_and_attr);
extern bool oidnotin(Oid the_oid, char *compare);
/* oid.c */
extern Oid *oid8in(char *oidString);
extern char *oid8out(Oid (*oidArray)[]);
extern Oid oidin(char *s);
extern char *oidout(Oid o);
extern bool oideq(Oid arg1, Oid arg2);
extern bool oidne(Oid arg1, Oid arg2);
extern bool oid8eq(Oid arg1[], Oid arg2[]);
extern bool oideqint4(Oid arg1, int32 arg2);
extern bool int4eqoid(int32 arg1, Oid arg2);
extern Oid *oid8in(char *oidString);
extern char *oid8out(Oid(*oidArray)[]);
extern Oid oidin(char *s);
extern char *oidout(Oid o);
extern bool oideq(Oid arg1, Oid arg2);
extern bool oidne(Oid arg1, Oid arg2);
extern bool oid8eq(Oid arg1[], Oid arg2[]);
extern bool oideqint4(Oid arg1, int32 arg2);
extern bool int4eqoid(int32 arg1, Oid arg2);
/* regexp.c */
extern bool char2regexeq(uint16 arg1, struct varlena *p);
extern bool char2regexne(uint16 arg1, struct varlena *p);
extern bool char4regexeq(uint32 arg1, struct varlena *p);
extern bool char4regexne(uint32 arg1, struct varlena *p);
extern bool char8regexeq(char *s, struct varlena *p);
extern bool char8regexne(char *s, struct varlena *p);
extern bool char16regexeq(char *s, struct varlena *p);
extern bool char16regexne(char *s, struct varlena *p);
extern bool nameregexeq(NameData *n, struct varlena *p);
extern bool nameregexne(NameData *s, struct varlena *p);
extern bool textregexeq(struct varlena *s, struct varlena *p);
extern bool textregexne(struct varlena *s, struct varlena *p);
extern bool char2icregexeq(uint16 arg1, struct varlena *p);
extern bool char2icregexne(uint16 arg1, struct varlena *p);
extern bool char4icregexeq(uint32 arg1, struct varlena *p);
extern bool char4icregexne(uint32 arg1, struct varlena *p);
extern bool char8icregexeq(char *s, struct varlena *p);
extern bool char8icregexne(char *s, struct varlena *p);
extern bool char16icregexeq(char *s, struct varlena *p);
extern bool char16icregexne(char *s, struct varlena *p);
extern bool nameicregexeq(NameData *s, struct varlena *p);
extern bool nameicregexne(NameData *s, struct varlena *p);
extern bool texticregexeq(struct varlena *s, struct varlena *p);
extern bool texticregexne(struct varlena *s, struct varlena *p);
extern bool char2regexeq(uint16 arg1, struct varlena * p);
extern bool char2regexne(uint16 arg1, struct varlena * p);
extern bool char4regexeq(uint32 arg1, struct varlena * p);
extern bool char4regexne(uint32 arg1, struct varlena * p);
extern bool char8regexeq(char *s, struct varlena * p);
extern bool char8regexne(char *s, struct varlena * p);
extern bool char16regexeq(char *s, struct varlena * p);
extern bool char16regexne(char *s, struct varlena * p);
extern bool nameregexeq(NameData * n, struct varlena * p);
extern bool nameregexne(NameData * s, struct varlena * p);
extern bool textregexeq(struct varlena * s, struct varlena * p);
extern bool textregexne(struct varlena * s, struct varlena * p);
extern bool char2icregexeq(uint16 arg1, struct varlena * p);
extern bool char2icregexne(uint16 arg1, struct varlena * p);
extern bool char4icregexeq(uint32 arg1, struct varlena * p);
extern bool char4icregexne(uint32 arg1, struct varlena * p);
extern bool char8icregexeq(char *s, struct varlena * p);
extern bool char8icregexne(char *s, struct varlena * p);
extern bool char16icregexeq(char *s, struct varlena * p);
extern bool char16icregexne(char *s, struct varlena * p);
extern bool nameicregexeq(NameData * s, struct varlena * p);
extern bool nameicregexne(NameData * s, struct varlena * p);
extern bool texticregexeq(struct varlena * s, struct varlena * p);
extern bool texticregexne(struct varlena * s, struct varlena * p);
/* regproc.c */
extern int32 regprocin(char *proname);
extern char *regprocout(RegProcedure proid);
extern Oid regproctooid(RegProcedure rp);
extern int32 regprocin(char *proname);
extern char *regprocout(RegProcedure proid);
extern Oid regproctooid(RegProcedure rp);
/* define macro to replace mixed-case function call - tgl 97/04/27 */
#define RegprocToOid(rp) regproctooid(rp)
/* selfuncs.c */
extern float64 eqsel(Oid opid, Oid relid, AttrNumber attno, char *value, int32 flag);
extern float64 neqsel(Oid opid, Oid relid, AttrNumber attno, char *value, int32 flag);
extern float64 intltsel(Oid opid, Oid relid, AttrNumber attno, int32 value, int32 flag);
extern float64 intgtsel(Oid opid, Oid relid, AttrNumber attno, int32 value, int32 flag);
extern float64 eqjoinsel(Oid opid, Oid relid1, AttrNumber attno1, Oid relid2, AttrNumber attno2);
extern float64 neqjoinsel(Oid opid, Oid relid1, AttrNumber attno1, Oid relid2, AttrNumber attno2);
extern float64 intltjoinsel(Oid opid, Oid relid1, AttrNumber attno1, Oid relid2, AttrNumber attno2);
extern float64 intgtjoinsel(Oid opid, Oid relid1, AttrNumber attno1, Oid relid2, AttrNumber attno2);
extern float64 btreesel(Oid operatorOid, Oid indrelid, AttrNumber attributeNumber, char *constValue, int32 constFlag, int32 nIndexKeys, Oid indexrelid);
extern float64 btreenpage(Oid operatorOid, Oid indrelid, AttrNumber attributeNumber, char *constValue, int32 constFlag, int32 nIndexKeys, Oid indexrelid);
extern float64 hashsel(Oid operatorOid, Oid indrelid, AttrNumber attributeNumber, char *constValue, int32 constFlag, int32 nIndexKeys, Oid indexrelid);
extern float64 hashnpage(Oid operatorOid, Oid indrelid, AttrNumber attributeNumber, char *constValue, int32 constFlag, int32 nIndexKeys, Oid indexrelid);
extern float64 rtsel(Oid operatorOid, Oid indrelid, AttrNumber attributeNumber, char *constValue, int32 constFlag, int32 nIndexKeys, Oid indexrelid);
extern float64 rtnpage(Oid operatorOid, Oid indrelid, AttrNumber attributeNumber, char *constValue, int32 constFlag, int32 nIndexKeys, Oid indexrelid);
extern float64 gistsel(Oid operatorObjectId, Oid indrelid, AttrNumber attributeNumber, char *constValue, int32 constFlag, int32 nIndexKeys, Oid indexrelid);
extern float64 gistnpage(Oid operatorObjectId, Oid indrelid, AttrNumber attributeNumber, char *constValue, int32 constFlag, int32 nIndexKeys, Oid indexrelid);
extern float64 eqsel(Oid opid, Oid relid, AttrNumber attno, char *value, int32 flag);
extern float64 neqsel(Oid opid, Oid relid, AttrNumber attno, char *value, int32 flag);
extern float64 intltsel(Oid opid, Oid relid, AttrNumber attno, int32 value, int32 flag);
extern float64 intgtsel(Oid opid, Oid relid, AttrNumber attno, int32 value, int32 flag);
extern float64 eqjoinsel(Oid opid, Oid relid1, AttrNumber attno1, Oid relid2, AttrNumber attno2);
extern float64 neqjoinsel(Oid opid, Oid relid1, AttrNumber attno1, Oid relid2, AttrNumber attno2);
extern float64 intltjoinsel(Oid opid, Oid relid1, AttrNumber attno1, Oid relid2, AttrNumber attno2);
extern float64 intgtjoinsel(Oid opid, Oid relid1, AttrNumber attno1, Oid relid2, AttrNumber attno2);
extern float64 btreesel(Oid operatorOid, Oid indrelid, AttrNumber attributeNumber, char *constValue, int32 constFlag, int32 nIndexKeys, Oid indexrelid);
extern float64 btreenpage(Oid operatorOid, Oid indrelid, AttrNumber attributeNumber, char *constValue, int32 constFlag, int32 nIndexKeys, Oid indexrelid);
extern float64 hashsel(Oid operatorOid, Oid indrelid, AttrNumber attributeNumber, char *constValue, int32 constFlag, int32 nIndexKeys, Oid indexrelid);
extern float64 hashnpage(Oid operatorOid, Oid indrelid, AttrNumber attributeNumber, char *constValue, int32 constFlag, int32 nIndexKeys, Oid indexrelid);
extern float64 rtsel(Oid operatorOid, Oid indrelid, AttrNumber attributeNumber, char *constValue, int32 constFlag, int32 nIndexKeys, Oid indexrelid);
extern float64 rtnpage(Oid operatorOid, Oid indrelid, AttrNumber attributeNumber, char *constValue, int32 constFlag, int32 nIndexKeys, Oid indexrelid);
extern float64 gistsel(Oid operatorObjectId, Oid indrelid, AttrNumber attributeNumber, char *constValue, int32 constFlag, int32 nIndexKeys, Oid indexrelid);
extern float64 gistnpage(Oid operatorObjectId, Oid indrelid, AttrNumber attributeNumber, char *constValue, int32 constFlag, int32 nIndexKeys, Oid indexrelid);
/* tid.c */
extern ItemPointer tidin(char *str);
extern char *tidout(ItemPointer itemPtr);
extern char *tidout(ItemPointer itemPtr);
/* timestamp.c */
extern time_t timestamp_in(const char *timestamp_str);
extern char *timestamp_out(time_t timestamp);
extern time_t now(void);
bool timestampeq(time_t t1, time_t t2);
bool timestampne(time_t t1, time_t t2);
bool timestamplt(time_t t1, time_t t2);
bool timestampgt(time_t t1, time_t t2);
bool timestample(time_t t1, time_t t2);
bool timestampge(time_t t1, time_t t2);
DateTime *timestamp_datetime(time_t timestamp);
extern time_t timestamp_in(const char *timestamp_str);
extern char *timestamp_out(time_t timestamp);
extern time_t now(void);
bool timestampeq(time_t t1, time_t t2);
bool timestampne(time_t t1, time_t t2);
bool timestamplt(time_t t1, time_t t2);
bool timestampgt(time_t t1, time_t t2);
bool timestample(time_t t1, time_t t2);
bool timestampge(time_t t1, time_t t2);
DateTime *timestamp_datetime(time_t timestamp);
/* varchar.c */
extern char *bpcharin(char *s, int dummy, int typlen);
extern char *bpcharout(char *s);
extern char *varcharin(char *s, int dummy, int typlen);
extern char *varcharout(char *s);
extern bool bpchareq(char *arg1, char *arg2);
extern bool bpcharne(char *arg1, char *arg2);
extern bool bpcharlt(char *arg1, char *arg2);
extern bool bpcharle(char *arg1, char *arg2);
extern bool bpchargt(char *arg1, char *arg2);
extern bool bpcharge(char *arg1, char *arg2);
extern int32 bpcharcmp(char *arg1, char *arg2);
extern bool varchareq(char *arg1, char *arg2);
extern bool varcharne(char *arg1, char *arg2);
extern bool varcharlt(char *arg1, char *arg2);
extern bool varcharle(char *arg1, char *arg2);
extern bool varchargt(char *arg1, char *arg2);
extern bool varcharge(char *arg1, char *arg2);
extern int32 varcharcmp(char *arg1, char *arg2);
extern uint32 hashbpchar(struct varlena *key);
extern uint32 hashvarchar(struct varlena *key);
extern char *bpcharin(char *s, int dummy, int typlen);
extern char *bpcharout(char *s);
extern char *varcharin(char *s, int dummy, int typlen);
extern char *varcharout(char *s);
extern bool bpchareq(char *arg1, char *arg2);
extern bool bpcharne(char *arg1, char *arg2);
extern bool bpcharlt(char *arg1, char *arg2);
extern bool bpcharle(char *arg1, char *arg2);
extern bool bpchargt(char *arg1, char *arg2);
extern bool bpcharge(char *arg1, char *arg2);
extern int32 bpcharcmp(char *arg1, char *arg2);
extern bool varchareq(char *arg1, char *arg2);
extern bool varcharne(char *arg1, char *arg2);
extern bool varcharlt(char *arg1, char *arg2);
extern bool varcharle(char *arg1, char *arg2);
extern bool varchargt(char *arg1, char *arg2);
extern bool varcharge(char *arg1, char *arg2);
extern int32 varcharcmp(char *arg1, char *arg2);
extern uint32 hashbpchar(struct varlena * key);
extern uint32 hashvarchar(struct varlena * key);
/* varlena.c */
extern struct varlena *byteain(char *inputText);
extern char *byteaout(struct varlena *vlena);
extern char *byteaout(struct varlena * vlena);
extern struct varlena *textin(char *inputText);
extern char *textout(struct varlena *vlena);
extern text *textcat(text* t1, text* t2);
extern bool texteq(struct varlena *arg1, struct varlena *arg2);
extern bool textne(struct varlena *arg1, struct varlena *arg2);
extern bool text_lt(struct varlena *arg1, struct varlena *arg2);
extern bool text_le(struct varlena *arg1, struct varlena *arg2);
extern bool text_gt(struct varlena *arg1, struct varlena *arg2);
extern bool text_ge(struct varlena *arg1, struct varlena *arg2);
extern int32 textpos(text* t1, text* t2);
extern int32 byteaGetSize(struct varlena *v);
extern int32 byteaGetByte(struct varlena *v, int32 n);
extern int32 byteaGetBit(struct varlena *v, int32 n);
extern struct varlena *byteaSetByte(struct varlena *v, int32 n, int32 newByte);
extern struct varlena *byteaSetBit(struct varlena *v, int32 n, int32 newBit);
extern char *textout(struct varlena * vlena);
extern text *textcat(text * t1, text * t2);
extern bool texteq(struct varlena * arg1, struct varlena * arg2);
extern bool textne(struct varlena * arg1, struct varlena * arg2);
extern bool text_lt(struct varlena * arg1, struct varlena * arg2);
extern bool text_le(struct varlena * arg1, struct varlena * arg2);
extern bool text_gt(struct varlena * arg1, struct varlena * arg2);
extern bool text_ge(struct varlena * arg1, struct varlena * arg2);
extern int32 textpos(text * t1, text * t2);
extern int32 byteaGetSize(struct varlena * v);
extern int32 byteaGetByte(struct varlena * v, int32 n);
extern int32 byteaGetBit(struct varlena * v, int32 n);
extern struct varlena *byteaSetByte(struct varlena * v, int32 n, int32 newByte);
extern struct varlena *byteaSetBit(struct varlena * v, int32 n, int32 newBit);
/* datetime.c */
extern DateADT date_in(char *datestr);
extern char *date_out(DateADT dateVal);
extern bool date_eq(DateADT dateVal1, DateADT dateVal2);
extern bool date_ne(DateADT dateVal1, DateADT dateVal2);
extern bool date_lt(DateADT dateVal1, DateADT dateVal2);
extern bool date_le(DateADT dateVal1, DateADT dateVal2);
extern bool date_gt(DateADT dateVal1, DateADT dateVal2);
extern bool date_ge(DateADT dateVal1, DateADT dateVal2);
extern int date_cmp(DateADT dateVal1, DateADT dateVal2);
extern DateADT date_larger(DateADT dateVal1, DateADT dateVal2);
extern DateADT date_smaller(DateADT dateVal1, DateADT dateVal2);
extern int32 date_mi(DateADT dateVal1, DateADT dateVal2);
extern DateADT date_pli(DateADT dateVal, int32 days);
extern DateADT date_mii(DateADT dateVal, int32 days);
extern DateADT date_in(char *datestr);
extern char *date_out(DateADT dateVal);
extern bool date_eq(DateADT dateVal1, DateADT dateVal2);
extern bool date_ne(DateADT dateVal1, DateADT dateVal2);
extern bool date_lt(DateADT dateVal1, DateADT dateVal2);
extern bool date_le(DateADT dateVal1, DateADT dateVal2);
extern bool date_gt(DateADT dateVal1, DateADT dateVal2);
extern bool date_ge(DateADT dateVal1, DateADT dateVal2);
extern int date_cmp(DateADT dateVal1, DateADT dateVal2);
extern DateADT date_larger(DateADT dateVal1, DateADT dateVal2);
extern DateADT date_smaller(DateADT dateVal1, DateADT dateVal2);
extern int32 date_mi(DateADT dateVal1, DateADT dateVal2);
extern DateADT date_pli(DateADT dateVal, int32 days);
extern DateADT date_mii(DateADT dateVal, int32 days);
extern DateTime *date_datetime(DateADT date);
extern DateADT datetime_date(DateTime *datetime);
extern DateTime *datetime_datetime(DateADT date, TimeADT *time);
extern DateADT abstime_date(AbsoluteTime abstime);
extern DateADT datetime_date(DateTime * datetime);
extern DateTime *datetime_datetime(DateADT date, TimeADT * time);
extern DateADT abstime_date(AbsoluteTime abstime);
extern TimeADT *time_in(char *timestr);
extern char *time_out(TimeADT *time);
extern bool time_eq(TimeADT *time1, TimeADT *time2);
extern bool time_ne(TimeADT *time1, TimeADT *time2);
extern bool time_lt(TimeADT *time1, TimeADT *time2);
extern bool time_le(TimeADT *time1, TimeADT *time2);
extern bool time_gt(TimeADT *time1, TimeADT *time2);
extern bool time_ge(TimeADT *time1, TimeADT *time2);
extern int time_cmp(TimeADT *time1, TimeADT *time2);
extern int32 int42reltime(int32 timevalue);
extern char *time_out(TimeADT * time);
extern bool time_eq(TimeADT * time1, TimeADT * time2);
extern bool time_ne(TimeADT * time1, TimeADT * time2);
extern bool time_lt(TimeADT * time1, TimeADT * time2);
extern bool time_le(TimeADT * time1, TimeADT * time2);
extern bool time_gt(TimeADT * time1, TimeADT * time2);
extern bool time_ge(TimeADT * time1, TimeADT * time2);
extern int time_cmp(TimeADT * time1, TimeADT * time2);
extern int32 int42reltime(int32 timevalue);
/* like.c */
extern bool char2like(uint16 arg1, struct varlena *p);
extern bool char2nlike(uint16 arg1, struct varlena *p);
extern bool char4like(uint32 arg1, struct varlena *p);
extern bool char4nlike(uint32 arg1, struct varlena *p);
extern bool char8like(char *s, struct varlena *p);
extern bool char8nlike(char *s, struct varlena *p);
extern bool char16like(char *s, struct varlena *p);
extern bool char16nlike(char *s, struct varlena *p);
extern bool namelike(NameData *n, struct varlena *p);
extern bool namenlike(NameData *s, struct varlena *p);
extern bool textlike(struct varlena *s, struct varlena *p);
extern bool textnlike(struct varlena *s, struct varlena *p);
extern bool char2like(uint16 arg1, struct varlena * p);
extern bool char2nlike(uint16 arg1, struct varlena * p);
extern bool char4like(uint32 arg1, struct varlena * p);
extern bool char4nlike(uint32 arg1, struct varlena * p);
extern bool char8like(char *s, struct varlena * p);
extern bool char8nlike(char *s, struct varlena * p);
extern bool char16like(char *s, struct varlena * p);
extern bool char16nlike(char *s, struct varlena * p);
extern bool namelike(NameData * n, struct varlena * p);
extern bool namenlike(NameData * s, struct varlena * p);
extern bool textlike(struct varlena * s, struct varlena * p);
extern bool textnlike(struct varlena * s, struct varlena * p);
/* oracle_compat.c */
extern text *lower(text *string);
extern text *upper(text *string);
extern text *initcap(text *string);
extern text *lpad(text *string1, int4 len, text *string2);
extern text *rpad(text *string1, int4 len, text *string2);
extern text *ltrim(text *string, text *set);
extern text *rtrim(text *string, text *set);
extern text *substr(text *string, int4 m, int4 n);
extern text *translate(text *string, char from, char to);
extern text *lower(text * string);
extern text *upper(text * string);
extern text *initcap(text * string);
extern text *lpad(text * string1, int4 len, text * string2);
extern text *rpad(text * string1, int4 len, text * string2);
extern text *ltrim(text * string, text * set);
extern text *rtrim(text * string, text * set);
extern text *substr(text * string, int4 m, int4 n);
extern text *translate(text * string, char from, char to);
/* acl.c */
#endif /* BUILTINS_H */
#endif /* BUILTINS_H */

View File

@@ -3,7 +3,7 @@
* Written by D'Arcy J.M. Cain
*
* Functions to allow input and output of money normally but store
* and handle it as int4.
* and handle it as int4.
*/
#ifndef CASH_H
@@ -12,24 +12,24 @@
/* if we store this as 4 bytes, we better make it int, not long, bjm */
typedef signed int Cash;
extern const char *cash_out(Cash *value);
extern Cash *cash_in(const char *str);
extern const char *cash_out(Cash * value);
extern Cash *cash_in(const char *str);
extern bool cash_eq(Cash *c1, Cash *c2);
extern bool cash_ne(Cash *c1, Cash *c2);
extern bool cash_lt(Cash *c1, Cash *c2);
extern bool cash_le(Cash *c1, Cash *c2);
extern bool cash_gt(Cash *c1, Cash *c2);
extern bool cash_ge(Cash *c1, Cash *c2);
extern bool cash_eq(Cash * c1, Cash * c2);
extern bool cash_ne(Cash * c1, Cash * c2);
extern bool cash_lt(Cash * c1, Cash * c2);
extern bool cash_le(Cash * c1, Cash * c2);
extern bool cash_gt(Cash * c1, Cash * c2);
extern bool cash_ge(Cash * c1, Cash * c2);
extern Cash *cash_pl(Cash *c1, Cash *c2);
extern Cash *cash_mi(Cash *c1, Cash *c2);
extern Cash *cash_mul(Cash *c, float8 *f);
extern Cash *cash_div(Cash *c, float8 *f);
extern Cash *cash_pl(Cash * c1, Cash * c2);
extern Cash *cash_mi(Cash * c1, Cash * c2);
extern Cash *cash_mul(Cash * c, float8 * f);
extern Cash *cash_div(Cash * c, float8 * f);
extern Cash *cashlarger(Cash *c1, Cash *c2);
extern Cash *cashsmaller(Cash *c1, Cash *c2);
extern Cash *cashlarger(Cash * c1, Cash * c2);
extern Cash *cashsmaller(Cash * c1, Cash * c2);
extern const char *cash_words_out(Cash *value);
extern const char *cash_words_out(Cash * value);
#endif /* CASH_H */
#endif /* CASH_H */

View File

@@ -1,19 +1,19 @@
/*-------------------------------------------------------------------------
*
* catcache.h--
* Low-level catalog cache definitions.
* Low-level catalog cache definitions.
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: catcache.h,v 1.5 1997/08/19 21:40:28 momjian Exp $
* $Id: catcache.h,v 1.6 1997/09/07 05:02:14 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef CATCACHE_H
#ifndef CATCACHE_H
#define CATCACHE_H
/* #define CACHEDEBUG turns DEBUG elogs on */
/* #define CACHEDEBUG turns DEBUG elogs on */
#include <access/htup.h>
#include <lib/dllist.h>
@@ -21,54 +21,60 @@
#include <utils/rel.h>
/*
* struct catctup: tuples in the cache.
* struct catcache: information for managing a cache.
* struct catctup: tuples in the cache.
* struct catcache: information for managing a cache.
*/
typedef struct catctup {
HeapTuple ct_tup; /* A pointer to a tuple */
Dlelem *ct_node; /* points to LRU list is the CatCTup is in the cache,
else, points to the cache if the CatCTup is in
LRU list */
} CatCTup;
typedef struct catctup
{
HeapTuple ct_tup; /* A pointer to a tuple */
Dlelem *ct_node; /* points to LRU list is the CatCTup is in
* the cache, else, points to the cache if
* the CatCTup is in LRU list */
} CatCTup;
/* voodoo constants */
#define NCCBUCK 500 /* CatCache buckets*/
#define MAXTUP 300 /* Maximum # of tuples cached per cache */
#define NCCBUCK 500 /* CatCache buckets */
#define MAXTUP 300 /* Maximum # of tuples cached per cache */
typedef struct catcache {
Oid relationId;
Oid indexId;
char *cc_relname; /* relation name for defered open */
char *cc_indname; /* index name for defered open */
HeapTuple (*cc_iscanfunc)(); /* index scanfunction */
TupleDesc cc_tupdesc; /* tuple descriptor from reldesc */
int id; /* XXX could be improved -hirohama */
short cc_ntup; /* # of tuples in this cache */
short cc_maxtup; /* max # of tuples allowed (LRU)*/
short cc_nkeys;
short cc_size;
short cc_key[4];
short cc_klen[4];
ScanKeyData cc_skey[4];
struct catcache *cc_next;
Dllist *cc_lrulist; /* LRU list, most recent first */
Dllist *cc_cache[NCCBUCK+1];
} CatCache;
typedef struct catcache
{
Oid relationId;
Oid indexId;
char *cc_relname; /* relation name for defered open */
char *cc_indname; /* index name for defered open */
HeapTuple(*cc_iscanfunc) (); /* index scanfunction */
TupleDesc cc_tupdesc; /* tuple descriptor from reldesc */
int id; /* XXX could be improved -hirohama */
short cc_ntup; /* # of tuples in this cache */
short cc_maxtup; /* max # of tuples allowed (LRU) */
short cc_nkeys;
short cc_size;
short cc_key[4];
short cc_klen[4];
ScanKeyData cc_skey[4];
struct catcache *cc_next;
Dllist *cc_lrulist; /* LRU list, most recent first */
Dllist *cc_cache[NCCBUCK + 1];
} CatCache;
#define InvalidCatalogCacheId (-1)
#define InvalidCatalogCacheId (-1)
extern struct catcache *Caches;
extern GlobalMemory CacheCxt;
extern struct catcache *Caches;
extern GlobalMemory CacheCxt;
extern void CatalogCacheIdInvalidate(int cacheId, Index hashIndex,
ItemPointer pointer);
extern void ResetSystemCache(void);
extern CatCache *InitSysCache(char *relname, char *indname, int id, int nkeys,
int key[], HeapTuple (*iScanfuncP)());
extern HeapTuple SearchSysCache(struct catcache *cache, Datum v1, Datum v2,
Datum v3, Datum v4);
extern void RelationInvalidateCatalogCacheTuple(Relation relation,
HeapTuple tuple, void (*function)());
extern void
CatalogCacheIdInvalidate(int cacheId, Index hashIndex,
ItemPointer pointer);
extern void ResetSystemCache(void);
extern CatCache *
InitSysCache(char *relname, char *indname, int id, int nkeys,
int key[], HeapTuple(*iScanfuncP) ());
extern HeapTuple
SearchSysCache(struct catcache * cache, Datum v1, Datum v2,
Datum v3, Datum v4);
extern void
RelationInvalidateCatalogCacheTuple(Relation relation,
HeapTuple tuple, void (*function) ());
#endif /* CATCACHE_H */
#endif /* CATCACHE_H */

View File

@@ -1,12 +1,12 @@
/*-------------------------------------------------------------------------
*
* datetime.h--
* Definitions for the datetime
* Definitions for the datetime
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: datetime.h,v 1.3 1997/06/23 15:03:41 thomas Exp $
* $Id: datetime.h,v 1.4 1997/09/07 05:02:16 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -19,4 +19,4 @@ typedef int32 DateADT;
typedef float8 TimeADT;
#endif /* DATETIME_H */
#endif /* DATETIME_H */

View File

@@ -1,17 +1,17 @@
/*-------------------------------------------------------------------------
*
* datum.h--
* POSTGRES abstract data type datum representation definitions.
* POSTGRES abstract data type datum representation definitions.
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: datum.h,v 1.2 1996/10/31 09:51:11 scrappy Exp $
* $Id: datum.h,v 1.3 1997/09/07 05:02:17 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef DATUM_H
#define DATUM_H
#ifndef DATUM_H
#define DATUM_H
/*--------------------------------------------------------
@@ -38,26 +38,27 @@
* datumGetSize
* find the "real" length of a datum
*/
extern Size datumGetSize(Datum value, Oid type, bool byVal, Size len);
extern Size datumGetSize(Datum value, Oid type, bool byVal, Size len);
/*---------------
* datumCopy
* make a copy of a datum.
*/
extern Datum datumCopy(Datum value, Oid type, bool byVal, Size len);
extern Datum datumCopy(Datum value, Oid type, bool byVal, Size len);
/*---------------
* datumFree
* free space that *might* have been palloced by "datumCopy"
*/
extern void datumFree(Datum value, Oid type, bool byVal, Size len);
extern void datumFree(Datum value, Oid type, bool byVal, Size len);
/*---------------
* datumIsEqual
* return true if thwo datums are equal, false otherwise.
* XXX : See comments in the code for restrictions!
*/
extern bool datumIsEqual(Datum value1, Datum value2, Oid type,
extern bool
datumIsEqual(Datum value1, Datum value2, Oid type,
bool byVal, Size len);
#endif /* DATUM_H */
#endif /* DATUM_H */

View File

@@ -1,14 +1,14 @@
/*-------------------------------------------------------------------------
*
* dt.h--
* Definitions for the date/time and other date/time support code.
* The support code is shared with other date data types,
* including abstime, reltime, date, and time.
* Definitions for the date/time and other date/time support code.
* The support code is shared with other date data types,
* including abstime, reltime, date, and time.
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: dt.h,v 1.18 1997/09/04 18:44:29 thomas Exp $
* $Id: dt.h,v 1.19 1997/09/07 05:02:19 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -21,23 +21,26 @@
/*
* DateTime represents absolute time.
* TimeSpan represents delta time. Keep track of months (and years)
* separately since the elapsed time spanned is unknown until instantiated
* relative to an absolute time.
* separately since the elapsed time spanned is unknown until instantiated
* relative to an absolute time.
*
* Note that Postgres uses "time interval" to mean a bounded interval,
* consisting of a beginning and ending time, not a time span - tgl 97/03/20
* consisting of a beginning and ending time, not a time span - tgl 97/03/20
*/
typedef double DateTime;
typedef double DateTime;
typedef struct {
double time; /* all time units other than months and years */
int4 month; /* months and years, after time for alignment */
} TimeSpan;
typedef struct
{
double time; /* all time units other than months and
* years */
int4 month; /* months and years, after time for
* alignment */
} TimeSpan;
/* ----------------------------------------------------------------
* time types + support macros
* time types + support macros
*
* String definitions for standard time quantities.
*
@@ -46,196 +49,202 @@ typedef struct {
* ----------------------------------------------------------------
*/
#define DAGO "ago"
#define DCURRENT "current"
#define EPOCH "epoch"
#define INVALID "invalid"
#define EARLY "-infinity"
#define LATE "infinity"
#define NOW "now"
#define TODAY "today"
#define TOMORROW "tomorrow"
#define YESTERDAY "yesterday"
#define ZULU "zulu"
#define DAGO "ago"
#define DCURRENT "current"
#define EPOCH "epoch"
#define INVALID "invalid"
#define EARLY "-infinity"
#define LATE "infinity"
#define NOW "now"
#define TODAY "today"
#define TOMORROW "tomorrow"
#define YESTERDAY "yesterday"
#define ZULU "zulu"
#define DMICROSEC "usecond"
#define DMILLISEC "msecond"
#define DSECOND "second"
#define DMINUTE "minute"
#define DHOUR "hour"
#define DDAY "day"
#define DWEEK "week"
#define DMONTH "month"
#define DQUARTER "quarter"
#define DYEAR "year"
#define DDECADE "decade"
#define DCENTURY "century"
#define DMILLENIUM "millenium"
#define DA_D "ad"
#define DB_C "bc"
#define DTIMEZONE "timezone"
#define DMICROSEC "usecond"
#define DMILLISEC "msecond"
#define DSECOND "second"
#define DMINUTE "minute"
#define DHOUR "hour"
#define DDAY "day"
#define DWEEK "week"
#define DMONTH "month"
#define DQUARTER "quarter"
#define DYEAR "year"
#define DDECADE "decade"
#define DCENTURY "century"
#define DMILLENIUM "millenium"
#define DA_D "ad"
#define DB_C "bc"
#define DTIMEZONE "timezone"
/*
* Fundamental time field definitions for parsing.
*
* Meridian: am, pm, or 24-hour style.
* Millenium: ad, bc
* Meridian: am, pm, or 24-hour style.
* Millenium: ad, bc
*/
#define AM 0
#define PM 1
#define AM 0
#define PM 1
#define HR24 2
#define AD 0
#define BC 1
#define AD 0
#define BC 1
/*
* Fields for time decoding.
* Can't have more of these than there are bits in an unsigned int
* since these are turned into bit masks during parsing and decoding.
* since these are turned into bit masks during parsing and decoding.
*/
#define RESERV 0
#define MONTH 1
#define YEAR 2
#define DAY 3
#define TIMES 4 /* not used - thomas 1997-07-14 */
#define TZ 5
#define DTZ 6
#define DAY 3
#define TIMES 4 /* not used - thomas 1997-07-14 */
#define TZ 5
#define DTZ 6
#define DTZMOD 7
#define IGNORE 8
#define AMPM 9
#define HOUR 10
#define MINUTE 11
#define SECOND 12
#define DOY 13
#define DOW 14
#define DOY 13
#define DOW 14
#define UNITS 15
#define ADBC 16
/* these are only for relative dates */
#define AGO 17
#define ABS_BEFORE 18
#define ABS_AFTER 19
#define AGO 17
#define ABS_BEFORE 18
#define ABS_AFTER 19
/*
* Token field definitions for time parsing and decoding.
* These need to fit into the datetkn table type.
* At the moment, that means keep them within [-127,127].
* These are also used for bit masks in DecodeDateDelta()
* so actually restrict them to within [0,31] for now.
* so actually restrict them to within [0,31] for now.
* - tgl 97/06/19
*/
#define DTK_NUMBER 0
#define DTK_STRING 1
#define DTK_NUMBER 0
#define DTK_STRING 1
#define DTK_DATE 2
#define DTK_TIME 3
#define DTK_TZ 4
#define DTK_AGO 5
#define DTK_DATE 2
#define DTK_TIME 3
#define DTK_TZ 4
#define DTK_AGO 5
#define DTK_SPECIAL 6
#define DTK_INVALID 7
#define DTK_CURRENT 8
#define DTK_EARLY 9
#define DTK_LATE 10
#define DTK_EPOCH 11
#define DTK_NOW 12
#define DTK_SPECIAL 6
#define DTK_INVALID 7
#define DTK_CURRENT 8
#define DTK_EARLY 9
#define DTK_LATE 10
#define DTK_EPOCH 11
#define DTK_NOW 12
#define DTK_YESTERDAY 13
#define DTK_TODAY 14
#define DTK_TODAY 14
#define DTK_TOMORROW 15
#define DTK_ZULU 16
#define DTK_ZULU 16
#define DTK_DELTA 17
#define DTK_SECOND 18
#define DTK_MINUTE 19
#define DTK_HOUR 20
#define DTK_DAY 21
#define DTK_WEEK 22
#define DTK_MONTH 23
#define DTK_QUARTER 24
#define DTK_YEAR 25
#define DTK_DECADE 26
#define DTK_CENTURY 27
#define DTK_DELTA 17
#define DTK_SECOND 18
#define DTK_MINUTE 19
#define DTK_HOUR 20
#define DTK_DAY 21
#define DTK_WEEK 22
#define DTK_MONTH 23
#define DTK_QUARTER 24
#define DTK_YEAR 25
#define DTK_DECADE 26
#define DTK_CENTURY 27
#define DTK_MILLENIUM 28
#define DTK_MILLISEC 29
#define DTK_MICROSEC 30
#define DTK_DOW 31
#define DTK_DOW 31
/*
* Bit mask definitions for time parsing.
*/
#define DTK_M(t) (0x01 << (t))
#define DTK_M(t) (0x01 << (t))
#define DTK_DATE_M (DTK_M(YEAR) | DTK_M(MONTH) | DTK_M(DAY))
#define DTK_TIME_M (DTK_M(HOUR) | DTK_M(MINUTE) | DTK_M(SECOND))
#define DTK_DATE_M (DTK_M(YEAR) | DTK_M(MONTH) | DTK_M(DAY))
#define DTK_TIME_M (DTK_M(HOUR) | DTK_M(MINUTE) | DTK_M(SECOND))
#define MAXDATELEN 47 /* maximum possible length of an input date string */
#define MAXDATEFIELDS 25 /* maximum possible number of fields in a date string */
#define TOKMAXLEN 10 /* only this many chars are stored in datetktbl */
#define MAXDATELEN 47 /* maximum possible length of an input
* date string */
#define MAXDATEFIELDS 25 /* maximum possible number of fields in a
* date string */
#define TOKMAXLEN 10 /* only this many chars are stored in
* datetktbl */
/* keep this struct small; it gets used a lot */
typedef struct {
typedef struct
{
#if defined(aix)
char *token;
char *token;
#else
char token[TOKMAXLEN];
#endif /* aix */
char type;
char value; /* this may be unsigned, alas */
} datetkn;
char token[TOKMAXLEN];
#endif /* aix */
char type;
char value; /* this may be unsigned, alas */
} datetkn;
#ifdef NAN
#define DT_INVALID (NAN)
#define DT_INVALID (NAN)
#else
#define DT_INVALID (DBL_MIN+DBL_MIN)
#define DT_INVALID (DBL_MIN+DBL_MIN)
#endif
#ifdef HUGE_VAL
#define DT_NOBEGIN (-HUGE_VAL)
#define DT_NOEND (HUGE_VAL)
#define DT_NOBEGIN (-HUGE_VAL)
#define DT_NOEND (HUGE_VAL)
#else
#define DT_NOBEGIN (-DBL_MAX)
#define DT_NOEND (DBL_MAX)
#define DT_NOBEGIN (-DBL_MAX)
#define DT_NOEND (DBL_MAX)
#endif
#define DT_CURRENT (DBL_MIN)
#define DT_EPOCH (-DBL_MIN)
#define DT_CURRENT (DBL_MIN)
#define DT_EPOCH (-DBL_MIN)
#define DATETIME_INVALID(j) {j = DT_INVALID;}
#define DATETIME_INVALID(j) {j = DT_INVALID;}
#ifdef NAN
#define DATETIME_IS_INVALID(j) (isnan(j))
#else
#define DATETIME_IS_INVALID(j) (j == DT_INVALID)
#endif
#define DATETIME_NOBEGIN(j) {j = DT_NOBEGIN;}
#define DATETIME_NOBEGIN(j) {j = DT_NOBEGIN;}
#define DATETIME_IS_NOBEGIN(j) (j == DT_NOBEGIN)
#define DATETIME_NOEND(j) {j = DT_NOEND;}
#define DATETIME_NOEND(j) {j = DT_NOEND;}
#define DATETIME_IS_NOEND(j) (j == DT_NOEND)
#define DATETIME_CURRENT(j) {j = DT_CURRENT;}
#define DATETIME_CURRENT(j) {j = DT_CURRENT;}
#if defined(linux) && defined(PPC)
extern int datetime_is_current(double j);
extern int datetime_is_current(double j);
#define DATETIME_IS_CURRENT(j) datetime_is_current(j)
#else
#define DATETIME_IS_CURRENT(j) (j == DT_CURRENT)
#endif
#define DATETIME_EPOCH(j) {j = DT_EPOCH;}
#define DATETIME_EPOCH(j) {j = DT_EPOCH;}
#if defined(linux) && defined(PPC)
extern int datetime_is_epoch(double j);
extern int datetime_is_epoch(double j);
#define DATETIME_IS_EPOCH(j) datetime_is_epoch(j)
#else
#define DATETIME_IS_EPOCH(j) (j == DT_EPOCH)
#endif
#define DATETIME_IS_RELATIVE(j) (DATETIME_IS_CURRENT(j) || DATETIME_IS_EPOCH(j))
#define DATETIME_IS_RELATIVE(j) (DATETIME_IS_CURRENT(j) || DATETIME_IS_EPOCH(j))
#define DATETIME_NOT_FINITE(j) (DATETIME_IS_INVALID(j) \
|| DATETIME_IS_NOBEGIN(j) || DATETIME_IS_NOEND(j))
|| DATETIME_IS_NOBEGIN(j) || DATETIME_IS_NOEND(j))
#define DATETIME_IS_RESERVED(j) (DATETIME_IS_RELATIVE(j) || DATETIME_NOT_FINITE(j))
#define TIMESPAN_INVALID(j) {(j).time = DT_INVALID;}
#define TIMESPAN_INVALID(j) {(j).time = DT_INVALID;}
#ifdef NAN
#define TIMESPAN_IS_INVALID(j) (isnan((j).time))
#else
@@ -247,76 +256,80 @@ extern int datetime_is_epoch(double j);
#define JROUND(j) (rint(((double) (j))/TIME_PREC)*TIME_PREC)
/*
* dt.c prototypes
* dt.c prototypes
*/
extern DateTime *datetime_in( char *str);
extern char *datetime_out( DateTime *dt);
extern bool datetime_eq(DateTime *dt1, DateTime *dt2);
extern bool datetime_ne(DateTime *dt1, DateTime *dt2);
extern bool datetime_lt(DateTime *dt1, DateTime *dt2);
extern bool datetime_le(DateTime *dt1, DateTime *dt2);
extern bool datetime_ge(DateTime *dt1, DateTime *dt2);
extern bool datetime_gt(DateTime *dt1, DateTime *dt2);
extern bool datetime_finite(DateTime *datetime);
extern int datetime_cmp(DateTime *dt1, DateTime *dt2);
extern DateTime *datetime_smaller(DateTime *dt1, DateTime *dt2);
extern DateTime *datetime_larger(DateTime *dt1, DateTime *dt2);
extern DateTime *datetime_in(char *str);
extern char *datetime_out(DateTime * dt);
extern bool datetime_eq(DateTime * dt1, DateTime * dt2);
extern bool datetime_ne(DateTime * dt1, DateTime * dt2);
extern bool datetime_lt(DateTime * dt1, DateTime * dt2);
extern bool datetime_le(DateTime * dt1, DateTime * dt2);
extern bool datetime_ge(DateTime * dt1, DateTime * dt2);
extern bool datetime_gt(DateTime * dt1, DateTime * dt2);
extern bool datetime_finite(DateTime * datetime);
extern int datetime_cmp(DateTime * dt1, DateTime * dt2);
extern DateTime *datetime_smaller(DateTime * dt1, DateTime * dt2);
extern DateTime *datetime_larger(DateTime * dt1, DateTime * dt2);
extern TimeSpan *timespan_in(char *str);
extern char *timespan_out(TimeSpan *span);
extern bool timespan_eq(TimeSpan *span1, TimeSpan *span2);
extern bool timespan_ne(TimeSpan *span1, TimeSpan *span2);
extern bool timespan_lt(TimeSpan *span1, TimeSpan *span2);
extern bool timespan_le(TimeSpan *span1, TimeSpan *span2);
extern bool timespan_ge(TimeSpan *span1, TimeSpan *span2);
extern bool timespan_gt(TimeSpan *span1, TimeSpan *span2);
extern int timespan_cmp(TimeSpan *span1, TimeSpan *span2);
extern TimeSpan *timespan_smaller(TimeSpan *span1, TimeSpan *span2);
extern TimeSpan *timespan_larger(TimeSpan *span1, TimeSpan *span2);
extern char *timespan_out(TimeSpan * span);
extern bool timespan_eq(TimeSpan * span1, TimeSpan * span2);
extern bool timespan_ne(TimeSpan * span1, TimeSpan * span2);
extern bool timespan_lt(TimeSpan * span1, TimeSpan * span2);
extern bool timespan_le(TimeSpan * span1, TimeSpan * span2);
extern bool timespan_ge(TimeSpan * span1, TimeSpan * span2);
extern bool timespan_gt(TimeSpan * span1, TimeSpan * span2);
extern int timespan_cmp(TimeSpan * span1, TimeSpan * span2);
extern TimeSpan *timespan_smaller(TimeSpan * span1, TimeSpan * span2);
extern TimeSpan *timespan_larger(TimeSpan * span1, TimeSpan * span2);
extern text *datetime_text(DateTime *datetime);
extern DateTime *text_datetime(text *str);
extern text *timespan_text(TimeSpan *timespan);
extern DateTime *datetime_trunc(text *units, DateTime *datetime);
extern TimeSpan *timespan_trunc(text *units, TimeSpan *timespan);
extern float64 datetime_part(text *units, DateTime *datetime);
extern float64 timespan_part(text *units, TimeSpan *timespan);
extern text *datetime_zone(text *zone, DateTime *datetime);
extern text *datetime_text(DateTime * datetime);
extern DateTime *text_datetime(text * str);
extern text *timespan_text(TimeSpan * timespan);
extern DateTime *datetime_trunc(text * units, DateTime * datetime);
extern TimeSpan *timespan_trunc(text * units, TimeSpan * timespan);
extern float64 datetime_part(text * units, DateTime * datetime);
extern float64 timespan_part(text * units, TimeSpan * timespan);
extern text *datetime_zone(text * zone, DateTime * datetime);
extern TimeSpan *timespan_um(TimeSpan *span);
extern TimeSpan *timespan_pl(TimeSpan *span1, TimeSpan *span2);
extern TimeSpan *timespan_mi(TimeSpan *span1, TimeSpan *span2);
extern TimeSpan *timespan_div(TimeSpan *span1, float8 *arg2);
extern TimeSpan *timespan_um(TimeSpan * span);
extern TimeSpan *timespan_pl(TimeSpan * span1, TimeSpan * span2);
extern TimeSpan *timespan_mi(TimeSpan * span1, TimeSpan * span2);
extern TimeSpan *timespan_div(TimeSpan * span1, float8 * arg2);
extern TimeSpan *datetime_mi(DateTime *dt1, DateTime *dt2);
extern DateTime *datetime_pl_span(DateTime *dt, TimeSpan *span);
extern DateTime *datetime_mi_span(DateTime *dt, TimeSpan *span);
extern TimeSpan *datetime_age(DateTime *dt1, DateTime *dt2);
extern TimeSpan *datetime_mi(DateTime * dt1, DateTime * dt2);
extern DateTime *datetime_pl_span(DateTime * dt, TimeSpan * span);
extern DateTime *datetime_mi_span(DateTime * dt, TimeSpan * span);
extern TimeSpan *datetime_age(DateTime * dt1, DateTime * dt2);
extern void GetCurrentTime(struct tm *tm);
extern void GetCurrentTime(struct tm * tm);
extern DateTime SetDateTime(DateTime datetime);
extern int tm2datetime(struct tm *tm, double fsec, int *tzp, DateTime *dt);
extern int tm2datetime(struct tm * tm, double fsec, int *tzp, DateTime * dt);
extern void j2date( int jd, int *year, int *month, int *day);
extern int date2j( int year, int month, int day);
extern void j2date(int jd, int *year, int *month, int *day);
extern int date2j(int year, int month, int day);
extern double time2t(const int hour, const int min, const double sec);
extern double time2t(const int hour, const int min, const double sec);
extern int ParseDateTime( char *timestr, char *lowstr,
char *field[], int ftype[], int maxfields, int *numfields);
extern int DecodeDateTime( char *field[], int ftype[],
int nf, int *dtype, struct tm *tm, double *fsec, int *tzp);
extern int
ParseDateTime(char *timestr, char *lowstr,
char *field[], int ftype[], int maxfields, int *numfields);
extern int
DecodeDateTime(char *field[], int ftype[],
int nf, int *dtype, struct tm * tm, double *fsec, int *tzp);
extern int DecodeTimeOnly( char *field[], int ftype[], int nf,
int *dtype, struct tm *tm, double *fsec);
extern int
DecodeTimeOnly(char *field[], int ftype[], int nf,
int *dtype, struct tm * tm, double *fsec);
extern int DecodeDateDelta( char *field[], int ftype[],
int nf, int *dtype, struct tm *tm, double *fsec);
extern int
DecodeDateDelta(char *field[], int ftype[],
int nf, int *dtype, struct tm * tm, double *fsec);
extern int EncodeDateOnly(struct tm *tm, int style, char *str);
extern int EncodeTimeOnly(struct tm *tm, double fsec, int style, char *str);
extern int EncodeDateTime(struct tm *tm, double fsec, int *tzp, char **tzn, int style, char *str);
extern int EncodeTimeSpan(struct tm *tm, double fsec, int style, char *str);
extern int EncodeDateOnly(struct tm * tm, int style, char *str);
extern int EncodeTimeOnly(struct tm * tm, double fsec, int style, char *str);
extern int EncodeDateTime(struct tm * tm, double fsec, int *tzp, char **tzn, int style, char *str);
extern int EncodeTimeSpan(struct tm * tm, double fsec, int style, char *str);
#endif /* DT_H */
#endif /* DT_H */

View File

@@ -1,19 +1,18 @@
/*-------------------------------------------------------------------------
*
* dynahash--
* POSTGRES dynahash.h file definitions
* POSTGRES dynahash.h file definitions
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: dynahash.h,v 1.2 1996/11/14 20:06:39 scrappy Exp $
* $Id: dynahash.h,v 1.3 1997/09/07 05:02:20 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef DYNAHASH_H
#ifndef DYNAHASH_H
#define DYNAHASH_H
extern int my_log2(long num);
#endif /* DYNAHASH_H */
extern int my_log2(long num);
#endif /* DYNAHASH_H */

View File

@@ -1,12 +1,12 @@
/*-------------------------------------------------------------------------
*
* dynamic_loader.h--
*
*
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: dynamic_loader.h,v 1.5 1997/02/14 04:18:56 momjian Exp $
* $Id: dynamic_loader.h,v 1.6 1997/09/07 05:02:22 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -14,30 +14,31 @@
#define DYNAMIC_LOADER_H
#include <sys/types.h>
#include <sys/param.h> /* For MAXPATHLEN */
#include <sys/param.h> /* For MAXPATHLEN */
#include <postgres.h>
#ifdef MIN
#undef MIN
#undef MAX
#endif /* MIN */
#endif /* MIN */
/*
* List of dynamically loaded files.
*/
typedef struct df_files {
char filename[MAXPATHLEN]; /* Full pathname of file */
dev_t device; /* Device file is on */
ino_t inode; /* Inode number of file */
void *handle; /* a handle for pg_dl* functions */
struct df_files *next;
} DynamicFileList;
typedef struct df_files
{
char filename[MAXPATHLEN]; /* Full pathname of file */
dev_t device; /* Device file is on */
ino_t inode; /* Inode number of file */
void *handle; /* a handle for pg_dl* functions */
struct df_files *next;
} DynamicFileList;
extern void *pg_dlopen(char *filename);
extern void *pg_dlopen(char *filename);
extern func_ptr pg_dlsym(void *handle, char *funcname);
extern void pg_dlclose(void *handle);
extern char *pg_dlerror(void);
extern void pg_dlclose(void *handle);
extern char *pg_dlerror(void);
#endif /* DYNAMIC_LOADER_H */
#endif /* DYNAMIC_LOADER_H */

View File

@@ -1,31 +1,31 @@
/*-------------------------------------------------------------------------
*
* elog.h--
* POSTGRES error logging definitions.
* POSTGRES error logging definitions.
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: elog.h,v 1.3 1996/11/10 03:06:24 momjian Exp $
* $Id: elog.h,v 1.4 1997/09/07 05:02:27 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef ELOG_H
#ifndef ELOG_H
#define ELOG_H
#define NOTICE 0 /* random info - no special action */
#define WARN -1 /* Warning error - return to known state */
#define FATAL 1 /* Fatal error - abort process */
#define DEBUG -2 /* debug message */
#define NOIND -3 /* debug message, don't indent as far */
#define NOTICE 0 /* random info - no special action */
#define WARN -1 /* Warning error - return to known state */
#define FATAL 1 /* Fatal error - abort process */
#define DEBUG -2 /* debug message */
#define NOIND -3 /* debug message, don't indent as far */
#define PTIME 0x100 /* prepend time to message */
#define POS 0x200 /* prepend source position to message */
#define USERMSG 0x400 /* send message to user */
#define TERM 0x800 /* send message to terminal */
#define DBLOG 0x1000 /* put message in per db log */
#define SLOG 0x2000 /* put message in system log */
#define ABORT 0x4000 /* abort process after logging */
#define PTIME 0x100 /* prepend time to message */
#define POS 0x200 /* prepend source position to message */
#define USERMSG 0x400 /* send message to user */
#define TERM 0x800 /* send message to terminal */
#define DBLOG 0x1000 /* put message in per db log */
#define SLOG 0x2000 /* put message in system log */
#define ABORT 0x4000 /* abort process after logging */
#define ELOG_MAXLEN 4096
@@ -33,9 +33,11 @@
/* uncomment the following if you want your elog's to be timestamped */
/* #define ELOG_TIMESTAMPS */
extern void elog(int lev, const char *fmt, ...);
extern void elog(int lev, const char *fmt,...);
#ifndef PG_STANDALONE
int DebugFileOpen(void);
int DebugFileOpen(void);
#endif
#endif /* ELOG_H */
#endif /* ELOG_H */

View File

@@ -1,90 +1,95 @@
/*-------------------------------------------------------------------------
*
* exc.h--
* POSTGRES exception handling definitions.
* POSTGRES exception handling definitions.
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: exc.h,v 1.7 1997/08/19 21:40:32 momjian Exp $
* $Id: exc.h,v 1.8 1997/09/07 05:02:28 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef EXC_H
#ifndef EXC_H
#define EXC_H
#include <setjmp.h>
#include "config.h"
extern char *ExcFileName;
extern Index ExcLineNumber;
extern char *ExcFileName;
extern Index ExcLineNumber;
/*
* ExcMessage and Exception are now defined in c.h
*/
#if defined(JMP_BUF)
typedef jmp_buf ExcContext;
typedef jmp_buf ExcContext;
#else
typedef sigjmp_buf ExcContext;
typedef sigjmp_buf ExcContext;
#endif
typedef Exception* ExcId;
typedef long ExcDetail;
typedef char* ExcData;
typedef Exception *ExcId;
typedef long ExcDetail;
typedef char *ExcData;
typedef struct ExcFrame {
struct ExcFrame *link;
ExcContext context;
ExcId id;
ExcDetail detail;
ExcData data;
ExcMessage message;
} ExcFrame;
typedef struct ExcFrame
{
struct ExcFrame *link;
ExcContext context;
ExcId id;
ExcDetail detail;
ExcData data;
ExcMessage message;
} ExcFrame;
extern ExcFrame* ExcCurFrameP;
extern ExcFrame *ExcCurFrameP;
#define ExcBegin() \
{ \
ExcFrame exception; \
\
exception.link = ExcCurFrameP; \
if (sigsetjmp(exception.context, 1) == 0) { \
ExcCurFrameP = &exception; \
{
#define ExcExcept() \
} \
ExcCurFrameP = exception.link; \
} else { \
{
#define ExcEnd() \
} \
} \
}
#define ExcBegin() \
{ \
ExcFrame exception; \
\
exception.link = ExcCurFrameP; \
if (sigsetjmp(exception.context, 1) == 0) { \
ExcCurFrameP = &exception; \
{
#define ExcExcept() \
} \
ExcCurFrameP = exception.link; \
} else { \
{
#define ExcEnd() \
} \
} \
}
#define raise4(x, t, d, message) \
ExcRaise(&(x), (ExcDetail)(t), (ExcData)(d), (ExcMessage)(message))
ExcRaise(&(x), (ExcDetail)(t), (ExcData)(d), (ExcMessage)(message))
#define reraise() \
raise4(*exception.id,exception.detail,exception.data,exception.message)
#define reraise() \
raise4(*exception.id,exception.detail,exception.data,exception.message)
typedef void ExcProc(Exception*, ExcDetail, ExcData, ExcMessage);
typedef void ExcProc(Exception *, ExcDetail, ExcData, ExcMessage);
/*
* prototypes for functions in exc.c
*/
extern void EnableExceptionHandling(bool on);
extern void ExcRaise(Exception *excP,
ExcDetail detail,
ExcData data,
ExcMessage message);
extern void EnableExceptionHandling(bool on);
extern void
ExcRaise(Exception * excP,
ExcDetail detail,
ExcData data,
ExcMessage message);
/*
* prototypes for functions in excabort.c
*/
extern void ExcAbort(const Exception *excP, ExcDetail detail, ExcData data,
ExcMessage message);
extern void
ExcAbort(const Exception * excP, ExcDetail detail, ExcData data,
ExcMessage message);
#endif /* EXC_H */
#endif /* EXC_H */

View File

@@ -1,16 +1,16 @@
/*-------------------------------------------------------------------------
*
* excid.h--
* POSTGRES known exception identifier definitions.
* POSTGRES known exception identifier definitions.
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: excid.h,v 1.3 1996/11/04 11:51:16 scrappy Exp $
* $Id: excid.h,v 1.4 1997/09/07 05:02:29 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef EXCID_H
#ifndef EXCID_H
#define EXCID_H
@@ -21,9 +21,9 @@ extern Exception BadAllocSize;
extern Exception ExhaustedMemory;
extern Exception Unimplemented;
extern Exception CatalogFailure; /* XXX inconsistent naming style */
extern Exception InternalError; /* XXX inconsistent naming style */
extern Exception SemanticError; /* XXX inconsistent naming style */
extern Exception SystemError; /* XXX inconsistent naming style */
extern Exception CatalogFailure;/* XXX inconsistent naming style */
extern Exception InternalError; /* XXX inconsistent naming style */
extern Exception SemanticError; /* XXX inconsistent naming style */
extern Exception SystemError; /* XXX inconsistent naming style */
#endif /* EXCID_H */
#endif /* EXCID_H */

View File

@@ -1,54 +1,54 @@
/*-------------------------------------------------------------------------
*
* fcache.h--
*
*
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: fcache.h,v 1.2 1996/11/04 07:18:42 scrappy Exp $
* $Id: fcache.h,v 1.3 1997/09/07 05:02:30 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef FCACHE_H
#define FCACHE_H
#ifndef FCACHE_H
#define FCACHE_H
typedef struct
{
int typlen; /* length of the return type */
int typbyval; /* true if return type is pass by value */
func_ptr func; /* address of function to call (for c funcs) */
Oid foid; /* oid of the function in pg_proc */
Oid language; /* oid of the language in pg_language */
int nargs; /* number of arguments */
int typlen; /* length of the return type */
int typbyval; /* true if return type is pass by value */
func_ptr func; /* address of function to call (for c
* funcs) */
Oid foid; /* oid of the function in pg_proc */
Oid language; /* oid of the language in pg_language */
int nargs; /* number of arguments */
/* Might want to make these two arrays of size MAXFUNCARGS */
/* Might want to make these two arrays of size MAXFUNCARGS */
Oid *argOidVect; /* oids of all the arguments */
bool *nullVect; /* keep track of null arguments */
Oid *argOidVect; /* oids of all the arguments */
bool *nullVect; /* keep track of null arguments */
char *src; /* source code of the function */
char *bin; /* binary object code ?? */
char *func_state; /* fuction_state struct for execution */
char *src; /* source code of the function */
char *bin; /* binary object code ?? */
char *func_state; /* fuction_state struct for execution */
bool oneResult; /* true we only want 1 result from the
* function
*/
bool hasSetArg; /* true if func is part of a nested dot expr
* whose argument is func returning a set ugh!
*/
bool oneResult; /* true we only want 1 result from the
* function */
bool hasSetArg; /* true if func is part of a nested dot
* expr whose argument is func returning a
* set ugh! */
Pointer funcSlot; /* if one result we need to copy it before we
* end execution of the function and free stuff
*/
Pointer funcSlot; /* if one result we need to copy it before
* we end execution of the function and
* free stuff */
char *setArg; /* current argument for nested dot execution
* Nested dot expressions mean we have funcs
* whose argument is a set of tuples
*/
char *setArg; /* current argument for nested dot
* execution Nested dot expressions mean
* we have funcs whose argument is a set
* of tuples */
bool istrusted; /* trusted fn? */
} FunctionCache, *FunctionCachePtr;
bool istrusted; /* trusted fn? */
} FunctionCache, *FunctionCachePtr;
#endif /* FCACHE_H */
#endif /* FCACHE_H */

View File

@@ -1,12 +1,12 @@
/*-------------------------------------------------------------------------
*
* fcache2.h--
*
*
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: fcache2.h,v 1.2 1996/11/04 08:53:07 scrappy Exp $
* $Id: fcache2.h,v 1.3 1997/09/07 05:02:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -16,6 +16,6 @@
#include <nodes/execnodes.h>
extern void
setFcache(Node *node, Oid foid, List *argList, ExprContext *econtext);
setFcache(Node * node, Oid foid, List * argList, ExprContext * econtext);
#endif /* FCACHE2_H */
#endif /* FCACHE2_H */

View File

@@ -1,12 +1,12 @@
/*-------------------------------------------------------------------------
*
* fmgrtab.h--
*
*
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: fmgrtab.h,v 1.4 1996/11/10 03:06:27 momjian Exp $
* $Id: fmgrtab.h,v 1.5 1997/09/07 05:02:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -14,15 +14,16 @@
#define FMGRTAB_H
typedef struct {
Oid proid;
uint16 nargs;
func_ptr func;
char* funcName;
} FmgrCall;
typedef struct
{
Oid proid;
uint16 nargs;
func_ptr func;
char *funcName;
} FmgrCall;
extern FmgrCall *fmgr_isbuiltin(Oid id);
extern func_ptr fmgr_lookupByName(char* name);
extern void load_file(char *filename);
extern FmgrCall *fmgr_isbuiltin(Oid id);
extern func_ptr fmgr_lookupByName(char *name);
extern void load_file(char *filename);
#endif /* FMGRTAB_H */
#endif /* FMGRTAB_H */

View File

@@ -5,19 +5,19 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: geo_decls.h,v 1.8 1997/08/21 01:40:30 vadim Exp $
* $Id: geo_decls.h,v 1.9 1997/09/07 05:02:34 momjian Exp $
*
* NOTE
* These routines do *not* use the float types from adt/.
* These routines do *not* use the float types from adt/.
*
* XXX These routines were not written by a numerical analyst.
* XXX I have made some attempt to flesh out the operators
* and data types. There are still some more to do. - tgl 97/04/19
* XXX These routines were not written by a numerical analyst.
* XXX I have made some attempt to flesh out the operators
* and data types. There are still some more to do. - tgl 97/04/19
*
*-------------------------------------------------------------------------
*/
#ifndef GEO_DECLS_H
#define GEO_DECLS_H
#ifndef GEO_DECLS_H
#define GEO_DECLS_H
#include "access/attnum.h"
@@ -28,321 +28,334 @@
*-------------------------------------------------------------------*/
#define EPSILON 1.0E-06
#define EPSILON 1.0E-06
#ifdef EPSILON
#define FPzero(A) (fabs(A) <= EPSILON)
#define FPeq(A,B) (fabs((A) - (B)) <= EPSILON)
#define FPlt(A,B) ((B) - (A) > EPSILON)
#define FPle(A,B) ((A) - (B) <= EPSILON)
#define FPgt(A,B) ((A) - (B) > EPSILON)
#define FPge(A,B) ((B) - (A) <= EPSILON)
#define FPzero(A) (fabs(A) <= EPSILON)
#define FPeq(A,B) (fabs((A) - (B)) <= EPSILON)
#define FPlt(A,B) ((B) - (A) > EPSILON)
#define FPle(A,B) ((A) - (B) <= EPSILON)
#define FPgt(A,B) ((A) - (B) > EPSILON)
#define FPge(A,B) ((B) - (A) <= EPSILON)
#else
#define FPzero(A) (A == 0)
#define FPnzero(A) (A != 0)
#define FPeq(A,B) (A == B)
#define FPne(A,B) (A != B)
#define FPlt(A,B) (A < B)
#define FPle(A,B) (A <= B)
#define FPgt(A,B) (A > B)
#define FPge(A,B) (A >= B)
#define FPzero(A) (A == 0)
#define FPnzero(A) (A != 0)
#define FPeq(A,B) (A == B)
#define FPne(A,B) (A != B)
#define FPlt(A,B) (A < B)
#define FPle(A,B) (A <= B)
#define FPgt(A,B) (A > B)
#define FPge(A,B) (A >= B)
#endif
#define HYPOT(A, B) sqrt((A) * (A) + (B) * (B))
#define HYPOT(A, B) sqrt((A) * (A) + (B) * (B))
/*--------------------------------------------------------------------
* Memory management.
*-------------------------------------------------------------------*/
#define PALLOC(SIZE) palloc(SIZE)
#define PFREE(P) pfree(P)
#define PALLOCTYPE(TYPE) (TYPE *) PALLOC(sizeof(TYPE))
#define PALLOC(SIZE) palloc(SIZE)
#define PFREE(P) pfree(P)
#define PALLOCTYPE(TYPE) (TYPE *) PALLOC(sizeof(TYPE))
/*#endif !FmgrIncluded */
/*---------------------------------------------------------------------
* Point - (x,y)
*-------------------------------------------------------------------*/
typedef struct {
double x, y;
} Point;
typedef struct
{
double x,
y;
} Point;
/*---------------------------------------------------------------------
* LSEG - A straight line, specified by endpoints.
* LSEG - A straight line, specified by endpoints.
*-------------------------------------------------------------------*/
typedef struct {
Point p[2];
typedef struct
{
Point p[2];
double m; /* precomputed to save time, not in tuple */
} LSEG;
double m; /* precomputed to save time, not in tuple */
} LSEG;
/*---------------------------------------------------------------------
* PATH - Specified by vertex points.
* PATH - Specified by vertex points.
*-------------------------------------------------------------------*/
typedef struct {
int32 size; /* XXX varlena */
int32 npts;
int32 closed; /* is this a closed polygon? */
int32 dummy; /* padding to make it double align */
Point p[1]; /* variable length array of POINTs */
} PATH;
typedef struct
{
int32 size; /* XXX varlena */
int32 npts;
int32 closed; /* is this a closed polygon? */
int32 dummy; /* padding to make it double align */
Point p[1]; /* variable length array of POINTs */
} PATH;
/*---------------------------------------------------------------------
* LINE - Specified by its general equation (Ax+By+C=0).
* If there is a y-intercept, it is C, which
* incidentally gives a freebie point on the line
* (if B=0, then C is the x-intercept).
* Slope m is precalculated to save time; if
* the line is not vertical, m == A.
* LINE - Specified by its general equation (Ax+By+C=0).
* If there is a y-intercept, it is C, which
* incidentally gives a freebie point on the line
* (if B=0, then C is the x-intercept).
* Slope m is precalculated to save time; if
* the line is not vertical, m == A.
*-------------------------------------------------------------------*/
typedef struct {
double A, B, C;
typedef struct
{
double A,
B,
C;
double m;
} LINE;
double m;
} LINE;
/*---------------------------------------------------------------------
* BOX - Specified by two corner points, which are
* sorted to save calculation time later.
* sorted to save calculation time later.
*-------------------------------------------------------------------*/
typedef struct {
Point high, low; /* corner POINTs */
} BOX;
typedef struct
{
Point high,
low; /* corner POINTs */
} BOX;
/*---------------------------------------------------------------------
* POLYGON - Specified by an array of doubles defining the points,
* keeping the number of points and the bounding box for
* speed purposes.
* POLYGON - Specified by an array of doubles defining the points,
* keeping the number of points and the bounding box for
* speed purposes.
*-------------------------------------------------------------------*/
typedef struct {
int32 size; /* XXX varlena */
int32 npts;
BOX boundbox;
Point p[1]; /* variable length array of POINTs */
} POLYGON;
typedef struct
{
int32 size; /* XXX varlena */
int32 npts;
BOX boundbox;
Point p[1]; /* variable length array of POINTs */
} POLYGON;
/*---------------------------------------------------------------------
* CIRCLE - Specified by a center point and radius.
*-------------------------------------------------------------------*/
typedef struct {
Point center;
double radius;
} CIRCLE;
typedef struct
{
Point center;
double radius;
} CIRCLE;
/*
/*
* in geo_ops.h
*/
/* public point routines */
extern Point *point_in(char *str);
extern char *point_out(Point *pt);
extern bool point_left(Point *pt1, Point *pt2);
extern bool point_right(Point *pt1, Point *pt2);
extern bool point_above(Point *pt1, Point *pt2);
extern bool point_below(Point *pt1, Point *pt2);
extern bool point_vert(Point *pt1, Point *pt2);
extern bool point_horiz(Point *pt1, Point *pt2);
extern bool point_eq(Point *pt1, Point *pt2);
extern int32 pointdist(Point *p1, Point *p2);
extern double *point_distance(Point *pt1, Point *pt2);
extern double *point_slope(Point *pt1, Point *pt2);
extern Point *point_in(char *str);
extern char *point_out(Point * pt);
extern bool point_left(Point * pt1, Point * pt2);
extern bool point_right(Point * pt1, Point * pt2);
extern bool point_above(Point * pt1, Point * pt2);
extern bool point_below(Point * pt1, Point * pt2);
extern bool point_vert(Point * pt1, Point * pt2);
extern bool point_horiz(Point * pt1, Point * pt2);
extern bool point_eq(Point * pt1, Point * pt2);
extern int32 pointdist(Point * p1, Point * p2);
extern double *point_distance(Point * pt1, Point * pt2);
extern double *point_slope(Point * pt1, Point * pt2);
/* private routines */
extern double point_dt(Point *pt1, Point *pt2);
extern double point_sl(Point *pt1, Point *pt2);
extern double point_dt(Point * pt1, Point * pt2);
extern double point_sl(Point * pt1, Point * pt2);
extern Point *point(float8 *x, float8 *y);
extern Point *point_add(Point *p1, Point *p2);
extern Point *point_sub(Point *p1, Point *p2);
extern Point *point_mul(Point *p1, Point *p2);
extern Point *point_div(Point *p1, Point *p2);
extern Point *point(float8 * x, float8 * y);
extern Point *point_add(Point * p1, Point * p2);
extern Point *point_sub(Point * p1, Point * p2);
extern Point *point_mul(Point * p1, Point * p2);
extern Point *point_div(Point * p1, Point * p2);
/* public lseg routines */
extern LSEG *lseg_in(char *str);
extern char *lseg_out(LSEG *ls);
extern bool lseg_intersect(LSEG *l1, LSEG *l2);
extern bool lseg_parallel(LSEG *l1, LSEG *l2);
extern bool lseg_perp(LSEG *l1, LSEG *l2);
extern bool lseg_vertical(LSEG *lseg);
extern bool lseg_horizontal(LSEG *lseg);
extern bool lseg_eq(LSEG *l1, LSEG *l2);
extern double *lseg_distance(LSEG *l1, LSEG *l2);
extern Point *lseg_center(LSEG *lseg);
extern Point *lseg_interpt(LSEG *l1, LSEG *l2);
extern double *dist_pl(Point *pt, LINE *line);
extern double *dist_ps(Point *pt, LSEG *lseg);
extern double *dist_ppath(Point *pt, PATH *path);
extern double *dist_pb(Point *pt, BOX *box);
extern double *dist_sl(LSEG *lseg, LINE *line);
extern double *dist_sb(LSEG *lseg, BOX *box);
extern double *dist_lb(LINE *line, BOX *box);
extern Point *close_pl(Point *pt, LINE *line);
extern Point *close_ps(Point *pt, LSEG *lseg);
extern Point *close_pb(Point *pt, BOX *box);
extern Point *close_sl(LSEG *lseg, LINE *line);
extern Point *close_sb(LSEG *lseg, BOX *box);
extern Point *close_lb(LINE *line, BOX *box);
extern bool on_pl(Point *pt, LINE *line);
extern bool on_ps(Point *pt, LSEG *lseg);
extern bool on_pb(Point *pt, BOX *box);
extern bool on_ppath(Point *pt, PATH *path);
extern bool on_sl(LSEG *lseg, LINE *line);
extern bool on_sb(LSEG *lseg, BOX *box);
extern bool inter_sl(LSEG *lseg, LINE *line);
extern bool inter_sb(LSEG *lseg, BOX *box);
extern bool inter_lb(LINE *line, BOX *box);
extern LSEG *lseg_in(char *str);
extern char *lseg_out(LSEG * ls);
extern bool lseg_intersect(LSEG * l1, LSEG * l2);
extern bool lseg_parallel(LSEG * l1, LSEG * l2);
extern bool lseg_perp(LSEG * l1, LSEG * l2);
extern bool lseg_vertical(LSEG * lseg);
extern bool lseg_horizontal(LSEG * lseg);
extern bool lseg_eq(LSEG * l1, LSEG * l2);
extern double *lseg_distance(LSEG * l1, LSEG * l2);
extern Point *lseg_center(LSEG * lseg);
extern Point *lseg_interpt(LSEG * l1, LSEG * l2);
extern double *dist_pl(Point * pt, LINE * line);
extern double *dist_ps(Point * pt, LSEG * lseg);
extern double *dist_ppath(Point * pt, PATH * path);
extern double *dist_pb(Point * pt, BOX * box);
extern double *dist_sl(LSEG * lseg, LINE * line);
extern double *dist_sb(LSEG * lseg, BOX * box);
extern double *dist_lb(LINE * line, BOX * box);
extern Point *close_pl(Point * pt, LINE * line);
extern Point *close_ps(Point * pt, LSEG * lseg);
extern Point *close_pb(Point * pt, BOX * box);
extern Point *close_sl(LSEG * lseg, LINE * line);
extern Point *close_sb(LSEG * lseg, BOX * box);
extern Point *close_lb(LINE * line, BOX * box);
extern bool on_pl(Point * pt, LINE * line);
extern bool on_ps(Point * pt, LSEG * lseg);
extern bool on_pb(Point * pt, BOX * box);
extern bool on_ppath(Point * pt, PATH * path);
extern bool on_sl(LSEG * lseg, LINE * line);
extern bool on_sb(LSEG * lseg, BOX * box);
extern bool inter_sl(LSEG * lseg, LINE * line);
extern bool inter_sb(LSEG * lseg, BOX * box);
extern bool inter_lb(LINE * line, BOX * box);
/* private routines */
extern LSEG *lseg_construct(Point *pt1, Point *pt2);
extern LSEG *lseg_construct(Point * pt1, Point * pt2);
/* public box routines */
extern BOX *box_in(char *str);
extern char *box_out(BOX *box);
extern bool box_same(BOX *box1, BOX *box2);
extern bool box_overlap(BOX *box1, BOX *box2);
extern bool box_overleft(BOX *box1, BOX *box2);
extern bool box_left(BOX *box1, BOX *box2);
extern bool box_right(BOX *box1, BOX *box2);
extern bool box_overright(BOX *box1, BOX *box2);
extern bool box_contained(BOX *box1, BOX *box2);
extern bool box_contain(BOX *box1, BOX *box2);
extern bool box_below(BOX *box1, BOX *box2);
extern bool box_above(BOX *box1, BOX *box2);
extern bool box_lt(BOX *box1, BOX *box2);
extern bool box_gt(BOX *box1, BOX *box2);
extern bool box_eq(BOX *box1, BOX *box2);
extern bool box_le(BOX *box1, BOX *box2);
extern bool box_ge(BOX *box1, BOX *box2);
extern Point *box_center(BOX *box);
extern double *box_area(BOX *box);
extern double *box_width(BOX *box);
extern double *box_height(BOX *box);
extern double *box_distance(BOX *box1, BOX *box2);
extern Point *box_center(BOX *box);
extern BOX *box_intersect(BOX *box1, BOX *box2);
extern LSEG *box_diagonal(BOX *box);
extern BOX *box_in(char *str);
extern char *box_out(BOX * box);
extern bool box_same(BOX * box1, BOX * box2);
extern bool box_overlap(BOX * box1, BOX * box2);
extern bool box_overleft(BOX * box1, BOX * box2);
extern bool box_left(BOX * box1, BOX * box2);
extern bool box_right(BOX * box1, BOX * box2);
extern bool box_overright(BOX * box1, BOX * box2);
extern bool box_contained(BOX * box1, BOX * box2);
extern bool box_contain(BOX * box1, BOX * box2);
extern bool box_below(BOX * box1, BOX * box2);
extern bool box_above(BOX * box1, BOX * box2);
extern bool box_lt(BOX * box1, BOX * box2);
extern bool box_gt(BOX * box1, BOX * box2);
extern bool box_eq(BOX * box1, BOX * box2);
extern bool box_le(BOX * box1, BOX * box2);
extern bool box_ge(BOX * box1, BOX * box2);
extern Point *box_center(BOX * box);
extern double *box_area(BOX * box);
extern double *box_width(BOX * box);
extern double *box_height(BOX * box);
extern double *box_distance(BOX * box1, BOX * box2);
extern Point *box_center(BOX * box);
extern BOX *box_intersect(BOX * box1, BOX * box2);
extern LSEG *box_diagonal(BOX * box);
/* private routines */
extern double box_dt(BOX *box1, BOX *box2);
extern double box_dt(BOX * box1, BOX * box2);
extern BOX *box(Point *p1, Point *p2);
extern BOX *box_add(BOX *box, Point *p);
extern BOX *box_sub(BOX *box, Point *p);
extern BOX *box_mul(BOX *box, Point *p);
extern BOX *box_div(BOX *box, Point *p);
extern BOX *box(Point * p1, Point * p2);
extern BOX *box_add(BOX * box, Point * p);
extern BOX *box_sub(BOX * box, Point * p);
extern BOX *box_mul(BOX * box, Point * p);
extern BOX *box_div(BOX * box, Point * p);
/* private line routines */
extern double *line_distance(LINE *l1, LINE *l2);
extern double *line_distance(LINE * l1, LINE * l2);
/* public path routines */
extern PATH *path_in(char *str);
extern char *path_out(PATH *path);
extern bool path_n_lt(PATH *p1, PATH *p2);
extern bool path_n_gt(PATH *p1, PATH *p2);
extern bool path_n_eq(PATH *p1, PATH *p2);
extern bool path_n_le(PATH *p1, PATH *p2);
extern bool path_n_ge(PATH *p1, PATH *p2);
extern bool path_inter(PATH *p1, PATH *p2);
extern double *path_distance(PATH *p1, PATH *p2);
extern double *path_length(PATH *path);
extern PATH *path_in(char *str);
extern char *path_out(PATH * path);
extern bool path_n_lt(PATH * p1, PATH * p2);
extern bool path_n_gt(PATH * p1, PATH * p2);
extern bool path_n_eq(PATH * p1, PATH * p2);
extern bool path_n_le(PATH * p1, PATH * p2);
extern bool path_n_ge(PATH * p1, PATH * p2);
extern bool path_inter(PATH * p1, PATH * p2);
extern double *path_distance(PATH * p1, PATH * p2);
extern double *path_length(PATH * path);
extern bool path_isclosed(PATH *path);
extern bool path_isopen(PATH *path);
extern int4 path_npoints(PATH *path);
extern bool path_isclosed(PATH * path);
extern bool path_isopen(PATH * path);
extern int4 path_npoints(PATH * path);
extern PATH *path_close(PATH *path);
extern PATH *path_open(PATH *path);
extern PATH *path_add(PATH *p1, PATH *p2);
extern PATH *path_add_pt(PATH *path, Point *point);
extern PATH *path_sub_pt(PATH *path, Point *point);
extern PATH *path_mul_pt(PATH *path, Point *point);
extern PATH *path_div_pt(PATH *path, Point *point);
extern bool path_contain_pt( PATH *path, Point *p);
extern bool pt_contained_path( Point *p, PATH *path);
extern PATH *path_close(PATH * path);
extern PATH *path_open(PATH * path);
extern PATH *path_add(PATH * p1, PATH * p2);
extern PATH *path_add_pt(PATH * path, Point * point);
extern PATH *path_sub_pt(PATH * path, Point * point);
extern PATH *path_mul_pt(PATH * path, Point * point);
extern PATH *path_div_pt(PATH * path, Point * point);
extern bool path_contain_pt(PATH * path, Point * p);
extern bool pt_contained_path(Point * p, PATH * path);
extern Point *path_center(PATH *path);
extern POLYGON *path_poly(PATH *path);
extern Point *path_center(PATH * path);
extern POLYGON *path_poly(PATH * path);
extern PATH *upgradepath(PATH *path);
extern bool isoldpath(PATH *path);
extern PATH *upgradepath(PATH * path);
extern bool isoldpath(PATH * path);
/* public polygon routines */
extern POLYGON *poly_in(char *s);
extern char *poly_out(POLYGON *poly);
extern bool poly_left(POLYGON *polya, POLYGON *polyb);
extern bool poly_overleft(POLYGON *polya, POLYGON *polyb);
extern bool poly_right(POLYGON *polya, POLYGON *polyb);
extern bool poly_overright(POLYGON *polya, POLYGON *polyb);
extern bool poly_same(POLYGON *polya, POLYGON *polyb);
extern bool poly_overlap(POLYGON *polya, POLYGON *polyb);
extern bool poly_contain(POLYGON *polya, POLYGON *polyb);
extern bool poly_contained(POLYGON *polya, POLYGON *polyb);
extern bool poly_contain_pt( POLYGON *poly, Point *p);
extern bool pt_contained_poly( Point *p, POLYGON *poly);
extern char *poly_out(POLYGON * poly);
extern bool poly_left(POLYGON * polya, POLYGON * polyb);
extern bool poly_overleft(POLYGON * polya, POLYGON * polyb);
extern bool poly_right(POLYGON * polya, POLYGON * polyb);
extern bool poly_overright(POLYGON * polya, POLYGON * polyb);
extern bool poly_same(POLYGON * polya, POLYGON * polyb);
extern bool poly_overlap(POLYGON * polya, POLYGON * polyb);
extern bool poly_contain(POLYGON * polya, POLYGON * polyb);
extern bool poly_contained(POLYGON * polya, POLYGON * polyb);
extern bool poly_contain_pt(POLYGON * poly, Point * p);
extern bool pt_contained_poly(Point * p, POLYGON * poly);
extern double *poly_distance(POLYGON *polya, POLYGON *polyb);
extern int4 poly_npoints(POLYGON *poly);
extern Point *poly_center(POLYGON *poly);
extern BOX *poly_box(POLYGON *poly);
extern PATH *poly_path(POLYGON *poly);
extern POLYGON *box_poly(BOX *box);
extern double *poly_distance(POLYGON * polya, POLYGON * polyb);
extern int4 poly_npoints(POLYGON * poly);
extern Point *poly_center(POLYGON * poly);
extern BOX *poly_box(POLYGON * poly);
extern PATH *poly_path(POLYGON * poly);
extern POLYGON *box_poly(BOX * box);
extern POLYGON *upgradepoly(POLYGON *poly);
extern POLYGON *revertpoly(POLYGON *poly);
extern POLYGON *upgradepoly(POLYGON * poly);
extern POLYGON *revertpoly(POLYGON * poly);
/* private polygon routines */
/* public circle routines */
extern CIRCLE *circle_in(char *str);
extern char *circle_out(CIRCLE *circle);
extern bool circle_same(CIRCLE *circle1, CIRCLE *circle2);
extern bool circle_overlap(CIRCLE *circle1, CIRCLE *circle2);
extern bool circle_overleft(CIRCLE *circle1, CIRCLE *circle2);
extern bool circle_left(CIRCLE *circle1, CIRCLE *circle2);
extern bool circle_right(CIRCLE *circle1, CIRCLE *circle2);
extern bool circle_overright(CIRCLE *circle1, CIRCLE *circle2);
extern bool circle_contained(CIRCLE *circle1, CIRCLE *circle2);
extern bool circle_contain(CIRCLE *circle1, CIRCLE *circle2);
extern bool circle_below(CIRCLE *circle1, CIRCLE *circle2);
extern bool circle_above(CIRCLE *circle1, CIRCLE *circle2);
extern CIRCLE *circle_in(char *str);
extern char *circle_out(CIRCLE * circle);
extern bool circle_same(CIRCLE * circle1, CIRCLE * circle2);
extern bool circle_overlap(CIRCLE * circle1, CIRCLE * circle2);
extern bool circle_overleft(CIRCLE * circle1, CIRCLE * circle2);
extern bool circle_left(CIRCLE * circle1, CIRCLE * circle2);
extern bool circle_right(CIRCLE * circle1, CIRCLE * circle2);
extern bool circle_overright(CIRCLE * circle1, CIRCLE * circle2);
extern bool circle_contained(CIRCLE * circle1, CIRCLE * circle2);
extern bool circle_contain(CIRCLE * circle1, CIRCLE * circle2);
extern bool circle_below(CIRCLE * circle1, CIRCLE * circle2);
extern bool circle_above(CIRCLE * circle1, CIRCLE * circle2);
extern bool circle_eq(CIRCLE *circle1, CIRCLE *circle2);
extern bool circle_ne(CIRCLE *circle1, CIRCLE *circle2);
extern bool circle_lt(CIRCLE *circle1, CIRCLE *circle2);
extern bool circle_gt(CIRCLE *circle1, CIRCLE *circle2);
extern bool circle_le(CIRCLE *circle1, CIRCLE *circle2);
extern bool circle_ge(CIRCLE *circle1, CIRCLE *circle2);
extern bool circle_contain_pt(CIRCLE *circle, Point *point);
extern bool pt_contained_circle(Point *point, CIRCLE *circle);
extern CIRCLE *circle_add_pt(CIRCLE *circle, Point *point);
extern CIRCLE *circle_sub_pt(CIRCLE *circle, Point *point);
extern CIRCLE *circle_mul_pt(CIRCLE *circle, Point *point);
extern CIRCLE *circle_div_pt(CIRCLE *circle, Point *point);
extern double *circle_diameter(CIRCLE *circle);
extern double *circle_radius(CIRCLE *circle);
extern double *circle_distance(CIRCLE *circle1, CIRCLE *circle2);
extern double *dist_pc(Point *point, CIRCLE *circle);
extern double *dist_cpoly(CIRCLE *circle, POLYGON *poly);
extern Point *circle_center(CIRCLE *circle);
extern CIRCLE *circle(Point *center, float8 *radius);
extern CIRCLE *box_circle(BOX *box);
extern BOX *circle_box(CIRCLE *circle);
extern CIRCLE *poly_circle(POLYGON *poly);
extern POLYGON *circle_poly(int npts, CIRCLE *circle);
extern bool circle_eq(CIRCLE * circle1, CIRCLE * circle2);
extern bool circle_ne(CIRCLE * circle1, CIRCLE * circle2);
extern bool circle_lt(CIRCLE * circle1, CIRCLE * circle2);
extern bool circle_gt(CIRCLE * circle1, CIRCLE * circle2);
extern bool circle_le(CIRCLE * circle1, CIRCLE * circle2);
extern bool circle_ge(CIRCLE * circle1, CIRCLE * circle2);
extern bool circle_contain_pt(CIRCLE * circle, Point * point);
extern bool pt_contained_circle(Point * point, CIRCLE * circle);
extern CIRCLE *circle_add_pt(CIRCLE * circle, Point * point);
extern CIRCLE *circle_sub_pt(CIRCLE * circle, Point * point);
extern CIRCLE *circle_mul_pt(CIRCLE * circle, Point * point);
extern CIRCLE *circle_div_pt(CIRCLE * circle, Point * point);
extern double *circle_diameter(CIRCLE * circle);
extern double *circle_radius(CIRCLE * circle);
extern double *circle_distance(CIRCLE * circle1, CIRCLE * circle2);
extern double *dist_pc(Point * point, CIRCLE * circle);
extern double *dist_cpoly(CIRCLE * circle, POLYGON * poly);
extern Point *circle_center(CIRCLE * circle);
extern CIRCLE *circle(Point * center, float8 * radius);
extern CIRCLE *box_circle(BOX * box);
extern BOX *circle_box(CIRCLE * circle);
extern CIRCLE *poly_circle(POLYGON * poly);
extern POLYGON *circle_poly(int npts, CIRCLE * circle);
/* private routines */
extern double *circle_area(CIRCLE *circle);
extern double circle_dt(CIRCLE *circle1, CIRCLE *circle2);
extern double *circle_area(CIRCLE * circle);
extern double circle_dt(CIRCLE * circle1, CIRCLE * circle2);
/* geo_selfuncs.c */
extern float64 areasel(Oid opid, Oid relid, AttrNumber attno,
char *value, int32 flag);
extern float64 areajoinsel(Oid opid, Oid relid, AttrNumber attno,
char *value, int32 flag);
extern float64
areasel(Oid opid, Oid relid, AttrNumber attno,
char *value, int32 flag);
extern float64
areajoinsel(Oid opid, Oid relid, AttrNumber attno,
char *value, int32 flag);
#endif /* GEO_DECLS_H */
#endif /* GEO_DECLS_H */

View File

@@ -1,12 +1,12 @@
/*-------------------------------------------------------------------------
*
* hsearch.h--
* for hashing in the new buffer manager
* for hashing in the new buffer manager
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: hsearch.h,v 1.3 1997/08/19 21:40:35 momjian Exp $
* $Id: hsearch.h,v 1.4 1997/09/07 05:02:35 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -17,123 +17,131 @@
/*
* Constants
*/
# define DEF_BUCKET_SIZE 256
# define DEF_BUCKET_SHIFT 8 /* log2(BUCKET) */
# define DEF_SEGSIZE 256
# define DEF_SEGSIZE_SHIFT 8 /* log2(SEGSIZE) */
# define DEF_DIRSIZE 256
# define PRIME1 37
# define PRIME2 1048583
# define DEF_FFACTOR 1
# define SPLTMAX 8
#define DEF_BUCKET_SIZE 256
#define DEF_BUCKET_SHIFT 8/* log2(BUCKET) */
#define DEF_SEGSIZE 256
#define DEF_SEGSIZE_SHIFT 8 /* log2(SEGSIZE) */
#define DEF_DIRSIZE 256
#define PRIME1 37
#define PRIME2 1048583
#define DEF_FFACTOR 1
#define SPLTMAX 8
/*
* Hash bucket is actually bigger than this. Key field can have
* variable length and a variable length data field follows it.
*/
typedef struct element {
unsigned long next; /* secret from user */
long key;
} ELEMENT;
typedef struct element
{
unsigned long next; /* secret from user */
long key;
} ELEMENT;
typedef unsigned long BUCKET_INDEX;
/* segment is an array of bucket pointers */
typedef BUCKET_INDEX *SEGMENT;
typedef unsigned long SEG_OFFSET;
typedef struct hashhdr {
long bsize; /* Bucket/Page Size */
long bshift; /* Bucket shift */
long dsize; /* Directory Size */
long ssize; /* Segment Size */
long sshift; /* Segment shift */
long max_bucket; /* ID of Maximum bucket in use */
long high_mask; /* Mask to modulo into entire table */
long low_mask; /* Mask to modulo into lower half of table */
long ffactor; /* Fill factor */
long nkeys; /* Number of keys in hash table */
long nsegs; /* Number of allocated segments */
long keysize; /* hash key length in bytes */
long datasize; /* elem data length in bytes */
long max_dsize; /* 'dsize' limit if directory is fixed size */
BUCKET_INDEX freeBucketIndex;
/* index of first free bucket */
typedef struct hashhdr
{
long bsize; /* Bucket/Page Size */
long bshift; /* Bucket shift */
long dsize; /* Directory Size */
long ssize; /* Segment Size */
long sshift; /* Segment shift */
long max_bucket; /* ID of Maximum bucket in use */
long high_mask; /* Mask to modulo into entire table */
long low_mask; /* Mask to modulo into lower half of table */
long ffactor; /* Fill factor */
long nkeys; /* Number of keys in hash table */
long nsegs; /* Number of allocated segments */
long keysize; /* hash key length in bytes */
long datasize; /* elem data length in bytes */
long max_dsize; /* 'dsize' limit if directory is fixed
* size */
BUCKET_INDEX freeBucketIndex;
/* index of first free bucket */
#ifdef HASH_STATISTICS
long accesses;
long collisions;
long accesses;
long collisions;
#endif
} HHDR;
} HHDR;
typedef struct htab {
HHDR *hctl; /* shared control information */
long (*hash)(); /* Hash Function */
char *segbase; /* segment base address for
* calculating pointer values
*/
SEG_OFFSET *dir; /* 'directory' of segm starts */
long *(*alloc)(); /* memory allocator
* (long * for alignment reasons)
*/
typedef struct htab
{
HHDR *hctl; /* shared control information */
long (*hash) (); /* Hash Function */
char *segbase; /* segment base address for calculating
* pointer values */
SEG_OFFSET *dir; /* 'directory' of segm starts */
long *(*alloc) ();/* memory allocator (long * for alignment
* reasons) */
} HTAB;
} HTAB;
typedef struct hashctl {
long bsize; /* Bucket Size */
long ssize; /* Segment Size */
long dsize; /* Dirsize Size */
long ffactor; /* Fill factor */
long (*hash)(); /* Hash Function */
long keysize; /* hash key length in bytes */
long datasize; /* elem data length in bytes */
long max_size; /* limit to dsize if directory size is limited */
long *segbase; /* base for calculating bucket + seg ptrs */
long * (*alloc)(); /* memory allocation function */
long *dir; /* directory if allocated already */
long *hctl; /* location of header information in shd mem */
} HASHCTL;
typedef struct hashctl
{
long bsize; /* Bucket Size */
long ssize; /* Segment Size */
long dsize; /* Dirsize Size */
long ffactor; /* Fill factor */
long (*hash) (); /* Hash Function */
long keysize; /* hash key length in bytes */
long datasize; /* elem data length in bytes */
long max_size; /* limit to dsize if directory size is
* limited */
long *segbase; /* base for calculating bucket + seg ptrs */
long *(*alloc) ();/* memory allocation function */
long *dir; /* directory if allocated already */
long *hctl; /* location of header information in shd
* mem */
} HASHCTL;
/* Flags to indicate action for hctl */
#define HASH_BUCKET 0x001 /* Setting bucket size */
#define HASH_BUCKET 0x001 /* Setting bucket size */
#define HASH_SEGMENT 0x002 /* Setting segment size */
#define HASH_DIRSIZE 0x004 /* Setting directory size */
#define HASH_FFACTOR 0x008 /* Setting fill factor */
#define HASH_FUNCTION 0x010 /* Set user defined hash function */
#define HASH_ELEM 0x020 /* Setting key/data size */
#define HASH_SHARED_MEM 0x040 /* Setting shared mem const */
#define HASH_ATTACH 0x080 /* Do not initialize hctl */
#define HASH_ALLOC 0x100 /* Setting memory allocator */
#define HASH_ELEM 0x020 /* Setting key/data size */
#define HASH_SHARED_MEM 0x040 /* Setting shared mem const */
#define HASH_ATTACH 0x080 /* Do not initialize hctl */
#define HASH_ALLOC 0x100 /* Setting memory allocator */
/* seg_alloc assumes that INVALID_INDEX is 0*/
#define INVALID_INDEX (0)
#define NO_MAX_DSIZE (-1)
#define INVALID_INDEX (0)
#define NO_MAX_DSIZE (-1)
/* number of hash buckets allocated at once */
#define BUCKET_ALLOC_INCR (30)
#define BUCKET_ALLOC_INCR (30)
/* hash_search operations */
typedef enum {
HASH_FIND,
HASH_ENTER,
HASH_REMOVE,
HASH_FIND_SAVE,
HASH_REMOVE_SAVED
} HASHACTION;
typedef enum
{
HASH_FIND,
HASH_ENTER,
HASH_REMOVE,
HASH_FIND_SAVE,
HASH_REMOVE_SAVED
} HASHACTION;
/*
/*
* prototypes from functions in dynahash.c
*/
extern HTAB *hash_create(int nelem, HASHCTL *info, int flags);
extern void hash_destroy(HTAB *hashp);
extern void hash_stats(char *where, HTAB *hashp);
extern long *hash_search(HTAB *hashp, char *keyPtr, HASHACTION action,
bool *foundPtr);
extern long *hash_seq(HTAB *hashp);
extern HTAB *hash_create(int nelem, HASHCTL * info, int flags);
extern void hash_destroy(HTAB * hashp);
extern void hash_stats(char *where, HTAB * hashp);
extern long *
hash_search(HTAB * hashp, char *keyPtr, HASHACTION action,
bool * foundPtr);
extern long *hash_seq(HTAB * hashp);
/*
/*
* prototypes from functions in hashfn.c
*/
extern long string_hash(char *key, int keysize);
extern long tag_hash(int *key, int keysize);
extern long string_hash(char *key, int keysize);
extern long tag_hash(int *key, int keysize);
#endif /* HSEARCH_H */
#endif /* HSEARCH_H */

View File

@@ -1,46 +1,47 @@
/*-------------------------------------------------------------------------
*
* inval.h--
* POSTGRES cache invalidation dispatcher definitions.
* POSTGRES cache invalidation dispatcher definitions.
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: inval.h,v 1.4 1997/08/19 21:40:37 momjian Exp $
* $Id: inval.h,v 1.5 1997/09/07 05:02:36 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef INVAL_H
#ifndef INVAL_H
#define INVAL_H
#include <access/htup.h>
#include <utils/rel.h>
extern void DiscardInvalid(void);
extern void DiscardInvalid(void);
extern void RegisterInvalid(bool send);
extern void RegisterInvalid(bool send);
extern void SetRefreshWhenInvalidate(bool on);
extern void SetRefreshWhenInvalidate(bool on);
extern void RelationInvalidateHeapTuple(Relation relation, HeapTuple tuple);
extern void RelationInvalidateHeapTuple(Relation relation, HeapTuple tuple);
/*
* POSTGRES local cache invalidation definitions. (originates from linval.h)
*/
typedef struct InvalidationUserData {
struct InvalidationUserData *dataP[1]; /* VARIABLE LENGTH */
} InvalidationUserData; /* VARIABLE LENGTH STRUCTURE */
typedef struct InvalidationUserData
{
struct InvalidationUserData *dataP[1]; /* VARIABLE LENGTH */
} InvalidationUserData; /* VARIABLE LENGTH STRUCTURE */
typedef struct InvalidationEntryData {
InvalidationUserData *nextP;
InvalidationUserData userData; /* VARIABLE LENGTH ARRAY */
} InvalidationEntryData; /* VARIABLE LENGTH STRUCTURE */
typedef struct InvalidationEntryData
{
InvalidationUserData *nextP;
InvalidationUserData userData; /* VARIABLE LENGTH ARRAY */
} InvalidationEntryData; /* VARIABLE LENGTH STRUCTURE */
typedef Pointer InvalidationEntry;
typedef InvalidationEntry LocalInvalid;
typedef InvalidationEntry LocalInvalid;
#define EmptyLocalInvalid NULL
#endif /* INVAL_H */
#define EmptyLocalInvalid NULL
#endif /* INVAL_H */

View File

@@ -1,49 +1,55 @@
/*-------------------------------------------------------------------------
*
* lselect.h--
* definitions for the replacement selection algorithm.
* definitions for the replacement selection algorithm.
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: lselect.h,v 1.4 1997/08/06 03:42:07 momjian Exp $
*
* $Id: lselect.h,v 1.5 1997/09/07 05:02:38 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef LSELECT_H
#define LSELECT_H
#ifndef LSELECT_H
#define LSELECT_H
#include <stdio.h>
#include "access/htup.h"
struct leftist {
short lt_dist; /* distance to leaf/empty node */
short lt_devnum; /* device number of tuple */
HeapTuple lt_tuple;
struct leftist *lt_left;
struct leftist *lt_right;
struct leftist
{
short lt_dist; /* distance to leaf/empty node */
short lt_devnum; /* device number of tuple */
HeapTuple lt_tuple;
struct leftist *lt_left;
struct leftist *lt_right;
};
/* replaces global variables in lselect.c to make it reentrant */
typedef struct {
TupleDesc tupDesc;
int nKeys;
ScanKey scanKeys;
int sortMem; /* needed for psort */
} LeftistContextData;
typedef struct
{
TupleDesc tupDesc;
int nKeys;
ScanKey scanKeys;
int sortMem; /* needed for psort */
} LeftistContextData;
typedef LeftistContextData *LeftistContext;
extern struct leftist *lmerge(struct leftist *pt, struct leftist *qt,
LeftistContext context);
extern HeapTuple gettuple(struct leftist **treep, short *devnum,
LeftistContext context);
extern void puttuple(struct leftist **treep, HeapTuple newtuple, short devnum,
LeftistContext context);
extern int tuplecmp(HeapTuple ltup, HeapTuple rtup, LeftistContext context);
extern struct leftist *
lmerge(struct leftist * pt, struct leftist * qt,
LeftistContext context);
extern HeapTuple
gettuple(struct leftist ** treep, short *devnum,
LeftistContext context);
extern void
puttuple(struct leftist ** treep, HeapTuple newtuple, short devnum,
LeftistContext context);
extern int tuplecmp(HeapTuple ltup, HeapTuple rtup, LeftistContext context);
#ifdef EBUG
extern void checktree(struct leftist *tree, LeftistContext context);
extern int checktreer(struct leftist *tree, int level, LeftistContext context);
#endif /* EBUG */
extern void checktree(struct leftist * tree, LeftistContext context);
extern int checktreer(struct leftist * tree, int level, LeftistContext context);
#endif /* LSELECT_H */
#endif /* EBUG */
#endif /* LSELECT_H */

View File

@@ -1,44 +1,44 @@
/*-------------------------------------------------------------------------
*
* lsyscache.h--
*
*
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: lsyscache.h,v 1.3 1997/08/19 21:40:40 momjian Exp $
* $Id: lsyscache.h,v 1.4 1997/09/07 05:02:39 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef LSYSCACHE_H
#define LSYSCACHE_H
#ifndef LSYSCACHE_H
#define LSYSCACHE_H
#include <access/attnum.h>
#include <access/htup.h>
extern bool op_class(Oid opid, int32 opclass, Oid amopid);
extern char *get_attname(Oid relid, AttrNumber attnum);
extern bool op_class(Oid opid, int32 opclass, Oid amopid);
extern char *get_attname(Oid relid, AttrNumber attnum);
extern AttrNumber get_attnum(Oid relid, char *attname);
extern Oid get_atttype(Oid relid, AttrNumber attnum);
extern bool get_attisset(Oid relid, char *attname);
extern Oid get_atttype(Oid relid, AttrNumber attnum);
extern bool get_attisset(Oid relid, char *attname);
extern RegProcedure get_opcode(Oid opid);
extern char *get_opname(Oid opid);
extern bool op_mergesortable(Oid opid, Oid ltype, Oid rtype,
Oid *leftOp, Oid *rightOp);
extern Oid op_hashjoinable(Oid opid, Oid ltype, Oid rtype);
extern Oid get_commutator(Oid opid);
extern char *get_opname(Oid opid);
extern bool
op_mergesortable(Oid opid, Oid ltype, Oid rtype,
Oid * leftOp, Oid * rightOp);
extern Oid op_hashjoinable(Oid opid, Oid ltype, Oid rtype);
extern Oid get_commutator(Oid opid);
extern HeapTuple get_operator_tuple(Oid opno);
extern Oid get_negator(Oid opid);
extern Oid get_negator(Oid opid);
extern RegProcedure get_oprrest(Oid opid);
extern RegProcedure get_oprjoin(Oid opid);
extern int get_relnatts(Oid relid);
extern char *get_rel_name(Oid relid);
extern struct varlena * get_relstub(Oid relid, int no, bool *islast);
extern Oid get_ruleid(char *rulename);
extern Oid get_eventrelid(Oid ruleid);
extern int16 get_typlen(Oid typid);
extern bool get_typbyval(Oid typid);
extern int get_relnatts(Oid relid);
extern char *get_rel_name(Oid relid);
extern struct varlena *get_relstub(Oid relid, int no, bool * islast);
extern Oid get_ruleid(char *rulename);
extern Oid get_eventrelid(Oid ruleid);
extern int16 get_typlen(Oid typid);
extern bool get_typbyval(Oid typid);
extern struct varlena *get_typdefault(Oid typid);
#endif /* LSYSCACHE_H */
#endif /* LSYSCACHE_H */

View File

@@ -1,51 +1,52 @@
/*-------------------------------------------------------------------------
*
* mcxt.h--
* POSTGRES memory context definitions.
* POSTGRES memory context definitions.
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: mcxt.h,v 1.5 1997/08/19 21:40:41 momjian Exp $
* $Id: mcxt.h,v 1.6 1997/09/07 05:02:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef MCXT_H
#ifndef MCXT_H
#define MCXT_H
#include <nodes/memnodes.h>
extern MemoryContext CurrentMemoryContext;
extern MemoryContext TopMemoryContext;
extern MemoryContext CurrentMemoryContext;
extern MemoryContext TopMemoryContext;
/*
* MaxAllocSize --
* Arbitrary limit on size of allocations.
* Arbitrary limit on size of allocations.
*
* Note:
* There is no guarantee that allocations smaller than MaxAllocSize
* will succeed. Allocation requests larger than MaxAllocSize will
* be summarily denied.
* There is no guarantee that allocations smaller than MaxAllocSize
* will succeed. Allocation requests larger than MaxAllocSize will
* be summarily denied.
*
* This value should not be referenced except in one place in the code.
* This value should not be referenced except in one place in the code.
*
* XXX This should be defined in a file of tunable constants.
*/
#define MaxAllocSize (0xfffffff) /* 16G - 1 */
#define MaxAllocSize (0xfffffff) /* 16G - 1 */
/*
* prototypes for functions in mcxt.c
*/
extern void EnableMemoryContext(bool on);
extern Pointer MemoryContextAlloc(MemoryContext context, Size size);
extern Pointer MemoryContextRealloc(MemoryContext context,
Pointer pointer,
Size size);
extern void MemoryContextFree(MemoryContext context, Pointer pointer);
extern void EnableMemoryContext(bool on);
extern Pointer MemoryContextAlloc(MemoryContext context, Size size);
extern Pointer
MemoryContextRealloc(MemoryContext context,
Pointer pointer,
Size size);
extern void MemoryContextFree(MemoryContext context, Pointer pointer);
extern MemoryContext MemoryContextSwitchTo(MemoryContext context);
extern GlobalMemory CreateGlobalMemory(char *name);
extern void GlobalMemoryDestroy(GlobalMemory context);
extern void GlobalMemoryDestroy(GlobalMemory context);
#endif /* MCXT_H */
#endif /* MCXT_H */

View File

@@ -1,25 +1,25 @@
/*-------------------------------------------------------------------------
*
* memutils.h--
* this file contains general memory alignment, allocation
* and manipulation stuff that used to be spread out
* between the following files:
* this file contains general memory alignment, allocation
* and manipulation stuff that used to be spread out
* between the following files:
*
* align.h alignment macros
* aset.h memory allocation set stuff
* oset.h (used by aset.h)
* (bit.h bit array type / extern)
* clib.h mem routines
* limit.h max bits/byte, etc.
* align.h alignment macros
* aset.h memory allocation set stuff
* oset.h (used by aset.h)
* (bit.h bit array type / extern)
* clib.h mem routines
* limit.h max bits/byte, etc.
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: memutils.h,v 1.8 1997/08/20 14:54:35 momjian Exp $
* $Id: memutils.h,v 1.9 1997/09/07 05:02:42 momjian Exp $
*
* NOTES
* some of the information in this file will be moved to
* other files, (like MaxHeapTupleSize and MaxAttributeSize).
* some of the information in this file will be moved to
* other files, (like MaxHeapTupleSize and MaxAttributeSize).
*
*-------------------------------------------------------------------------
*/
@@ -29,238 +29,245 @@
#ifdef NOT_USED
/*****************************************************************************
* align.h - alignment macros *
* align.h - alignment macros *
****************************************************************************
[TRH] Let the compiler decide what alignment it uses instead of
[TRH] Let the compiler decide what alignment it uses instead of
tending
we know better.
GCC (at least v2.5.8 and up) has an __alignof__ keyword.
However, we cannot use it here since on some architectures it reports
just a _recommended_ alignment instead of the actual alignment used in
padding structures (or at least, this is how I understand gcc's
padding structures (or at least, this is how I understand gcc's
s...)
So define a macro that gives us the _actual_ alignment inside a struct.
{{note: assumes that alignment size is always a power of 2.}}
*/
#define _ALIGNSIZE(TYPE) offsetof(struct { char __c; TYPE __t;}, __t)
#define _ALIGNSIZE(TYPE) offsetof(struct { char __c; TYPE __t;}, __t)
#define _ALIGN(TYPE, LEN) \
(((long)(LEN) + (_ALIGNSIZE(TYPE) - 1)) & ~(_ALIGNSIZE(TYPE) - 1))
#define SHORTALIGN(LEN) _ALIGN(short, (LEN))
#define INTALIGN(LEN) _ALIGN(int, (LEN))
#define LONGALIGN(LEN) _ALIGN(long, (LEN))
#define DOUBLEALIGN(LEN) _ALIGN(double, (LEN))
#define MAXALIGN(LEN) _ALIGN(double, (LEN))
(((long)(LEN) + (_ALIGNSIZE(TYPE) - 1)) & ~(_ALIGNSIZE(TYPE) - 1))
#define SHORTALIGN(LEN) _ALIGN(short, (LEN))
#define INTALIGN(LEN) _ALIGN(int, (LEN))
#define LONGALIGN(LEN) _ALIGN(long, (LEN))
#define DOUBLEALIGN(LEN) _ALIGN(double, (LEN))
#define MAXALIGN(LEN) _ALIGN(double, (LEN))
#endif /* 0 */
#endif /* 0 */
/*
* SHORTALIGN(LEN) - length (or address) aligned for shorts
* SHORTALIGN(LEN) - length (or address) aligned for shorts
*/
#define SHORTALIGN(LEN)\
(((long)(LEN) + (sizeof (short) - 1)) & ~(sizeof (short) - 1))
#define SHORTALIGN(LEN)\
(((long)(LEN) + (sizeof (short) - 1)) & ~(sizeof (short) - 1))
#define INTALIGN(LEN)\
(((long)(LEN) + (sizeof (int) - 1)) & ~(sizeof (int) -1))
(((long)(LEN) + (sizeof (int) - 1)) & ~(sizeof (int) -1))
/*
* LONGALIGN(LEN) - length (or address) aligned for longs
* LONGALIGN(LEN) - length (or address) aligned for longs
*/
#if defined(sun) && ! defined(sparc)
#define LONGALIGN(LEN) SHORTALIGN(LEN)
#define LONGALIGN(LEN) SHORTALIGN(LEN)
#elif defined (alpha) || defined(linuxalpha)
/* even though "long alignment" should really be on 8-byte boundaries
* for linuxalpha, we want the strictest alignment to be on 4-byte (int)
* boundaries, because otherwise things break when they try to use the
* FormData_pg_* structures. --djm 12/12/96
*/
#define LONGALIGN(LEN)\
(((long)(LEN) + (sizeof (int) - 1)) & ~(sizeof (int) -1))
/*
* even though "long alignment" should really be on 8-byte boundaries for
* linuxalpha, we want the strictest alignment to be on 4-byte (int)
* boundaries, because otherwise things break when they try to use the
* FormData_pg_* structures. --djm 12/12/96
*/
#define LONGALIGN(LEN)\
(((long)(LEN) + (sizeof (int) - 1)) & ~(sizeof (int) -1))
#else
#define LONGALIGN(LEN)\
(((long)(LEN) + (sizeof (long) - 1)) & ~(sizeof (long) -1))
#define LONGALIGN(LEN)\
(((long)(LEN) + (sizeof (long) - 1)) & ~(sizeof (long) -1))
#endif
#define DOUBLEALIGN(LEN)\
(((long)(LEN) + (sizeof (double) - 1)) & ~(sizeof (double) -1))
(((long)(LEN) + (sizeof (double) - 1)) & ~(sizeof (double) -1))
#define MAXALIGN(LEN)\
(((long)(LEN) + (sizeof (double) - 1)) & ~(sizeof (double) -1))
(((long)(LEN) + (sizeof (double) - 1)) & ~(sizeof (double) -1))
/*****************************************************************************
* oset.h -- Fixed format ordered set definitions. *
* oset.h -- Fixed format ordered set definitions. *
*****************************************************************************/
/* Note:
* Fixed format ordered sets are <EXPLAIN>.
* XXX This is a preliminary version. Work is needed to explain
* XXX semantics of the external definitions. Otherwise, the
* XXX functional interface should not change.
* Fixed format ordered sets are <EXPLAIN>.
* XXX This is a preliminary version. Work is needed to explain
* XXX semantics of the external definitions. Otherwise, the
* XXX functional interface should not change.
*
*/
typedef struct OrderedElemData OrderedElemData;
typedef OrderedElemData* OrderedElem;
typedef OrderedElemData *OrderedElem;
typedef struct OrderedSetData OrderedSetData;
typedef OrderedSetData* OrderedSet;
typedef OrderedSetData *OrderedSet;
struct OrderedElemData {
OrderedElem next; /* Next elem or &this->set->dummy */
OrderedElem prev; /* Previous elem or &this->set->head */
OrderedSet set; /* Parent set */
struct OrderedElemData
{
OrderedElem next; /* Next elem or &this->set->dummy */
OrderedElem prev; /* Previous elem or &this->set->head */
OrderedSet set; /* Parent set */
};
struct OrderedSetData {
OrderedElem head; /* First elem or &this->dummy */
OrderedElem dummy; /* (hack) Terminator == NULL */
OrderedElem tail; /* Last elem or &this->head */
Offset offset; /* Offset from struct base to elem */
/* this could be signed short int! */
struct OrderedSetData
{
OrderedElem head; /* First elem or &this->dummy */
OrderedElem dummy; /* (hack) Terminator == NULL */
OrderedElem tail; /* Last elem or &this->head */
Offset offset; /* Offset from struct base to elem */
/* this could be signed short int! */
};
extern void OrderedSetInit(OrderedSet set, Offset offset);
extern bool OrderedSetContains(OrderedSet set, OrderedElem elem);
extern Pointer OrderedSetGetHead(OrderedSet set);
extern Pointer OrderedElemGetPredecessor(OrderedElem elem);
extern Pointer OrderedElemGetSuccessor(OrderedElem elem);
extern void OrderedElemPop(OrderedElem elem);
extern void OrderedElemPushInto(OrderedElem elem, OrderedSet Set);
extern void OrderedSetInit(OrderedSet set, Offset offset);
extern bool OrderedSetContains(OrderedSet set, OrderedElem elem);
extern Pointer OrderedSetGetHead(OrderedSet set);
extern Pointer OrderedElemGetPredecessor(OrderedElem elem);
extern Pointer OrderedElemGetSuccessor(OrderedElem elem);
extern void OrderedElemPop(OrderedElem elem);
extern void OrderedElemPushInto(OrderedElem elem, OrderedSet Set);
/*****************************************************************************
* aset.h -- Allocation set definitions. *
* aset.h -- Allocation set definitions. *
*****************************************************************************/
/*
* Description:
* An allocation set is a set containing allocated elements. When
* an allocation is requested for a set, memory is allocated and a
* pointer is returned. Subsequently, this memory may be freed or
* reallocated. In addition, an allocation set may be reset which
* will cause all allocated memory to be freed.
* An allocation set is a set containing allocated elements. When
* an allocation is requested for a set, memory is allocated and a
* pointer is returned. Subsequently, this memory may be freed or
* reallocated. In addition, an allocation set may be reset which
* will cause all allocated memory to be freed.
*
* Allocations may occur in four different modes. The mode of
* allocation does not affect the behavior of allocations except in
* terms of performance. The allocation mode is set at the time of
* set initialization. Once the mode is chosen, it cannot be changed
* unless the set is reinitialized.
* Allocations may occur in four different modes. The mode of
* allocation does not affect the behavior of allocations except in
* terms of performance. The allocation mode is set at the time of
* set initialization. Once the mode is chosen, it cannot be changed
* unless the set is reinitialized.
*
* "Dynamic" mode forces all allocations to occur in a heap. This
* is a good mode to use when small memory segments are allocated
* and freed very frequently. This is a good choice when allocation
* characteristics are unknown. This is the default mode.
* "Dynamic" mode forces all allocations to occur in a heap. This
* is a good mode to use when small memory segments are allocated
* and freed very frequently. This is a good choice when allocation
* characteristics are unknown. This is the default mode.
*
* "Static" mode attemts to allocate space as efficiently as possible
* without regard to freeing memory. This mode should be chosen only
* when it is known that many allocations will occur but that very
* little of the allocated memory will be explicitly freed.
* "Static" mode attemts to allocate space as efficiently as possible
* without regard to freeing memory. This mode should be chosen only
* when it is known that many allocations will occur but that very
* little of the allocated memory will be explicitly freed.
*
* "Tunable" mode is a hybrid of dynamic and static modes. The
* tunable mode will use static mode allocation except when the
* allocation request exceeds a size limit supplied at the time of set
* initialization. "Big" objects are allocated using dynamic mode.
* "Tunable" mode is a hybrid of dynamic and static modes. The
* tunable mode will use static mode allocation except when the
* allocation request exceeds a size limit supplied at the time of set
* initialization. "Big" objects are allocated using dynamic mode.
*
* "Bounded" mode attempts to allocate space efficiently given a limit
* on space consumed by the allocation set. This restriction can be
* considered a "soft" restriction, because memory segments will
* continue to be returned after the limit is exceeded. The limit is
* specified at the time of set initialization like for tunable mode.
* "Bounded" mode attempts to allocate space efficiently given a limit
* on space consumed by the allocation set. This restriction can be
* considered a "soft" restriction, because memory segments will
* continue to be returned after the limit is exceeded. The limit is
* specified at the time of set initialization like for tunable mode.
*
* Note:
* Allocation sets are not automatically reset on a system reset.
* Higher level code is responsible for cleaning up.
* Allocation sets are not automatically reset on a system reset.
* Higher level code is responsible for cleaning up.
*
* There may other modes in the future.
* There may other modes in the future.
*/
/*
* AllocPointer --
* Aligned pointer which may be a member of an allocation set.
* Aligned pointer which may be a member of an allocation set.
*/
typedef Pointer AllocPointer;
/*
* AllocMode --
* Mode of allocation for an allocation set.
* Mode of allocation for an allocation set.
*
* Note:
* See above for a description of the various nodes.
* See above for a description of the various nodes.
*/
typedef enum AllocMode {
DynamicAllocMode, /* always dynamically allocate */
StaticAllocMode, /* always "statically" allocate */
TunableAllocMode, /* allocations are "tuned" */
BoundedAllocMode /* allocations bounded to fixed usage */
} AllocMode;
typedef enum AllocMode
{
DynamicAllocMode, /* always dynamically allocate */
StaticAllocMode, /* always "statically" allocate */
TunableAllocMode, /* allocations are "tuned" */
BoundedAllocMode /* allocations bounded to fixed usage */
} AllocMode;
#define DefaultAllocMode DynamicAllocMode
#define DefaultAllocMode DynamicAllocMode
/*
* AllocSet --
* Allocation set.
* Allocation set.
*/
typedef struct AllocSetData {
OrderedSetData setData;
typedef struct AllocSetData
{
OrderedSetData setData;
/* Note: this will change in the future to support other modes */
} AllocSetData;
} AllocSetData;
typedef AllocSetData *AllocSet;
/*
* AllocPointerIsValid --
* True iff pointer is valid allocation pointer.
* True iff pointer is valid allocation pointer.
*/
#define AllocPointerIsValid(pointer) PointerIsValid(pointer)
/*
* AllocSetIsValid --
* True iff set is valid allocation set.
* True iff set is valid allocation set.
*/
#define AllocSetIsValid(set) PointerIsValid(set)
#define AllocSetIsValid(set) PointerIsValid(set)
extern void AllocSetInit(AllocSet set, AllocMode mode, Size limit);
extern void AllocSetInit(AllocSet set, AllocMode mode, Size limit);
extern void AllocSetReset(AllocSet set);
extern void AllocSetReset(AllocSet set);
extern bool AllocSetContains(AllocSet set, AllocPointer pointer);
extern bool AllocSetContains(AllocSet set, AllocPointer pointer);
extern AllocPointer AllocSetAlloc(AllocSet set, Size size);
extern void AllocSetFree(AllocSet set, AllocPointer pointer);
extern AllocPointer AllocSetRealloc(AllocSet set, AllocPointer pointer,
Size size);
extern void AllocSetFree(AllocSet set, AllocPointer pointer);
extern AllocPointer
AllocSetRealloc(AllocSet set, AllocPointer pointer,
Size size);
extern void AllocSetDump(AllocSet set);
extern void AllocSetDump(AllocSet set);
/*****************************************************************************
* clib.h -- Standard C library definitions *
* clib.h -- Standard C library definitions *
*****************************************************************************/
/*
* Note:
* This file is OPERATING SYSTEM dependent!!!
* This file is OPERATING SYSTEM dependent!!!
*
*/
/*
* LibCCopyLength is only used within this file. -cim 6/12/90
*
/*
* LibCCopyLength is only used within this file. -cim 6/12/90
*
*/
typedef int LibCCopyLength;
typedef int LibCCopyLength;
/*
* MemoryCopy --
* Copies fixed length block of memory to another.
* Copies fixed length block of memory to another.
*/
#define MemoryCopy(toBuffer, fromBuffer, length)\
memcpy(toBuffer, fromBuffer, length)
memcpy(toBuffer, fromBuffer, length)
/*****************************************************************************
* limit.h -- POSTGRES limit definitions. *
* limit.h -- POSTGRES limit definitions. *
*****************************************************************************/
#define MaxBitsPerByte 8
typedef uint32 AttributeSize; /* XXX should be defined elsewhere */
#define MaxHeapTupleSize 0x7fffffff
#define MaxAttributeSize 0x7fffffff
#define MaxHeapTupleSize 0x7fffffff
#define MaxAttributeSize 0x7fffffff
#define MaxIndexAttributeNumber 7
#define MaxIndexAttributeNumber 7
#endif /* MEMUTILS_H */
#endif /* MEMUTILS_H */

View File

@@ -1,25 +1,25 @@
/*-------------------------------------------------------------------------
*
* module.h--
* this file contains general "module" stuff that used to be
* spread out between the following files:
* this file contains general "module" stuff that used to be
* spread out between the following files:
*
* enbl.h module enable stuff
* trace.h module trace stuff (now gone)
* enbl.h module enable stuff
* trace.h module trace stuff (now gone)
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: module.h,v 1.1 1996/08/28 01:59:12 scrappy Exp $
* $Id: module.h,v 1.2 1997/09/07 05:02:44 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef MODULE_H
#define MODULE_H
/*
* prototypes for functions in init/enbl.c
/*
* prototypes for functions in init/enbl.c
*/
extern bool BypassEnable(int *enableCountInOutP, bool on);
extern bool BypassEnable(int *enableCountInOutP, bool on);
#endif /* MODULE_H */
#endif /* MODULE_H */

View File

@@ -1,12 +1,12 @@
/*-------------------------------------------------------------------------
*
* nabstime.h--
* Definitions for the "new" abstime code.
* Definitions for the "new" abstime code.
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: nabstime.h,v 1.10 1997/08/19 21:40:47 momjian Exp $
* $Id: nabstime.h,v 1.11 1997/09/07 05:02:46 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -18,7 +18,7 @@
/* ----------------------------------------------------------------
* time types + support macros
* time types + support macros
*
*
* ----------------------------------------------------------------
@@ -26,92 +26,98 @@
typedef int32 AbsoluteTime;
typedef int32 RelativeTime;
typedef struct {
int32 status;
AbsoluteTime data[2];
} TimeIntervalData;
typedef struct
{
int32 status;
AbsoluteTime data[2];
} TimeIntervalData;
typedef TimeIntervalData *TimeInterval;
/*
* Reserved values
* Epoch is Unix system time zero, but needs to be kept as a reserved
* value rather than converting to time since timezone calculations
* might move it away from 1970-01-01 00:00:00Z - tgl 97/02/20
* value rather than converting to time since timezone calculations
* might move it away from 1970-01-01 00:00:00Z - tgl 97/02/20
*
* Pre-v6.1 code had large decimal numbers for reserved values.
* These were chosen as special 32-bit bit patterns,
* so redefine them explicitly using these bit patterns. - tgl 97/02/24
* so redefine them explicitly using these bit patterns. - tgl 97/02/24
*/
#define EPOCH_ABSTIME ((AbsoluteTime) 0)
#define INVALID_ABSTIME ((AbsoluteTime) 0x7FFFFFFE) /* 2147483647 == 2^31 - 1 */
#define CURRENT_ABSTIME ((AbsoluteTime) 0x7FFFFFFD) /* 2147483646 == 2^31 - 2 */
#define NOEND_ABSTIME ((AbsoluteTime) 0x7FFFFFFC) /* 2147483645 == 2^31 - 3 */
#define BIG_ABSTIME ((AbsoluteTime) 0x7FFFFFFB) /* 2147483644 == 2^31 - 4 */
#define INVALID_ABSTIME ((AbsoluteTime) 0x7FFFFFFE) /* 2147483647 == 2^31 -
* 1 */
#define CURRENT_ABSTIME ((AbsoluteTime) 0x7FFFFFFD) /* 2147483646 == 2^31 -
* 2 */
#define NOEND_ABSTIME ((AbsoluteTime) 0x7FFFFFFC) /* 2147483645 == 2^31 -
* 3 */
#define BIG_ABSTIME ((AbsoluteTime) 0x7FFFFFFB) /* 2147483644 == 2^31 -
* 4 */
#if defined(aix)
/*
* AIX considers 2147483648 == -2147483648 (since they have the same bit
* representation) but uses a different sign sense in a comparison to
* these integer constants depending on whether the constant is signed
* representation) but uses a different sign sense in a comparison to
* these integer constants depending on whether the constant is signed
* or not!
*/
#define NOSTART_ABSTIME ((AbsoluteTime) INT_MIN)
#define NOSTART_ABSTIME ((AbsoluteTime) INT_MIN)
#else
#define NOSTART_ABSTIME ((AbsoluteTime) 0x80000001) /* -2147483647 == - 2^31 */
#endif /* aix */
#define NOSTART_ABSTIME ((AbsoluteTime) 0x80000001) /* -2147483647 == - 2^31 */
#endif /* aix */
#define INVALID_RELTIME ((RelativeTime) 0x7FFFFFFE) /* 2147483647 == 2^31 - 1 */
#define INVALID_RELTIME ((RelativeTime) 0x7FFFFFFE) /* 2147483647 == 2^31 -
* 1 */
#define AbsoluteTimeIsValid(time) \
((bool) ((time) != INVALID_ABSTIME))
((bool) ((time) != INVALID_ABSTIME))
#define AbsoluteTimeIsReal(time) \
((bool) (((AbsoluteTime) time) < NOEND_ABSTIME && \
((AbsoluteTime) time) > NOSTART_ABSTIME))
((bool) (((AbsoluteTime) time) < NOEND_ABSTIME && \
((AbsoluteTime) time) > NOSTART_ABSTIME))
/* have to include this because EPOCH_ABSTIME used to be invalid - yuk */
#define AbsoluteTimeIsBackwardCompatiblyValid(time) \
((bool) (((AbsoluteTime) time) != INVALID_ABSTIME && \
((AbsoluteTime) time) > EPOCH_ABSTIME))
((bool) (((AbsoluteTime) time) != INVALID_ABSTIME && \
((AbsoluteTime) time) > EPOCH_ABSTIME))
#define AbsoluteTimeIsBackwardCompatiblyReal(time) \
((bool) (((AbsoluteTime) time) < NOEND_ABSTIME && \
((AbsoluteTime) time) > NOSTART_ABSTIME && \
((AbsoluteTime) time) > EPOCH_ABSTIME))
((bool) (((AbsoluteTime) time) < NOEND_ABSTIME && \
((AbsoluteTime) time) > NOSTART_ABSTIME && \
((AbsoluteTime) time) > EPOCH_ABSTIME))
#define RelativeTimeIsValid(time) \
((bool) (((RelativeTime) time) != INVALID_RELTIME))
((bool) (((RelativeTime) time) != INVALID_RELTIME))
extern AbsoluteTime GetCurrentAbsoluteTime(void);
/*
* getSystemTime --
* Returns system time.
* Returns system time.
*/
#define getSystemTime() \
((time_t) (time(0l)))
((time_t) (time(0l)))
/*
* nabstime.c prototypes
* nabstime.c prototypes
*/
extern AbsoluteTime nabstimein(char *timestr);
extern char *nabstimeout(AbsoluteTime time);
extern char *nabstimeout(AbsoluteTime time);
extern bool abstimeeq(AbsoluteTime t1, AbsoluteTime t2);
extern bool abstimene(AbsoluteTime t1, AbsoluteTime t2);
extern bool abstimelt(AbsoluteTime t1, AbsoluteTime t2);
extern bool abstimegt(AbsoluteTime t1, AbsoluteTime t2);
extern bool abstimele(AbsoluteTime t1, AbsoluteTime t2);
extern bool abstimege(AbsoluteTime t1, AbsoluteTime t2);
extern bool abstime_finite(AbsoluteTime time);
extern bool abstimeeq(AbsoluteTime t1, AbsoluteTime t2);
extern bool abstimene(AbsoluteTime t1, AbsoluteTime t2);
extern bool abstimelt(AbsoluteTime t1, AbsoluteTime t2);
extern bool abstimegt(AbsoluteTime t1, AbsoluteTime t2);
extern bool abstimele(AbsoluteTime t1, AbsoluteTime t2);
extern bool abstimege(AbsoluteTime t1, AbsoluteTime t2);
extern bool abstime_finite(AbsoluteTime time);
extern AbsoluteTime datetime_abstime(DateTime *datetime);
extern AbsoluteTime datetime_abstime(DateTime * datetime);
extern DateTime *abstime_datetime(AbsoluteTime abstime);
extern bool AbsoluteTimeIsBefore(AbsoluteTime time1, AbsoluteTime time2);
extern bool AbsoluteTimeIsAfter(AbsoluteTime time1, AbsoluteTime time2);
extern bool AbsoluteTimeIsBefore(AbsoluteTime time1, AbsoluteTime time2);
extern bool AbsoluteTimeIsAfter(AbsoluteTime time1, AbsoluteTime time2);
extern void abstime2tm(AbsoluteTime time, int *tzp, struct tm *tm, char *tzn);
extern void abstime2tm(AbsoluteTime time, int *tzp, struct tm * tm, char *tzn);
#endif /* NABSTIME_H */
#endif /* NABSTIME_H */

View File

@@ -1,52 +1,52 @@
/*-------------------------------------------------------------------------
*
* oidcompos.h--
* prototype file for the oid {char16,int4} composite type functions.
* prototype file for the oid {char16,int4} composite type functions.
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: oidcompos.h,v 1.1 1996/08/28 01:59:15 scrappy Exp $
* $Id: oidcompos.h,v 1.2 1997/09/07 05:02:47 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef OIDCOMPOS_H
#ifndef OIDCOMPOS_H
#define OIDCOMPOS_H
/* oidint4.c */
OidInt4 oidint4in(char *o);
char *oidint4out(OidInt4 o);
bool oidint4lt(OidInt4 o1, OidInt4 o2);
bool oidint4le(OidInt4 o1, OidInt4 o2);
bool oidint4eq(OidInt4 o1, OidInt4 o2);
bool oidint4ge(OidInt4 o1, OidInt4 o2);
bool oidint4gt(OidInt4 o1, OidInt4 o2);
bool oidint4ne(OidInt4 o1, OidInt4 o2);
int oidint4cmp(OidInt4 o1, OidInt4 o2);
OidInt4 mkoidint4(Oid v_oid, uint32 v_int4);
OidInt4 oidint4in(char *o);
char *oidint4out(OidInt4 o);
bool oidint4lt(OidInt4 o1, OidInt4 o2);
bool oidint4le(OidInt4 o1, OidInt4 o2);
bool oidint4eq(OidInt4 o1, OidInt4 o2);
bool oidint4ge(OidInt4 o1, OidInt4 o2);
bool oidint4gt(OidInt4 o1, OidInt4 o2);
bool oidint4ne(OidInt4 o1, OidInt4 o2);
int oidint4cmp(OidInt4 o1, OidInt4 o2);
OidInt4 mkoidint4(Oid v_oid, uint32 v_int4);
/* oidint2.c */
OidInt2 oidint2in(char *o);
char *oidint2out(OidInt2 o);
bool oidint2lt(OidInt2 o1, OidInt2 o2);
bool oidint2le(OidInt2 o1, OidInt2 o2);
bool oidint2eq(OidInt2 o1, OidInt2 o2);
bool oidint2ge(OidInt2 o1, OidInt2 o2);
bool oidint2gt(OidInt2 o1, OidInt2 o2);
bool oidint2ne(OidInt2 o1, OidInt2 o2);
int oidint2cmp(OidInt2 o1, OidInt2 o2);
OidInt2 mkoidint2(Oid v_oid, uint16 v_int2);
OidInt2 oidint2in(char *o);
char *oidint2out(OidInt2 o);
bool oidint2lt(OidInt2 o1, OidInt2 o2);
bool oidint2le(OidInt2 o1, OidInt2 o2);
bool oidint2eq(OidInt2 o1, OidInt2 o2);
bool oidint2ge(OidInt2 o1, OidInt2 o2);
bool oidint2gt(OidInt2 o1, OidInt2 o2);
bool oidint2ne(OidInt2 o1, OidInt2 o2);
int oidint2cmp(OidInt2 o1, OidInt2 o2);
OidInt2 mkoidint2(Oid v_oid, uint16 v_int2);
/* oidname.c */
OidName oidnamein(char *inStr);
char *oidnameout(OidName oidname);
bool oidnamelt(OidName o1, OidName o2);
bool oidnamele(OidName o1, OidName o2);
bool oidnameeq(OidName o1, OidName o2);
bool oidnamene(OidName o1, OidName o2);
bool oidnamege(OidName o1, OidName o2);
bool oidnamegt(OidName o1, OidName o2);
int oidnamecmp(OidName o1, OidName o2);
OidName mkoidname(Oid id, char *name);
OidName oidnamein(char *inStr);
char *oidnameout(OidName oidname);
bool oidnamelt(OidName o1, OidName o2);
bool oidnamele(OidName o1, OidName o2);
bool oidnameeq(OidName o1, OidName o2);
bool oidnamene(OidName o1, OidName o2);
bool oidnamege(OidName o1, OidName o2);
bool oidnamegt(OidName o1, OidName o2);
int oidnamecmp(OidName o1, OidName o2);
OidName mkoidname(Oid id, char *name);
#endif /* OIDCOMPOS_H */
#endif /* OIDCOMPOS_H */

View File

@@ -1,26 +1,25 @@
/*-------------------------------------------------------------------------
*
* palloc.h--
* POSTGRES memory allocator definitions.
* POSTGRES memory allocator definitions.
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: palloc.h,v 1.3 1996/11/26 03:20:23 bryanh Exp $
* $Id: palloc.h,v 1.4 1997/09/07 05:02:49 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef PALLOC_H
#ifndef PALLOC_H
#define PALLOC_H
#include <c.h>
extern void* palloc(Size size);
extern void pfree(void *pointer);
extern void *repalloc(void *pointer, Size size);
extern void *palloc(Size size);
extern void pfree(void *pointer);
extern void *repalloc(void *pointer, Size size);
/* like strdup except uses palloc */
extern char* pstrdup(char* pointer);
#endif /* PALLOC_H */
extern char *pstrdup(char *pointer);
#endif /* PALLOC_H */

View File

@@ -1,28 +1,28 @@
/*-------------------------------------------------------------------------
*
* portal.h--
* POSTGRES portal definitions.
* POSTGRES portal definitions.
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: portal.h,v 1.4 1997/08/19 21:40:48 momjian Exp $
* $Id: portal.h,v 1.5 1997/09/07 05:02:51 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* Note:
* A portal is an abstraction which represents the execution state of
* A portal is an abstraction which represents the execution state of
* a running query (or a fixed sequence of queries). The "blank portal" is
* a portal with an InvalidName. This blank portal is in existance except
* between calls to BlankPortalAssignName and GetPortalByName(NULL).
*
* Note:
* now that PQ calls can be made from within a backend, a portal
* may also be used to keep track of the tuples resulting
* from the execution of a query. In this case, entryIndex
* now that PQ calls can be made from within a backend, a portal
* may also be used to keep track of the tuples resulting
* from the execution of a query. In this case, entryIndex
*/
#ifndef PORTAL_H
#ifndef PORTAL_H
#define PORTAL_H
#include <executor/execdesc.h>
@@ -30,58 +30,61 @@
#include <nodes/memnodes.h>
#include <utils/memutils.h>
typedef struct PortalBlockData {
AllocSetData setData;
FixedItemData itemData;
} PortalBlockData;
typedef struct PortalBlockData
{
AllocSetData setData;
FixedItemData itemData;
} PortalBlockData;
typedef PortalBlockData *PortalBlock;
typedef PortalBlockData *PortalBlock;
typedef struct PortalD PortalD;
typedef PortalD *Portal;
typedef struct PortalD PortalD;
typedef PortalD *Portal;
struct PortalD {
char *name; /* XXX PortalName */
struct PortalVariableMemory variable;
struct PortalHeapMemory heap;
QueryDesc *queryDesc;
TupleDesc attinfo;
EState *state;
void (*cleanup)(Portal);
struct PortalD
{
char *name; /* XXX PortalName */
struct PortalVariableMemory variable;
struct PortalHeapMemory heap;
QueryDesc *queryDesc;
TupleDesc attinfo;
EState *state;
void (*cleanup) (Portal);
};
/*
* PortalIsValid --
* True iff portal is valid.
* True iff portal is valid.
*/
#define PortalIsValid(p) PointerIsValid(p)
#define PortalIsValid(p) PointerIsValid(p)
/*
* Special portals (well, their names anyway)
*/
#define VACPNAME "<vacuum>"
#define VACPNAME "<vacuum>"
extern bool PortalNameIsSpecial(char *pname);
extern void AtEOXact_portals(void);
extern void EnablePortalManager(bool on);
extern Portal GetPortalByName(char *name);
extern Portal BlankPortalAssignName(char *name);
extern void PortalSetQuery(Portal portal, QueryDesc *queryDesc,
TupleDesc attinfo, EState *state,
void (*cleanup)(Portal portal));
extern bool PortalNameIsSpecial(char *pname);
extern void AtEOXact_portals(void);
extern void EnablePortalManager(bool on);
extern Portal GetPortalByName(char *name);
extern Portal BlankPortalAssignName(char *name);
extern void
PortalSetQuery(Portal portal, QueryDesc * queryDesc,
TupleDesc attinfo, EState * state,
void (*cleanup) (Portal portal));
extern QueryDesc *PortalGetQueryDesc(Portal portal);
extern EState *PortalGetState(Portal portal);
extern Portal CreatePortal(char *name);
extern void PortalDestroy(Portal *portalP);
extern void StartPortalAllocMode(AllocMode mode, Size limit);
extern void EndPortalAllocMode(void);
extern EState *PortalGetState(Portal portal);
extern Portal CreatePortal(char *name);
extern void PortalDestroy(Portal * portalP);
extern void StartPortalAllocMode(AllocMode mode, Size limit);
extern void EndPortalAllocMode(void);
extern PortalVariableMemory PortalGetVariableMemory(Portal portal);
extern PortalHeapMemory PortalGetHeapMemory(Portal portal);
/* estimate of the maximum number of open portals a user would have,
* used in initially sizing the PortalHashTable in EnablePortalManager()
* used in initially sizing the PortalHashTable in EnablePortalManager()
*/
#define PORTALS_PER_USER 10
#define PORTALS_PER_USER 10
#endif /* PORTAL_H */
#endif /* PORTAL_H */

View File

@@ -1,67 +1,71 @@
/*-------------------------------------------------------------------------
*
* psort.h--
*
*
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: psort.h,v 1.7 1997/08/19 21:40:48 momjian Exp $
* $Id: psort.h,v 1.8 1997/09/07 05:02:53 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef PSORT_H
#define PSORT_H
#ifndef PSORT_H
#define PSORT_H
#include <stdio.h>
#include "access/relscan.h"
#include "utils/lselect.h"
#include "nodes/plannodes.h"
#define MAXTAPES 7 /* 7--See Fig. 70, p273 */
#define TAPEEXTLEN strlen("pg_psort.xxxxx.xxx") /* TEMPDIR/TAPEEXT */
#define FREE(x) pfree((char *) x)
#define MAXTAPES 7 /* 7--See Fig. 70, p273 */
#define TAPEEXTLEN strlen("pg_psort.xxxxx.xxx") /* TEMPDIR/TAPEEXT */
#define FREE(x) pfree((char *) x)
struct tape {
int tp_dummy; /* (D) */
int tp_fib; /* (A) */
FILE *tp_file; /* (TAPE) */
struct tape *tp_prev;
struct tape
{
int tp_dummy; /* (D) */
int tp_fib; /* (A) */
FILE *tp_file; /* (TAPE) */
struct tape *tp_prev;
};
struct cmplist {
int cp_attn; /* attribute number */
int cp_num; /* comparison function code */
int cp_rev; /* invert comparison flag */
struct cmplist *cp_next; /* next in chain */
struct cmplist
{
int cp_attn; /* attribute number */
int cp_num; /* comparison function code */
int cp_rev; /* invert comparison flag */
struct cmplist *cp_next; /* next in chain */
};
/* This structure preserves the state of psort between calls from different
* nodes to its interface functions. Basically, it includes all of the global
* variables in psort. In case you were wondering, pointers to these structures
* are included in Sort node structures. -Rex 2.6.1995
* are included in Sort node structures. -Rex 2.6.1995
*/
typedef struct Psortstate {
LeftistContextData treeContext;
typedef struct Psortstate
{
LeftistContextData treeContext;
int TapeRange;
int Level;
int TotalDummy;
struct tape Tape[MAXTAPES];
int TapeRange;
int Level;
int TotalDummy;
struct tape Tape[MAXTAPES];
int BytesRead;
int BytesWritten;
int tupcount;
int BytesRead;
int BytesWritten;
int tupcount;
struct leftist *Tuples;
struct leftist *Tuples;
FILE *psort_grab_file;
long psort_current; /* could be file offset, or array index */
long psort_saved; /* could be file offset, or array index */
bool using_tape_files;
FILE *psort_grab_file;
long psort_current; /* could be file offset, or array
* index */
long psort_saved;/* could be file offset, or array index */
bool using_tape_files;
HeapTuple *memtuples;
} Psortstate;
HeapTuple *memtuples;
} Psortstate;
#ifdef EBUG
#include <stdio.h>
@@ -69,36 +73,36 @@ typedef struct Psortstate {
#include "storage/buf.h"
#include "storage/bufmgr.h"
#define PDEBUG(PROC, S1)\
#define PDEBUG(PROC, S1)\
elog(DEBUG, "%s:%d>> PROC: %s.", __FILE__, __LINE__, S1)
#define PDEBUG2(PROC, S1, D1)\
#define PDEBUG2(PROC, S1, D1)\
elog(DEBUG, "%s:%d>> PROC: %s %d.", __FILE__, __LINE__, S1, D1)
#define PDEBUG4(PROC, S1, D1, S2, D2)\
#define PDEBUG4(PROC, S1, D1, S2, D2)\
elog(DEBUG, "%s:%d>> PROC: %s %d, %s %d.", __FILE__, __LINE__, S1, D1, S2, D2)
#define VDEBUG(VAR, FMT)\
#define VDEBUG(VAR, FMT)\
elog(DEBUG, "%s:%d>> VAR =FMT", __FILE__, __LINE__, VAR)
#define ASSERT(EXPR, STR)\
#define ASSERT(EXPR, STR)\
if (!(EXPR)) elog(FATAL, "%s:%d>> %s", __FILE__, __LINE__, STR)
#define TRACE(VAL, CODE)\
#define TRACE(VAL, CODE)\
if (1) CODE; else
#else
#define PDEBUG(MSG)
#define VDEBUG(VAR, FMT)
#define ASSERT(EXPR, MSG)
#define TRACE(VAL, CODE)
#define PDEBUG(MSG)
#define VDEBUG(VAR, FMT)
#define ASSERT(EXPR, MSG)
#define TRACE(VAL, CODE)
#endif
/* psort.c */
extern bool psort_begin(Sort *node, int nkeys, ScanKey key);
extern HeapTuple psort_grabtuple(Sort *node);
extern void psort_markpos(Sort *node);
extern void psort_restorepos(Sort *node);
extern void psort_end(Sort *node);
extern bool psort_begin(Sort * node, int nkeys, ScanKey key);
extern HeapTuple psort_grabtuple(Sort * node);
extern void psort_markpos(Sort * node);
extern void psort_restorepos(Sort * node);
extern void psort_end(Sort * node);
#endif /* PSORT_H */
#endif /* PSORT_H */

View File

@@ -1,16 +1,16 @@
/*-------------------------------------------------------------------------
*
* rel.h--
* POSTGRES relation descriptor definitions.
* POSTGRES relation descriptor definitions.
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: rel.h,v 1.9 1997/09/04 13:26:45 vadim Exp $
* $Id: rel.h,v 1.10 1997/09/07 05:02:54 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef REL_H
#ifndef REL_H
#define REL_H
#include <catalog/pg_am.h>
@@ -20,134 +20,137 @@
#include <rewrite/prs2lock.h>
#include <storage/fd.h>
typedef struct Trigger {
char *tgname;
Oid tgfoid;
func_ptr tgfunc;
int16 tgtype;
int16 tgnargs;
int16 tgattr[8];
char **tgargs;
} Trigger;
typedef struct Trigger
{
char *tgname;
Oid tgfoid;
func_ptr tgfunc;
int16 tgtype;
int16 tgnargs;
int16 tgattr[8];
char **tgargs;
} Trigger;
typedef struct TriggerDesc {
uint16 n_before_statement[4];
uint16 n_before_row[4];
uint16 n_after_row[4];
uint16 n_after_statement[4];
Trigger **tg_before_statement[4];
Trigger **tg_before_row[4];
Trigger **tg_after_row[4];
Trigger **tg_after_statement[4];
Trigger *triggers;
} TriggerDesc;
typedef struct TriggerDesc
{
uint16 n_before_statement[4];
uint16 n_before_row[4];
uint16 n_after_row[4];
uint16 n_after_statement[4];
Trigger **tg_before_statement[4];
Trigger **tg_before_row[4];
Trigger **tg_after_row[4];
Trigger **tg_after_statement[4];
Trigger *triggers;
} TriggerDesc;
typedef struct RelationData {
File rd_fd; /* open file descriptor */
int rd_nblocks; /* number of blocks in rel */
uint16 rd_refcnt; /* reference count */
bool rd_islocal; /* uses the local buffer mgr */
bool rd_isnailed; /* rel is nailed in cache */
bool rd_istemp; /* rel is a temp rel */
bool rd_tmpunlinked; /* temp rel already unlinked */
Form_pg_am rd_am; /* AM tuple */
Form_pg_class rd_rel; /* RELATION tuple */
Oid rd_id; /* relations's object id */
Pointer lockInfo; /* ptr. to misc. info. */
TupleDesc rd_att; /* tuple desciptor */
RuleLock *rd_rules; /* rewrite rules */
IndexStrategy rd_istrat;
RegProcedure* rd_support;
TriggerDesc *trigdesc;
} RelationData;
typedef struct RelationData
{
File rd_fd; /* open file descriptor */
int rd_nblocks; /* number of blocks in rel */
uint16 rd_refcnt; /* reference count */
bool rd_islocal; /* uses the local buffer mgr */
bool rd_isnailed;/* rel is nailed in cache */
bool rd_istemp; /* rel is a temp rel */
bool rd_tmpunlinked; /* temp rel already unlinked */
Form_pg_am rd_am; /* AM tuple */
Form_pg_class rd_rel; /* RELATION tuple */
Oid rd_id; /* relations's object id */
Pointer lockInfo; /* ptr. to misc. info. */
TupleDesc rd_att; /* tuple desciptor */
RuleLock *rd_rules; /* rewrite rules */
IndexStrategy rd_istrat;
RegProcedure *rd_support;
TriggerDesc *trigdesc;
} RelationData;
typedef RelationData *Relation;
typedef RelationData *Relation;
/* ----------------
* RelationPtr is used in the executor to support index scans
* where we have to keep track of several index relations in an
* array. -cim 9/10/89
* RelationPtr is used in the executor to support index scans
* where we have to keep track of several index relations in an
* array. -cim 9/10/89
* ----------------
*/
typedef Relation *RelationPtr;
typedef Relation *RelationPtr;
#define InvalidRelation ((Relation)NULL)
#define InvalidRelation ((Relation)NULL)
typedef char ArchiveMode;
/*
* RelationIsValid --
* True iff relation descriptor is valid.
* True iff relation descriptor is valid.
*/
#define RelationIsValid(relation) PointerIsValid(relation)
#define RelationIsValid(relation) PointerIsValid(relation)
/*
* RelationGetSystemPort --
* Returns system port of a relation.
* Returns system port of a relation.
*
* Note:
* Assumes relation descriptor is valid.
* Assumes relation descriptor is valid.
*/
#define RelationGetSystemPort(relation) ((relation)->rd_fd)
/*
* RelationGetLockInfo --
* Returns the lock information structure in the reldesc
* Returns the lock information structure in the reldesc
*
*/
#define RelationGetLockInfo(relation) ((relation)->lockInfo)
/*
* RelationHasReferenceCountZero --
* True iff relation reference count is zero.
* True iff relation reference count is zero.
*
* Note:
* Assumes relation descriptor is valid.
* Assumes relation descriptor is valid.
*/
#define RelationHasReferenceCountZero(relation) \
((bool)((relation)->rd_refcnt == 0))
((bool)((relation)->rd_refcnt == 0))
/*
* RelationSetReferenceCount --
* Sets relation reference count.
* Sets relation reference count.
*/
#define RelationSetReferenceCount(relation,count) ((relation)->rd_refcnt = count)
/*
* RelationIncrementReferenceCount --
* Increments relation reference count.
* Increments relation reference count.
*/
#define RelationIncrementReferenceCount(relation) ((relation)->rd_refcnt += 1);
/*
* RelationDecrementReferenceCount --
* Decrements relation reference count.
* Decrements relation reference count.
*/
#define RelationDecrementReferenceCount(relation) ((relation)->rd_refcnt -= 1)
/*
* RelationGetAccessMethodTupleForm --
* Returns access method attribute values for a relation.
* Returns access method attribute values for a relation.
*
* Note:
* Assumes relation descriptor is valid.
* Assumes relation descriptor is valid.
*/
#define RelationGetAccessMethodTupleForm(relation) ((relation)->rd_am)
/*
* RelationGetRelationTupleForm --
* Returns relation attribute values for a relation.
* Returns relation attribute values for a relation.
*
* Note:
* Assumes relation descriptor is valid.
* Assumes relation descriptor is valid.
*/
#define RelationGetRelationTupleForm(relation) ((relation)->rd_rel)
/*
/*
* RelationGetRelationId --
*
* returns the object id of the relation
* returns the object id of the relation
*
*/
#define RelationGetRelationId(relation) ((relation)->rd_id)
@@ -155,7 +158,7 @@ typedef char ArchiveMode;
/*
* RelationGetFile --
*
* Returns the open File decscriptor
* Returns the open File decscriptor
*/
#define RelationGetFile(relation) ((relation)->rd_fd)
@@ -163,28 +166,30 @@ typedef char ArchiveMode;
/*
* RelationGetRelationName --
*
* Returns a Relation Name
* Returns a Relation Name
*/
#define RelationGetRelationName(relation) (&(relation)->rd_rel->relname)
/*
* RelationGetRelationName --
*
* Returns a the number of attributes.
* Returns a the number of attributes.
*/
#define RelationGetNumberOfAttributes(relation) ((relation)->rd_rel->relnatts)
/*
* RelationGetTupleDescriptor --
* Returns tuple descriptor for a relation.
* Returns tuple descriptor for a relation.
*
* Note:
* Assumes relation descriptor is valid.
* Assumes relation descriptor is valid.
*/
#define RelationGetTupleDescriptor(relation) ((relation)->rd_att)
extern IndexStrategy RelationGetIndexStrategy(Relation relation);
extern void RelationSetIndexSupport(Relation relation, IndexStrategy strategy,
RegProcedure *support);
#endif /* REL_H */
extern void
RelationSetIndexSupport(Relation relation, IndexStrategy strategy,
RegProcedure * support);
#endif /* REL_H */

View File

@@ -1,23 +1,24 @@
/*-------------------------------------------------------------------------
*
* rel2.h--
*
*
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: rel2.h,v 1.2 1996/11/04 11:51:25 scrappy Exp $
* $Id: rel2.h,v 1.3 1997/09/07 05:02:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef TMP_REL2_H
#define TMP_REL2_H
#ifndef TMP_REL2_H
#define TMP_REL2_H
#include <utils/rel.h>
extern IndexStrategy RelationGetIndexStrategy(Relation relation);
extern void RelationSetIndexSupport(Relation relation, IndexStrategy strategy,
RegProcedure *support);
extern void
RelationSetIndexSupport(Relation relation, IndexStrategy strategy,
RegProcedure * support);
#endif /* TMP_REL2_H */
#endif /* TMP_REL2_H */

View File

@@ -1,16 +1,16 @@
/*-------------------------------------------------------------------------
*
* relcache.h--
* Relation descriptor cache definitions.
* Relation descriptor cache definitions.
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: relcache.h,v 1.6 1997/08/19 21:40:49 momjian Exp $
* $Id: relcache.h,v 1.7 1997/09/07 05:03:00 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef RELCACHE_H
#ifndef RELCACHE_H
#define RELCACHE_H
#include <utils/rel.h>
@@ -22,17 +22,17 @@ extern Relation RelationIdCacheGetRelation(Oid relationId);
extern Relation RelationIdGetRelation(Oid relationId);
extern Relation RelationNameGetRelation(char *relationName);
extern void RelationClose(Relation relation);
extern void RelationForgetRelation(Oid rid);
extern void RelationIdInvalidateRelationCacheByRelationId(Oid relationId);
extern void RelationClose(Relation relation);
extern void RelationForgetRelation(Oid rid);
extern void RelationIdInvalidateRelationCacheByRelationId(Oid relationId);
extern void
RelationIdInvalidateRelationCacheByAccessMethodId(Oid accessMethodId);
extern void
RelationIdInvalidateRelationCacheByAccessMethodId(Oid accessMethodId);
extern void RelationCacheInvalidate(bool onlyFlushReferenceCountZero);
extern void RelationCacheInvalidate(bool onlyFlushReferenceCountZero);
extern void RelationRegisterRelation(Relation relation);
extern void RelationPurgeLocalRelation(bool xactComitted);
extern void RelationInitialize(void);
extern void RelationRegisterRelation(Relation relation);
extern void RelationPurgeLocalRelation(bool xactComitted);
extern void RelationInitialize(void);
#endif /* RELCACHE_H */
#endif /* RELCACHE_H */

View File

@@ -1,12 +1,12 @@
/*-------------------------------------------------------------------------
*
* sets.h--
*
*
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: sets.h,v 1.1 1996/08/28 01:59:25 scrappy Exp $
* $Id: sets.h,v 1.2 1997/09/07 05:03:01 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -16,7 +16,7 @@
/* Temporary name of set, before SetDefine changes it. */
#define GENERICSETNAME "zyxset"
extern Oid SetDefine(char *querystr, char *typename);
extern int seteval(Oid funcoid);
extern Oid SetDefine(char *querystr, char *typename);
extern int seteval(Oid funcoid);
#endif /* SETS_H */
#endif /* SETS_H */

View File

@@ -1,90 +1,97 @@
/*-------------------------------------------------------------------------
*
* syscache.h--
* System catalog cache definitions.
* System catalog cache definitions.
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: syscache.h,v 1.4 1996/11/04 11:51:27 scrappy Exp $
* $Id: syscache.h,v 1.5 1997/09/07 05:03:02 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef SYSCACHE_H
#ifndef SYSCACHE_H
#define SYSCACHE_H
#include <access/attnum.h>
#include <access/htup.h>
/*#define CACHEDEBUG*/ /* turns DEBUG elogs on */
/*#define CACHEDEBUG*//* turns DEBUG elogs on */
/*
* Declarations for util/syscache.c.
* Declarations for util/syscache.c.
*
* SysCache identifiers.
* SysCache identifiers.
*
* The order of these must match the order
* they are entered into the structure cacheinfo[] in syscache.c
* The best thing to do is to add yours at the END, because some
* code assumes that certain caches are at certain places in this
* array.
* The order of these must match the order
* they are entered into the structure cacheinfo[] in syscache.c
* The best thing to do is to add yours at the END, because some
* code assumes that certain caches are at certain places in this
* array.
*/
#define AMOPOPID 0
#define AMOPSTRATEGY 1
#define ATTNAME 2
#define ATTNUM 3
#define INDEXRELID 4
#define LANNAME 5
#define OPRNAME 6
#define OPROID 7
#define PRONAME 8
#define PROOID 9
#define RELNAME 10
#define RELOID 11
#define TYPNAME 12
#define TYPOID 13
#define AMNAME 14
#define CLANAME 15
#define INDRELIDKEY 16
#define INHRELID 17
#define RULOID 18
#define AGGNAME 19
#define LISTENREL 20
#define USENAME 21
#define USESYSID 22
#define GRONAME 23
#define GROSYSID 24
#define REWRITENAME 25
#define PROSRC 26
#define CLADEFTYPE 27
#define AMOPOPID 0
#define AMOPSTRATEGY 1
#define ATTNAME 2
#define ATTNUM 3
#define INDEXRELID 4
#define LANNAME 5
#define OPRNAME 6
#define OPROID 7
#define PRONAME 8
#define PROOID 9
#define RELNAME 10
#define RELOID 11
#define TYPNAME 12
#define TYPOID 13
#define AMNAME 14
#define CLANAME 15
#define INDRELIDKEY 16
#define INHRELID 17
#define RULOID 18
#define AGGNAME 19
#define LISTENREL 20
#define USENAME 21
#define USESYSID 22
#define GRONAME 23
#define GROSYSID 24
#define REWRITENAME 25
#define PROSRC 26
#define CLADEFTYPE 27
/* ----------------
* struct cachedesc: information needed for a call to InitSysCache()
* struct cachedesc: information needed for a call to InitSysCache()
* ----------------
*/
struct cachedesc {
char *name; /* this is Name * so that we can initialize it */
int nkeys;
int key[4];
int size; /* sizeof(appropriate struct) */
char *indname; /* index relation for this cache, if exists */
HeapTuple (*iScanFunc)(); /* function to handle index scans */
struct cachedesc
{
char *name; /* this is Name * so that we can
* initialize it */
int nkeys;
int key[4];
int size; /* sizeof(appropriate struct) */
char *indname; /* index relation for this cache, if
* exists */
HeapTuple(*iScanFunc) (); /* function to handle
* index scans */
};
extern void zerocaches(void);
extern void InitCatalogCache(void);
extern HeapTuple SearchSysCacheTuple(int cacheId, Datum key1, Datum key2,
Datum key3, Datum key4);
extern int32 SearchSysCacheStruct(int cacheId, char *returnStruct,
Datum key1, Datum key2, Datum key3, Datum key4);
extern void *SearchSysCacheGetAttribute(int cacheId,
AttrNumber attributeNumber,
Datum key1,
Datum key2,
Datum key3,
Datum key4);
extern void *TypeDefaultRetrieve(Oid typId);
extern void zerocaches(void);
extern void InitCatalogCache(void);
extern HeapTuple
SearchSysCacheTuple(int cacheId, Datum key1, Datum key2,
Datum key3, Datum key4);
extern int32
SearchSysCacheStruct(int cacheId, char *returnStruct,
Datum key1, Datum key2, Datum key3, Datum key4);
extern void *
SearchSysCacheGetAttribute(int cacheId,
AttrNumber attributeNumber,
Datum key1,
Datum key2,
Datum key3,
Datum key4);
extern void *TypeDefaultRetrieve(Oid typId);
#endif /* SYSCACHE_H */
#endif /* SYSCACHE_H */

View File

@@ -1,43 +1,45 @@
/*-------------------------------------------------------------------------
*
* tqual.h--
* POSTGRES time qualification definitions.
* POSTGRES time qualification definitions.
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: tqual.h,v 1.6 1997/08/19 21:40:50 momjian Exp $
* $Id: tqual.h,v 1.7 1997/09/07 05:03:03 momjian Exp $
*
* NOTE
* It may be desirable to allow time qualifications to indicate
* relative times.
* It may be desirable to allow time qualifications to indicate
* relative times.
*
*-------------------------------------------------------------------------
*/
#ifndef TQUAL_H
#ifndef TQUAL_H
#define TQUAL_H
#include <access/htup.h>
typedef struct TimeQualSpace {
char data[12];
} TimeQualSpace;
typedef struct TimeQualSpace
{
char data[12];
} TimeQualSpace;
typedef Pointer TimeQual;
typedef Pointer TimeQual;
/* Tuples valid as of StartTransactionCommand */
#define NowTimeQual ((TimeQual) NULL)
#define NowTimeQual ((TimeQual) NULL)
/* As above, plus updates in this command */
extern TimeQual SelfTimeQual;
extern TimeQual SelfTimeQual;
extern void setheapoverride(bool on);
extern bool heapisoverride(void);
extern void setheapoverride(bool on);
extern bool heapisoverride(void);
extern TimeQual TimeFormSnapshotTimeQual(AbsoluteTime time);
extern TimeQual TimeFormRangedTimeQual(AbsoluteTime startTime,
AbsoluteTime endTime);
extern bool HeapTupleSatisfiesTimeQual(HeapTuple tuple, TimeQual qual);
extern TimeQual
TimeFormRangedTimeQual(AbsoluteTime startTime,
AbsoluteTime endTime);
extern bool HeapTupleSatisfiesTimeQual(HeapTuple tuple, TimeQual qual);
#endif /* TQUAL_H */
#endif /* TQUAL_H */