Eneboo - Documentación para desarrolladores
src/libmysql_macosx/include/my_global.h
Ir a la documentación de este archivo.
00001 /* Copyright (C) 2000-2003 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; either version 2 of the License, or
00006    (at your option) any later version.
00007 
00008    This program is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011    GNU General Public License for more details.
00012 
00013    You should have received a copy of the GNU General Public License
00014    along with this program; if not, write to the Free Software
00015    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
00016 
00017 /* This is the include file that should be included 'first' in every C file. */
00018 
00019 #ifndef _global_h
00020 #define _global_h
00021 
00022 #ifndef EMBEDDED_LIBRARY
00023 #define HAVE_REPLICATION
00024 #define HAVE_EXTERNAL_CLIENT
00025 #endif
00026 
00027 #if defined( __EMX__) && !defined( MYSQL_SERVER)
00028 /* moved here to use below VOID macro redefinition */
00029 #define INCL_BASE
00030 #define INCL_NOPMAPI
00031 #include <os2.h>
00032 #endif /* __EMX__ */
00033 
00034 #ifdef __CYGWIN__
00035 /* We use a Unix API, so pretend it's not Windows */
00036 #undef WIN
00037 #undef WIN32
00038 #undef _WIN
00039 #undef _WIN32
00040 #undef _WIN64
00041 #undef __WIN__
00042 #undef __WIN32__
00043 #define HAVE_ERRNO_AS_DEFINE
00044 #endif /* __CYGWIN__ */
00045 
00046 /* to make command line shorter we'll define USE_PRAGMA_INTERFACE here */
00047 #ifdef USE_PRAGMA_IMPLEMENTATION
00048 #define USE_PRAGMA_INTERFACE
00049 #endif
00050 
00051 #if defined(i386) && !defined(__i386__)
00052 #define __i386__
00053 #endif
00054 
00055 /* Macros to make switching between C and C++ mode easier */
00056 #ifdef __cplusplus
00057 #define C_MODE_START    extern "C" {
00058 #define C_MODE_END      }
00059 #else
00060 #define C_MODE_START
00061 #define C_MODE_END
00062 #endif
00063 
00064 #if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
00065 #include <config-win.h>
00066 #elif defined(OS2)
00067 #include <config-os2.h>
00068 #elif defined(__NETWARE__)
00069 #include <my_config.h>
00070 #include <config-netware.h>
00071 #if defined(__cplusplus) && defined(inline)
00072 #undef inline                           /* fix configure problem */
00073 #endif
00074 #else
00075 #include <my_config.h>
00076 #if defined(__cplusplus) && defined(inline)
00077 #undef inline                           /* fix configure problem */
00078 #endif
00079 #endif /* _WIN32... */
00080 
00081 /* Some defines to avoid ifdefs in the code */
00082 #ifndef NETWARE_YIELD
00083 #define NETWARE_YIELD
00084 #define NETWARE_SET_SCREEN_MODE(A)
00085 #endif
00086 
00087 /*
00088   The macros below are borrowed from include/linux/compiler.h in the
00089   Linux kernel. Use them to indicate the likelyhood of the truthfulness
00090   of a condition. This serves two purposes - newer versions of gcc will be
00091   able to optimize for branch predication, which could yield siginficant
00092   performance gains in frequently executed sections of the code, and the
00093   other reason to use them is for documentation
00094 */
00095 
00096 #if !defined(__GNUC__) || (__GNUC__ == 2 && __GNUC_MINOR__ < 96)
00097 #define __builtin_expect(x, expected_value) (x)
00098 #endif
00099 
00100 #define likely(x)       __builtin_expect((x),1)
00101 #define unlikely(x)     __builtin_expect((x),0)
00102 
00103 
00104 /* Fix problem with S_ISLNK() on Linux */
00105 #if defined(TARGET_OS_LINUX)
00106 #undef  _GNU_SOURCE
00107 #define _GNU_SOURCE 1
00108 #endif
00109 
00110 /* The client defines this to avoid all thread code */
00111 #if defined(UNDEF_THREADS_HACK)
00112 #undef THREAD
00113 #undef HAVE_mit_thread
00114 #undef HAVE_LINUXTHREADS
00115 #undef HAVE_NPTL
00116 #undef HAVE_UNIXWARE7_THREADS
00117 #endif
00118 
00119 #ifdef HAVE_THREADS_WITHOUT_SOCKETS
00120 /* MIT pthreads does not work with unix sockets */
00121 #undef HAVE_SYS_UN_H
00122 #endif
00123 
00124 #define __EXTENSIONS__ 1        /* We want some extension */
00125 #ifndef __STDC_EXT__
00126 #define __STDC_EXT__ 1          /* To get large file support on hpux */
00127 #endif
00128 
00129 #if defined(THREAD) && !defined(__WIN__) && !defined(OS2)
00130 #ifndef _POSIX_PTHREAD_SEMANTICS
00131 #define _POSIX_PTHREAD_SEMANTICS /* We want posix threads */
00132 #endif
00133 
00134 #if !defined(SCO)
00135 #define _REENTRANT      1       /* Some thread libraries require this */
00136 #endif
00137 #if !defined(_THREAD_SAFE) && !defined(_AIX)
00138 #define _THREAD_SAFE            /* Required for OSF1 */
00139 #endif
00140 #ifndef HAVE_mit_thread
00141 #ifdef HAVE_UNIXWARE7_THREADS
00142 #include <thread.h>
00143 #else
00144 #if defined(HPUX10) || defined(HPUX11)
00145 C_MODE_START                    /* HPUX needs this, signal.h bug */
00146 #include <pthread.h>
00147 C_MODE_END
00148 #else
00149 #include <pthread.h>            /* AIX must have this included first */
00150 #endif
00151 #endif /* HAVE_UNIXWARE7_THREADS */
00152 #endif /* HAVE_mit_thread */
00153 #if !defined(SCO) && !defined(_REENTRANT)
00154 #define _REENTRANT      1       /* Threads requires reentrant code */
00155 #endif
00156 #endif /* THREAD */
00157 
00158 /* Go around some bugs in different OS and compilers */
00159 #ifdef _AIX                     /* By soren@t.dk */
00160 #define _H_STRINGS
00161 #define _SYS_STREAM_H
00162 /* #define _AIX32_CURSES */     /* XXX: this breaks AIX 4.3.3 (others?). */
00163 #define ulonglong2double(A) my_ulonglong2double(A)
00164 #define my_off_t2double(A)  my_ulonglong2double(A)
00165 C_MODE_START
00166 double my_ulonglong2double(unsigned long long A);
00167 C_MODE_END
00168 #endif /* _AIX */
00169 
00170 #ifdef HAVE_BROKEN_SNPRINTF     /* HPUX 10.20 don't have this defined */
00171 #undef HAVE_SNPRINTF
00172 #endif
00173 #ifdef HAVE_BROKEN_PREAD
00174 /*
00175   pread()/pwrite() are not 64 bit safe on HP-UX 11.0 without
00176   installing the kernel patch PHKL_20349 or greater
00177 */
00178 #undef HAVE_PREAD
00179 #undef HAVE_PWRITE
00180 #endif
00181 #if defined(HAVE_BROKEN_INLINE) && !defined(__cplusplus)
00182 #undef inline
00183 #define inline
00184 #endif
00185 
00186 #ifdef UNDEF_HAVE_GETHOSTBYNAME_R               /* For OSF4.x */
00187 #undef HAVE_GETHOSTBYNAME_R
00188 #endif
00189 #ifdef UNDEF_HAVE_INITGROUPS                    /* For AIX 4.3 */
00190 #undef HAVE_INITGROUPS
00191 #endif
00192 
00193 /* gcc/egcs issues */
00194 
00195 #if defined(__GNUC) && defined(__EXCEPTIONS)
00196 #error "Please add -fno-exceptions to CXXFLAGS and reconfigure/recompile"
00197 #endif
00198 
00199 
00200 /* Fix a bug in gcc 2.8.0 on IRIX 6.2 */
00201 #if SIZEOF_LONG == 4 && defined(__LONG_MAX__)
00202 #undef __LONG_MAX__             /* Is a longlong value in gcc 2.8.0 ??? */
00203 #define __LONG_MAX__ 2147483647
00204 #endif
00205 
00206 /* Fix problem when linking c++ programs with gcc 3.x */
00207 #ifdef DEFINE_CXA_PURE_VIRTUAL
00208 #define FIX_GCC_LINKING_PROBLEM \
00209 C_MODE_START int __cxa_pure_virtual() {\
00210   DBUG_ASSERT("Pure virtual method called." == "Aborted");\
00211   return 0;\
00212 } C_MODE_END
00213 #else
00214 #define FIX_GCC_LINKING_PROBLEM
00215 #endif
00216 
00217 /* egcs 1.1.2 has a problem with memcpy on Alpha */
00218 #if defined(__GNUC__) && defined(__alpha__) && ! (__GNUC__ > 2 || (__GNUC__ == 2 &&  __GNUC_MINOR__ >= 95))
00219 #define BAD_MEMCPY
00220 #endif
00221 
00222 #if defined(_lint) && !defined(lint)
00223 #define lint
00224 #endif
00225 #if SIZEOF_LONG_LONG > 4 && !defined(_LONG_LONG)
00226 #define _LONG_LONG 1            /* For AIX string library */
00227 #endif
00228 
00229 #ifndef stdin
00230 #include <stdio.h>
00231 #endif
00232 #ifdef HAVE_STDLIB_H
00233 #include <stdlib.h>
00234 #endif
00235 #ifdef HAVE_STDDEF_H
00236 #include <stddef.h>
00237 #endif
00238 
00239 #include <math.h>
00240 #ifdef HAVE_LIMITS_H
00241 #include <limits.h>
00242 #endif
00243 #ifdef HAVE_FLOAT_H
00244 #include <float.h>
00245 #endif
00246 
00247 #ifdef HAVE_SYS_TYPES_H
00248 #include <sys/types.h>
00249 #endif
00250 #ifdef HAVE_FCNTL_H
00251 #include <fcntl.h>
00252 #endif
00253 #ifdef HAVE_SYS_TIMEB_H
00254 #include <sys/timeb.h>                          /* Avoid warnings on SCO */
00255 #endif
00256 #if TIME_WITH_SYS_TIME
00257 # include <sys/time.h>
00258 # include <time.h>
00259 #else
00260 # if HAVE_SYS_TIME_H
00261 #  include <sys/time.h>
00262 # else
00263 #  include <time.h>
00264 # endif
00265 #endif /* TIME_WITH_SYS_TIME */
00266 #ifdef HAVE_UNISTD_H
00267 #include <unistd.h>
00268 #endif
00269 #if defined(__cplusplus) && defined(NO_CPLUSPLUS_ALLOCA)
00270 #undef HAVE_ALLOCA
00271 #undef HAVE_ALLOCA_H
00272 #endif
00273 #ifdef HAVE_ALLOCA_H
00274 #include <alloca.h>
00275 #endif
00276 #ifdef HAVE_ATOMIC_ADD
00277 #define new my_arg_new
00278 #define need_to_restore_new 1
00279 C_MODE_START
00280 #include <asm/atomic.h>
00281 C_MODE_END
00282 #ifdef need_to_restore_new /* probably safer than #ifdef new */
00283 #undef new
00284 #undef need_to_restore_new
00285 #endif
00286 #endif
00287 #include <errno.h>                              /* Recommended by debian */
00288 /* We need the following to go around a problem with openssl on solaris */
00289 #if defined(HAVE_CRYPT_H)
00290 #include <crypt.h>
00291 #endif
00292 
00293 /*
00294   A lot of our programs uses asserts, so better to always include it
00295   This also fixes a problem when people uses DBUG_ASSERT without including
00296   assert.h
00297 */
00298 #include <assert.h>
00299 
00300 /* Go around some bugs in different OS and compilers */
00301 #if defined(_HPUX_SOURCE) && defined(HAVE_SYS_STREAM_H)
00302 #include <sys/stream.h>         /* HPUX 10.20 defines ulong here. UGLY !!! */
00303 #define HAVE_ULONG
00304 #endif
00305 #ifdef DONT_USE_FINITE          /* HPUX 11.x has is_finite() */
00306 #undef HAVE_FINITE
00307 #endif
00308 #if defined(HPUX10) && defined(_LARGEFILE64_SOURCE) && defined(THREAD)
00309 /* Fix bug in setrlimit */
00310 #undef setrlimit
00311 #define setrlimit cma_setrlimit64
00312 #endif
00313 /* Declare madvise where it is not declared for C++, like Solaris */
00314 #if HAVE_MADVISE && !HAVE_DECL_MADVISE && defined(__cplusplus)
00315 extern "C" int madvise(void *addr, size_t len, int behav);
00316 #endif
00317 
00318 #ifdef __QNXNTO__
00319 /* This has to be after include limits.h */
00320 #define HAVE_ERRNO_AS_DEFINE
00321 #define HAVE_FCNTL_LOCK
00322 #undef  HAVE_FINITE
00323 #undef  LONGLONG_MIN            /* These get wrongly defined in QNX 6.2 */
00324 #undef  LONGLONG_MAX            /* standard system library 'limits.h' */
00325 #ifdef __cplusplus
00326 #define HAVE_RINT               /* rint() and isnan() functions are not */
00327 #define rint(a) std::rint(a)    /* visible in C++ scope due to an error */
00328 #define isnan(a) std::isnan(a)  /* in the usr/include/math.h on QNX     */
00329 #endif
00330 #endif
00331 
00332 /* We can not live without the following defines */
00333 
00334 #define USE_MYFUNC 1            /* Must use syscall indirection */
00335 #define MASTER 1                /* Compile without unireg */
00336 #define ENGLISH 1               /* Messages in English */
00337 #define POSIX_MISTAKE 1         /* regexp: Fix stupid spec error */
00338 #define USE_REGEX 1             /* We want the use the regex library */
00339 /* Do not define for ultra sparcs */
00340 #ifndef OS2
00341 #define USE_BMOVE512 1          /* Use this unless system bmove is faster */
00342 #endif
00343 
00344 #define QUOTE_ARG(x)            #x      /* Quote argument (before cpp) */
00345 #define STRINGIFY_ARG(x) QUOTE_ARG(x)   /* Quote argument, after cpp */
00346 
00347 /* Paranoid settings. Define I_AM_PARANOID if you are paranoid */
00348 #ifdef I_AM_PARANOID
00349 #define DONT_ALLOW_USER_CHANGE 1
00350 #define DONT_USE_MYSQL_PWD 1
00351 #endif
00352 
00353 /* Does the system remember a signal handler after a signal ? */
00354 #ifndef HAVE_BSD_SIGNALS
00355 #define DONT_REMEMBER_SIGNAL
00356 #endif
00357 
00358 /* Define void to stop lint from generating "null effekt" comments */
00359 #ifndef DONT_DEFINE_VOID
00360 #ifdef _lint
00361 int     __void__;
00362 #define VOID(X)         (__void__ = (int) (X))
00363 #else
00364 #undef VOID
00365 #define VOID(X)         (X)
00366 #endif
00367 #endif /* DONT_DEFINE_VOID */
00368 
00369 #if defined(_lint) || defined(FORCE_INIT_OF_VARS)
00370 #define LINT_INIT(var)  var=0                   /* No uninitialize-warning */
00371 #else
00372 #define LINT_INIT(var)
00373 #endif
00374 
00375 #if defined(_lint) || defined(FORCE_INIT_OF_VARS) || defined(HAVE_purify)
00376 #define PURIFY_OR_LINT_INIT(var) var=0
00377 #else
00378 #define PURIFY_OR_LINT_INIT(var)
00379 #endif
00380 
00381 /* Define some useful general macros */
00382 #if !defined(max)
00383 #define max(a, b)       ((a) > (b) ? (a) : (b))
00384 #define min(a, b)       ((a) < (b) ? (a) : (b))
00385 #endif
00386 
00387 #if defined(__EMX__) || !defined(HAVE_UINT)
00388 #undef HAVE_UINT
00389 #define HAVE_UINT
00390 typedef unsigned int uint;
00391 typedef unsigned short ushort;
00392 #endif
00393 
00394 #define CMP_NUM(a,b)    (((a) < (b)) ? -1 : ((a) == (b)) ? 0 : 1)
00395 #define sgn(a)          (((a) < 0) ? -1 : ((a) > 0) ? 1 : 0)
00396 #define swap_variables(t, a, b) { register t dummy; dummy= a; a= b; b= dummy; }
00397 #define test(a)         ((a) ? 1 : 0)
00398 #define set_if_bigger(a,b)  do { if ((a) < (b)) (a)=(b); } while(0)
00399 #define set_if_smaller(a,b) do { if ((a) > (b)) (a)=(b); } while(0)
00400 #define test_all_bits(a,b) (((a) & (b)) == (b))
00401 #define set_bits(type, bit_count) (sizeof(type)*8 <= (bit_count) ? ~(type) 0 : ((((type) 1) << (bit_count)) - (type) 1))
00402 #define array_elements(A) ((uint) (sizeof(A)/sizeof(A[0])))
00403 #ifndef HAVE_RINT
00404 #define rint(A) floor((A)+(((A) < 0)? -0.5 : 0.5))
00405 #endif
00406 
00407 /* Define some general constants */
00408 #ifndef TRUE
00409 #define TRUE            (1)     /* Logical true */
00410 #define FALSE           (0)     /* Logical false */
00411 #endif
00412 
00413 #if defined(__GNUC__)
00414 #define function_volatile       volatile
00415 #define my_reinterpret_cast(A) reinterpret_cast<A>
00416 #define my_const_cast(A) const_cast<A>
00417 #elif !defined(my_reinterpret_cast)
00418 #define my_reinterpret_cast(A) (A)
00419 #define my_const_cast(A) (A)
00420 #endif
00421 #if !defined(__attribute__) && (defined(__cplusplus) || !defined(__GNUC__)  || __GNUC__ == 2 && __GNUC_MINOR__ < 8)
00422 #define __attribute__(A)
00423 #endif
00424 
00425 /* From old s-system.h */
00426 
00427 /*
00428   Support macros for non ansi & other old compilers. Since such
00429   things are no longer supported we do nothing. We keep then since
00430   some of our code may still be needed to upgrade old customers.
00431 */
00432 #define _VARARGS(X) X
00433 #define _STATIC_VARARGS(X) X
00434 #define _PC(X)  X
00435 
00436 #if defined(DBUG_ON) && defined(DBUG_OFF)
00437 #undef DBUG_OFF
00438 #endif
00439 
00440 #if defined(_lint) && !defined(DBUG_OFF)
00441 #define DBUG_OFF
00442 #endif
00443 
00444 #include <my_dbug.h>
00445 
00446 #define MIN_ARRAY_SIZE  0       /* Zero or One. Gcc allows zero*/
00447 #define ASCII_BITS_USED 8       /* Bit char used */
00448 #define NEAR_F                  /* No near function handling */
00449 
00450 /* Some types that is different between systems */
00451 
00452 typedef int     File;           /* File descriptor */
00453 #ifndef Socket_defined
00454 typedef int     my_socket;      /* File descriptor for sockets */
00455 #define INVALID_SOCKET -1
00456 #endif
00457 /* Type for fuctions that handles signals */
00458 #define sig_handler RETSIGTYPE
00459 C_MODE_START
00460 typedef void    (*sig_return)();/* Returns type from signal */
00461 C_MODE_END
00462 #if defined(__GNUC__) && !defined(_lint)
00463 typedef char    pchar;          /* Mixed prototypes can take char */
00464 typedef char    puchar;         /* Mixed prototypes can take char */
00465 typedef char    pbool;          /* Mixed prototypes can take char */
00466 typedef short   pshort;         /* Mixed prototypes can take short int */
00467 typedef float   pfloat;         /* Mixed prototypes can take float */
00468 #else
00469 typedef int     pchar;          /* Mixed prototypes can't take char */
00470 typedef uint    puchar;         /* Mixed prototypes can't take char */
00471 typedef int     pbool;          /* Mixed prototypes can't take char */
00472 typedef int     pshort;         /* Mixed prototypes can't take short int */
00473 typedef double  pfloat;         /* Mixed prototypes can't take float */
00474 #endif
00475 C_MODE_START
00476 typedef int     (*qsort_cmp)(const void *,const void *);
00477 typedef int     (*qsort_cmp2)(void*, const void *,const void *);
00478 C_MODE_END
00479 #ifdef HAVE_mit_thread
00480 #define qsort_t void
00481 #undef QSORT_TYPE_IS_VOID
00482 #define QSORT_TYPE_IS_VOID
00483 #else
00484 #define qsort_t RETQSORTTYPE    /* Broken GCC cant handle typedef !!!! */
00485 #endif
00486 #ifdef HAVE_mit_thread
00487 #define size_socket socklen_t   /* Type of last arg to accept */
00488 #else
00489 #ifdef HAVE_SYS_SOCKET_H
00490 #include <sys/socket.h>
00491 #endif
00492 typedef SOCKET_SIZE_TYPE size_socket;
00493 #endif
00494 
00495 #ifndef SOCKOPT_OPTLEN_TYPE
00496 #define SOCKOPT_OPTLEN_TYPE size_socket
00497 #endif
00498 
00499 /* file create flags */
00500 
00501 #ifndef O_SHARE                 /* Probably not windows */
00502 #define O_SHARE         0       /* Flag to my_open for shared files */
00503 #ifndef O_BINARY
00504 #define O_BINARY        0       /* Flag to my_open for binary files */
00505 #endif
00506 #ifndef FILE_BINARY
00507 #define FILE_BINARY     O_BINARY /* Flag to my_fopen for binary streams */
00508 #endif
00509 #ifdef HAVE_FCNTL
00510 #define HAVE_FCNTL_LOCK
00511 #define F_TO_EOF        0L      /* Param to lockf() to lock rest of file */
00512 #endif
00513 #endif /* O_SHARE */
00514 
00515 #ifndef O_TEMPORARY
00516 #define O_TEMPORARY     0
00517 #endif
00518 #ifndef O_SHORT_LIVED
00519 #define O_SHORT_LIVED   0
00520 #endif
00521 #ifndef O_NOFOLLOW
00522 #define O_NOFOLLOW      0
00523 #endif
00524 
00525 /* #define USE_RECORD_LOCK      */
00526 
00527         /* Unsigned types supported by the compiler */
00528 #define UNSINT8                 /* unsigned int8 (char) */
00529 #define UNSINT16                /* unsigned int16 */
00530 #define UNSINT32                /* unsigned int32 */
00531 
00532         /* General constants */
00533 #define SC_MAXWIDTH     256     /* Max width of screen (for error messages) */
00534 #define FN_LEN          256     /* Max file name len */
00535 #define FN_HEADLEN      253     /* Max length of filepart of file name */
00536 #define FN_EXTLEN       20      /* Max length of extension (part of FN_LEN) */
00537 #ifdef PATH_MAX
00538 #define FN_REFLEN       PATH_MAX/* Max length of full path-name */
00539 #else
00540 #define FN_REFLEN       512     /* Max length of full path-name */
00541 #endif
00542 #define FN_EXTCHAR      '.'
00543 #define FN_HOMELIB      '~'     /* ~/ is used as abbrev for home dir */
00544 #define FN_CURLIB       '.'     /* ./ is used as abbrev for current dir */
00545 #define FN_PARENTDIR    ".."    /* Parent directory; Must be a string */
00546 #define FN_DEVCHAR      ':'
00547 
00548 #ifndef FN_LIBCHAR
00549 #ifdef __EMX__
00550 #define FN_LIBCHAR      '\\'
00551 #define FN_ROOTDIR      "\\"
00552 #else
00553 #define FN_LIBCHAR      '/'
00554 #define FN_ROOTDIR      "/"
00555 #endif
00556 #endif
00557 #define MY_NFILE        64      /* This is only used to save filenames */
00558 #ifndef OS_FILE_LIMIT
00559 #define OS_FILE_LIMIT   65535
00560 #endif
00561 
00562 /* #define EXT_IN_LIBNAME     */
00563 /* #define FN_NO_CASE_SENCE   */
00564 /* #define FN_UPPER_CASE TRUE */
00565 
00566 /*
00567   Io buffer size; Must be a power of 2 and a multiple of 512. May be
00568   smaller what the disk page size. This influences the speed of the
00569   isam btree library. eg to big to slow.
00570 */
00571 #define IO_SIZE                 4096
00572 /*
00573   How much overhead does malloc have. The code often allocates
00574   something like 1024-MALLOC_OVERHEAD bytes
00575 */
00576 #ifdef SAFEMALLOC
00577 #define MALLOC_OVERHEAD (8+24+4)
00578 #else
00579 #define MALLOC_OVERHEAD 8
00580 #endif
00581         /* get memory in huncs */
00582 #define ONCE_ALLOC_INIT         (uint) (4096-MALLOC_OVERHEAD)
00583         /* Typical record cash */
00584 #define RECORD_CACHE_SIZE       (uint) (64*1024-MALLOC_OVERHEAD)
00585         /* Typical key cash */
00586 #define KEY_CACHE_SIZE          (uint) (8*1024*1024-MALLOC_OVERHEAD)
00587         /* Default size of a key cache block  */
00588 #define KEY_CACHE_BLOCK_SIZE    (uint) 1024
00589 
00590 
00591         /* Some things that this system doesn't have */
00592 
00593 #define NO_HASH                 /* Not needed anymore */
00594 #ifdef __WIN__
00595 #define NO_DIR_LIBRARY          /* Not standar dir-library */
00596 #define USE_MY_STAT_STRUCT      /* For my_lib */
00597 #endif
00598 
00599 /* Some defines of functions for portability */
00600 
00601 #undef remove           /* Crashes MySQL on SCO 5.0.0 */
00602 #ifndef __WIN__
00603 #ifdef OS2
00604 #define closesocket(A)  soclose(A)
00605 #else
00606 #define closesocket(A)  close(A)
00607 #endif
00608 #ifndef ulonglong2double
00609 #define ulonglong2double(A) ((double) (ulonglong) (A))
00610 #define my_off_t2double(A)  ((double) (my_off_t) (A))
00611 #endif
00612 #endif
00613 
00614 #ifndef offsetof
00615 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
00616 #endif
00617 #define ulong_to_double(X) ((double) (ulong) (X))
00618 #define SET_STACK_SIZE(X)       /* Not needed on real machines */
00619 
00620 #if !defined(HAVE_mit_thread) && !defined(HAVE_STRTOK_R)
00621 #define strtok_r(A,B,C) strtok((A),(B))
00622 #endif
00623 
00624 /* Remove some things that mit_thread break or doesn't support */
00625 #if defined(HAVE_mit_thread) && defined(THREAD)
00626 #undef HAVE_PREAD
00627 #undef HAVE_REALPATH
00628 #undef HAVE_MLOCK
00629 #undef HAVE_TEMPNAM                             /* Use ours */
00630 #undef HAVE_PTHREAD_SETPRIO
00631 #undef HAVE_FTRUNCATE
00632 #undef HAVE_READLINK
00633 #endif
00634 
00635 /* This is from the old m-machine.h file */
00636 
00637 #if SIZEOF_LONG_LONG > 4
00638 #define HAVE_LONG_LONG 1
00639 #endif
00640 
00641 /*
00642   Some pre-ANSI-C99 systems like AIX 5.1 and Linux/GCC 2.95 define
00643   ULONGLONG_MAX, LONGLONG_MIN, LONGLONG_MAX; we use them if they're defined.
00644   Also on Windows we define these constants by hand in config-win.h.
00645 */
00646 
00647 #if defined(HAVE_LONG_LONG) && !defined(LONGLONG_MIN)
00648 #define LONGLONG_MIN    ((long long) 0x8000000000000000LL)
00649 #define LONGLONG_MAX    ((long long) 0x7FFFFFFFFFFFFFFFLL)
00650 #endif
00651 
00652 #if defined(HAVE_LONG_LONG) && !defined(ULONGLONG_MAX)
00653 /* First check for ANSI C99 definition: */
00654 #ifdef ULLONG_MAX
00655 #define ULONGLONG_MAX  ULLONG_MAX
00656 #else
00657 #define ULONGLONG_MAX ((unsigned long long)(~0ULL))
00658 #endif
00659 #endif /* defined (HAVE_LONG_LONG) && !defined(ULONGLONG_MAX)*/
00660 
00661 #define INT_MIN32       (~0x7FFFFFFFL)
00662 #define INT_MAX32       0x7FFFFFFFL
00663 #define UINT_MAX32      0xFFFFFFFFL
00664 #define INT_MIN24       (~0x007FFFFF)
00665 #define INT_MAX24       0x007FFFFF
00666 #define UINT_MAX24      0x00FFFFFF
00667 #define INT_MIN16       (~0x7FFF)
00668 #define INT_MAX16       0x7FFF
00669 #define UINT_MAX16      0xFFFF
00670 #define INT_MIN8        (~0x7F)
00671 #define INT_MAX8        0x7F
00672 
00673 /* From limits.h instead */
00674 #ifndef DBL_MIN
00675 #define DBL_MIN         4.94065645841246544e-324
00676 #define FLT_MIN         ((float)1.40129846432481707e-45)
00677 #endif
00678 #ifndef DBL_MAX
00679 #define DBL_MAX         1.79769313486231470e+308
00680 #define FLT_MAX         ((float)3.40282346638528860e+38)
00681 #endif
00682 
00683 #if !defined(HAVE_ISINF) && !defined(isinf)
00684 #define isinf(X)    0
00685 #endif
00686 
00687 /*
00688   Max size that must be added to a so that we know Size to make
00689   adressable obj.
00690 */
00691 #if SIZEOF_CHARP == 4
00692 typedef long            my_ptrdiff_t;
00693 #else
00694 typedef long long       my_ptrdiff_t;
00695 #endif
00696 
00697 #define MY_ALIGN(A,L)   (((A) + (L) - 1) & ~((L) - 1))
00698 #define ALIGN_SIZE(A)   MY_ALIGN((A),sizeof(double))
00699 /* Size to make adressable obj. */
00700 #define ALIGN_PTR(A, t) ((t*) MY_ALIGN((A),sizeof(t)))
00701                          /* Offset of field f in structure t */
00702 #define OFFSET(t, f)    ((size_t)(char *)&((t *)0)->f)
00703 #define ADD_TO_PTR(ptr,size,type) (type) ((byte*) (ptr)+size)
00704 #define PTR_BYTE_DIFF(A,B) (my_ptrdiff_t) ((byte*) (A) - (byte*) (B))
00705 
00706 #define NullS           (char *) 0
00707 /* Nowdays we do not support MessyDos */
00708 #ifndef NEAR
00709 #define NEAR                            /* Who needs segments ? */
00710 #define FAR                             /* On a good machine */
00711 #ifndef HUGE_PTR
00712 #define HUGE_PTR
00713 #endif
00714 #endif
00715 #if defined(__IBMC__) || defined(__IBMCPP__)
00716 /* This was  _System _Export but caused a lot of warnings on _AIX43 */
00717 #define STDCALL
00718 #elif !defined( STDCALL)
00719 #define STDCALL
00720 #endif
00721 
00722 /* Typdefs for easyier portability */
00723 
00724 #if defined(VOIDTYPE)
00725 typedef void    *gptr;          /* Generic pointer */
00726 #else
00727 typedef char    *gptr;          /* Generic pointer */
00728 #endif
00729 #ifndef HAVE_INT_8_16_32
00730 typedef signed char int8;       /* Signed integer >= 8  bits */
00731 typedef short   int16;          /* Signed integer >= 16 bits */
00732 #endif
00733 #ifndef HAVE_UCHAR
00734 typedef unsigned char   uchar;  /* Short for unsigned char */
00735 #endif
00736 typedef unsigned char   uint8;  /* Short for unsigned integer >= 8  bits */
00737 typedef unsigned short  uint16; /* Short for unsigned integer >= 16 bits */
00738 
00739 #if SIZEOF_INT == 4
00740 #ifndef HAVE_INT_8_16_32
00741 typedef int             int32;
00742 #endif
00743 typedef unsigned int    uint32; /* Short for unsigned integer >= 32 bits */
00744 #elif SIZEOF_LONG == 4
00745 #ifndef HAVE_INT_8_16_32
00746 typedef long            int32;
00747 #endif
00748 typedef unsigned long   uint32; /* Short for unsigned integer >= 32 bits */
00749 #else
00750 error "Neither int or long is of 4 bytes width"
00751 #endif
00752 
00753 #if !defined(HAVE_ULONG) && !defined(TARGET_OS_LINUX) && !defined(__USE_MISC)
00754 typedef unsigned long   ulong;            /* Short for unsigned long */
00755 #endif
00756 #ifndef longlong_defined
00757 #if defined(HAVE_LONG_LONG) && SIZEOF_LONG != 8
00758 typedef unsigned long long int ulonglong; /* ulong or unsigned long long */
00759 typedef long long int   longlong;
00760 #else
00761 typedef unsigned long   ulonglong;        /* ulong or unsigned long long */
00762 typedef long            longlong;
00763 #endif
00764 #endif
00765 
00766 #if defined(NO_CLIENT_LONG_LONG)
00767 typedef unsigned long my_ulonglong;
00768 #elif defined (__WIN__)
00769 typedef unsigned __int64 my_ulonglong;
00770 #else
00771 typedef unsigned long long my_ulonglong;
00772 #endif
00773 
00774 #ifdef USE_RAID
00775 /*
00776   The following is done with a if to not get problems with pre-processors
00777   with late define evaluation
00778 */
00779 #if SIZEOF_OFF_T == 4
00780 #define SYSTEM_SIZEOF_OFF_T 4
00781 #else
00782 #define SYSTEM_SIZEOF_OFF_T 8
00783 #endif
00784 #undef  SIZEOF_OFF_T
00785 #define SIZEOF_OFF_T        8
00786 #else
00787 #define SYSTEM_SIZEOF_OFF_T SIZEOF_OFF_T
00788 #endif /* USE_RAID */
00789 
00790 #if SIZEOF_OFF_T > 4
00791 typedef ulonglong my_off_t;
00792 #else
00793 typedef unsigned long my_off_t;
00794 #endif
00795 #define MY_FILEPOS_ERROR        (~(my_off_t) 0)
00796 #if !defined(__WIN__) && !defined(OS2)
00797 typedef off_t os_off_t;
00798 #endif
00799 
00800 #if defined(__WIN__)
00801 #define socket_errno    WSAGetLastError()
00802 #define SOCKET_EINTR    WSAEINTR
00803 #define SOCKET_EAGAIN   WSAEINPROGRESS
00804 #define SOCKET_ETIMEDOUT WSAETIMEDOUT
00805 #define SOCKET_EWOULDBLOCK WSAEWOULDBLOCK
00806 #define SOCKET_ENFILE   ENFILE
00807 #define SOCKET_EMFILE   EMFILE
00808 #elif defined(OS2)
00809 #define socket_errno    sock_errno()
00810 #define SOCKET_EINTR    SOCEINTR
00811 #define SOCKET_EAGAIN   SOCEINPROGRESS
00812 #define SOCKET_ETIMEDOUT SOCKET_EINTR
00813 #define SOCKET_EWOULDBLOCK SOCEWOULDBLOCK
00814 #define SOCKET_ENFILE   SOCENFILE
00815 #define SOCKET_EMFILE   SOCEMFILE
00816 #define closesocket(A)  soclose(A)
00817 #else /* Unix */
00818 #define socket_errno    errno
00819 #define closesocket(A)  close(A)
00820 #define SOCKET_EINTR    EINTR
00821 #define SOCKET_EAGAIN   EAGAIN
00822 #define SOCKET_ETIMEDOUT SOCKET_EINTR
00823 #define SOCKET_EWOULDBLOCK EWOULDBLOCK
00824 #define SOCKET_ENFILE   ENFILE
00825 #define SOCKET_EMFILE   EMFILE
00826 #endif
00827 
00828 typedef uint8           int7;   /* Most effective integer 0 <= x <= 127 */
00829 typedef short           int15;  /* Most effective integer 0 <= x <= 32767 */
00830 typedef char            *my_string; /* String of characters */
00831 typedef unsigned long   size_s; /* Size of strings (In string-funcs) */
00832 typedef int             myf;    /* Type of MyFlags in my_funcs */
00833 #ifndef byte_defined
00834 typedef char            byte;   /* Smallest addressable unit */
00835 #endif
00836 typedef char            my_bool; /* Small bool */
00837 #if !defined(bool) && !defined(bool_defined) && (!defined(HAVE_BOOL) || !defined(__cplusplus))
00838 typedef char            bool;   /* Ordinary boolean values 0 1 */
00839 #endif
00840         /* Macros for converting *constants* to the right type */
00841 #define INT8(v)         (int8) (v)
00842 #define INT16(v)        (int16) (v)
00843 #define INT32(v)        (int32) (v)
00844 #define MYF(v)          (myf) (v)
00845 
00846 #ifndef LL
00847 #ifdef HAVE_LONG_LONG
00848 #define LL(A) A ## LL
00849 #else
00850 #define LL(A) A ## L
00851 #endif
00852 #endif
00853 
00854 #ifndef ULL
00855 #ifdef HAVE_LONG_LONG
00856 #define ULL(A) A ## ULL
00857 #else
00858 #define ULL(A) A ## UL
00859 #endif
00860 #endif
00861 
00862 /*
00863   Defines to make it possible to prioritize register assignments. No
00864   longer that important with modern compilers.
00865 */
00866 #ifndef USING_X
00867 #define reg1 register
00868 #define reg2 register
00869 #define reg3 register
00870 #define reg4 register
00871 #define reg5 register
00872 #define reg6 register
00873 #define reg7 register
00874 #define reg8 register
00875 #define reg9 register
00876 #define reg10 register
00877 #define reg11 register
00878 #define reg12 register
00879 #define reg13 register
00880 #define reg14 register
00881 #define reg15 register
00882 #define reg16 register
00883 #endif
00884 
00885 /*
00886   Sometimes we want to make sure that the variable is not put into
00887   a register in debugging mode so we can see its value in the core
00888 */
00889 
00890 #ifndef DBUG_OFF
00891 #define dbug_volatile volatile
00892 #else
00893 #define dbug_volatile
00894 #endif
00895 
00896 /* Defines for time function */
00897 #define SCALE_SEC       100
00898 #define SCALE_USEC      10000
00899 #define MY_HOW_OFTEN_TO_ALARM   2       /* How often we want info on screen */
00900 #define MY_HOW_OFTEN_TO_WRITE   1000    /* How often we want info on screen */
00901 
00902 #ifndef set_timespec
00903 #ifdef HAVE_TIMESPEC_TS_SEC
00904 #define set_timespec(ABSTIME,SEC) { (ABSTIME).ts_sec=time(0) + (time_t) (SEC); (ABSTIME).ts_nsec=0; }
00905 #else
00906 #define set_timespec(ABSTIME,SEC) \
00907 {\
00908   struct timeval tv;\
00909   gettimeofday(&tv,0);\
00910   (ABSTIME).tv_sec=tv.tv_sec+(time_t) (SEC);\
00911   (ABSTIME).tv_nsec=tv.tv_usec*1000;\
00912 }
00913 #endif /* HAVE_TIMESPEC_TS_SEC */
00914 #endif /* set_timespec */
00915 
00916 /*
00917   Define-funktions for reading and storing in machine independent format
00918   (low byte first)
00919 */
00920 
00921 /* Optimized store functions for Intel x86 */
00922 #if defined(__i386__) && !defined(_WIN64)
00923 #define sint2korr(A)    (*((int16 *) (A)))
00924 #define sint3korr(A)    ((int32) ((((uchar) (A)[2]) & 128) ? \
00925                                   (((uint32) 255L << 24) | \
00926                                    (((uint32) (uchar) (A)[2]) << 16) |\
00927                                    (((uint32) (uchar) (A)[1]) << 8) | \
00928                                    ((uint32) (uchar) (A)[0])) : \
00929                                   (((uint32) (uchar) (A)[2]) << 16) |\
00930                                   (((uint32) (uchar) (A)[1]) << 8) | \
00931                                   ((uint32) (uchar) (A)[0])))
00932 #define sint4korr(A)    (*((long *) (A)))
00933 #define uint2korr(A)    (*((uint16 *) (A)))
00934 #ifdef HAVE_purify
00935 #define uint3korr(A)    (uint32) (((uint32) ((uchar) (A)[0])) +\
00936                                   (((uint32) ((uchar) (A)[1])) << 8) +\
00937                                   (((uint32) ((uchar) (A)[2])) << 16))
00938 #else
00939 /*
00940    ATTENTION !
00941    
00942     Please, note, uint3korr reads 4 bytes (not 3) !
00943     It means, that you have to provide enough allocated space !
00944 */
00945 #define uint3korr(A)    (long) (*((unsigned int *) (A)) & 0xFFFFFF)
00946 #endif
00947 #define uint4korr(A)    (*((unsigned long *) (A)))
00948 #define uint5korr(A)    ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
00949                                     (((uint32) ((uchar) (A)[1])) << 8) +\
00950                                     (((uint32) ((uchar) (A)[2])) << 16) +\
00951                                     (((uint32) ((uchar) (A)[3])) << 24)) +\
00952                                     (((ulonglong) ((uchar) (A)[4])) << 32))
00953 #define uint8korr(A)    (*((ulonglong *) (A)))
00954 #define sint8korr(A)    (*((longlong *) (A)))
00955 #define int2store(T,A)  *((uint16*) (T))= (uint16) (A)
00956 #define int3store(T,A)  do { *(T)=  (uchar) ((A));\
00957                             *(T+1)=(uchar) (((uint) (A) >> 8));\
00958                             *(T+2)=(uchar) (((A) >> 16)); } while (0)
00959 #define int4store(T,A)  *((long *) (T))= (long) (A)
00960 #define int5store(T,A)  do { *(T)= (uchar)((A));\
00961                              *((T)+1)=(uchar) (((A) >> 8));\
00962                              *((T)+2)=(uchar) (((A) >> 16));\
00963                              *((T)+3)=(uchar) (((A) >> 24)); \
00964                              *((T)+4)=(uchar) (((A) >> 32)); } while(0)
00965 #define int8store(T,A)  *((ulonglong *) (T))= (ulonglong) (A)
00966 
00967 typedef union {
00968   double v;
00969   long m[2];
00970 } doubleget_union;
00971 #define doubleget(V,M)  \
00972 do { doubleget_union _tmp; \
00973      _tmp.m[0] = *((long*)(M)); \
00974      _tmp.m[1] = *(((long*) (M))+1); \
00975      (V) = _tmp.v; } while(0)
00976 #define doublestore(T,V) do { *((long *) T) = ((doubleget_union *)&V)->m[0]; \
00977                              *(((long *) T)+1) = ((doubleget_union *)&V)->m[1]; \
00978                          } while (0)
00979 #define float4get(V,M) do { *((long *) &(V)) = *((long*) (M)); } while(0)
00980 #define float8get(V,M) doubleget((V),(M))
00981 #define float4store(V,M) memcpy((byte*) V,(byte*) (&M),sizeof(float))
00982 #define floatstore(T,V)  memcpy((byte*)(T), (byte*)(&V),sizeof(float))
00983 #define floatget(V,M)    memcpy((byte*) &V,(byte*) (M),sizeof(float))
00984 #define float8store(V,M) doublestore((V),(M))
00985 #endif /* __i386__ */
00986 
00987 #ifndef sint2korr
00988 /*
00989   We're here if it's not a IA-32 architecture (Win32 and UNIX IA-32 defines
00990   were done before)
00991 */
00992 #define sint2korr(A)    (int16) (((int16) ((uchar) (A)[0])) +\
00993                                  ((int16) ((int16) (A)[1]) << 8))
00994 #define sint3korr(A)    ((int32) ((((uchar) (A)[2]) & 128) ? \
00995                                   (((uint32) 255L << 24) | \
00996                                    (((uint32) (uchar) (A)[2]) << 16) |\
00997                                    (((uint32) (uchar) (A)[1]) << 8) | \
00998                                    ((uint32) (uchar) (A)[0])) : \
00999                                   (((uint32) (uchar) (A)[2]) << 16) |\
01000                                   (((uint32) (uchar) (A)[1]) << 8) | \
01001                                   ((uint32) (uchar) (A)[0])))
01002 #define sint4korr(A)    (int32) (((int32) ((uchar) (A)[0])) +\
01003                                 (((int32) ((uchar) (A)[1]) << 8)) +\
01004                                 (((int32) ((uchar) (A)[2]) << 16)) +\
01005                                 (((int32) ((int16) (A)[3]) << 24)))
01006 #define sint8korr(A)    (longlong) uint8korr(A)
01007 #define uint2korr(A)    (uint16) (((uint16) ((uchar) (A)[0])) +\
01008                                   ((uint16) ((uchar) (A)[1]) << 8))
01009 #define uint3korr(A)    (uint32) (((uint32) ((uchar) (A)[0])) +\
01010                                   (((uint32) ((uchar) (A)[1])) << 8) +\
01011                                   (((uint32) ((uchar) (A)[2])) << 16))
01012 #define uint4korr(A)    (uint32) (((uint32) ((uchar) (A)[0])) +\
01013                                   (((uint32) ((uchar) (A)[1])) << 8) +\
01014                                   (((uint32) ((uchar) (A)[2])) << 16) +\
01015                                   (((uint32) ((uchar) (A)[3])) << 24))
01016 #define uint5korr(A)    ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
01017                                     (((uint32) ((uchar) (A)[1])) << 8) +\
01018                                     (((uint32) ((uchar) (A)[2])) << 16) +\
01019                                     (((uint32) ((uchar) (A)[3])) << 24)) +\
01020                                     (((ulonglong) ((uchar) (A)[4])) << 32))
01021 #define uint8korr(A)    ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
01022                                     (((uint32) ((uchar) (A)[1])) << 8) +\
01023                                     (((uint32) ((uchar) (A)[2])) << 16) +\
01024                                     (((uint32) ((uchar) (A)[3])) << 24)) +\
01025                         (((ulonglong) (((uint32) ((uchar) (A)[4])) +\
01026                                     (((uint32) ((uchar) (A)[5])) << 8) +\
01027                                     (((uint32) ((uchar) (A)[6])) << 16) +\
01028                                     (((uint32) ((uchar) (A)[7])) << 24))) <<\
01029                                     32))
01030 #define int2store(T,A)       do { uint def_temp= (uint) (A) ;\
01031                                   *((uchar*) (T))=  (uchar)(def_temp); \
01032                                    *((uchar*) (T)+1)=(uchar)((def_temp >> 8)); \
01033                              } while(0)
01034 #define int3store(T,A)       do { /*lint -save -e734 */\
01035                                   *((uchar*)(T))=(uchar) ((A));\
01036                                   *((uchar*) (T)+1)=(uchar) (((A) >> 8));\
01037                                   *((uchar*)(T)+2)=(uchar) (((A) >> 16)); \
01038                                   /*lint -restore */} while(0)
01039 #define int4store(T,A)       do { *((char *)(T))=(char) ((A));\
01040                                   *(((char *)(T))+1)=(char) (((A) >> 8));\
01041                                   *(((char *)(T))+2)=(char) (((A) >> 16));\
01042                                   *(((char *)(T))+3)=(char) (((A) >> 24)); } while(0)
01043 #define int5store(T,A)       do { *((char *)(T))=((A));\
01044                                   *(((char *)(T))+1)=(((A) >> 8));\
01045                                   *(((char *)(T))+2)=(((A) >> 16));\
01046                                   *(((char *)(T))+3)=(((A) >> 24)); \
01047                                   *(((char *)(T))+4)=(((A) >> 32)); } while(0)
01048 #define int8store(T,A)       do { uint def_temp= (uint) (A), def_temp2= (uint) ((A) >> 32); \
01049                                   int4store((T),def_temp); \
01050                                   int4store((T+4),def_temp2); } while(0)
01051 #ifdef WORDS_BIGENDIAN
01052 #define float4store(T,A) do { *(T)= ((byte *) &A)[3];\
01053                               *((T)+1)=(char) ((byte *) &A)[2];\
01054                               *((T)+2)=(char) ((byte *) &A)[1];\
01055                               *((T)+3)=(char) ((byte *) &A)[0]; } while(0)
01056 
01057 #define float4get(V,M)   do { float def_temp;\
01058                               ((byte*) &def_temp)[0]=(M)[3];\
01059                               ((byte*) &def_temp)[1]=(M)[2];\
01060                               ((byte*) &def_temp)[2]=(M)[1];\
01061                               ((byte*) &def_temp)[3]=(M)[0];\
01062                               (V)=def_temp; } while(0)
01063 #define float8store(T,V) do { *(T)= ((byte *) &V)[7];\
01064                               *((T)+1)=(char) ((byte *) &V)[6];\
01065                               *((T)+2)=(char) ((byte *) &V)[5];\
01066                               *((T)+3)=(char) ((byte *) &V)[4];\
01067                               *((T)+4)=(char) ((byte *) &V)[3];\
01068                               *((T)+5)=(char) ((byte *) &V)[2];\
01069                               *((T)+6)=(char) ((byte *) &V)[1];\
01070                               *((T)+7)=(char) ((byte *) &V)[0]; } while(0)
01071 
01072 #define float8get(V,M)   do { double def_temp;\
01073                               ((byte*) &def_temp)[0]=(M)[7];\
01074                               ((byte*) &def_temp)[1]=(M)[6];\
01075                               ((byte*) &def_temp)[2]=(M)[5];\
01076                               ((byte*) &def_temp)[3]=(M)[4];\
01077                               ((byte*) &def_temp)[4]=(M)[3];\
01078                               ((byte*) &def_temp)[5]=(M)[2];\
01079                               ((byte*) &def_temp)[6]=(M)[1];\
01080                               ((byte*) &def_temp)[7]=(M)[0];\
01081                               (V) = def_temp; } while(0)
01082 #else
01083 #define float4get(V,M)   memcpy_fixed((byte*) &V,(byte*) (M),sizeof(float))
01084 #define float4store(V,M) memcpy_fixed((byte*) V,(byte*) (&M),sizeof(float))
01085 
01086 #if defined(__FLOAT_WORD_ORDER) && (__FLOAT_WORD_ORDER == __BIG_ENDIAN)
01087 #define doublestore(T,V) do { *(((char*)T)+0)=(char) ((byte *) &V)[4];\
01088                               *(((char*)T)+1)=(char) ((byte *) &V)[5];\
01089                               *(((char*)T)+2)=(char) ((byte *) &V)[6];\
01090                               *(((char*)T)+3)=(char) ((byte *) &V)[7];\
01091                               *(((char*)T)+4)=(char) ((byte *) &V)[0];\
01092                               *(((char*)T)+5)=(char) ((byte *) &V)[1];\
01093                               *(((char*)T)+6)=(char) ((byte *) &V)[2];\
01094                               *(((char*)T)+7)=(char) ((byte *) &V)[3]; }\
01095                          while(0)
01096 #define doubleget(V,M)   do { double def_temp;\
01097                               ((byte*) &def_temp)[0]=(M)[4];\
01098                               ((byte*) &def_temp)[1]=(M)[5];\
01099                               ((byte*) &def_temp)[2]=(M)[6];\
01100                               ((byte*) &def_temp)[3]=(M)[7];\
01101                               ((byte*) &def_temp)[4]=(M)[0];\
01102                               ((byte*) &def_temp)[5]=(M)[1];\
01103                               ((byte*) &def_temp)[6]=(M)[2];\
01104                               ((byte*) &def_temp)[7]=(M)[3];\
01105                               (V) = def_temp; } while(0)
01106 #endif /* __FLOAT_WORD_ORDER */
01107 
01108 #define float8get(V,M)   doubleget((V),(M))
01109 #define float8store(V,M) doublestore((V),(M))
01110 #endif /* WORDS_BIGENDIAN */
01111 
01112 #endif /* sint2korr */
01113 
01114 /*
01115   Macro for reading 32-bit integer from network byte order (big-endian)
01116   from unaligned memory location.
01117 */
01118 #define int4net(A)        (int32) (((uint32) ((uchar) (A)[3]))        |\
01119                                   (((uint32) ((uchar) (A)[2])) << 8)  |\
01120                                   (((uint32) ((uchar) (A)[1])) << 16) |\
01121                                   (((uint32) ((uchar) (A)[0])) << 24))
01122 /*
01123   Define-funktions for reading and storing in machine format from/to
01124   short/long to/from some place in memory V should be a (not
01125   register) variable, M is a pointer to byte
01126 */
01127 
01128 #ifdef WORDS_BIGENDIAN
01129 
01130 #define ushortget(V,M)  do { V = (uint16) (((uint16) ((uchar) (M)[1]))+\
01131                                  ((uint16) ((uint16) (M)[0]) << 8)); } while(0)
01132 #define shortget(V,M)   do { V = (short) (((short) ((uchar) (M)[1]))+\
01133                                  ((short) ((short) (M)[0]) << 8)); } while(0)
01134 #define longget(V,M)    do { int32 def_temp;\
01135                              ((byte*) &def_temp)[0]=(M)[0];\
01136                              ((byte*) &def_temp)[1]=(M)[1];\
01137                              ((byte*) &def_temp)[2]=(M)[2];\
01138                              ((byte*) &def_temp)[3]=(M)[3];\
01139                              (V)=def_temp; } while(0)
01140 #define ulongget(V,M)   do { uint32 def_temp;\
01141                             ((byte*) &def_temp)[0]=(M)[0];\
01142                             ((byte*) &def_temp)[1]=(M)[1];\
01143                             ((byte*) &def_temp)[2]=(M)[2];\
01144                             ((byte*) &def_temp)[3]=(M)[3];\
01145                             (V)=def_temp; } while(0)
01146 #define shortstore(T,A) do { uint def_temp=(uint) (A) ;\
01147                              *(((char*)T)+1)=(char)(def_temp); \
01148                              *(((char*)T)+0)=(char)(def_temp >> 8); } while(0)
01149 #define longstore(T,A)  do { *(((char*)T)+3)=((A));\
01150                              *(((char*)T)+2)=(((A) >> 8));\
01151                              *(((char*)T)+1)=(((A) >> 16));\
01152                              *(((char*)T)+0)=(((A) >> 24)); } while(0)
01153 
01154 #define floatget(V,M)    memcpy_fixed((byte*) &V,(byte*) (M),sizeof(float))
01155 #define floatstore(T,V)  memcpy_fixed((byte*) (T),(byte*)(&V),sizeof(float))
01156 #define doubleget(V,M)   memcpy_fixed((byte*) &V,(byte*) (M),sizeof(double))
01157 #define doublestore(T,V) memcpy_fixed((byte*) (T),(byte*) &V,sizeof(double))
01158 #define longlongget(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(ulonglong))
01159 #define longlongstore(T,V) memcpy_fixed((byte*) (T),(byte*) &V,sizeof(ulonglong))
01160 
01161 #else
01162 
01163 #define ushortget(V,M)  do { V = uint2korr(M); } while(0)
01164 #define shortget(V,M)   do { V = sint2korr(M); } while(0)
01165 #define longget(V,M)    do { V = sint4korr(M); } while(0)
01166 #define ulongget(V,M)   do { V = uint4korr(M); } while(0)
01167 #define shortstore(T,V) int2store(T,V)
01168 #define longstore(T,V)  int4store(T,V)
01169 #ifndef floatstore
01170 #define floatstore(T,V)  memcpy_fixed((byte*) (T),(byte*) (&V),sizeof(float))
01171 #define floatget(V,M)    memcpy_fixed((byte*) &V, (byte*) (M), sizeof(float))
01172 #endif
01173 #ifndef doubleget
01174 #define doubleget(V,M)   memcpy_fixed((byte*) &V,(byte*) (M),sizeof(double))
01175 #define doublestore(T,V) memcpy_fixed((byte*) (T),(byte*) &V,sizeof(double))
01176 #endif /* doubleget */
01177 #define longlongget(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(ulonglong))
01178 #define longlongstore(T,V) memcpy_fixed((byte*) (T),(byte*) &V,sizeof(ulonglong))
01179 
01180 #endif /* WORDS_BIGENDIAN */
01181 
01182 /* sprintf does not always return the number of bytes :- */
01183 #ifdef SPRINTF_RETURNS_INT
01184 #define my_sprintf(buff,args) sprintf args
01185 #else
01186 #ifdef SPRINTF_RETURNS_PTR
01187 #define my_sprintf(buff,args) ((int)(sprintf args - buff))
01188 #else
01189 #define my_sprintf(buff,args) ((ulong) sprintf args, (ulong) strlen(buff))
01190 #endif
01191 #endif
01192 
01193 #ifndef THREAD
01194 #define thread_safe_increment(V,L) (V)++
01195 #define thread_safe_add(V,C,L)     (V)+=(C)
01196 #define thread_safe_sub(V,C,L)     (V)-=(C)
01197 #define statistic_increment(V,L)   (V)++
01198 #define statistic_add(V,C,L)       (V)+=(C)
01199 #endif
01200 
01201 #ifdef HAVE_CHARSET_utf8
01202 #define MYSQL_UNIVERSAL_CLIENT_CHARSET "utf8"
01203 #else
01204 #define MYSQL_UNIVERSAL_CLIENT_CHARSET MYSQL_DEFAULT_CHARSET_NAME
01205 #endif
01206 
01207 #if defined(EMBEDDED_LIBRARY) && !defined(HAVE_EMBEDDED_PRIVILEGE_CONTROL)
01208 #define NO_EMBEDDED_ACCESS_CHECKS
01209 #endif
01210 
01211 #endif /* my_global_h */
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'