00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifdef __WIN2000__
00020
00021
00022 #define _WIN32_WINNT 0x0500
00023 #endif
00024
00025 #include <sys/locking.h>
00026 #include <windows.h>
00027 #include <math.h>
00028 #include <fcntl.h>
00029 #include <io.h>
00030 #include <malloc.h>
00031
00032 #define HAVE_SMEM 1
00033
00034 #if defined(_WIN64) || defined(WIN64)
00035 #define SYSTEM_TYPE "Win64"
00036 #elif defined(_WIN32) || defined(WIN32)
00037 #define SYSTEM_TYPE "Win32"
00038 #else
00039 #define SYSTEM_TYPE "Windows"
00040 #endif
00041
00042 #if defined(_M_IA64)
00043 #define MACHINE_TYPE "ia64"
00044 #elif defined(_M_IX86)
00045 #define MACHINE_TYPE "ia32"
00046 #elif defined(_M_ALPHA)
00047 #define MACHINE_TYPE "axp"
00048 #else
00049 #define MACHINE_TYPE "unknown"
00050 #endif
00051
00052 #if !(defined(_WIN64) || defined(WIN64))
00053 #ifndef _WIN32
00054 #define _WIN32
00055 #endif
00056 #ifndef __WIN32__
00057 #define __WIN32__
00058 #endif
00059 #endif
00060 #ifndef __WIN__
00061 #define __WIN__
00062 #endif
00063
00064
00065 #define O_SHARE 0x1000
00066 #ifdef __BORLANDC__
00067 #define F_RDLCK LK_NBLCK
00068 #define F_WRLCK LK_NBRLCK
00069 #define F_UNLCK LK_UNLCK
00070 #else
00071 #define F_RDLCK _LK_NBLCK
00072 #define F_WRLCK _LK_NBRLCK
00073 #define F_UNLCK _LK_UNLCK
00074 #endif
00075
00076 #define F_EXCLUSIVE 1
00077 #define F_TO_EOF (INT_MAX32/2)
00078 #define F_OK 0
00079
00080 #define S_IROTH S_IREAD
00081
00082 #ifdef __BORLANDC__
00083 #define FILE_BINARY O_BINARY
00084 #define O_TEMPORARY 0
00085 #define O_SHORT_LIVED 0
00086 #define SH_DENYNO _SH_DENYNO
00087 #else
00088 #define O_BINARY _O_BINARY
00089 #define FILE_BINARY _O_BINARY
00090 #define O_TEMPORARY _O_TEMPORARY
00091 #define O_SHORT_LIVED _O_SHORT_LIVED
00092 #define SH_DENYNO _SH_DENYNO
00093 #endif
00094 #define NO_OPEN_3
00095
00096 #define SIGQUIT SIGTERM
00097
00098 #undef _REENTRANT
00099 #undef SAFE_MUTEX
00100
00101 #define LONGLONG_MIN ((__int64) 0x8000000000000000)
00102 #define LONGLONG_MAX ((__int64) 0x7FFFFFFFFFFFFFFF)
00103 #define ULONGLONG_MAX ((unsigned __int64) 0xFFFFFFFFFFFFFFFF)
00104 #define LL(A) ((__int64) A)
00105 #define ULL(A) ((unsigned __int64) A)
00106
00107
00108
00109 #if defined(__EMX__) || !defined(HAVE_UINT)
00110 #undef HAVE_UINT
00111 #define HAVE_UINT
00112 typedef unsigned short ushort;
00113 typedef unsigned int uint;
00114 #endif
00115
00116 typedef unsigned __int64 ulonglong;
00117 typedef __int64 longlong;
00118 #ifndef HAVE_SIGSET_T
00119 typedef int sigset_t;
00120 #endif
00121 #define longlong_defined
00122
00123
00124
00125
00126 #ifndef HAVE_OFF_T
00127 typedef long off_t;
00128 #endif
00129 typedef __int64 os_off_t;
00130 #ifdef _WIN64
00131 typedef UINT_PTR rf_SetTimer;
00132 #else
00133 #ifndef HAVE_SIZE_T
00134 typedef unsigned int size_t;
00135 #endif
00136 typedef uint rf_SetTimer;
00137 #endif
00138
00139 #define Socket_defined
00140 #define my_socket SOCKET
00141 #define bool BOOL
00142 #define SIGPIPE SIGINT
00143 #define RETQSORTTYPE void
00144 #define QSORT_TYPE_IS_VOID
00145 #define RETSIGTYPE void
00146 #define SOCKET_SIZE_TYPE int
00147 #define my_socket_defined
00148 #define bool_defined
00149 #define byte_defined
00150 #define HUGE_PTR
00151 #define STDCALL __stdcall
00152 #define isnan(X) _isnan(X)
00153 #define finite(X) _finite(X)
00154
00155 #ifndef UNDEF_THREAD_HACK
00156 #define THREAD
00157 #endif
00158 #define VOID_SIGHANDLER
00159 #define SIZEOF_CHAR 1
00160 #define SIZEOF_LONG 4
00161 #define SIZEOF_LONG_LONG 8
00162 #define SIZEOF_OFF_T 8
00163 #ifdef _WIN64
00164 #define SIZEOF_CHARP 8
00165 #else
00166 #define SIZEOF_CHARP 4
00167 #endif
00168 #define HAVE_BROKEN_NETINET_INCLUDES
00169 #ifdef __NT__
00170 #define HAVE_NAMED_PIPE
00171 #endif
00172
00173
00174 #undef ERROR
00175
00176
00177 #ifndef SIGNAL_WITH_VIO_CLOSE
00178 #define SIGNAL_WITH_VIO_CLOSE
00179 #endif
00180
00181
00182 #define USE_MB 1
00183 #define USE_MB_IDENT 1
00184 #define USE_STRCOLL 1
00185
00186
00187 #undef USE_SYMDIR
00188 #define USE_SYMDIR
00189
00190
00191 #define ENABLED_LOCAL_INFILE 1
00192
00193
00194
00195 #define sigset(A,B) signal((A),(B))
00196 #define finite(A) _finite(A)
00197 #define sleep(A) Sleep((A)*1000)
00198 #define popen(A) popen(A,B) _popen((A),(B))
00199 #define pclose(A) _pclose(A)
00200
00201 #ifndef __BORLANDC__
00202 #define access(A,B) _access(A,B)
00203 #endif
00204
00205 #if !defined(__cplusplus)
00206 #define inline __inline
00207 #endif
00208
00209 inline double rint(double nr)
00210 {
00211 double f = floor(nr);
00212 double c = ceil(nr);
00213 return (((c-nr) >= (nr-f)) ? f :c);
00214 }
00215
00216 #ifdef _WIN64
00217 #define ulonglong2double(A) ((double) (ulonglong) (A))
00218 #define my_off_t2double(A) ((double) (my_off_t) (A))
00219
00220 #else
00221 inline double ulonglong2double(ulonglong value)
00222 {
00223 longlong nr=(longlong) value;
00224 if (nr >= 0)
00225 return (double) nr;
00226 return (18446744073709551616.0 + (double) nr);
00227 }
00228 #define my_off_t2double(A) ulonglong2double(A)
00229 #endif
00230
00231 #if SIZEOF_OFF_T > 4
00232 #define lseek(A,B,C) _lseeki64((A),(longlong) (B),(C))
00233 #define tell(A) _telli64(A)
00234 #endif
00235
00236 #define set_timespec(ABSTIME,SEC) { (ABSTIME).tv_sec=time((time_t*)0) + (time_t) (SEC); (ABSTIME).tv_nsec=0; }
00237
00238 #define STACK_DIRECTION -1
00239
00240
00241
00242 #ifndef _WIN64
00243 #define sint2korr(A) (*((int16 *) (A)))
00244 #define sint3korr(A) ((int32) ((((uchar) (A)[2]) & 128) ? \
00245 (((uint32) 255L << 24) | \
00246 (((uint32) (uchar) (A)[2]) << 16) |\
00247 (((uint32) (uchar) (A)[1]) << 8) | \
00248 ((uint32) (uchar) (A)[0])) : \
00249 (((uint32) (uchar) (A)[2]) << 16) |\
00250 (((uint32) (uchar) (A)[1]) << 8) | \
00251 ((uint32) (uchar) (A)[0])))
00252 #define sint4korr(A) (*((long *) (A)))
00253 #define uint2korr(A) (*((uint16 *) (A)))
00254
00255
00256
00257
00258
00259
00260 #define uint3korr(A) (long) (*((unsigned int *) (A)) & 0xFFFFFF)
00261 #define uint4korr(A) (*((unsigned long *) (A)))
00262 #define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
00263 (((uint32) ((uchar) (A)[1])) << 8) +\
00264 (((uint32) ((uchar) (A)[2])) << 16) +\
00265 (((uint32) ((uchar) (A)[3])) << 24)) +\
00266 (((ulonglong) ((uchar) (A)[4])) << 32))
00267 #define uint8korr(A) (*((ulonglong *) (A)))
00268 #define sint8korr(A) (*((longlong *) (A)))
00269 #define int2store(T,A) *((uint16*) (T))= (uint16) (A)
00270 #define int3store(T,A) { *(T)= (uchar) ((A));\
00271 *(T+1)=(uchar) (((uint) (A) >> 8));\
00272 *(T+2)=(uchar) (((A) >> 16)); }
00273 #define int4store(T,A) *((long *) (T))= (long) (A)
00274 #define int5store(T,A) { *(T)= (uchar)((A));\
00275 *((T)+1)=(uchar) (((A) >> 8));\
00276 *((T)+2)=(uchar) (((A) >> 16));\
00277 *((T)+3)=(uchar) (((A) >> 24)); \
00278 *((T)+4)=(uchar) (((A) >> 32)); }
00279 #define int8store(T,A) *((ulonglong *) (T))= (ulonglong) (A)
00280
00281 #define doubleget(V,M) { *((long *) &V) = *((long*) M); \
00282 *(((long *) &V)+1) = *(((long*) M)+1); }
00283 #define doublestore(T,V) { *((long *) T) = *((long*) &V); \
00284 *(((long *) T)+1) = *(((long*) &V)+1); }
00285 #define float4get(V,M) { *((long *) &(V)) = *((long*) (M)); }
00286 #define floatstore(T,V) memcpy((byte*)(T), (byte*)(&V), sizeof(float))
00287 #define float8get(V,M) doubleget((V),(M))
00288 #define float4store(V,M) memcpy((byte*) V,(byte*) (&M),sizeof(float))
00289 #define float8store(V,M) doublestore((V),(M))
00290 #endif
00291
00292 #define HAVE_PERROR
00293 #define HAVE_VFPRINT
00294 #define HAVE_RENAME
00295 #define HAVE_BINARY_STREAMS
00296 #define HAVE_LONG_JMP
00297 #define HAVE_LOCKING
00298 #define HAVE_ERRNO_AS_DEFINE
00299 #define HAVE_STDLIB
00300 #define HAVE_MEMCPY
00301 #define HAVE_MEMMOVE
00302 #define HAVE_GETCWD
00303 #define HAVE_TELL
00304 #define HAVE_TZNAME
00305 #define HAVE_PUTENV
00306 #define HAVE_SELECT
00307 #define HAVE_SETLOCALE
00308 #define HAVE_SOCKET
00309 #define HAVE_FLOAT_H
00310 #define HAVE_LIMITS_H
00311 #define HAVE_STDDEF_H
00312 #define HAVE_RINT
00313 #define NO_FCNTL_NONBLOCK
00314 #define HAVE_ALLOCA
00315 #define HAVE_STRPBRK
00316 #define HAVE_STRSTR
00317 #define HAVE_COMPRESS
00318 #define HAVE_CREATESEMAPHORE
00319 #define HAVE_ISNAN
00320 #define HAVE_FINITE
00321 #define HAVE_QUERY_CACHE
00322 #define SPRINTF_RETURNS_INT
00323 #define HAVE_SETFILEPOINTER
00324 #define HAVE_VIO
00325
00326 #ifdef NOT_USED
00327 #define HAVE_SNPRINTF
00328 #define _snprintf snprintf
00329 #endif
00330
00331 #ifdef _MSC_VER
00332 #define HAVE_LDIV
00333 #define HAVE_ANSI_INCLUDE
00334 #define HAVE_SYS_UTIME_H
00335 #define HAVE_STRTOUL
00336 #endif
00337 #define my_reinterpret_cast(A) reinterpret_cast <A>
00338 #define my_const_cast(A) const_cast<A>
00339
00340
00341
00342
00343 #ifdef _CUSTOMCONFIG_
00344 #include <custom_conf.h>
00345 #else
00346 #define DEFAULT_MYSQL_HOME "c:\\mysql"
00347 #define PACKAGE "mysql"
00348 #define DEFAULT_BASEDIR "C:\\"
00349 #define SHAREDIR "share"
00350 #define DEFAULT_CHARSET_HOME "C:/mysql/"
00351 #endif
00352
00353
00354
00355 #define FN_LIBCHAR '\\'
00356 #define FN_ROOTDIR "\\"
00357 #define FN_NETWORK_DRIVES
00358 #define FN_NO_CASE_SENCE
00359 #define OS_FILE_LIMIT 2048
00360
00361 #define DO_NOT_REMOVE_THREAD_WRAPPERS
00362 #define thread_safe_increment(V,L) InterlockedIncrement((long*) &(V))
00363
00364 #ifdef __NT__
00365 #define thread_safe_add(V,C,L) InterlockedExchangeAdd((long*) &(V),(C))
00366 #define thread_safe_sub(V,C,L) InterlockedExchangeAdd((long*) &(V),-(long) (C))
00367 #define statistic_add(V,C,L) thread_safe_add((V),(C),(L))
00368 #else
00369 #define thread_safe_add(V,C,L) \
00370 pthread_mutex_lock((L)); (V)+=(C); pthread_mutex_unlock((L));
00371 #define thread_safe_sub(V,C,L) \
00372 pthread_mutex_lock((L)); (V)-=(C); pthread_mutex_unlock((L));
00373 #define statistic_add(V,C,L) (V)+=(C)
00374 #endif
00375 #define statistic_increment(V,L) thread_safe_increment((V),(L))
00376
00377 #define shared_memory_buffer_length 16000
00378 #define default_shared_memory_base_name "MYSQL"
00379 #define MYSQL_DEFAULT_CHARSET_NAME "latin1"
00380 #define MYSQL_DEFAULT_COLLATION_NAME "latin1_swedish_ci"
00381
00382 #define HAVE_SPATIAL 1
00383 #define HAVE_RTREE_KEYS 1
00384
00385
00386
00387
00388 #define HAVE_CHARSET_big5 1
00389 #define HAVE_CHARSET_cp1250 1
00390
00391
00392
00393
00394
00395
00396 #define HAVE_CHARSET_cp932 1
00397
00398 #define HAVE_CHARSET_euckr 1
00399 #define HAVE_CHARSET_gb2312 1
00400 #define HAVE_CHARSET_gbk 1
00401
00402
00403
00404
00405
00406
00407 #define HAVE_CHARSET_latin1 1
00408 #define HAVE_CHARSET_latin2 1
00409
00410
00411
00412
00413 #define HAVE_CHARSET_sjis 1
00414
00415 #define HAVE_CHARSET_tis620 1
00416 #define HAVE_CHARSET_ucs2 1
00417 #define HAVE_CHARSET_ujis 1
00418 #define HAVE_CHARSET_utf8 1
00419 #define HAVE_UCA_COLLATIONS 1
00420