?? my_global.h
字號:
/* Copyright (C) 2000-2003 MySQL AB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *//* This is the include file that should be included 'first' in every C file. */#ifndef _global_h#define _global_h#ifndef EMBEDDED_LIBRARY#define HAVE_REPLICATION#define HAVE_EXTERNAL_CLIENT#endif#if defined( __EMX__) && !defined( MYSQL_SERVER)/* moved here to use below VOID macro redefinition */#define INCL_BASE#define INCL_NOPMAPI#include <os2.h>#endif /* __EMX__ */#ifdef __CYGWIN__/* We use a Unix API, so pretend it's not Windows */#undef WIN#undef WIN32#undef _WIN#undef _WIN32#undef _WIN64#undef __WIN__#undef __WIN32__#define HAVE_ERRNO_AS_DEFINE#endif /* __CYGWIN__ *//* to make command line shorter we'll define USE_PRAGMA_INTERFACE here */#ifdef USE_PRAGMA_IMPLEMENTATION#define USE_PRAGMA_INTERFACE#endif#if defined(i386) && !defined(__i386__)#define __i386__#endif/* Macros to make switching between C and C++ mode easier */#ifdef __cplusplus#define C_MODE_START extern "C" {#define C_MODE_END }#else#define C_MODE_START#define C_MODE_END#endif#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)#include <config-win.h>#elif defined(OS2)#include <config-os2.h>#elif defined(__NETWARE__)#include <my_config.h>#include <config-netware.h>#if defined(__cplusplus) && defined(inline)#undef inline /* fix configure problem */#endif#else#include <my_config.h>#if defined(__cplusplus) && defined(inline)#undef inline /* fix configure problem */#endif#endif /* _WIN32... *//* Some defines to avoid ifdefs in the code */#ifndef NETWARE_YIELD#define NETWARE_YIELD#define NETWARE_SET_SCREEN_MODE(A)#endif/* The macros below are borrowed from include/linux/compiler.h in the Linux kernel. Use them to indicate the likelyhood of the truthfulness of a condition. This serves two purposes - newer versions of gcc will be able to optimize for branch predication, which could yield siginficant performance gains in frequently executed sections of the code, and the other reason to use them is for documentation*/#if !defined(__GNUC__) || (__GNUC__ == 2 && __GNUC_MINOR__ < 96)#define __builtin_expect(x, expected_value) (x)#endif#define likely(x) __builtin_expect((x),1)#define unlikely(x) __builtin_expect((x),0)/* Fix problem with S_ISLNK() on Linux */#if defined(TARGET_OS_LINUX)#undef _GNU_SOURCE#define _GNU_SOURCE 1#endif/* The client defines this to avoid all thread code */#if defined(UNDEF_THREADS_HACK)#undef THREAD#undef HAVE_mit_thread#undef HAVE_LINUXTHREADS#undef HAVE_NPTL#undef HAVE_UNIXWARE7_THREADS#endif#ifdef HAVE_THREADS_WITHOUT_SOCKETS/* MIT pthreads does not work with unix sockets */#undef HAVE_SYS_UN_H#endif#define __EXTENSIONS__ 1 /* We want some extension */#ifndef __STDC_EXT__#define __STDC_EXT__ 1 /* To get large file support on hpux */#endif#if defined(THREAD) && !defined(__WIN__) && !defined(OS2)#ifndef _POSIX_PTHREAD_SEMANTICS#define _POSIX_PTHREAD_SEMANTICS /* We want posix threads */#endif#if !defined(SCO)#define _REENTRANT 1 /* Some thread libraries require this */#endif#if !defined(_THREAD_SAFE) && !defined(_AIX)#define _THREAD_SAFE /* Required for OSF1 */#endif#ifndef HAVE_mit_thread#ifdef HAVE_UNIXWARE7_THREADS#include <thread.h>#else#if defined(HPUX10) || defined(HPUX11)C_MODE_START /* HPUX needs this, signal.h bug */#include <pthread.h>C_MODE_END#else#include <pthread.h> /* AIX must have this included first */#endif#endif /* HAVE_UNIXWARE7_THREADS */#endif /* HAVE_mit_thread */#if !defined(SCO) && !defined(_REENTRANT)#define _REENTRANT 1 /* Threads requires reentrant code */#endif#endif /* THREAD *//* Go around some bugs in different OS and compilers */#ifdef _AIX /* By soren@t.dk */#define _H_STRINGS#define _SYS_STREAM_H/* #define _AIX32_CURSES */ /* XXX: this breaks AIX 4.3.3 (others?). */#define ulonglong2double(A) my_ulonglong2double(A)#define my_off_t2double(A) my_ulonglong2double(A)C_MODE_STARTdouble my_ulonglong2double(unsigned long long A);C_MODE_END#endif /* _AIX */#ifdef HAVE_BROKEN_SNPRINTF /* HPUX 10.20 don't have this defined */#undef HAVE_SNPRINTF#endif#ifdef HAVE_BROKEN_PREAD/* pread()/pwrite() are not 64 bit safe on HP-UX 11.0 without installing the kernel patch PHKL_20349 or greater*/#undef HAVE_PREAD#undef HAVE_PWRITE#endif#if defined(HAVE_BROKEN_INLINE) && !defined(__cplusplus)#undef inline#define inline#endif#ifdef UNDEF_HAVE_GETHOSTBYNAME_R /* For OSF4.x */#undef HAVE_GETHOSTBYNAME_R#endif#ifdef UNDEF_HAVE_INITGROUPS /* For AIX 4.3 */#undef HAVE_INITGROUPS#endif/* gcc/egcs issues */#if defined(__GNUC) && defined(__EXCEPTIONS)#error "Please add -fno-exceptions to CXXFLAGS and reconfigure/recompile"#endif/* Fix a bug in gcc 2.8.0 on IRIX 6.2 */#if SIZEOF_LONG == 4 && defined(__LONG_MAX__)#undef __LONG_MAX__ /* Is a longlong value in gcc 2.8.0 ??? */#define __LONG_MAX__ 2147483647#endif/* Fix problem when linking c++ programs with gcc 3.x */#ifdef DEFINE_CXA_PURE_VIRTUAL#define FIX_GCC_LINKING_PROBLEM \C_MODE_START int __cxa_pure_virtual() {\ DBUG_ASSERT("Pure virtual method called." == "Aborted");\ return 0;\} C_MODE_END#else#define FIX_GCC_LINKING_PROBLEM#endif/* egcs 1.1.2 has a problem with memcpy on Alpha */#if defined(__GNUC__) && defined(__alpha__) && ! (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95))#define BAD_MEMCPY#endif#if defined(_lint) && !defined(lint)#define lint#endif#if SIZEOF_LONG_LONG > 4 && !defined(_LONG_LONG)#define _LONG_LONG 1 /* For AIX string library */#endif#ifndef stdin#include <stdio.h>#endif#ifdef HAVE_STDLIB_H#include <stdlib.h>#endif#ifdef HAVE_STDDEF_H#include <stddef.h>#endif#include <math.h>#ifdef HAVE_LIMITS_H#include <limits.h>#endif#ifdef HAVE_FLOAT_H#include <float.h>#endif#ifdef HAVE_SYS_TYPES_H#include <sys/types.h>#endif#ifdef HAVE_FCNTL_H#include <fcntl.h>#endif#ifdef HAVE_SYS_TIMEB_H#include <sys/timeb.h> /* Avoid warnings on SCO */#endif#if TIME_WITH_SYS_TIME# include <sys/time.h># include <time.h>#else# if HAVE_SYS_TIME_H# include <sys/time.h># else# include <time.h># endif#endif /* TIME_WITH_SYS_TIME */#ifdef HAVE_UNISTD_H#include <unistd.h>#endif#if defined(__cplusplus) && defined(NO_CPLUSPLUS_ALLOCA)#undef HAVE_ALLOCA#undef HAVE_ALLOCA_H#endif#ifdef HAVE_ALLOCA_H#include <alloca.h>#endif#ifdef HAVE_ATOMIC_ADD#define new my_arg_new#define need_to_restore_new 1C_MODE_START#include <asm/atomic.h>C_MODE_END#ifdef need_to_restore_new /* probably safer than #ifdef new */#undef new#undef need_to_restore_new#endif#endif#include <errno.h> /* Recommended by debian *//* We need the following to go around a problem with openssl on solaris */#if defined(HAVE_CRYPT_H)#include <crypt.h>#endif/* A lot of our programs uses asserts, so better to always include it This also fixes a problem when people uses DBUG_ASSERT without including assert.h*/#include <assert.h>/* Go around some bugs in different OS and compilers */#if defined(_HPUX_SOURCE) && defined(HAVE_SYS_STREAM_H)#include <sys/stream.h> /* HPUX 10.20 defines ulong here. UGLY !!! */#define HAVE_ULONG#ifdef DONT_USE_FINITE /* HPUX 11.x has is_finite() */#undef HAVE_FINITE#endif#if defined(HPUX10) && defined(_LARGEFILE64_SOURCE) && defined(THREAD)/* Fix bug in setrlimit */#undef setrlimit#define setrlimit cma_setrlimit64#endif#ifdef __QNXNTO__/* This has to be after include limits.h */#define HAVE_ERRNO_AS_DEFINE#define HAVE_FCNTL_LOCK#undef HAVE_FINITE#undef LONGLONG_MIN /* These get wrongly defined in QNX 6.2 */#undef LONGLONG_MAX /* standard system library 'limits.h' */#ifdef __cplusplus#define HAVE_RINT /* rint() and isnan() functions are not */#define rint(a) std::rint(a) /* visible in C++ scope due to an error */#define isnan(a) std::isnan(a) /* in the usr/include/math.h on QNX */#endif#endif/* We can not live without the following defines */#define USE_MYFUNC 1 /* Must use syscall indirection */#define MASTER 1 /* Compile without unireg */#define ENGLISH 1 /* Messages in English */#define POSIX_MISTAKE 1 /* regexp: Fix stupid spec error */#define USE_REGEX 1 /* We want the use the regex library *//* Do not define for ultra sparcs */#ifndef OS2#define USE_BMOVE512 1 /* Use this unless system bmove is faster */#endif#define QUOTE_ARG(x) #x /* Quote argument (before cpp) */#define STRINGIFY_ARG(x) QUOTE_ARG(x) /* Quote argument, after cpp *//* Paranoid settings. Define I_AM_PARANOID if you are paranoid */#ifdef I_AM_PARANOID#define DONT_ALLOW_USER_CHANGE 1#define DONT_USE_MYSQL_PWD 1#endif/* Does the system remember a signal handler after a signal ? */#ifndef HAVE_BSD_SIGNALS#define DONT_REMEMBER_SIGNAL#endif/* Define void to stop lint from generating "null effekt" comments */#ifndef DONT_DEFINE_VOID#ifdef _lintint __void__;#define VOID(X) (__void__ = (int) (X))#else#undef VOID#define VOID(X) (X)#endif#endif /* DONT_DEFINE_VOID */#if defined(_lint) || defined(FORCE_INIT_OF_VARS)#define LINT_INIT(var) var=0 /* No uninitialize-warning */#else#define LINT_INIT(var)#endif#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || defined(HAVE_purify)#define PURIFY_OR_LINT_INIT(var) var=0#else#define PURIFY_OR_LINT_INIT(var)#endif/* Define some useful general macros */#if !defined(max)#define max(a, b) ((a) > (b) ? (a) : (b))#define min(a, b) ((a) < (b) ? (a) : (b))#endif#if defined(__EMX__) || !defined(HAVE_UINT)#undef HAVE_UINT#define HAVE_UINTtypedef unsigned int uint;typedef unsigned short ushort;#endif#define CMP_NUM(a,b) (((a) < (b)) ? -1 : ((a) == (b)) ? 0 : 1)#define sgn(a) (((a) < 0) ? -1 : ((a) > 0) ? 1 : 0)#define swap_variables(t, a, b) { register t dummy; dummy= a; a= b; b= dummy; }#define test(a) ((a) ? 1 : 0)#define set_if_bigger(a,b) do { if ((a) < (b)) (a)=(b); } while(0)#define set_if_smaller(a,b) do { if ((a) > (b)) (a)=(b); } while(0)#define test_all_bits(a,b) (((a) & (b)) == (b))#define set_bits(type, bit_count) (sizeof(type)*8 <= (bit_count) ? ~(type) 0 : ((((type) 1) << (bit_count)) - (type) 1))#define array_elements(A) ((uint) (sizeof(A)/sizeof(A[0])))#ifndef HAVE_RINT#define rint(A) floor((A)+(((A) < 0)? -0.5 : 0.5))#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -