1 /*-------------------------------------------------------------------------
4 * definition of (and support for) postgres system types.
5 * this file is included by almost every .c in the system
7 * Copyright (c) 1995, Regents of the University of California
9 * $Id: postgres.h,v 1.20 1999/02/13 23:20:46 momjian Exp $
11 *-------------------------------------------------------------------------
15 * this file will eventually contain the definitions for the
16 * following (and perhaps other) system types:
18 * int2 int4 float4 float8
19 * Oid regproc RegProcedure
27 * 1) simple type definitions
28 * 2) varlena and array types
29 * 3) TransactionId and CommandId
30 * 4) genbki macros used by catalog/pg_xxx.h files
31 * 5) random CSIGNBIT, MAXPGPATH, STATUS macros
33 * ----------------------------------------------------------------
38 #include "postgres_ext.h"
43 #include "utils/elog.h"
44 #include "utils/palloc.h"
46 /* ----------------------------------------------------------------
47 * Section 1: simple type definitions
48 * ----------------------------------------------------------------
54 typedef double float8;
59 #define OidIsValid(objectId) ((bool) (objectId != InvalidOid))
61 /* unfortunately, both regproc and RegProcedure are used */
63 typedef Oid RegProcedure;
65 /* ptr to func returning (char *) */
66 typedef char *((*func_ptr) ());
69 #define RegProcedureIsValid(p) OidIsValid(p)
71 /* ----------------------------------------------------------------
72 * Section 2: variable length and array types
73 * ----------------------------------------------------------------
85 #define VARSIZE(PTR) (((struct varlena *)(PTR))->vl_len)
86 #define VARDATA(PTR) (((struct varlena *)(PTR))->vl_dat)
87 #define VARHDRSZ sizeof(int32)
89 typedef struct varlena bytea;
90 typedef struct varlena text;
92 typedef int2 int28[8];
95 typedef struct nameData
97 char data[NAMEDATALEN];
99 typedef NameData *Name;
101 /* ----------------------------------------------------------------
102 * Section 3: TransactionId and CommandId
103 * ----------------------------------------------------------------
106 typedef uint32 TransactionId;
108 #define InvalidTransactionId 0
109 typedef uint32 CommandId;
111 #define FirstCommandId 0
113 /* ----------------------------------------------------------------
114 * Section 4: genbki macros used by the
115 * catalog/pg_xxx.h files
116 * ----------------------------------------------------------------
119 typedef struct CppConcat(FormData_,x)
121 #define DATA(x) extern int errno
122 #define DESCR(x) extern int errno
123 #define DECLARE_INDEX(x) extern int errno
125 #define BUILD_INDICES
131 /* ----------------------------------------------------------------
132 * Section 5: random stuff
133 * CSIGNBIT, MAXPGPATH, STATUS...
134 * ----------------------------------------------------------------
137 /* msb for int/unsigned */
138 #define ISIGNBIT (0x80000000)
139 #define WSIGNBIT (0x8000)
142 #define CSIGNBIT (0x80)
145 * global variables which should probably go someplace else.
148 #define MAXPGPATH 128
150 #define STATUS_OK (0)
151 #define STATUS_ERROR (-1)
152 #define STATUS_NOT_FOUND (-2)
153 #define STATUS_INVALID (-3)
154 #define STATUS_UNCATALOGUED (-4)
155 #define STATUS_REPLACED (-5)
156 #define STATUS_NOT_DONE (-6)
157 #define STATUS_BAD_PACKET (-7)
158 #define STATUS_FOUND (1)
161 * Cyrillic on the fly charsets recode
167 #endif /* CYR_RECODE */
169 #endif /* POSTGRES_H */