1996-10-31 08:10:14 +01:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
1999-02-14 00:22:53 +01:00
|
|
|
* c.h
|
1997-09-07 07:04:48 +02:00
|
|
|
* Fundamental C definitions. This is included by every .c file in
|
|
|
|
* postgres.
|
1996-10-31 08:10:14 +01:00
|
|
|
*
|
|
|
|
*
|
2000-01-26 06:58:53 +01:00
|
|
|
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
1996-10-31 08:10:14 +01:00
|
|
|
*
|
2000-04-12 19:17:23 +02:00
|
|
|
* $Id: c.h,v 1.69 2000/04/12 17:16:24 momjian Exp $
|
1996-10-31 08:10:14 +01:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
/*
|
1997-09-07 07:04:48 +02:00
|
|
|
* TABLE OF CONTENTS
|
1996-10-31 08:10:14 +01:00
|
|
|
*
|
2000-03-19 23:08:51 +01:00
|
|
|
* When adding stuff to this file, please try to put stuff
|
1997-09-07 07:04:48 +02:00
|
|
|
* into the relevant section, or add new sections as appropriate.
|
1996-10-31 08:10:14 +01:00
|
|
|
*
|
1997-09-07 07:04:48 +02:00
|
|
|
* section description
|
|
|
|
* ------- ------------------------------------------------
|
1999-04-02 07:10:16 +02:00
|
|
|
* 1) bool, true, false, TRUE, FALSE, NULL
|
|
|
|
* 2) non-ansi C definitions:
|
1997-09-07 07:04:48 +02:00
|
|
|
* type prefixes: const, signed, volatile, inline
|
1999-04-02 07:10:16 +02:00
|
|
|
* cpp magic macros
|
1997-09-07 07:04:48 +02:00
|
|
|
* 3) standard system types
|
|
|
|
* 4) datum type
|
|
|
|
* 5) IsValid macros for system types
|
|
|
|
* 6) offsetof, lengthof, endof
|
|
|
|
* 7) exception handling definitions, Assert, Trap, etc macros
|
1997-10-25 03:10:58 +02:00
|
|
|
* 8) Min, Max, Abs, StrNCpy macros
|
1997-09-07 07:04:48 +02:00
|
|
|
* 9) externs
|
1999-04-02 07:10:16 +02:00
|
|
|
* 10) Berkeley-specific defs
|
1997-09-07 07:04:48 +02:00
|
|
|
* 11) system-specific hacks
|
1996-10-31 08:10:14 +01:00
|
|
|
*
|
|
|
|
* ----------------------------------------------------------------
|
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
#ifndef C_H
|
1996-10-31 08:10:14 +01:00
|
|
|
#define C_H
|
|
|
|
|
1996-11-14 07:06:39 +01:00
|
|
|
/* We have to include stdlib.h here because it defines many of these macros
|
|
|
|
on some platforms, and we only want our definitions used if stdlib.h doesn't
|
1999-01-17 04:22:52 +01:00
|
|
|
have its own. The same goes for stddef and stdarg if present.
|
1996-11-14 07:06:39 +01:00
|
|
|
*/
|
1999-07-17 06:12:10 +02:00
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
|
1999-07-17 22:18:55 +02:00
|
|
|
#include <stdio.h>
|
1996-11-14 07:06:39 +01:00
|
|
|
#include <stdlib.h>
|
1999-07-17 22:18:55 +02:00
|
|
|
#include <string.h>
|
1999-01-17 04:22:52 +01:00
|
|
|
#ifdef STDC_HEADERS
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#endif
|
1996-11-14 07:06:39 +01:00
|
|
|
|
1999-01-17 07:20:06 +01:00
|
|
|
#ifdef __CYGWIN32__
|
|
|
|
#include <errno.h>
|
|
|
|
#endif
|
|
|
|
|
1996-10-31 08:10:14 +01:00
|
|
|
/* ----------------------------------------------------------------
|
1999-04-02 07:10:16 +02:00
|
|
|
* Section 1: bool, true, false, TRUE, FALSE, NULL
|
1996-10-31 08:10:14 +01:00
|
|
|
* ----------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* bool
|
1997-09-07 07:04:48 +02:00
|
|
|
* Boolean value, either true or false.
|
1996-10-31 08:10:14 +01:00
|
|
|
*
|
|
|
|
*/
|
1997-04-12 11:24:23 +02:00
|
|
|
#ifndef __cplusplus
|
1998-10-04 17:38:58 +02:00
|
|
|
#ifndef bool
|
1997-09-08 04:41:22 +02:00
|
|
|
typedef char bool;
|
1999-05-25 18:15:34 +02:00
|
|
|
|
|
|
|
#endif /* ndef bool */
|
1998-09-01 06:40:42 +02:00
|
|
|
#endif /* not C++ */
|
1999-07-01 21:47:25 +02:00
|
|
|
#ifndef true
|
1999-04-02 07:10:16 +02:00
|
|
|
#define true ((bool) 1)
|
1999-07-01 21:47:25 +02:00
|
|
|
#endif
|
|
|
|
#ifndef false
|
|
|
|
#define false ((bool) 0)
|
|
|
|
#endif
|
1997-09-08 04:41:22 +02:00
|
|
|
typedef bool *BoolPtr;
|
1996-10-31 08:10:14 +01:00
|
|
|
|
|
|
|
#ifndef TRUE
|
|
|
|
#define TRUE 1
|
1998-09-01 06:40:42 +02:00
|
|
|
#endif /* TRUE */
|
1996-10-31 08:10:14 +01:00
|
|
|
|
|
|
|
#ifndef FALSE
|
|
|
|
#define FALSE 0
|
1998-09-01 06:40:42 +02:00
|
|
|
#endif /* FALSE */
|
1996-10-31 08:10:14 +01:00
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* NULL
|
1997-09-07 07:04:48 +02:00
|
|
|
* Null pointer.
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
#ifndef NULL
|
1999-04-02 07:10:16 +02:00
|
|
|
#define NULL ((void *) 0)
|
1998-09-01 06:40:42 +02:00
|
|
|
#endif /* !defined(NULL) */
|
1996-10-31 08:10:14 +01:00
|
|
|
|
1999-04-02 07:10:16 +02:00
|
|
|
/* ----------------------------------------------------------------
|
|
|
|
* Section 2: non-ansi C definitions:
|
1996-10-31 08:10:14 +01:00
|
|
|
*
|
1999-04-02 07:10:16 +02:00
|
|
|
* type prefixes: const, signed, volatile, inline
|
|
|
|
* cpp magic macros
|
|
|
|
* ----------------------------------------------------------------
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* CppAsString
|
1997-09-07 07:04:48 +02:00
|
|
|
* Convert the argument to a string, using the C preprocessor.
|
1999-05-25 18:15:34 +02:00
|
|
|
* CppConcat
|
1997-09-07 07:04:48 +02:00
|
|
|
* Concatenate two arguments together, using the C preprocessor.
|
1999-04-02 07:10:16 +02:00
|
|
|
*
|
|
|
|
* Note: the standard Autoconf macro AC_C_STRINGIZE actually only checks
|
|
|
|
* whether #identifier works, but if we have that we likely have ## too.
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
1999-04-02 07:10:16 +02:00
|
|
|
#if defined(HAVE_STRINGIZE)
|
1996-10-31 08:10:14 +01:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
#define CppAsString(identifier) #identifier
|
|
|
|
#define CppConcat(x, y) x##y
|
1996-10-31 08:10:14 +01:00
|
|
|
|
1999-04-02 07:10:16 +02:00
|
|
|
#else /* !HAVE_STRINGIZE */
|
1996-10-31 08:10:14 +01:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
#define CppAsString(identifier) "identifier"
|
1996-10-31 08:10:14 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* CppIdentity -- On Reiser based cpp's this is used to concatenate
|
1997-09-07 07:04:48 +02:00
|
|
|
* two tokens. That is
|
|
|
|
* CppIdentity(A)B ==> AB
|
|
|
|
* We renamed it to _private_CppIdentity because it should not
|
|
|
|
* be referenced outside this file. On other cpp's it
|
|
|
|
* produces A B.
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
|
|
|
#define _priv_CppIdentity(x)x
|
1997-09-07 07:04:48 +02:00
|
|
|
#define CppConcat(x, y) _priv_CppIdentity(x)y
|
1996-10-31 08:10:14 +01:00
|
|
|
|
1999-04-02 07:10:16 +02:00
|
|
|
#endif /* !HAVE_STRINGIZE */
|
1998-01-27 16:35:30 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* dummyret is used to set return values in macros that use ?: to make
|
|
|
|
* assignments. gcc wants these to be void, other compilers like char
|
|
|
|
*/
|
1999-05-25 18:15:34 +02:00
|
|
|
#ifdef __GNUC__ /* GNU cc */
|
1998-01-27 16:35:30 +01:00
|
|
|
#define dummyret void
|
1999-04-02 07:10:16 +02:00
|
|
|
#else
|
|
|
|
#define dummyret char
|
1996-10-31 08:10:14 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* Section 3: standard system types
|
1996-10-31 08:10:14 +01:00
|
|
|
* ----------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
1999-04-02 07:10:16 +02:00
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* Pointer
|
1999-04-02 07:10:16 +02:00
|
|
|
* Variable holding address of any memory resident object.
|
|
|
|
*
|
|
|
|
* XXX Pointer arithmetic is done with this, so it can't be void *
|
|
|
|
* under "true" ANSI compilers.
|
|
|
|
*/
|
|
|
|
typedef char *Pointer;
|
|
|
|
|
1996-10-31 08:10:14 +01:00
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* intN
|
1998-01-26 02:42:53 +01:00
|
|
|
* Signed integer, EXACTLY N BITS IN SIZE,
|
|
|
|
* used for numerical computations and the
|
|
|
|
* frontend/backend protocol.
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
1998-01-26 02:42:53 +01:00
|
|
|
typedef signed char int8; /* == 8 bits */
|
|
|
|
typedef signed short int16; /* == 16 bits */
|
|
|
|
typedef signed int int32; /* == 32 bits */
|
1996-10-31 08:10:14 +01:00
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* uintN
|
1998-01-26 02:42:53 +01:00
|
|
|
* Unsigned integer, EXACTLY N BITS IN SIZE,
|
|
|
|
* used for numerical computations and the
|
|
|
|
* frontend/backend protocol.
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
1998-01-26 02:42:53 +01:00
|
|
|
typedef unsigned char uint8; /* == 8 bits */
|
|
|
|
typedef unsigned short uint16; /* == 16 bits */
|
|
|
|
typedef unsigned int uint32; /* == 32 bits */
|
1996-10-31 08:10:14 +01:00
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* floatN
|
1997-09-07 07:04:48 +02:00
|
|
|
* Floating point number, AT LEAST N BITS IN SIZE,
|
|
|
|
* used for numerical computations.
|
1996-10-31 08:10:14 +01:00
|
|
|
*
|
1997-09-07 07:04:48 +02:00
|
|
|
* Since sizeof(floatN) may be > sizeof(char *), always pass
|
|
|
|
* floatN by reference.
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
1997-09-08 04:41:22 +02:00
|
|
|
typedef float float32data;
|
|
|
|
typedef double float64data;
|
|
|
|
typedef float *float32;
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef double *float64;
|
1996-10-31 08:10:14 +01:00
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* boolN
|
1997-09-07 07:04:48 +02:00
|
|
|
* Boolean value, AT LEAST N BITS IN SIZE.
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
1997-09-08 04:41:22 +02:00
|
|
|
typedef uint8 bool8; /* >= 8 bits */
|
|
|
|
typedef uint16 bool16; /* >= 16 bits */
|
|
|
|
typedef uint32 bool32; /* >= 32 bits */
|
1996-10-31 08:10:14 +01:00
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* bitsN
|
1997-09-07 07:04:48 +02:00
|
|
|
* Unit of bitwise operation, AT LEAST N BITS IN SIZE.
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
1997-09-08 04:41:22 +02:00
|
|
|
typedef uint8 bits8; /* >= 8 bits */
|
|
|
|
typedef uint16 bits16; /* >= 16 bits */
|
|
|
|
typedef uint32 bits32; /* >= 32 bits */
|
1996-10-31 08:10:14 +01:00
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* wordN
|
1997-09-07 07:04:48 +02:00
|
|
|
* Unit of storage, AT LEAST N BITS IN SIZE,
|
|
|
|
* used to fetch/store data.
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
1997-09-08 04:41:22 +02:00
|
|
|
typedef uint8 word8; /* >= 8 bits */
|
|
|
|
typedef uint16 word16; /* >= 16 bits */
|
|
|
|
typedef uint32 word32; /* >= 32 bits */
|
1996-10-31 08:10:14 +01:00
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* Size
|
1997-09-07 07:04:48 +02:00
|
|
|
* Size of any memory resident object, as returned by sizeof.
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
1998-12-13 04:44:38 +01:00
|
|
|
typedef size_t Size;
|
1996-10-31 08:10:14 +01:00
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* Index
|
1997-09-07 07:04:48 +02:00
|
|
|
* Index into any memory resident array.
|
1996-10-31 08:10:14 +01:00
|
|
|
*
|
|
|
|
* Note:
|
1997-09-07 07:04:48 +02:00
|
|
|
* Indices are non negative.
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef unsigned int Index;
|
1996-10-31 08:10:14 +01:00
|
|
|
|
|
|
|
#define MAXDIM 6
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef struct
|
|
|
|
{
|
1997-09-08 04:41:22 +02:00
|
|
|
int indx[MAXDIM];
|
1997-09-08 23:56:23 +02:00
|
|
|
} IntArray;
|
1996-10-31 08:10:14 +01:00
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* Offset
|
1997-09-07 07:04:48 +02:00
|
|
|
* Offset into any memory resident array.
|
1996-10-31 08:10:14 +01:00
|
|
|
*
|
|
|
|
* Note:
|
1997-09-07 07:04:48 +02:00
|
|
|
* This differs from an Index in that an Index is always
|
|
|
|
* non negative, whereas Offset may be negative.
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef signed int Offset;
|
1996-10-31 08:10:14 +01:00
|
|
|
|
|
|
|
/* ----------------------------------------------------------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* Section 4: datum type + support macros
|
1996-10-31 08:10:14 +01:00
|
|
|
* ----------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* datum.h
|
1997-09-07 07:04:48 +02:00
|
|
|
* POSTGRES abstract data type datum representation definitions.
|
1996-10-31 08:10:14 +01:00
|
|
|
*
|
|
|
|
* Note:
|
|
|
|
*
|
|
|
|
* Port Notes:
|
1997-09-07 07:04:48 +02:00
|
|
|
* Postgres makes the following assumption about machines:
|
1996-10-31 08:10:14 +01:00
|
|
|
*
|
1997-09-07 07:04:48 +02:00
|
|
|
* sizeof(Datum) == sizeof(long) >= sizeof(void *) >= 4
|
1996-10-31 08:10:14 +01:00
|
|
|
*
|
1997-09-07 07:04:48 +02:00
|
|
|
* Postgres also assumes that
|
1996-10-31 08:10:14 +01:00
|
|
|
*
|
1997-09-07 07:04:48 +02:00
|
|
|
* sizeof(char) == 1
|
1996-10-31 08:10:14 +01:00
|
|
|
*
|
1997-09-07 07:04:48 +02:00
|
|
|
* and that
|
1996-10-31 08:10:14 +01:00
|
|
|
*
|
1997-09-07 07:04:48 +02:00
|
|
|
* sizeof(short) == 2
|
1996-10-31 08:10:14 +01:00
|
|
|
*
|
1997-09-07 07:04:48 +02:00
|
|
|
* If your machine meets these requirements, Datums should also be checked
|
|
|
|
* to see if the positioning is correct.
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
typedef unsigned long Datum; /* XXX sizeof(long) >= sizeof(void *) */
|
1997-09-08 04:41:22 +02:00
|
|
|
typedef Datum *DatumPtr;
|
1996-10-31 08:10:14 +01:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
#define GET_1_BYTE(datum) (((Datum) (datum)) & 0x000000ff)
|
|
|
|
#define GET_2_BYTES(datum) (((Datum) (datum)) & 0x0000ffff)
|
|
|
|
#define GET_4_BYTES(datum) (((Datum) (datum)) & 0xffffffff)
|
|
|
|
#define SET_1_BYTE(value) (((Datum) (value)) & 0x000000ff)
|
|
|
|
#define SET_2_BYTES(value) (((Datum) (value)) & 0x0000ffff)
|
|
|
|
#define SET_4_BYTES(value) (((Datum) (value)) & 0xffffffff)
|
1996-10-31 08:10:14 +01:00
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* DatumGetChar
|
1997-09-07 07:04:48 +02:00
|
|
|
* Returns character value of a datum.
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#define DatumGetChar(X) ((char) GET_1_BYTE(X))
|
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* CharGetDatum
|
1997-09-07 07:04:48 +02:00
|
|
|
* Returns datum representation for a character.
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#define CharGetDatum(X) ((Datum) SET_1_BYTE(X))
|
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* Int8GetDatum
|
1997-09-07 07:04:48 +02:00
|
|
|
* Returns datum representation for an 8-bit integer.
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#define Int8GetDatum(X) ((Datum) SET_1_BYTE(X))
|
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* DatumGetUInt8
|
1997-09-07 07:04:48 +02:00
|
|
|
* Returns 8-bit unsigned integer value of a datum.
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#define DatumGetUInt8(X) ((uint8) GET_1_BYTE(X))
|
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* UInt8GetDatum
|
1997-09-07 07:04:48 +02:00
|
|
|
* Returns datum representation for an 8-bit unsigned integer.
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#define UInt8GetDatum(X) ((Datum) SET_1_BYTE(X))
|
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* DatumGetInt16
|
1997-09-07 07:04:48 +02:00
|
|
|
* Returns 16-bit integer value of a datum.
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#define DatumGetInt16(X) ((int16) GET_2_BYTES(X))
|
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* Int16GetDatum
|
1997-09-07 07:04:48 +02:00
|
|
|
* Returns datum representation for a 16-bit integer.
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#define Int16GetDatum(X) ((Datum) SET_2_BYTES(X))
|
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* DatumGetUInt16
|
1997-09-07 07:04:48 +02:00
|
|
|
* Returns 16-bit unsigned integer value of a datum.
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#define DatumGetUInt16(X) ((uint16) GET_2_BYTES(X))
|
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* UInt16GetDatum
|
1997-09-07 07:04:48 +02:00
|
|
|
* Returns datum representation for a 16-bit unsigned integer.
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#define UInt16GetDatum(X) ((Datum) SET_2_BYTES(X))
|
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* DatumGetInt32
|
1997-09-07 07:04:48 +02:00
|
|
|
* Returns 32-bit integer value of a datum.
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#define DatumGetInt32(X) ((int32) GET_4_BYTES(X))
|
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* Int32GetDatum
|
1997-09-07 07:04:48 +02:00
|
|
|
* Returns datum representation for a 32-bit integer.
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#define Int32GetDatum(X) ((Datum) SET_4_BYTES(X))
|
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* DatumGetUInt32
|
1997-09-07 07:04:48 +02:00
|
|
|
* Returns 32-bit unsigned integer value of a datum.
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#define DatumGetUInt32(X) ((uint32) GET_4_BYTES(X))
|
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* UInt32GetDatum
|
1997-09-07 07:04:48 +02:00
|
|
|
* Returns datum representation for a 32-bit unsigned integer.
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#define UInt32GetDatum(X) ((Datum) SET_4_BYTES(X))
|
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* DatumGetObjectId
|
1997-09-07 07:04:48 +02:00
|
|
|
* Returns object identifier value of a datum.
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#define DatumGetObjectId(X) ((Oid) GET_4_BYTES(X))
|
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* ObjectIdGetDatum
|
1997-09-07 07:04:48 +02:00
|
|
|
* Returns datum representation for an object identifier.
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#define ObjectIdGetDatum(X) ((Datum) SET_4_BYTES(X))
|
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* DatumGetPointer
|
1997-09-07 07:04:48 +02:00
|
|
|
* Returns pointer value of a datum.
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
|
|
|
|
2000-03-19 23:08:51 +01:00
|
|
|
#define DatumGetPointer(X) ((Pointer) (X))
|
1996-10-31 08:10:14 +01:00
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* PointerGetDatum
|
1997-09-07 07:04:48 +02:00
|
|
|
* Returns datum representation for a pointer.
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
|
|
|
|
2000-03-19 23:08:51 +01:00
|
|
|
#define PointerGetDatum(X) ((Datum) (X))
|
1996-10-31 08:10:14 +01:00
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* DatumGetName
|
1997-09-07 07:04:48 +02:00
|
|
|
* Returns name value of a datum.
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
|
|
|
|
2000-03-19 23:08:51 +01:00
|
|
|
#define DatumGetName(X) ((Name) DatumGetPointer((Datum) (X)))
|
1996-10-31 08:10:14 +01:00
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* NameGetDatum
|
1997-09-07 07:04:48 +02:00
|
|
|
* Returns datum representation for a name.
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
|
|
|
|
2000-03-19 23:08:51 +01:00
|
|
|
#define NameGetDatum(X) PointerGetDatum((Pointer) (X))
|
1996-10-31 08:10:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* DatumGetFloat32
|
1997-09-07 07:04:48 +02:00
|
|
|
* Returns 32-bit floating point value of a datum.
|
|
|
|
* This is really a pointer, of course.
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
|
|
|
|
2000-03-19 23:08:51 +01:00
|
|
|
#define DatumGetFloat32(X) ((float32) DatumGetPointer(X))
|
1996-10-31 08:10:14 +01:00
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* Float32GetDatum
|
1997-09-07 07:04:48 +02:00
|
|
|
* Returns datum representation for a 32-bit floating point number.
|
|
|
|
* This is really a pointer, of course.
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
|
|
|
|
2000-03-19 23:08:51 +01:00
|
|
|
#define Float32GetDatum(X) PointerGetDatum((Pointer) (X))
|
1996-10-31 08:10:14 +01:00
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* DatumGetFloat64
|
1997-09-07 07:04:48 +02:00
|
|
|
* Returns 64-bit floating point value of a datum.
|
|
|
|
* This is really a pointer, of course.
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#define DatumGetFloat64(X) ((float64) DatumGetPointer(X))
|
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* Float64GetDatum
|
1997-09-07 07:04:48 +02:00
|
|
|
* Returns datum representation for a 64-bit floating point number.
|
|
|
|
* This is really a pointer, of course.
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
|
|
|
|
2000-03-19 23:08:51 +01:00
|
|
|
#define Float64GetDatum(X) PointerGetDatum((Pointer) (X))
|
1996-10-31 08:10:14 +01:00
|
|
|
|
|
|
|
/* ----------------------------------------------------------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* Section 5: IsValid macros for system types
|
1996-10-31 08:10:14 +01:00
|
|
|
* ----------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* BoolIsValid
|
1997-09-07 07:04:48 +02:00
|
|
|
* True iff bool is valid.
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
#define BoolIsValid(boolean) ((boolean) == false || (boolean) == true)
|
1996-10-31 08:10:14 +01:00
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* PointerIsValid
|
1997-09-07 07:04:48 +02:00
|
|
|
* True iff pointer is valid.
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
2000-03-19 23:08:51 +01:00
|
|
|
#define PointerIsValid(pointer) ((void*)(pointer) != NULL)
|
1996-10-31 08:10:14 +01:00
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* PointerIsAligned
|
1997-09-07 07:04:48 +02:00
|
|
|
* True iff pointer is properly aligned to point to the given type.
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
#define PointerIsAligned(pointer, type) \
|
|
|
|
(((long)(pointer) % (sizeof (type))) == 0)
|
1996-10-31 08:10:14 +01:00
|
|
|
|
|
|
|
/* ----------------------------------------------------------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* Section 6: offsetof, lengthof, endof
|
1996-10-31 08:10:14 +01:00
|
|
|
* ----------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* offsetof
|
1997-09-07 07:04:48 +02:00
|
|
|
* Offset of a structure/union field within that structure/union.
|
1996-10-31 08:10:14 +01:00
|
|
|
*
|
1997-09-07 07:04:48 +02:00
|
|
|
* XXX This is supposed to be part of stddef.h, but isn't on
|
|
|
|
* some systems (like SunOS 4).
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
|
|
|
#ifndef offsetof
|
|
|
|
#define offsetof(type, field) ((long) &((type *)0)->field)
|
1998-09-01 06:40:42 +02:00
|
|
|
#endif /* offsetof */
|
1996-10-31 08:10:14 +01:00
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* lengthof
|
1997-09-07 07:04:48 +02:00
|
|
|
* Number of elements in an array.
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
#define lengthof(array) (sizeof (array) / sizeof ((array)[0]))
|
1996-10-31 08:10:14 +01:00
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* endof
|
1997-09-07 07:04:48 +02:00
|
|
|
* Address of the element one past the last in an array.
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
|
|
|
#define endof(array) (&array[lengthof(array)])
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* Section 7: exception handling definitions
|
|
|
|
* Assert, Trap, etc macros
|
1996-10-31 08:10:14 +01:00
|
|
|
* ----------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* Exception Handling definitions
|
|
|
|
*/
|
|
|
|
|
1997-09-08 04:41:22 +02:00
|
|
|
typedef char *ExcMessage;
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef struct Exception
|
|
|
|
{
|
1997-09-08 04:41:22 +02:00
|
|
|
ExcMessage message;
|
1997-09-08 23:56:23 +02:00
|
|
|
} Exception;
|
1996-10-31 08:10:14 +01:00
|
|
|
|
|
|
|
/*
|
1998-08-25 23:04:41 +02:00
|
|
|
* USE_ASSERT_CHECKING, if defined, turns on all the assertions.
|
1996-10-31 08:10:14 +01:00
|
|
|
* - plai 9/5/90
|
|
|
|
*
|
1998-08-25 23:04:41 +02:00
|
|
|
* It should _NOT_ be defined in releases or in benchmark copies
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* Trap
|
1997-09-07 07:04:48 +02:00
|
|
|
* Generates an exception if the given condition is true.
|
1996-10-31 08:10:14 +01:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
#define Trap(condition, exception) \
|
2000-04-12 19:17:23 +02:00
|
|
|
do { \
|
|
|
|
if ((assert_enabled) && (condition)) \
|
1997-09-07 07:04:48 +02:00
|
|
|
ExceptionalCondition(CppAsString(condition), &(exception), \
|
2000-04-12 19:17:23 +02:00
|
|
|
(char*)NULL, __FILE__, __LINE__); \
|
|
|
|
} while (0)
|
1996-10-31 08:10:14 +01:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
/*
|
|
|
|
* TrapMacro is the same as Trap but it's intended for use in macros:
|
1996-10-31 08:10:14 +01:00
|
|
|
*
|
1997-09-07 07:04:48 +02:00
|
|
|
* #define foo(x) (AssertM(x != 0) && bar(x))
|
1996-10-31 08:10:14 +01:00
|
|
|
*
|
1997-09-07 07:04:48 +02:00
|
|
|
* Isn't CPP fun?
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
|
|
|
#define TrapMacro(condition, exception) \
|
2000-03-19 23:08:51 +01:00
|
|
|
((bool) ((! assert_enabled) || ! (condition) || \
|
1997-09-07 07:04:48 +02:00
|
|
|
(ExceptionalCondition(CppAsString(condition), \
|
|
|
|
&(exception), \
|
|
|
|
(char*) NULL, __FILE__, __LINE__))))
|
|
|
|
|
1998-04-06 19:27:54 +02:00
|
|
|
#ifndef USE_ASSERT_CHECKING
|
1996-10-31 08:10:14 +01:00
|
|
|
#define Assert(condition)
|
2000-03-19 23:08:51 +01:00
|
|
|
#define AssertMacro(condition) ((void)true)
|
1996-10-31 08:10:14 +01:00
|
|
|
#define AssertArg(condition)
|
|
|
|
#define AssertState(condition)
|
1998-08-25 23:04:41 +02:00
|
|
|
#define assert_enabled 0
|
1996-10-31 08:10:14 +01:00
|
|
|
#else
|
|
|
|
#define Assert(condition) \
|
1997-09-07 07:04:48 +02:00
|
|
|
Trap(!(condition), FailedAssertion)
|
1996-10-31 08:10:14 +01:00
|
|
|
|
|
|
|
#define AssertMacro(condition) \
|
2000-03-19 23:08:51 +01:00
|
|
|
((void) TrapMacro(!(condition), FailedAssertion))
|
1996-10-31 08:10:14 +01:00
|
|
|
|
|
|
|
#define AssertArg(condition) \
|
1997-09-07 07:04:48 +02:00
|
|
|
Trap(!(condition), BadArg)
|
1996-10-31 08:10:14 +01:00
|
|
|
|
|
|
|
#define AssertState(condition) \
|
1997-09-07 07:04:48 +02:00
|
|
|
Trap(!(condition), BadState)
|
1996-10-31 08:10:14 +01:00
|
|
|
|
1998-09-01 06:40:42 +02:00
|
|
|
extern int assert_enabled;
|
|
|
|
|
|
|
|
#endif /* USE_ASSERT_CHECKING */
|
1996-10-31 08:10:14 +01:00
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* LogTrap
|
1997-09-07 07:04:48 +02:00
|
|
|
* Generates an exception with a message if the given condition is true.
|
1996-10-31 08:10:14 +01:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
#define LogTrap(condition, exception, printArgs) \
|
2000-04-12 19:17:23 +02:00
|
|
|
do { \
|
|
|
|
if ((assert_enabled) && (condition)) \
|
1997-09-07 07:04:48 +02:00
|
|
|
ExceptionalCondition(CppAsString(condition), &(exception), \
|
2000-04-12 19:17:23 +02:00
|
|
|
vararg_format printArgs, __FILE__, __LINE__); \
|
|
|
|
} while (0)
|
1996-10-31 08:10:14 +01:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
/*
|
|
|
|
* LogTrapMacro is the same as LogTrap but it's intended for use in macros:
|
1996-10-31 08:10:14 +01:00
|
|
|
*
|
1997-09-07 07:04:48 +02:00
|
|
|
* #define foo(x) (LogAssertMacro(x != 0, "yow!") && bar(x))
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
|
|
|
#define LogTrapMacro(condition, exception, printArgs) \
|
2000-03-19 23:08:51 +01:00
|
|
|
((bool) ((! assert_enabled) || ! (condition) || \
|
1997-09-07 07:04:48 +02:00
|
|
|
(ExceptionalCondition(CppAsString(condition), \
|
|
|
|
&(exception), \
|
1999-06-19 07:00:30 +02:00
|
|
|
vararg_format printArgs, __FILE__, __LINE__))))
|
1997-09-07 07:04:48 +02:00
|
|
|
|
1998-04-06 19:27:54 +02:00
|
|
|
#ifndef USE_ASSERT_CHECKING
|
1996-10-31 08:10:14 +01:00
|
|
|
#define LogAssert(condition, printArgs)
|
|
|
|
#define LogAssertMacro(condition, printArgs) true
|
|
|
|
#define LogAssertArg(condition, printArgs)
|
|
|
|
#define LogAssertState(condition, printArgs)
|
|
|
|
#else
|
|
|
|
#define LogAssert(condition, printArgs) \
|
1997-09-07 07:04:48 +02:00
|
|
|
LogTrap(!(condition), FailedAssertion, printArgs)
|
1996-10-31 08:10:14 +01:00
|
|
|
|
|
|
|
#define LogAssertMacro(condition, printArgs) \
|
1997-09-07 07:04:48 +02:00
|
|
|
LogTrapMacro(!(condition), FailedAssertion, printArgs)
|
1996-10-31 08:10:14 +01:00
|
|
|
|
|
|
|
#define LogAssertArg(condition, printArgs) \
|
1997-09-07 07:04:48 +02:00
|
|
|
LogTrap(!(condition), BadArg, printArgs)
|
1996-10-31 08:10:14 +01:00
|
|
|
|
|
|
|
#define LogAssertState(condition, printArgs) \
|
1997-09-07 07:04:48 +02:00
|
|
|
LogTrap(!(condition), BadState, printArgs)
|
1996-10-31 08:10:14 +01:00
|
|
|
|
1998-08-25 23:04:41 +02:00
|
|
|
extern int assertEnable(int val);
|
1998-09-01 06:40:42 +02:00
|
|
|
|
1998-08-25 23:04:41 +02:00
|
|
|
#ifdef ASSERT_CHECKING_TEST
|
|
|
|
extern int assertTest(int val);
|
1998-09-01 06:40:42 +02:00
|
|
|
|
1998-08-25 23:04:41 +02:00
|
|
|
#endif
|
1998-09-01 06:40:42 +02:00
|
|
|
#endif /* USE_ASSERT_CHECKING */
|
1996-10-31 08:10:14 +01:00
|
|
|
|
|
|
|
/* ----------------------------------------------------------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* Section 8: Min, Max, Abs macros
|
1996-10-31 08:10:14 +01:00
|
|
|
* ----------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* Max
|
1997-09-07 07:04:48 +02:00
|
|
|
* Return the maximum of two numbers.
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
#define Max(x, y) ((x) > (y) ? (x) : (y))
|
1996-10-31 08:10:14 +01:00
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* Min
|
1997-09-07 07:04:48 +02:00
|
|
|
* Return the minimum of two numbers.
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
#define Min(x, y) ((x) < (y) ? (x) : (y))
|
1996-10-31 08:10:14 +01:00
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* Abs
|
1997-09-07 07:04:48 +02:00
|
|
|
* Return the absolute value of the argument.
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
#define Abs(x) ((x) >= 0 ? (x) : -(x))
|
1996-10-31 08:10:14 +01:00
|
|
|
|
1997-08-12 22:16:25 +02:00
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* StrNCpy
|
2000-03-19 23:08:51 +01:00
|
|
|
* Like standard library function strncpy(), except that result string
|
|
|
|
* is guaranteed to be null-terminated --- that is, at most N-1 bytes
|
|
|
|
* of the source string will be kept.
|
|
|
|
* Also, the macro returns no result (too hard to do that without
|
|
|
|
* evaluating the arguments multiple times, which seems worse).
|
|
|
|
*/
|
|
|
|
#define StrNCpy(dst,src,len) \
|
|
|
|
do \
|
|
|
|
{ \
|
|
|
|
char * _dst = (dst); \
|
|
|
|
Size _len = (len); \
|
|
|
|
\
|
|
|
|
if (_len > 0) \
|
|
|
|
{ \
|
|
|
|
strncpy(_dst, (src), _len); \
|
|
|
|
_dst[_len-1] = '\0'; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
1997-08-12 22:16:25 +02:00
|
|
|
|
1998-02-11 22:38:08 +01:00
|
|
|
/* Get a bit mask of the bits set in non-int32 aligned addresses */
|
|
|
|
#define INT_ALIGN_MASK (sizeof(int32) - 1)
|
|
|
|
|
1998-02-11 22:45:40 +01:00
|
|
|
/*
|
2000-03-19 23:08:51 +01:00
|
|
|
* MemSet
|
|
|
|
* Exactly the same as standard library function memset(), but considerably
|
|
|
|
* faster for zeroing small word-aligned structures (such as parsetree nodes).
|
|
|
|
* This has to be a macro because the main point is to avoid function-call
|
|
|
|
* overhead.
|
|
|
|
*
|
1998-02-11 22:45:40 +01:00
|
|
|
* We got the 64 number by testing this against the stock memset() on
|
2000-04-12 19:17:23 +02:00
|
|
|
* BSD/OS 3.0. Larger values were slower. bjm 1997/09/11
|
2000-03-20 05:02:47 +01:00
|
|
|
*
|
2000-04-12 19:17:23 +02:00
|
|
|
* I think the crossover point could be a good deal higher for
|
2000-03-20 05:02:47 +01:00
|
|
|
* most platforms, actually. tgl 2000-03-19
|
2000-03-19 23:08:51 +01:00
|
|
|
*/
|
|
|
|
#define MemSet(start, val, len) \
|
|
|
|
do \
|
|
|
|
{ \
|
|
|
|
int32 * _start = (int32 *) (start); \
|
|
|
|
int _val = (val); \
|
|
|
|
Size _len = (len); \
|
|
|
|
\
|
|
|
|
if ((((long) _start) & INT_ALIGN_MASK) == 0 && \
|
|
|
|
(_len & INT_ALIGN_MASK) == 0 && \
|
|
|
|
_val == 0 && \
|
|
|
|
_len <= MEMSET_LOOP_LIMIT) \
|
|
|
|
{ \
|
|
|
|
int32 * _stop = (int32 *) ((char *) _start + _len); \
|
|
|
|
while (_start < _stop) \
|
|
|
|
*_start++ = 0; \
|
|
|
|
} \
|
|
|
|
else \
|
|
|
|
memset((char *) _start, _val, _len); \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define MEMSET_LOOP_LIMIT 64
|
|
|
|
|
1997-09-18 16:21:02 +02:00
|
|
|
|
1996-10-31 08:10:14 +01:00
|
|
|
/* ----------------------------------------------------------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* Section 9: externs
|
1996-10-31 08:10:14 +01:00
|
|
|
* ----------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
extern Exception FailedAssertion;
|
|
|
|
extern Exception BadArg;
|
|
|
|
extern Exception BadState;
|
1996-10-31 08:10:14 +01:00
|
|
|
|
|
|
|
/* in utils/error/assert.c */
|
1998-09-01 06:40:42 +02:00
|
|
|
extern int ExceptionalCondition(char *conditionName,
|
1997-09-08 23:56:23 +02:00
|
|
|
Exception *exceptionP, char *details,
|
1997-09-07 07:04:48 +02:00
|
|
|
char *fileName, int lineNumber);
|
1996-10-31 08:10:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* ----------------
|
1999-06-19 07:00:30 +02:00
|
|
|
* vararg_format is used by assert and the exception handling stuff
|
1996-10-31 08:10:14 +01:00
|
|
|
* ----------------
|
|
|
|
*/
|
1999-06-19 07:00:30 +02:00
|
|
|
extern char *vararg_format(const char *fmt,...);
|
1996-10-31 08:10:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* Section 10: berkeley-specific configuration
|
1996-10-31 08:10:14 +01:00
|
|
|
*
|
|
|
|
* this section contains settings which are only relevant to the UC Berkeley
|
|
|
|
* sites. Other sites can ignore this
|
|
|
|
* ----------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* ----------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* storage managers
|
1996-10-31 08:10:14 +01:00
|
|
|
*
|
1997-09-07 07:04:48 +02:00
|
|
|
* These are experimental and are not supported in the code that
|
|
|
|
* we distribute to other sites.
|
1996-10-31 08:10:14 +01:00
|
|
|
* ----------------
|
|
|
|
*/
|
1998-06-23 17:35:48 +02:00
|
|
|
#ifdef NOT_USED
|
|
|
|
#define STABLE_MEMORY_STORAGE
|
1996-10-31 08:10:14 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* Section 11: system-specific hacks
|
1996-10-31 08:10:14 +01:00
|
|
|
*
|
1997-09-07 07:04:48 +02:00
|
|
|
* This should be limited to things that absolutely have to be
|
|
|
|
* included in every source file. The changes should be factored
|
|
|
|
* into a separate file so that changes to one port don't require
|
|
|
|
* changes to c.h (and everyone recompiling their whole system).
|
1996-10-31 08:10:14 +01:00
|
|
|
* ----------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
1997-04-15 19:55:37 +02:00
|
|
|
#ifdef FIXADE
|
1997-09-07 07:04:48 +02:00
|
|
|
#if defined(hpux)
|
|
|
|
#include "port/hpux/fixade.h" /* for unaligned access fixup */
|
1998-09-01 06:40:42 +02:00
|
|
|
#endif /* hpux */
|
1997-04-15 19:55:37 +02:00
|
|
|
#endif
|
1996-10-31 08:10:14 +01:00
|
|
|
|
1999-07-13 22:00:37 +02:00
|
|
|
#if defined(sun) && defined(__sparc__) && !defined(__SVR4)
|
1997-09-07 07:04:48 +02:00
|
|
|
#define memmove(d, s, l) bcopy(s, d, l)
|
1997-04-24 22:02:02 +02:00
|
|
|
#include <unistd.h>
|
1999-02-11 02:36:55 +01:00
|
|
|
#include <varargs.h>
|
1996-10-31 08:10:14 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* These are for things that are one way on Unix and another on NT */
|
1997-09-07 07:04:48 +02:00
|
|
|
#define NULL_DEV "/dev/null"
|
|
|
|
#define SEP_CHAR '/'
|
1996-10-31 08:10:14 +01:00
|
|
|
|
1999-03-09 14:39:15 +01:00
|
|
|
/* defines for dynamic linking on Win32 platform */
|
|
|
|
#ifdef __CYGWIN32__
|
|
|
|
#if __GNUC__ && ! defined (__declspec)
|
|
|
|
#error You need egcs 1.1 or newer for compiling!
|
|
|
|
#endif
|
|
|
|
#ifdef BUILDING_DLL
|
|
|
|
#define DLLIMPORT __declspec (dllexport)
|
1999-05-25 18:15:34 +02:00
|
|
|
#else /* not BUILDING_DLL */
|
1999-03-09 14:39:15 +01:00
|
|
|
#define DLLIMPORT __declspec (dllimport)
|
|
|
|
#endif
|
1999-05-25 18:15:34 +02:00
|
|
|
#else /* not CYGWIN */
|
1999-03-09 14:39:15 +01:00
|
|
|
#define DLLIMPORT
|
|
|
|
#endif
|
|
|
|
|
1999-01-17 04:22:52 +01:00
|
|
|
/* Provide prototypes for routines not present in a particular machine's
|
1999-05-25 18:15:34 +02:00
|
|
|
* standard C library. It'd be better to put these in config.h, but
|
1999-01-17 04:22:52 +01:00
|
|
|
* in config.h we haven't yet included anything that defines size_t...
|
|
|
|
*/
|
|
|
|
|
1999-12-20 01:51:25 +01:00
|
|
|
#ifndef HAVE_SNPRINTF_DECL
|
1999-05-25 18:15:34 +02:00
|
|
|
extern int snprintf(char *str, size_t count, const char *fmt,...);
|
2000-04-12 19:17:23 +02:00
|
|
|
|
1999-01-17 04:22:52 +01:00
|
|
|
#endif
|
|
|
|
|
1999-12-20 01:51:25 +01:00
|
|
|
#ifndef HAVE_VSNPRINTF_DECL
|
1999-05-25 18:15:34 +02:00
|
|
|
extern int vsnprintf(char *str, size_t count, const char *fmt, va_list args);
|
2000-04-12 19:17:23 +02:00
|
|
|
|
1999-07-17 22:18:55 +02:00
|
|
|
#endif
|
1999-05-25 18:15:34 +02:00
|
|
|
|
1999-07-17 22:18:55 +02:00
|
|
|
#ifndef HAVE_MEMMOVE
|
|
|
|
#include <regex/utils.h>
|
1999-01-17 04:22:52 +01:00
|
|
|
#endif
|
|
|
|
|
1996-10-31 08:10:14 +01:00
|
|
|
/* ----------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* end of c.h
|
1996-10-31 08:10:14 +01:00
|
|
|
* ----------------
|
|
|
|
*/
|
1998-09-01 06:40:42 +02:00
|
|
|
#endif /* C_H */
|