00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef __STDTP_H__
00012 #define __STDTP_H__
00013
00014 #ifdef FASTDB_DLL
00015 #ifdef INSIDE_FASTDB
00016 #define FASTDB_DLL_ENTRY __declspec(dllexport)
00017 #else
00018 #define FASTDB_DLL_ENTRY __declspec(dllimport)
00019 #endif
00020 #else
00021 #define FASTDB_DLL_ENTRY
00022 #endif
00023
00024 #ifdef _WIN32
00025 #include <windows.h>
00026 #ifdef _MSC_VER
00027 #pragma warning(disable:4800 4355 4146 4251)
00028 #pragma warning(disable:4512 4244 4097 4127 4611 4310)
00029 #endif
00030 #else
00031 #ifdef _AIX
00032 #define INT8_IS_DEFINED
00033 #endif
00034 #ifndef NO_PTHREADS
00035 #ifndef _REENTRANT
00036 #define _REENTRANT
00037 #endif
00038 #endif
00039 #endif
00040
00041 #include <stdio.h>
00042 #include <stddef.h>
00043 #include <stdlib.h>
00044 #include <string.h>
00045 #include <limits.h>
00046 #include <assert.h>
00047 #include <stdarg.h>
00048 #include <time.h>
00049
00050 #define DEBUG_NONE 0
00051 #define DEBUG_CHECK 1
00052 #define DEBUG_TRACE 2
00053
00054 #if DEBUG == DEBUG_TRACE
00055 #define TRACE_MSG(x) dbTrace x
00056 #else
00057 #define TRACE_MSG(x)
00058 #endif
00059
00060 extern FASTDB_DLL_ENTRY void dbTrace(char* message, ...);
00061
00062
00063 #ifdef PHAR_LAP
00064 #define PHAR_LAP 1
00065 #endif
00066
00067 #ifdef __QNX__
00068 #define USE_POSIX_API 1
00069 #define POSIX_1003_1d 1
00070 #endif
00071
00072
00073 #define DOALIGN(x,b) (((x) + (b) - 1) & ~((b) - 1))
00074
00075 typedef signed char int1;
00076 typedef unsigned char nat1;
00077
00078 typedef signed short int2;
00079 typedef unsigned short nat2;
00080
00081 typedef signed int int4;
00082 typedef unsigned int nat4;
00083
00084 typedef unsigned char byte;
00085
00086 #if defined(_WIN32) && !defined(__MINGW32__)
00087 typedef unsigned __int64 nat8;
00088 typedef __int64 db_int8;
00089 #if defined(__IBMCPP__)
00090 #define INT8_FORMAT "%lld"
00091 #else
00092 #define INT8_FORMAT "%I64d"
00093 #endif
00094 #define CONST64(c) c
00095 #else
00096 #if defined(__osf__ )
00097 typedef unsigned long nat8;
00098 typedef signed long db_int8;
00099 #define INT8_FORMAT "%ld"
00100 #define CONST64(c) c##L
00101 #else
00102 typedef unsigned long long nat8;
00103 typedef signed long long db_int8;
00104 #define INT8_FORMAT "%lld"
00105 #define CONST64(c) c##LL
00106 #endif
00107 #endif
00108
00109 #if !defined(bool) && (defined(__SUNPRO_CC) || defined(__IBMCPP__))
00110 #define bool char
00111 #define true (1)
00112 #define false (0)
00113 #endif
00114
00115 #define nat8_low_part(x) ((nat4)(x))
00116 #define nat8_high_part(x) ((nat4)((nat8)(x)>>32))
00117 #define int8_low_part(x) ((int4)(x))
00118 #define int8_high_part(x) ((int4)((db_int8)(x)>>32))
00119 #define cons_nat8(hi, lo) ((((nat8)(hi)) << 32) | (nat4)(lo))
00120 #define cons_int8(hi, lo) ((((db_int8)(hi)) << 32) | (nat4)(lo))
00121
00122 #define MAX_NAT8 nat8(-1)
00123
00124 #ifndef INT8_IS_DEFINED
00125 typedef db_int8 int8;
00126 #endif
00127
00128 typedef float real4;
00129 typedef double real8;
00130
00131 #ifndef BIG_ENDIAN
00132 #define BIG_ENDIAN 4321
00133 #endif
00134 #ifndef LITTLE_ENDIAN
00135 #define LITTLE_ENDIAN 1234
00136 #endif
00137
00138 #ifndef BYTE_ORDER
00139 #if defined(__sparc__) || defined(__m68k__)
00140 #define BYTE_ORDER BIG_ENDIAN
00141 #else
00142 #define BYTE_ORDER LITTLE_ENDIAN
00143 #endif
00144 #endif
00145
00146 #ifdef _WIN32
00147 typedef HANDLE descriptor_t;
00148 #else
00149 typedef int descriptor_t;
00150 #endif
00151
00152 #if !defined(_WIN32) || defined(__IBMCPP__) || defined(__MINGW32__)
00153 #define _fastcall
00154 #endif
00155
00156 #if defined(_WIN32) || !defined(NO_PTHREADS)
00157 #define THREADS_SUPPORTED 1
00158 #else
00159 #define THREADS_SUPPORTED 0
00160 #endif
00161
00162 #define items(array) (sizeof(array)/sizeof*(array))
00163
00164
00165 #if defined(USE_SYSV_SHARED_MEMORY) && !defined(DISKLESS_CONFIGURATION)
00166 #define DISKLESS_CONFIGURATION 1
00167 #endif
00168
00169
00170 #if !defined(_WIN32)
00171 #define NO_STRICMP 1
00172 #endif
00173
00174 #if defined(IGNORE_CASE) && defined(NO_STRICMP)
00175 #include <ctype.h>
00176 inline int stricmp(const char* p, const char* q)
00177 {
00178 while (toupper(*(unsigned char*)p) == toupper(*(unsigned char*)q)) {
00179 if (*p == '\0') {
00180 return 0;
00181 }
00182 p += 1;
00183 q += 1;
00184 }
00185 return toupper(*(unsigned char*)p) - toupper(*(unsigned char*)q);
00186 }
00187 #endif
00188
00189
00190 #endif
00191
00192
00193
00194