Eneboo - Documentación para desarrolladores
src/libmysql_std/include/config-win.h
Ir a la documentación de este archivo.
00001 /* Copyright (C) 2000 MySQL AB
00002 
00003    This program is free software; you can redistribute it and/or modify
00004    it under the terms of the GNU General Public License as published by
00005    the Free Software Foundation; version 2 of the License.
00006 
00007    This program is distributed in the hope that it will be useful,
00008    but WITHOUT ANY WARRANTY; without even the implied warranty of
00009    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010    GNU General Public License for more details.
00011 
00012    You should have received a copy of the GNU General Public License
00013    along with this program; if not, write to the Free Software
00014    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
00015 
00016 /* Defines for Win32 to make it compatible for MySQL */
00017 
00018 #ifdef __WIN2000__
00019 /* We have to do this define before including windows.h to get the AWE API
00020 functions */
00021 #define _WIN32_WINNT     0x0500
00022 #endif
00023 
00024 #if defined(_MSC_VER) && _MSC_VER >= 1400
00025 /* Avoid endless warnings about sprintf() etc. being unsafe. */
00026 #define _CRT_SECURE_NO_DEPRECATE 1
00027 #endif
00028 
00029 #include <sys/locking.h>
00030 #include <windows.h>
00031 #include <math.h>                       /* Because of rint() */
00032 #include <fcntl.h>
00033 #include <io.h>
00034 #include <malloc.h>
00035 
00036 #define HAVE_SMEM 1
00037 
00038 #if defined(_WIN64) || defined(WIN64) 
00039 #define SYSTEM_TYPE     "Win64" 
00040 #elif defined(_WIN32) || defined(WIN32) 
00041 #define SYSTEM_TYPE     "Win32" 
00042 #else
00043 #define SYSTEM_TYPE     "Windows"
00044 #endif
00045 
00046 #if defined(_M_IA64) 
00047 #define MACHINE_TYPE    "ia64" 
00048 #elif defined(_M_IX86) 
00049 #define MACHINE_TYPE    "ia32" 
00050 #elif defined(_M_ALPHA) 
00051 #define MACHINE_TYPE    "axp" 
00052 #else
00053 #define MACHINE_TYPE    "unknown"       /* Define to machine type name */
00054 #endif 
00055  
00056 #if !(defined(_WIN64) || defined(WIN64)) 
00057 #ifndef _WIN32
00058 #define _WIN32                          /* Compatible with old source */
00059 #endif
00060 #ifndef __WIN32__
00061 #define __WIN32__
00062 #endif
00063 #endif /* _WIN64 */
00064 #ifndef __WIN__
00065 #define __WIN__                       /* To make it easier in VC++ */
00066 #endif
00067 
00068 #ifndef MAX_INDEXES
00069 #define MAX_INDEXES 64
00070 #endif
00071 
00072 /* File and lock constants */
00073 #define O_SHARE         0x1000          /* Open file in sharing mode */
00074 #ifdef __BORLANDC__
00075 #define F_RDLCK         LK_NBLCK        /* read lock */
00076 #define F_WRLCK         LK_NBRLCK       /* write lock */
00077 #define F_UNLCK         LK_UNLCK        /* remove lock(s) */
00078 #else
00079 #define F_RDLCK         _LK_NBLCK       /* read lock */
00080 #define F_WRLCK         _LK_NBRLCK      /* write lock */
00081 #define F_UNLCK         _LK_UNLCK       /* remove lock(s) */
00082 #endif
00083 
00084 #define F_EXCLUSIVE     1               /* We have only exclusive locking */
00085 #define F_TO_EOF        (INT_MAX32/2)   /* size for lock of all file */
00086 #define F_OK            0               /* parameter to access() */
00087 #define W_OK            2
00088 
00089 #define S_IROTH         S_IREAD         /* for my_lib */
00090 
00091 #ifdef __BORLANDC__
00092 #define FILE_BINARY     O_BINARY        /* my_fopen in binary mode */
00093 #define O_TEMPORARY     0
00094 #define O_SHORT_LIVED   0
00095 #define SH_DENYNO       _SH_DENYNO
00096 #else
00097 #define O_BINARY        _O_BINARY       /* compability with MSDOS */
00098 #define FILE_BINARY     _O_BINARY       /* my_fopen in binary mode */
00099 #define O_TEMPORARY     _O_TEMPORARY
00100 #define O_SHORT_LIVED   _O_SHORT_LIVED
00101 #define SH_DENYNO       _SH_DENYNO
00102 #endif
00103 #define NO_OPEN_3                       /* For my_create() */
00104 
00105 #define SIGQUIT         SIGTERM         /* No SIGQUIT */
00106 
00107 #undef _REENTRANT                       /* Crashes something for win32 */
00108 #undef SAFE_MUTEX                       /* Can't be used on windows */
00109 
00110 #if defined(_MSC_VER) && _MSC_VER >= 1310
00111 #define LL(A)           A##ll
00112 #define ULL(A)          A##ull
00113 #else
00114 #define LL(A)           ((__int64) A)
00115 #define ULL(A)          ((unsigned __int64) A)
00116 #endif
00117 
00118 #define LONGLONG_MIN    LL(0x8000000000000000)
00119 #define LONGLONG_MAX    LL(0x7FFFFFFFFFFFFFFF)
00120 #define ULONGLONG_MAX   ULL(0xFFFFFFFFFFFFFFFF)
00121 
00122 /* Type information */
00123 
00124 #if defined(__EMX__) || !defined(HAVE_UINT)
00125 #undef HAVE_UINT
00126 #define HAVE_UINT
00127 typedef unsigned short  ushort;
00128 typedef unsigned int    uint;
00129 #endif /* defined(__EMX__) || !defined(HAVE_UINT) */
00130 
00131 typedef unsigned __int64 ulonglong;     /* Microsofts 64 bit types */
00132 typedef __int64 longlong;
00133 #ifndef HAVE_SIGSET_T
00134 typedef int sigset_t;
00135 #endif
00136 #define longlong_defined
00137 /*
00138   off_t should not be __int64 because of conflicts in header files;
00139   Use my_off_t or os_off_t instead
00140 */
00141 #ifndef HAVE_OFF_T
00142 typedef long off_t;
00143 #endif
00144 typedef __int64 os_off_t;
00145 #ifdef _WIN64
00146 typedef UINT_PTR rf_SetTimer;
00147 #else
00148 #ifndef HAVE_SIZE_T
00149 typedef unsigned int size_t;
00150 #endif
00151 typedef uint rf_SetTimer;
00152 #endif
00153 
00154 #define Socket_defined
00155 #define my_socket SOCKET
00156 #define bool BOOL
00157 #define SIGPIPE SIGINT
00158 #define RETQSORTTYPE void
00159 #define QSORT_TYPE_IS_VOID
00160 #define RETSIGTYPE void
00161 #define SOCKET_SIZE_TYPE int
00162 #define my_socket_defined
00163 #define bool_defined
00164 #define byte_defined
00165 #define uintptr_t uint
00166 #define HUGE_PTR
00167 #define STDCALL __stdcall           /* Used by libmysql.dll */
00168 #define isnan(X) _isnan(X)
00169 #define finite(X) _finite(X)
00170 
00171 #ifndef UNDEF_THREAD_HACK
00172 #define THREAD
00173 #endif
00174 #define VOID_SIGHANDLER
00175 #define SIZEOF_CHAR             1
00176 #define SIZEOF_LONG             4
00177 #define SIZEOF_LONG_LONG        8
00178 #define SIZEOF_OFF_T            8
00179 #ifdef _WIN64
00180 #define SIZEOF_CHARP            8
00181 #else
00182 #define SIZEOF_CHARP            4
00183 #endif
00184 #define HAVE_BROKEN_NETINET_INCLUDES
00185 #ifdef __NT__
00186 #define HAVE_NAMED_PIPE                 /* We can only create pipes on NT */
00187 #endif
00188 
00189 /* ERROR is defined in wingdi.h */
00190 #undef ERROR
00191 
00192 /* We need to close files to break connections on shutdown */
00193 #ifndef SIGNAL_WITH_VIO_CLOSE
00194 #define SIGNAL_WITH_VIO_CLOSE
00195 #endif
00196 
00197 /* Use all character sets in MySQL */
00198 #define USE_MB 1
00199 #define USE_MB_IDENT 1
00200 #define USE_STRCOLL 1
00201 
00202 /* All windows servers should support .sym files */
00203 #undef USE_SYMDIR
00204 #define USE_SYMDIR
00205 
00206 /* If LOAD DATA LOCAL INFILE should be enabled by default */
00207 #define ENABLED_LOCAL_INFILE 1
00208 
00209 /* If query profiling should be enabled by default */
00210 #define ENABLED_PROFILING 1
00211 
00212 /* Convert some simple functions to Posix */
00213 
00214 #define my_sigset(A,B) signal((A),(B))
00215 #define finite(A) _finite(A)
00216 #define sleep(A)  Sleep((A)*1000)
00217 //#define popen(A,B) _popen((A),(B))
00218 #define pclose(A) _pclose(A)
00219 
00220 #ifndef __BORLANDC__
00221 #define access(A,B) _access(A,B)
00222 #endif
00223 
00224 #if !defined(__cplusplus)
00225 #define inline __inline
00226 #endif /* __cplusplus */
00227 
00228 /*inline double rint(double nr)
00229 {
00230   double f = floor(nr);
00231   double c = ceil(nr);
00232   return (((c-nr) >= (nr-f)) ? f :c);
00233 }*/
00234 
00235 #ifdef _WIN64
00236 #define ulonglong2double(A) ((double) (ulonglong) (A))
00237 #define my_off_t2double(A)  ((double) (my_off_t) (A))
00238 
00239 #else
00240 /*inline double ulonglong2double(ulonglong value)
00241 {
00242   longlong nr=(longlong) value;
00243   if (nr >= 0)
00244     return (double) nr;
00245   return (18446744073709551616.0 + (double) nr);
00246 }*/
00247 #define my_off_t2double(A) ulonglong2double(A)
00248 #endif /* _WIN64 */
00249 
00250 #if SIZEOF_OFF_T > 4
00251 #define lseek(A,B,C) _lseeki64((A),(longlong) (B),(C))
00252 #define tell(A) _telli64(A)
00253 #endif
00254 
00255 
00256 #define STACK_DIRECTION -1
00257 
00258 /* Optimized store functions for Intel x86 */
00259 
00260 #ifndef _WIN64
00261 #define sint2korr(A)    (*((int16 *) (A)))
00262 #define sint3korr(A)    ((int32) ((((uchar) (A)[2]) & 128) ? \
00263                                   (((uint32) 255L << 24) | \
00264                                    (((uint32) (uchar) (A)[2]) << 16) |\
00265                                    (((uint32) (uchar) (A)[1]) << 8) | \
00266                                    ((uint32) (uchar) (A)[0])) : \
00267                                   (((uint32) (uchar) (A)[2]) << 16) |\
00268                                   (((uint32) (uchar) (A)[1]) << 8) | \
00269                                   ((uint32) (uchar) (A)[0])))
00270 #define sint4korr(A)    (*((long *) (A)))
00271 #define uint2korr(A)    (*((uint16 *) (A)))
00272 /*
00273    ATTENTION !
00274    
00275     Please, note, uint3korr reads 4 bytes (not 3) !
00276     It means, that you have to provide enough allocated space !
00277 */
00278 #define uint3korr(A)    (long) (*((unsigned int *) (A)) & 0xFFFFFF)
00279 #define uint4korr(A)    (*((unsigned long *) (A)))
00280 #define uint5korr(A)    ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
00281                                     (((uint32) ((uchar) (A)[1])) << 8) +\
00282                                     (((uint32) ((uchar) (A)[2])) << 16) +\
00283                                     (((uint32) ((uchar) (A)[3])) << 24)) +\
00284                                     (((ulonglong) ((uchar) (A)[4])) << 32))
00285 #define uint8korr(A)    (*((ulonglong *) (A)))
00286 #define sint8korr(A)    (*((longlong *) (A)))
00287 #define int2store(T,A)  *((uint16*) (T))= (uint16) (A)
00288 #define int3store(T,A)          { *(T)=  (uchar) ((A));\
00289                                   *(T+1)=(uchar) (((uint) (A) >> 8));\
00290                                   *(T+2)=(uchar) (((A) >> 16)); }
00291 #define int4store(T,A)  *((long *) (T))= (long) (A)
00292 #define int5store(T,A)  { *(T)= (uchar)((A));\
00293                           *((T)+1)=(uchar) (((A) >> 8));\
00294                           *((T)+2)=(uchar) (((A) >> 16));\
00295                           *((T)+3)=(uchar) (((A) >> 24)); \
00296                           *((T)+4)=(uchar) (((A) >> 32)); }
00297 #define int8store(T,A)  *((ulonglong *) (T))= (ulonglong) (A)
00298 
00299 #define doubleget(V,M)  do { *((long *) &V) = *((long*) M); \
00300                             *(((long *) &V)+1) = *(((long*) M)+1); } while(0)
00301 #define doublestore(T,V) do { *((long *) T) = *((long*) &V); \
00302                               *(((long *) T)+1) = *(((long*) &V)+1); } while(0)
00303 #define float4get(V,M) { *((long *) &(V)) = *((long*) (M)); }
00304 #define floatstore(T,V) memcpy((byte*)(T), (byte*)(&V), sizeof(float))
00305 #define floatget(V,M)   memcpy((byte*)(&V), (byte*)(M), sizeof(float))
00306 #define float8get(V,M) doubleget((V),(M))
00307 #define float4store(V,M) memcpy((byte*) V,(byte*) (&M),sizeof(float))
00308 #define float8store(V,M) doublestore((V),(M))
00309 #endif /* _WIN64 */
00310 
00311 #define HAVE_PERROR
00312 #define HAVE_VFPRINT
00313 #define HAVE_RENAME             /* Have rename() as function */
00314 #define HAVE_BINARY_STREAMS     /* Have "b" flag in streams */
00315 #define HAVE_LONG_JMP           /* Have long jump function */
00316 #define HAVE_LOCKING            /* have locking() call */
00317 #define HAVE_ERRNO_AS_DEFINE    /* errno is a define */
00318 #define HAVE_STDLIB             /* everything is include in this file */
00319 #define HAVE_MEMCPY
00320 #define HAVE_MEMMOVE
00321 #define HAVE_GETCWD
00322 #define HAVE_TELL
00323 #define HAVE_TZNAME
00324 #define HAVE_PUTENV
00325 #define HAVE_SELECT
00326 #define HAVE_SETLOCALE
00327 #define HAVE_SOCKET             /* Giangi */
00328 #define HAVE_FLOAT_H
00329 #define HAVE_LIMITS_H
00330 #define HAVE_STDDEF_H
00331 #define HAVE_RINT               /* defined in this file */
00332 #define NO_FCNTL_NONBLOCK       /* No FCNTL */
00333 #define HAVE_ALLOCA
00334 #define HAVE_STRPBRK
00335 #define HAVE_STRSTR
00336 #define HAVE_COMPRESS 1
00337 #define HAVE_CREATESEMAPHORE
00338 #define HAVE_ISNAN
00339 #define HAVE_FINITE
00340 #define HAVE_QUERY_CACHE
00341 #define SPRINTF_RETURNS_INT
00342 #define HAVE_SETFILEPOINTER
00343 #define HAVE_VIO_READ_BUFF
00344 #define HAVE_STRNLEN
00345 
00346 #ifndef __NT__
00347 #undef FILE_SHARE_DELETE
00348 #define FILE_SHARE_DELETE 0     /* Not implemented on Win 98/ME */
00349 #endif
00350 
00351 #ifdef NOT_USED
00352 #define HAVE_SNPRINTF           /* Gave link error */
00353 #define _snprintf snprintf
00354 #endif
00355 
00356 #ifdef _MSC_VER
00357 #define HAVE_LDIV               /* The optimizer breaks in zortech for ldiv */
00358 #define HAVE_ANSI_INCLUDE
00359 #define HAVE_SYS_UTIME_H
00360 #define HAVE_STRTOUL
00361 #endif
00362 #define my_reinterpret_cast(A) reinterpret_cast <A>
00363 #define my_const_cast(A) const_cast<A>
00364 
00365 
00366 /* MYSQL OPTIONS */
00367 
00368 #ifdef _CUSTOMCONFIG_
00369 #include <custom_conf.h>
00370 #else
00371 #define DEFAULT_MYSQL_HOME      "c:\\"
00372 #define DATADIR                 "c:\\"
00373 #define PACKAGE                 "mysql"
00374 #define DEFAULT_BASEDIR         "c:\\"
00375 #define SHAREDIR                "share"
00376 #define DEFAULT_CHARSET_HOME    "c:/"
00377 #endif
00378 #ifndef DEFAULT_HOME_ENV
00379 #define DEFAULT_HOME_ENV MYSQL_HOME
00380 #endif
00381 #ifndef DEFAULT_GROUP_SUFFIX_ENV
00382 #define DEFAULT_GROUP_SUFFIX_ENV MYSQL_GROUP_SUFFIX
00383 #endif
00384 
00385 /* File name handling */
00386 
00387 #define FN_LIBCHAR      '\\'
00388 #define FN_ROOTDIR      "\\"
00389 #define FN_DEVCHAR      ':'
00390 #define FN_NETWORK_DRIVES       /* Uses \\ to indicate network drives */
00391 #define FN_NO_CASE_SENCE        /* Files are not case-sensitive */
00392 #define OS_FILE_LIMIT   2048
00393 
00394 #define DO_NOT_REMOVE_THREAD_WRAPPERS
00395 #define thread_safe_increment(V,L) InterlockedIncrement((long*) &(V))
00396 #define thread_safe_decrement(V,L) InterlockedDecrement((long*) &(V))
00397 /* The following is only used for statistics, so it should be good enough */
00398 #ifdef __NT__  /* This should also work on Win98 but .. */
00399 #define thread_safe_add(V,C,L) InterlockedExchangeAdd((long*) &(V),(C))
00400 #define thread_safe_sub(V,C,L) InterlockedExchangeAdd((long*) &(V),-(long) (C))
00401 #define statistic_add(V,C,L) thread_safe_add((V),(C),(L))
00402 #else
00403 #define thread_safe_add(V,C,L) \
00404         pthread_mutex_lock((L)); (V)+=(C); pthread_mutex_unlock((L));
00405 #define thread_safe_sub(V,C,L) \
00406         pthread_mutex_lock((L)); (V)-=(C); pthread_mutex_unlock((L));
00407 #define statistic_add(V,C,L)     (V)+=(C)
00408 #endif
00409 #define statistic_increment(V,L) thread_safe_increment((V),(L))
00410 #define statistic_decrement(V,L) thread_safe_decrement((V),(L))
00411 
00412 #define shared_memory_buffer_length 16000
00413 #define default_shared_memory_base_name "MYSQL"
00414 
00415 #define MYSQL_DEFAULT_CHARSET_NAME "latin1"
00416 #define MYSQL_DEFAULT_COLLATION_NAME "latin1_swedish_ci"
00417 
00418 #define HAVE_SPATIAL 1
00419 #define HAVE_RTREE_KEYS 1
00420 
00421 //#define HAVE_OPENSSL 1
00422 //#define HAVE_YASSL 1
00423 
00424 /* Define charsets you want */
00425 /* #undef HAVE_CHARSET_armscii8 */
00426 /* #undef HAVE_CHARSET_ascii */
00427 //#define HAVE_CHARSET_big5 1
00428 //#define HAVE_CHARSET_cp1250 1
00429 /* #undef HAVE_CHARSET_cp1251 */
00430 /* #undef HAVE_CHARSET_cp1256 */
00431 /* #undef HAVE_CHARSET_cp1257 */
00432 /* #undef HAVE_CHARSET_cp850 */
00433 /* #undef HAVE_CHARSET_cp852 */
00434 /* #undef HAVE_CHARSET_cp866 */
00435 #define HAVE_CHARSET_cp932 1
00436 /* #undef HAVE_CHARSET_dec8 */
00437 //#define HAVE_CHARSET_eucjpms 1
00438 //#define HAVE_CHARSET_euckr 1
00439 //#define HAVE_CHARSET_gb2312 1
00440 //#define HAVE_CHARSET_gbk 1
00441 /* #undef HAVE_CHARSET_greek */
00442 /* #undef HAVE_CHARSET_hebrew */
00443 /* #undef HAVE_CHARSET_hp8 */
00444 /* #undef HAVE_CHARSET_keybcs2 */
00445 /* #undef HAVE_CHARSET_koi8r */
00446 /* #undef HAVE_CHARSET_koi8u */
00447 #define HAVE_CHARSET_latin1 1
00448 //#define HAVE_CHARSET_latin2 1
00449 /* #undef HAVE_CHARSET_latin5 */
00450 /* #undef HAVE_CHARSET_latin7 */
00451 /* #undef HAVE_CHARSET_macce */
00452 /* #undef HAVE_CHARSET_macroman */
00453 //#define HAVE_CHARSET_sjis 1
00454 /* #undef HAVE_CHARSET_swe7 */
00455 //#define HAVE_CHARSET_tis620 1
00456 //#define HAVE_CHARSET_ucs2 1
00457 //#define HAVE_CHARSET_ujis 1
00458 #define HAVE_CHARSET_utf8 1
00459 #define HAVE_UCA_COLLATIONS 1
00460 
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'