⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 my_global.h

📁 通用的数据库中间库
💻 H
📖 第 1 页 / 共 2 页
字号:
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB      This library is free software; you can redistribute it and/or   modify it under the terms of the GNU Library General Public   License as published by the Free Software Foundation; either   version 2 of the License, or (at your option) any later version.      This library 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   Library General Public License for more details.      You should have received a copy of the GNU Library General Public   License along with this library; if not, write to the Free   Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,   MA 02111-1307, USA *//* This is the main include file that should included 'first' in every   C file. */#ifndef _global_h#define _global_h#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__ */#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)#include <config-win.h>#else#include <my_config.h>#endif#if defined(__cplusplus)#if defined(inline)#undef inline				/* fix configure problem */#endif#endif /* _cplusplus *//* Fix problem with S_ISLNK() on Linux */#if defined(HAVE_LINUXTHREADS)#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_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__)#ifndef _POSIX_PTHREAD_SEMANTICS#define _POSIX_PTHREAD_SEMANTICS /* We want posix threads */#endif/* was #if defined(HAVE_LINUXTHREADS) || defined(HAVE_DEC_THREADS) || defined(HPUX) */#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#include <pthread.h>		/* AIX must have this included first */#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#endif#ifdef HAVE_BROKEN_SNPRINTF	/* HPUX 10.20 don't have this defined */#undef HAVE_SNPRINTF#endif#ifdef HAVE_BROKEN_PREAD	/* These doesn't work on HPUX 11.x */#undef HAVE_PREAD#undef HAVE_PWRITE#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/* 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/* 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/* In Linux-alpha we have atomic.h if we are using gcc */#if defined(HAVE_LINUXTHREADS) && defined(__GNUC__) && defined(__alpha__) && (__GNUC__ > 2 || ( __GNUC__ == 2 &&  __GNUC_MINOR__ >= 95)) && !defined(HAVE_ATOMIC_ADD)#define HAVE_ATOMIC_ADD#define HAVE_ATOMIC_SUB#endif/* In Linux-ia64 including atomic.h will give us an error */#if (defined(HAVE_LINUXTHREADS) && defined(__GNUC__) && defined(__ia64__)) || !defined(THREAD)#undef HAVE_ATOMIC_ADD#undef HAVE_ATOMIC_SUB#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 __SMP__#include <asm/atomic.h>#endif/* 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#endif#ifdef DONT_USE_FINITE		/* HPUX 11.x has is_finite() */#undef HAVE_FINITE#endif/* We can not live without these */#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 */#define USE_BMOVE512 1		/* Use this unless the system bmove is faster *//* 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/* #define USE_some_charset 1 was deprecated by changes to configure *//* my_ctype my_to_upper, my_to_lower, my_sort_order gain theit right value *//* automagically during configuration *//* 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/* Define som useful general macros */#if defined(__cplusplus) && defined(__GNUC__)#define max(a, b)	((a) >? (b))#define min(a, b)	((a) <? (b))#elif !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)typedef unsigned int uint;typedef unsigned short ushort;#endif#define sgn(a)		(((a) < 0) ? -1 : ((a) > 0) ? 1 : 0)#define swap(t,a,b)	{ register t dummy; dummy = a; a = b; b = dummy; }#define test(a)		((a) ? 1 : 0)#define set_if_bigger(a,b)  { if ((a) < (b)) (a)=(b); }#define set_if_smaller(a,b) { if ((a) > (b)) (a)=(b); }#define test_all_bits(a,b) (((a) & (b)) == (b))#define array_elements(A) ((uint) (sizeof(A)/sizeof(A[0])))#ifndef HAVE_RINT#define rint(A) floor((A)+0.5)#endif/* Define som general constants */#ifndef TRUE#define TRUE		(1)	/* Logical true */#define FALSE		(0)	/* Logical false */#endif#if defined(__GNUC__)#define function_volatile	volatile#define my_reinterpret_cast(A) reinterpret_cast<A>#define my_const_cast(A) const_cast<A>#elif !defined(my_reinterpret_cast)#define my_reinterpret_cast(A) (A)#define my_const_cast(A) (A)#endif#if !defined(__attribute__) && (defined(__cplusplus) || !defined(__GNUC__)  || __GNUC__ == 2 && __GNUC_MINOR__ < 8)#define __attribute__(A)#endif/* From old s-system.h *//* Support macros for non ansi & other old compilers. Since such   things are no longer supported we do nothing. We keep then since   some of our code may still be needed to upgrade old customers. */#define _VARARGS(X) X#define _STATIC_VARARGS(X) X#define _PC(X)	X#if defined(DBUG_ON) && defined(DBUG_OFF)#undef DBUG_OFF#endif#if defined(_lint) && !defined(DBUG_OFF)#define DBUG_OFF#endif#include <dbug.h>#ifndef DBUG_OFF#define dbug_assert(A) assert(A)#else#define dbug_assert(A)#endif#define MIN_ARRAY_SIZE	0	/* Zero or One. Gcc allows zero*/#define ASCII_BITS_USED 8	/* Bit char used */#define NEAR_F			/* No near function handling *//* Some types that is different between systems */typedef int	File;		/* File descriptor */#ifndef Socket_definedtypedef int	my_socket;	/* File descriptor for sockets */#define INVALID_SOCKET -1#endif/* Type for fuctions that handles signals */#define sig_handler RETSIGTYPEtypedef void	(*sig_return)();/* Returns type from signal */#if defined(__GNUC__) && !defined(_lint)typedef char	pchar;		/* Mixed prototypes can take char */typedef char	puchar;		/* Mixed prototypes can take char */typedef char	pbool;		/* Mixed prototypes can take char */typedef short	pshort;		/* Mixed prototypes can take short int */typedef float	pfloat;		/* Mixed prototypes can take float */#elsetypedef int	pchar;		/* Mixed prototypes can't take char */typedef uint	puchar;		/* Mixed prototypes can't take char */typedef int	pbool;		/* Mixed prototypes can't take char */typedef int	pshort;		/* Mixed prototypes can't take short int */typedef double	pfloat;		/* Mixed prototypes can't take float */#endiftypedef int	(*qsort_cmp)(const void *,const void *);#ifdef HAVE_mit_thread#define qsort_t void#undef QSORT_TYPE_IS_VOID#define QSORT_TYPE_IS_VOID#else#define qsort_t RETQSORTTYPE	/* Broken GCC cant handle typedef !!!! */#endif#ifdef HAVE_mit_thread#define size_socket socklen_t	/* Type of last arg to accept */#else#ifdef HAVE_SYS_SOCKET_H#include <sys/socket.h>#endiftypedef SOCKET_SIZE_TYPE size_socket;#endif#ifndef SOCKOPT_OPTLEN_TYPE#define SOCKOPT_OPTLEN_TYPE size_socket#endif/* file create flags */#ifndef O_SHARE#define O_SHARE		0	/* Flag to my_open for shared files */#ifndef O_BINARY#define O_BINARY	0	/* Flag to my_open for binary files */#endif#define FILE_BINARY	0	/* Flag to my_fopen for binary streams */#ifdef HAVE_FCNTL#define HAVE_FCNTL_LOCK#define F_TO_EOF	0L	/* Param to lockf() to lock rest of file */#endif#endif /* O_SHARE */#ifndef O_TEMPORARY#define O_TEMPORARY	0#endif#ifndef O_SHORT_LIVED#define O_SHORT_LIVED	0#endif/* #define USE_RECORD_LOCK	*/	/* Unsigned types supported by the compiler */#define UNSINT8			/* unsigned int8 (char) */#define UNSINT16		/* unsigned int16 */#define UNSINT32		/* unsigned int32 */	/* General constants */#define SC_MAXWIDTH	256	/* Max width of screen (for error messages) */#define FN_LEN		256	/* Max file name len */#define FN_HEADLEN	253	/* Max length of filepart of file name */#define FN_EXTLEN	20	/* Max length of extension (part of FN_LEN) */#define FN_REFLEN	512	/* Max length of full path-name */#define FN_EXTCHAR	'.'#define FN_HOMELIB	'~'	/* ~/ is used as abbrev for home dir */#define FN_CURLIB	'.'	/* ./ is used as abbrev for current dir */#define FN_PARENTDIR	".."	/* Parentdirectory; Must be a string */#define FN_DEVCHAR	':'#ifndef FN_LIBCHAR#ifdef __EMX__#define FN_LIBCHAR	'\\'#define FN_ROOTDIR	"\\"#else#define FN_LIBCHAR	'/'#define FN_ROOTDIR	"/"#endif#define MY_NFILE	1024	/* This is only used to save filenames */#endif/* #define EXT_IN_LIBNAME     *//* #define FN_NO_CASE_SENCE   *//* #define FN_UPPER_CASE TRUE *//* Io buffer size; Must be a power of 2 and a multiple of 512. May be   smaller what the disk page size. This influences the speed of the   isam btree library. eg to big to slow. */#define IO_SIZE			4096/* How much overhead does malloc have. The code often allocates   something like 1024-MALLOC_OVERHEAD bytes */#ifdef SAFEMALLOC#define MALLOC_OVERHEAD (8+24+4)#else#define MALLOC_OVERHEAD 8#endif	/* get memory in huncs */#define ONCE_ALLOC_INIT		(uint) (4096-MALLOC_OVERHEAD)	/* Typical record cash */#define RECORD_CACHE_SIZE	(uint) (64*1024-MALLOC_OVERHEAD)	/* Typical key cash */#define KEY_CACHE_SIZE		(uint) (8*1024*1024-MALLOC_OVERHEAD)	/* Some things that this system doesn't have */#define ONLY_OWN_DATABASES	/* We are using only databases by monty */#define NO_PISAM		/* Not needed anymore */#define NO_MISAM		/* Not needed anymore */#define NO_HASH			/* Not needed anymore */#ifdef __WIN__#define NO_DIR_LIBRARY		/* Not standar dir-library */#define USE_MY_STAT_STRUCT	/* For my_lib */#endif/* Some things that this system does have */#ifndef HAVE_ITOA#define USE_MY_ITOA		/* There is no itoa */#endif/* Some defines of functions for portability */#ifndef HAVE_ATOD#define atod		atof

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -