diff options
Diffstat (limited to 'include')
43 files changed, 3117 insertions, 1453 deletions
diff --git a/include/Makefile.am b/include/Makefile.am index aa20cf892c1..8651a2dd9b1 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -15,26 +15,29 @@ # Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, # MA 02111-1307, USA -BUILT_SOURCES = $(HEADERS_GEN) abi_check +# FIXME 'abi_check' should be in BUILT_SOURCES, disabled for now +BUILT_SOURCES = $(HEADERS_GEN) HEADERS_GEN = mysql_version.h my_config.h HEADERS_ABI = mysql.h mysql_com.h mysql_time.h \ my_list.h my_alloc.h typelib.h pkginclude_HEADERS = $(HEADERS_ABI) my_dbug.h m_string.h my_sys.h \ my_xml.h mysql_embed.h \ - my_semaphore.h my_pthread.h my_no_pthread.h raid.h \ + my_semaphore.h my_pthread.h my_no_pthread.h \ errmsg.h my_global.h my_net.h \ my_getopt.h sslopt-longopts.h my_dir.h \ sslopt-vars.h sslopt-case.h sql_common.h keycache.h \ - m_ctype.h $(HEADERS_GEN) -noinst_HEADERS = config-win.h config-os2.h config-netware.h \ - heap.h my_bitmap.h\ + m_ctype.h mysql/plugin.h $(HEADERS_GEN) +noinst_HEADERS = config-win.h config-netware.h \ + heap.h my_bitmap.h my_uctype.h \ myisam.h myisampack.h myisammrg.h ft_global.h\ mysys_err.h my_base.h help_start.h help_end.h \ my_nosys.h my_alarm.h queues.h rijndael.h sha1.h \ - my_aes.h my_tree.h hash.h thr_alarm.h \ + my_aes.h my_tree.h my_trie.h hash.h thr_alarm.h \ thr_lock.h t_ctype.h violite.h md5.h base64.h \ mysql_version.h.in my_handler.h my_time.h decimal.h \ - my_user.h my_libwrap.h + my_vle.h my_user.h my_atomic.h atomic/nolock.h \ + atomic/rwlock.h atomic/x86-gcc.h atomic/x86-msvc.h \ + my_libwrap.h # Remove built files and the symlinked directories CLEANFILES = $(BUILT_SOURCES) readline openssl diff --git a/include/atomic/nolock.h b/include/atomic/nolock.h new file mode 100644 index 00000000000..1151a334b06 --- /dev/null +++ b/include/atomic/nolock.h @@ -0,0 +1,43 @@ +/* Copyright (C) 2006 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 */ + +#if defined(__i386__) || defined(_M_IX86) + +#ifdef MY_ATOMIC_MODE_DUMMY +# define LOCK "" +#else +# define LOCK "lock" +#endif + +#ifdef __GNUC__ +#include "x86-gcc.h" +#elif defined(_MSC_VER) +#include "x86-msvc.h" +#endif +#endif + +#ifdef make_atomic_cas_body + +typedef struct { } my_atomic_rwlock_t; +#define my_atomic_rwlock_destroy(name) +#define my_atomic_rwlock_init(name) +#define my_atomic_rwlock_rdlock(name) +#define my_atomic_rwlock_wrlock(name) +#define my_atomic_rwlock_rdunlock(name) +#define my_atomic_rwlock_wrunlock(name) + +#endif + diff --git a/include/atomic/rwlock.h b/include/atomic/rwlock.h new file mode 100644 index 00000000000..12d0dd3f069 --- /dev/null +++ b/include/atomic/rwlock.h @@ -0,0 +1,49 @@ +/* Copyright (C) 2006 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 */ + +typedef struct {pthread_rwlock_t rw;} my_atomic_rwlock_t; + +#ifdef MY_ATOMIC_MODE_DUMMY +/* + the following can never be enabled by ./configure, one need to put #define in + a source to trigger the following warning. The resulting code will be broken, + it only makes sense to do it to see now test_atomic detects broken + implementations (another way is to run a UP build on an SMP box). +*/ +#warning MY_ATOMIC_MODE_DUMMY and MY_ATOMIC_MODE_RWLOCKS are incompatible +#define my_atomic_rwlock_destroy(name) +#define my_atomic_rwlock_init(name) +#define my_atomic_rwlock_rdlock(name) +#define my_atomic_rwlock_wrlock(name) +#define my_atomic_rwlock_rdunlock(name) +#define my_atomic_rwlock_wrunlock(name) +#define MY_ATOMIC_MODE "dummy (non-atomic)" +#else +#define my_atomic_rwlock_destroy(name) pthread_rwlock_destroy(& (name)->rw) +#define my_atomic_rwlock_init(name) pthread_rwlock_init(& (name)->rw, 0) +#define my_atomic_rwlock_rdlock(name) pthread_rwlock_rdlock(& (name)->rw) +#define my_atomic_rwlock_wrlock(name) pthread_rwlock_wrlock(& (name)->rw) +#define my_atomic_rwlock_rdunlock(name) pthread_rwlock_unlock(& (name)->rw) +#define my_atomic_rwlock_wrunlock(name) pthread_rwlock_unlock(& (name)->rw) +#define MY_ATOMIC_MODE "rwlocks" +#endif + +#define make_atomic_add_body(S) int ## S sav; sav= *a; *a+= v; v=sav; +#define make_atomic_swap_body(S) int ## S sav; sav= *a; *a= v; v=sav; +#define make_atomic_cas_body(S) if ((ret= (*a == *cmp))) *a= set; else *cmp=*a; +#define make_atomic_load_body(S) ret= *a; +#define make_atomic_store_body(S) *a= v; + diff --git a/include/atomic/x86-gcc.h b/include/atomic/x86-gcc.h new file mode 100644 index 00000000000..5a72f318a61 --- /dev/null +++ b/include/atomic/x86-gcc.h @@ -0,0 +1,59 @@ +/* Copyright (C) 2006 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 */ + +/* + XXX 64-bit atomic operations can be implemented using + cmpxchg8b, if necessary. Though I've heard that not all 64-bit + architectures support double-word (128-bit) cas. +*/ + +#ifdef MY_ATOMIC_NO_XADD +#define MY_ATOMIC_MODE "gcc-x86" LOCK "-no-xadd" +#else +#define MY_ATOMIC_MODE "gcc-x86" LOCK +#endif + +/* fix -ansi errors while maintaining readability */ +#ifndef asm +#define asm __asm__ +#endif + +#ifndef MY_ATOMIC_NO_XADD +#define make_atomic_add_body(S) \ + asm volatile (LOCK "; xadd %0, %1;" : "+r" (v) , "+m" (*a)) +#endif +#define make_atomic_swap_body(S) \ + asm volatile ("; xchg %0, %1;" : "+r" (v) , "+m" (*a)) +#define make_atomic_cas_body(S) \ + asm volatile (LOCK "; cmpxchg %3, %0; setz %2;" \ + : "+m" (*a), "+a" (*cmp), "=q" (ret): "r" (set)) + +#ifdef MY_ATOMIC_MODE_DUMMY +#define make_atomic_load_body(S) ret=*a +#define make_atomic_store_body(S) *a=v +#else +/* + Actually 32-bit reads/writes are always atomic on x86 + But we add LOCK here anyway to force memory barriers +*/ +#define make_atomic_load_body(S) \ + ret=0; \ + asm volatile (LOCK "; cmpxchg %2, %0" \ + : "+m" (*a), "+a" (ret): "r" (ret)) +#define make_atomic_store_body(S) \ + asm volatile ("; xchg %0, %1;" : "+m" (*a) : "r" (v)) +#endif + diff --git a/include/atomic/x86-msvc.h b/include/atomic/x86-msvc.h new file mode 100644 index 00000000000..d4024a854fb --- /dev/null +++ b/include/atomic/x86-msvc.h @@ -0,0 +1,97 @@ +/* Copyright (C) 2006 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 */ + +/* + XXX 64-bit atomic operations can be implemented using + cmpxchg8b, if necessary +*/ + +// Would it be better to use intrinsics ? +// (InterlockedCompareExchange, InterlockedCompareExchange16 +// InterlockedExchangeAdd, InterlockedExchange) + +#ifndef _atomic_h_cleanup_ +#define _atomic_h_cleanup_ "atomic/x86-msvc.h" + +#define MY_ATOMIC_MODE "msvc-x86" LOCK + +#define make_atomic_add_body(S) \ + _asm { \ + _asm mov reg_ ## S, v \ + _asm LOCK xadd *a, reg_ ## S \ + _asm movzx v, reg_ ## S \ + } +#define make_atomic_cas_body(S) \ + _asm { \ + _asm mov areg_ ## S, *cmp \ + _asm mov reg2_ ## S, set \ + _asm LOCK cmpxchg *a, reg2_ ## S \ + _asm mov *cmp, areg_ ## S \ + _asm setz al \ + _asm movzx ret, al \ + } +#define make_atomic_swap_body(S) \ + _asm { \ + _asm mov reg_ ## S, v \ + _asm xchg *a, reg_ ## S \ + _asm mov v, reg_ ## S \ + } + +#ifdef MY_ATOMIC_MODE_DUMMY +#define make_atomic_load_body(S) ret=*a +#define make_atomic_store_body(S) *a=v +#else +/* + Actually 32-bit reads/writes are always atomic on x86 + But we add LOCK here anyway to force memory barriers +*/ +#define make_atomic_load_body(S) \ + _asm { \ + _asm mov areg_ ## S, 0 \ + _asm mov reg2_ ## S, areg_ ## S \ + _asm LOCK cmpxchg *a, reg2_ ## S \ + _asm mov ret, areg_ ## S \ + } +#define make_atomic_store_body(S) \ + _asm { \ + _asm mov reg_ ## S, v \ + _asm xchg *a, reg_ ## S \ + } +#endif + +#define reg_8 al +#define reg_16 ax +#define reg_32 eax +#define areg_8 al +#define areg_16 ax +#define areg_32 eax +#define reg2_8 bl +#define reg2_16 bx +#define reg2_32 ebx + +#else /* cleanup */ + +#undef reg_8 +#undef reg_16 +#undef reg_32 +#undef areg_8 +#undef areg_16 +#undef areg_32 +#undef reg2_8 +#undef reg2_16 +#undef reg2_32 +#endif + diff --git a/include/base64.h b/include/base64.h index fcc2f8b40dc..a6bffebfe07 100644 --- a/include/base64.h +++ b/include/base64.h @@ -21,9 +21,6 @@ extern "C" { #endif - -#include <mysys_priv.h> - /* Calculate how much memory needed for dst of base64_encode() */ @@ -42,7 +39,8 @@ int base64_encode(const void *src, size_t src_len, char *dst); /* Decode a base64 string into data */ -int base64_decode(const char *src, size_t src_len, void *dst); +int base64_decode(const char *src, size_t src_len, + void *dst, const char **end_ptr); #ifdef __cplusplus diff --git a/include/config-netware.h b/include/config-netware.h index a3cd6635bae..c30fc099985 100644 --- a/include/config-netware.h +++ b/include/config-netware.h @@ -19,6 +19,14 @@ #ifndef _config_netware_h #define _config_netware_h +#define __event_h__ +#define _EVENT_H_ +/* + These two #define(s) are needed as both libc of NetWare and MySQL have + files named event.h which causes compilation errors. +*/ + + /* required headers */ #include <unistd.h> #include <stdio.h> @@ -35,6 +43,12 @@ #include <pthread.h> #include <termios.h> +#undef _EVENT_H_ +/* + This #undef exists here because both libc of NetWare and MySQL have + files named event.h which causes compilation errors. +*/ + #ifdef __cplusplus extern "C" { #endif @@ -65,6 +79,13 @@ extern "C" { #undef HAVE_STPCPY /* changes end */ +/* Changes made to make use of LibC-June-2005 for building purpose */ +#undef HAVE_GETPASS +#undef HAVE_GETRLIMIT +#undef HAVE_GETRUSAGE +#undef HAVE_INITGROUPS +/* Changes end - LibC-June-2005 */ + /* no libc crypt() function */ #ifdef HAVE_OPENSSL #define HAVE_CRYPT 1 diff --git a/include/config-os2.h b/include/config-os2.h deleted file mode 100644 index 0402074acc0..00000000000 --- a/include/config-os2.h +++ /dev/null @@ -1,835 +0,0 @@ -/* Copyright (C) 2000 MySQL AB & Yuri Dario - All the above parties has a full, independent copyright to - the following code, including the right to use the code in - any manner without any demands from the other parties. - - 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 */ - -/* Defines for OS2 to make it compatible for MySQL */ - -#ifndef __CONFIG_OS2_H__ -#define __CONFIG_OS2_H__ - -#include <os2.h> -#include <math.h> -#include <io.h> -#include <types.h> - -/* Define to name of system eg solaris*/ -#define SYSTEM_TYPE "IBM OS/2 Warp" -/* Define to machine type name eg sun10 */ -#define MACHINE_TYPE "i686" -/* Name of package */ -#define PACKAGE "mysql" -/* Version number of package */ -#define VERSION MYSQL_SERVER_VERSION -/* Default socket */ -#define MYSQL_UNIX_ADDR "\\socket\\MySQL" - -#define FN_LIBCHAR '\\' -#define FN_ROOTDIR "\\" -#define MY_NFILE 1024 /* This is only used to save filenames */ - -#define HAVE_ACCESS - -#define DEFAULT_MYSQL_HOME "c:\\mysql" -#define DEFAULT_BASEDIR "C:\\" -#define SHAREDIR "share" -#define DEFAULT_CHARSET_HOME "C:/mysql/" -#define _POSIX_PATH_MAX 255 -#define DWORD ULONG - -#define O_SHARE 0x1000 /* Open file in sharing mode */ -#define FILE_BINARY O_BINARY /* my_fopen in binary mode */ -#define S_IROTH S_IREAD /* for my_lib */ - -#define CANT_DELETE_OPEN_FILES /* saves open files in a list, for delayed delete */ - -#define O_NONBLOCK 0x10 - -#define NO_OPEN_3 /* For my_create() */ -#define SIGQUIT SIGTERM /* No SIGQUIT */ -#define SIGALRM 14 /* Alarm */ - -#define NO_FCNTL_NONBLOCK - -#define EFBIG E2BIG -/*#define ENFILE EMFILE */ -/*#define ENAMETOOLONG (EOS2ERR+2) */ -/*#define ETIMEDOUT 145 */ -/*#define EPIPE 146 */ -#define EROFS 147 - -#define sleep(A) DosSleep((A)*1000) -#define closesocket(A) soclose(A) - -#define F_OK 0 -#define W_OK 2 - -#define bzero(x,y) memset((x),'\0',(y)) -#define bcopy(x,y,z) memcpy((y),(x),(z)) -#define bcmp(x,y,z) memcmp((y),(x),(z)) - -#define F_RDLCK 4 /* Read lock. */ -#define F_WRLCK 2 /* Write lock. */ -#define F_UNLCK 0 /* Remove lock. */ - -#define S_IFMT 0x17000 /* Mask for file type */ -#define F_TO_EOF 0L /* Param to lockf() to lock rest of file */ - -#define HUGE_PTR - -#ifdef __cplusplus -extern "C" -#endif -double _cdecl rint( double nr); - -DWORD TlsAlloc( void); -BOOL TlsFree( DWORD); -PVOID TlsGetValue( DWORD); -BOOL TlsSetValue( DWORD, PVOID); - -/* support for > 2GB file size */ -#define SIZEOF_OFF_T 8 -#define lseek(A,B,C) _lseek64( A, B, C) -#define tell(A) _lseek64( A, 0, SEEK_CUR) - -void* dlopen( char* path, int flag); -char* dlerror( void); -void* dlsym( void* hmod, char* fn); -void dlclose( void* hmod); - -/* Some typedefs */ -typedef unsigned long long os_off_t; - -/* config.h. Generated automatically by configure. */ -/* config.h.in. Generated automatically from configure.in by autoheader. */ - -/* Define if using alloca.c. */ -/* #undef C_ALLOCA */ - -/* Define to empty if the keyword does not work. */ -/* #undef const */ - -/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. - This function is required for alloca.c support on those systems. */ -/* #undef CRAY_STACKSEG_END */ - -/* Define if you have alloca, as a function or macro. */ -#define HAVE_ALLOCA 1 - -/* Define if you have <alloca.h> and it should be used (not on Ultrix). */ -/* #define HAVE_ALLOCA_H 1 */ - -/* Define if you don't have vprintf but do have _doprnt. */ -/* #undef HAVE_DOPRNT */ - -/* Define if you have a working `mmap' system call. */ -/* #undef HAVE_MMAP */ - -/* Define if system calls automatically restart after interruption - by a signal. */ -/* #undef HAVE_RESTARTABLE_SYSCALLS */ - -/* Define if your struct stat has st_rdev. */ -#define HAVE_ST_RDEV 1 - -/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */ -/* #define HAVE_SYS_WAIT_H 1 */ - -/* Define if you don't have tm_zone but do have the external array - tzname. */ -#define HAVE_TZNAME 1 - -/* Define if utime(file, NULL) sets file's timestamp to the present. */ -#define HAVE_UTIME_NULL 1 - -/* Define if you have the vprintf function. */ -#define HAVE_VPRINTF 1 - -/* Define as __inline if that's what the C compiler calls it. */ -/* #undef inline */ - -/* Define to `long' if <sys/types.h> doesn't define. */ -/* #undef off_t */ - -/* Define as the return type of signal handlers (int or void). */ -#define RETSIGTYPE void - -/* Define to `unsigned' if <sys/types.h> doesn't define. */ -/* #undef size_t */ - -/* If using the C implementation of alloca, define if you know the - direction of stack growth for your system; otherwise it will be - automatically deduced at run-time. - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown - */ -#define STACK_DIRECTION -1 - -/* Define if the `S_IS*' macros in <sys/stat.h> do not work properly. */ -/* #undef STAT_MACROS_BROKEN */ - -/* Define if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Define if you can safely include both <sys/time.h> and <time.h>. */ -#define TIME_WITH_SYS_TIME 1 - -/* Define if your <sys/time.h> declares struct tm. */ -/* #undef TM_IN_SYS_TIME */ - -/* Define if your processor stores words with the most significant - byte first (like Motorola and SPARC, unlike Intel and VAX). */ -/* #undef WORDS_BIGENDIAN */ - -/* Version of .frm files */ -#define DOT_FRM_VERSION 6 - -/* READLINE: */ -#define FIONREAD_IN_SYS_IOCTL 1 - -/* READLINE: Define if your system defines TIOCGWINSZ in sys/ioctl.h. */ -/* #undef GWINSZ_IN_SYS_IOCTL */ - -/* Do we have FIONREAD */ -#define FIONREAD_IN_SYS_IOCTL 1 - -/* atomic_add() from <asm/atomic.h> (Linux only) */ -/* #undef HAVE_ATOMIC_ADD */ - -/* atomic_sub() from <asm/atomic.h> (Linux only) */ -/* #undef HAVE_ATOMIC_SUB */ - -/* bool is not defined by all C++ compilators */ -#define HAVE_BOOL 1 - -/* Have berkeley db installed */ -/* #define HAVE_BERKELEY_DB 1 */ - -/* DSB style signals ? */ -/* #undef HAVE_BSD_SIGNALS */ - -/* Can netinet be included */ -/* #undef HAVE_BROKEN_NETINET_INCLUDES */ - -/* READLINE: */ -/* #undef HAVE_BSD_SIGNALS */ - -/* ZLIB and compress: */ -#define HAVE_COMPRESS 1 - -/* Define if we are using OSF1 DEC threads */ -/* #undef HAVE_DEC_THREADS */ - -/* Define if we are using OSF1 DEC threads on 3.2 */ -/* #undef HAVE_DEC_3_2_THREADS */ - -/* fp_except from ieeefp.h */ -/* #undef HAVE_FP_EXCEPT */ - -/* READLINE: */ -/* #undef HAVE_GETPW_DECLS */ - -/* Solaris define gethostbyname_r with 5 arguments. glibc2 defines - this with 6 arguments */ -/* #undef HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE */ - -/* In OSF 4.0f the 3'd argument to gethostname_r is hostent_data * */ -/* #undef HAVE_GETHOSTBYNAME_R_RETURN_INT */ - -/* Define if int8, int16 and int32 types exist */ -/* #undef HAVE_INT_8_16_32 */ - -/* Define if have -lwrap */ -/* #undef HAVE_LIBWRAP */ - -/* Define if we are using Xavier Leroy's LinuxThreads */ -/* #undef HAVE_LINUXTHREADS */ - -/* Do we use user level threads */ -/* #undef HAVE_mit_thread */ - -/* For some non posix threads */ -/* #undef HAVE_NONPOSIX_PTHREAD_GETSPECIFIC */ - -/* For some non posix threads */ -/* #undef HAVE_NONPOSIX_PTHREAD_MUTEX_INIT */ - -/* READLINE: */ -#define HAVE_POSIX_SIGNALS 0 - -/* sigwait with one argument */ -/* #undef HAVE_NONPOSIX_SIGWAIT */ - -/* pthread_attr_setscope */ -#define HAVE_PTHREAD_ATTR_SETSCOPE 1 - -/* POSIX readdir_r */ -/* #undef HAVE_READDIR_R */ - -/* POSIX sigwait */ -/* #undef HAVE_SIGWAIT */ - -/* crypt */ -#define HAVE_CRYPT 1 - -/* Solaris define gethostbyaddr_r with 7 arguments. glibc2 defines - this with 8 arguments */ -/* #undef HAVE_SOLARIS_STYLE_GETHOST */ - -/* Timespec has a ts_sec instead of tv_sev */ -#define HAVE_TIMESPEC_TS_SEC 1 - -/* Have the tzname variable */ -#define HAVE_TZNAME 1 - -/* Define if the system files define uchar */ -/* #undef HAVE_UCHAR */ - -/* Define if the system files define uint */ -/* #undef HAVE_UINT */ - -/* Define if the system files define ulong */ -/* #undef HAVE_ULONG */ - -/* UNIXWARE7 threads are not posix */ -/* #undef HAVE_UNIXWARE7_THREADS */ - -/* new UNIXWARE7 threads that are not yet posix */ -/* #undef HAVE_UNIXWARE7_POSIX */ - -/* READLINE: */ -/* #undef HAVE_USG_SIGHOLD */ - -/* Define if want -lwrap */ -/* #undef LIBWRAP */ - -/* mysql client protocoll version */ -#define PROTOCOL_VERSION 10 - -/* Define if qsort returns void */ -#define QSORT_TYPE_IS_VOID 1 - -/* Define as the return type of qsort (int or void). */ -#define RETQSORTTYPE void - -/* Define as the base type of the last arg to accept */ -#define SOCKET_SIZE_TYPE int - -/* Last argument to get/setsockopt */ -/* #undef SOCKOPT_OPTLEN_TYPE */ - -/* #undef SPEED_T_IN_SYS_TYPES */ -/* #undef SPRINTF_RETURNS_PTR */ -#define SPRINTF_RETURNS_INT 1 -/* #undef SPRINTF_RETURNS_GARBAGE */ - -/* #undef STRUCT_DIRENT_HAS_D_FILENO */ -#define STRUCT_DIRENT_HAS_D_INO 1 - -/* Define if you want to have threaded code. This may be undef on client code */ -#define THREAD 1 - -/* Should be client be thread safe */ -/* #undef THREAD_SAFE_CLIENT */ - -/* READLINE: */ -/* #undef TIOCSTAT_IN_SYS_IOCTL */ - -/* Use multi-byte character routines */ -/* #undef USE_MB */ -/* #undef USE_MB_IDENT */ - -/* Use MySQL RAID */ -/* #undef USE_RAID */ - -/* Use strcoll() functions when comparing and sorting. */ -/* #undef USE_STRCOLL */ - -/* READLINE: */ -#define VOID_SIGHANDLER 1 - -/* The number of bytes in a char. */ -#define SIZEOF_CHAR 1 - -/* The number of bytes in a int. */ -#define SIZEOF_INT 4 - -/* The number of bytes in a long. */ -#define SIZEOF_LONG 4 - -/* The number of bytes in a long long. */ -#define SIZEOF_LONG_LONG 8 - -/* Define if you have the alarm function. */ -#define HAVE_ALARM 1 - -/* Define if you have the atod function. */ -/* #undef HAVE_ATOD */ - -/* Define if you have the bcmp function. */ -#define HAVE_BCMP 1 - -/* Define if you have the bfill function. */ -/* #undef HAVE_BFILL */ - -/* Define if you have the bmove function. */ -/* #undef HAVE_BMOVE */ - -/* Define if you have the bzero function. */ -#define HAVE_BZERO 1 - -/* Define if you have the chsize function. */ -#define HAVE_CHSIZE 1 - -/* Define if you have the cuserid function. */ -/* #define HAVE_CUSERID 1 */ - -/* Define if you have the dlerror function. */ -#define HAVE_DLERROR 1 - -/* Define if you have the dlopen function. */ -#define HAVE_DLOPEN 1 - -/* Define if you have the fchmod function. */ -/* #undef HAVE_FCHMOD */ - -/* Define if you have the fcntl function. */ -/* #define HAVE_FCNTL 1 */ - -/* Define if you have the fconvert function. */ -/* #undef HAVE_FCONVERT */ - -/* Define if you have the finite function. */ -/* #undef HAVE_FINITE */ - -/* Define if you have the fpresetsticky function. */ -/* #undef HAVE_FPRESETSTICKY */ - -/* Define if you have the fpsetmask function. */ -/* #undef HAVE_FPSETMASK */ - -/* Define if you have the fseeko function. */ -/* #undef HAVE_FSEEKO */ - -/* Define if you have the ftruncate function. */ -/* #define HAVE_FTRUNCATE 1 */ - -/* Define if you have the getcwd function. */ -#define HAVE_GETCWD 1 - -/* Define if you have the gethostbyaddr_r function. */ -/* #undef HAVE_GETHOSTBYADDR_R */ - -/* Define if you have the gethostbyname_r function. */ -/* #undef HAVE_GETHOSTBYNAME_R */ - -/* Define if you have the getpagesize function. */ -#define HAVE_GETPAGESIZE 1 - -/* Define if you have the getpass function. */ -/*#define HAVE_GETPASS 1 */ - -/* Define if you have the getpassphrase function. */ -/* #undef HAVE_GETPASSPHRASE */ - -/* Define if you have the getpwnam function. */ -/* #define HAVE_GETPWNAM 1 */ - -/* Define if you have the getpwuid function. */ -/* #define HAVE_GETPWUID 1 */ - -/* Define if you have the getrlimit function. */ -/* #undef HAVE_GETRLIMIT */ - -/* Define if you have the getrusage function. */ -/* #undef HAVE_GETRUSAGE */ - -/* Define if you have the getwd function. */ -#define HAVE_GETWD 1 - -/* Define to 1 if you have the `gmtime_r' function. */ -#define HAVE_GMTIME_R 1 - -/* Define if you have the index function. */ -#define HAVE_INDEX 1 - -/* Define if you have the initgroups function. */ -/* #undef HAVE_INITGROUPS */ - -/* Define if you have the localtime_r function. */ -#define HAVE_LOCALTIME_R 1 - -/* Define if you have the locking function. */ -/* #undef HAVE_LOCKING */ - -/* Define if you have the longjmp function. */ -#define HAVE_LONGJMP 1 - -/* Define if you have the lrand48 function. */ -/* #undef HAVE_LRAND48 */ - -/* Define if you have the lstat function. */ -/* #undef HAVE_LSTAT */ - -/* Define if you have the madvise function. */ -/* #undef HAVE_MADVISE */ - -/* Define if you have the memcpy function. */ -#define HAVE_MEMCPY 1 - -/* Define if you have the memmove function. */ -#define HAVE_MEMMOVE 1 - -/* Define if you have the mkstemp function. */ -/* #define HAVE_MKSTEMP 1 */ - -/* Define if you have the mlockall function. */ -/* #undef HAVE_MLOCKALL */ - -/* Define if you have the perror function. */ -#define HAVE_PERROR 1 - -/* Define if you have the poll function. */ -/* #undef HAVE_POLL */ - -/* Define if you have the pread function. */ -/* #undef HAVE_PREAD */ - -/* Define if you have the pthread_attr_create function. */ -/* #undef HAVE_PTHREAD_ATTR_CREATE */ - -/* Define if you have the pthread_attr_setprio function. */ -#define HAVE_PTHREAD_ATTR_SETPRIO 1 - -/* Define if you have the pthread_attr_setschedparam function. */ -/* #undef HAVE_PTHREAD_ATTR_SETSCHEDPARAM */ - -/* Define if you have the pthread_attr_setstacksize function. */ -#define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1 - -/* Define if you have the pthread_condattr_create function. */ -/* #undef HAVE_PTHREAD_CONDATTR_CREATE */ - -/* Define if you have the pthread_getsequence_np function. */ -/* #undef HAVE_PTHREAD_GETSEQUENCE_NP */ - -/* Define if you have the pthread_init function. */ -/* #undef HAVE_PTHREAD_INIT */ - -/* Define if you have the pthread_rwlock_rdlock function. */ -/* #undef HAVE_PTHREAD_RWLOCK_RDLOCK */ - -/* Define if you have the pthread_setprio function. */ -#define HAVE_PTHREAD_SETPRIO 1 - -/* Define if you have the pthread_setprio_np function. */ -/* #undef HAVE_PTHREAD_SETPRIO_NP */ - -/* Define if you have the pthread_setschedparam function. */ -/* #undef HAVE_PTHREAD_SETSCHEDPARAM */ - -/* Define if you have the pthread_sigmask function. */ -#define HAVE_PTHREAD_SIGMASK 1 - -/* Define if you have the putenv function. */ -#define HAVE_PUTENV 1 - -/* Define if you have the readlink function. */ -/* #undef HAVE_READLINK */ - -/* Define if you have the realpath function. */ -/* #undef HAVE_REALPATH */ - -/* Define if you have the rename function. */ -#define HAVE_RENAME 1 - -/* Define if you have the rint function. */ -#define HAVE_RINT 1 - -/* Define if you have the rwlock_init function. */ -/* #undef HAVE_RWLOCK_INIT */ - -/* Define if you have the select function. */ -#define HAVE_SELECT 1 - -/* Define if you have the setenv function. */ -/* #undef HAVE_SETENV */ - -/* Define if you have the setlocale function. */ -#define HAVE_SETLOCALE 1 - -/* Define if you have the setupterm function. */ -/* #undef HAVE_SETUPTERM */ - -/* Define if you have the sighold function. */ -/* #undef HAVE_SIGHOLD */ - -/* Define if you have the sigset function. */ -/* #undef HAVE_SIGSET */ - -/* Define if you have the sigthreadmask function. */ -/* #undef HAVE_SIGTHREADMASK */ - -/* Define if you have the snprintf function. */ -/* #define HAVE_SNPRINTF 1 */ - -/* Define if you have the socket function. */ -#define HAVE_SOCKET 1 - -/* Define if you have the stpcpy function. */ -/* #undef HAVE_STPCPY */ - -/* Define if you have the strcasecmp function. */ -/* #undef HAVE_STRCASECMP */ - -/* Define if you have the strcoll function. */ -#define HAVE_STRCOLL 1 - -/* Define if you have the strerror function. */ -#define HAVE_STRERROR 1 - -/* Define if you have the strnlen function. */ -/* #undef HAVE_STRNLEN */ - -/* Define if you have the strpbrk function. */ -#define HAVE_STRPBRK 1 - -/* Define if you have the strstr function. */ -#define HAVE_STRSTR 1 - -/* Define if you have the strtok_r function. */ -/* #undef HAVE_STRTOK_R */ - -/* Define if you have the strtol function. */ -#define HAVE_STRTOL 1 - -/* Define if you have the strtoul function. */ -#define HAVE_STRTOUL 1 - -/* Define if you have the strtoull function. */ -/* #undef HAVE_STRTOULL */ - -/* Define if you have the tcgetattr function. */ -#define HAVE_TCGETATTR 1 - -/* Define if you have the tell function. */ -#define HAVE_TELL 1 - -/* Define if you have the tempnam function. */ -#define HAVE_TEMPNAM 1 - -/* Define if you have the thr_setconcurrency function. */ -/* #undef HAVE_THR_SETCONCURRENCY */ - -/* Define if you have the vidattr function. */ -/* #undef HAVE_VIDATTR */ - -/* Define if you have the <alloca.h> header file. */ -/* #define HAVE_ALLOCA_H 1 */ - -/* Define if you have the <arpa/inet.h> header file. */ -#define HAVE_ARPA_INET_H 1 - -/* Define if you have the <asm/termbits.h> header file. */ -/* #undef HAVE_ASM_TERMBITS_H */ - -/* Define if you have the <crypt.h> header file. */ -#define HAVE_CRYPT_H 1 - -/* Define if you have the <curses.h> header file. */ -/* #define HAVE_CURSES_H 1 */ - -/* Define if you have the <dirent.h> header file. */ -/* #define HAVE_DIRENT_H 1 */ - -/* Define if you have the <fcntl.h> header file. */ -#define HAVE_FCNTL_H 1 - -/* Define if you have the <float.h> header file. */ -#define HAVE_FLOAT_H 1 - -/* Define if you have the <floatingpoint.h> header file. */ -/* #undef HAVE_FLOATINGPOINT_H */ - -/* Define if you have the <grp.h> header file. */ -/* #define HAVE_GRP_H 1 */ - -/* Define if you have the <ieeefp.h> header file. */ -/* #undef HAVE_IEEEFP_H */ - -/* Define if you have the <limits.h> header file. */ -#define HAVE_LIMITS_H 1 - -/* Define if you have the <locale.h> header file. */ -#define HAVE_LOCALE_H 1 - -/* Define if you have the <memory.h> header file. */ -#define HAVE_MEMORY_H 1 - -/* Define if you have the <ndir.h> header file. */ -/* #undef HAVE_NDIR_H */ - -/* Define if you have the <netinet/in.h> header file. */ -#define HAVE_NETINET_IN_H 1 - -/* Define if you have the <paths.h> header file. */ -/* #undef HAVE_PATHS_H */ - -/* Define if you have the <pwd.h> header file. */ -/* #define HAVE_PWD_H 1 */ - -/* Define if you have the <sched.h> header file. */ -/* #undef HAVE_SCHED_H */ - -/* Define if you have the <select.h> header file. */ -/* #undef HAVE_SELECT_H */ - -/* Define if you have the <stdarg.h> header file. */ -#define HAVE_STDARG_H 1 - -/* Define if you have the <stddef.h> header file. */ -#define HAVE_STDDEF_H 1 - -/* Define if you have the <stdlib.h> header file. */ -#define HAVE_STDLIB_H 1 - -/* Define if you have the <string.h> header file. */ -#define HAVE_STRING_H 1 - -/* Define if you have the <strings.h> header file. */ -/* #define HAVE_STRINGS_H 1 */ - -/* Define if you have the <synch.h> header file. */ -/* #undef HAVE_SYNCH_H */ - -/* Define if you have the <sys/dir.h> header file. */ -/* #define HAVE_SYS_DIR_H 1 */ - -/* Define if you have the <sys/file.h> header file. */ -/* #define HAVE_SYS_FILE_H 1 */ - -/* Define if you have the <sys/ioctl.h> header file. */ -#define HAVE_SYS_IOCTL_H 1 - -/* Define if you have the <sys/mman.h> header file. */ -/* #undef HAVE_SYS_MMAN_H */ - -/* Define if you have the <sys/ndir.h> header file. */ -/* #undef HAVE_SYS_NDIR_H */ - -/* Define if you have the <sys/pte.h> header file. */ -/* #undef HAVE_SYS_PTE_H */ - -/* Define if you have the <sys/ptem.h> header file. */ -/* #undef HAVE_SYS_PTEM_H */ - -/* Define if you have the <sys/select.h> header file. */ -#define HAVE_SYS_SELECT_H 1 - -/* Define if you have the <sys/socket.h> header file. */ -#define HAVE_SYS_SOCKET_H 1 - -/* Define if you have the <sys/stream.h> header file. */ -/* #undef HAVE_SYS_STREAM_H */ - -/* Define if you have the <sys/timeb.h> header file. */ -#define HAVE_SYS_TIMEB_H 1 - -/* Define if you have the <sys/types.h> header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define if you have the <sys/un.h> header file. */ -#define HAVE_SYS_UN_H 1 - -/* Define if you have the <sys/utime.h> header file. */ -#define HAVE_SYS_UTIME_H 1 - -/* Define if you have the <sys/vadvise.h> header file. */ -/* #undef HAVE_SYS_VADVISE_H */ - -/* Define if you have the <sys/wait.h> header file. */ -/* #define HAVE_SYS_WAIT_H 1 */ - -/* Define if you have the <term.h> header file. */ -/* #undef HAVE_TERM_H */ - -/* Define if you have the <termbits.h> header file. */ -/* #undef HAVE_TERMBITS_H */ - -/* Define if you have the <termcap.h> header file. */ -/* #define HAVE_TERMCAP_H 1 */ - -/* Define if you have the <termio.h> header file. */ -/* /#define HAVE_TERMIO_H 1 */ - -/* Define if you have the <termios.h> header file. */ -/* #define HAVE_TERMIOS_H 1 */ - -/* Define if you have the <unistd.h> header file. */ -#define HAVE_UNISTD_H 1 - -/* Define if you have the <utime.h> header file. */ -#define HAVE_UTIME_H 1 - -/* Define if you have the <varargs.h> header file. */ -#define HAVE_VARARGS_H 1 - -/* Define if you have the bind library (-lbind). */ -/* #undef HAVE_LIBBIND */ - -/* Define if you have the c_r library (-lc_r). */ -/* #undef HAVE_LIBC_R */ - -/* Define if you have the compat library (-lcompat). */ -/* #undef HAVE_LIBCOMPAT */ - -/* Define if you have the crypt library (-lcrypt). */ -#define HAVE_LIBCRYPT 1 - -/* Define if you have the dl library (-ldl). */ -#define HAVE_LIBDL 1 - -/* Define if you have the gen library (-lgen). */ -/* #undef HAVE_LIBGEN */ - -/* Define if you have the m library (-lm). */ -#define HAVE_LIBM 1 - -/* Define if you have the nsl library (-lnsl). */ -/* #undef HAVE_LIBNSL */ - -/* Define if you have the nsl_r library (-lnsl_r). */ -/* #undef HAVE_LIBNSL_R */ - -/* Define if you have the pthread library (-lpthread). */ -/* #undef HAVE_LIBPTHREAD */ - -/* Define if you have the socket library (-lsocket). */ -/* #undef HAVE_LIBSOCKET */ - -/* Number of bits in a file offset, on hosts where this is settable. */ -/* #undef _FILE_OFFSET_BITS */ - -/* Define to make fseeko etc. visible, on some hosts. */ -/* #undef _LARGEFILE_SOURCE */ - -/* Define for large files, on AIX-style hosts. */ -/* #undef _LARGE_FILES */ - -#endif /* __CONFIG_OS2_H__ */ diff --git a/include/config-win.h b/include/config-win.h index 75133ddc837..5290cf83896 100644 --- a/include/config-win.h +++ b/include/config-win.h @@ -95,7 +95,7 @@ functions */ #define O_SHORT_LIVED 0 #define SH_DENYNO _SH_DENYNO #else -#define O_BINARY _O_BINARY /* compability with MSDOS */ +#define O_BINARY _O_BINARY /* compability with older style names */ #define FILE_BINARY _O_BINARY /* my_fopen in binary mode */ #define O_TEMPORARY _O_TEMPORARY #define O_SHORT_LIVED _O_SHORT_LIVED @@ -122,12 +122,12 @@ functions */ /* Type information */ -#if defined(__EMX__) || !defined(HAVE_UINT) +#if !defined(HAVE_UINT) #undef HAVE_UINT #define HAVE_UINT typedef unsigned short ushort; typedef unsigned int uint; -#endif /* defined(__EMX__) || !defined(HAVE_UINT) */ +#endif /* !defined(HAVE_UINT) */ typedef unsigned __int64 ulonglong; /* Microsofts 64 bit types */ typedef __int64 longlong; @@ -280,6 +280,12 @@ inline double ulonglong2double(ulonglong value) (((uint32) ((uchar) (A)[2])) << 16) +\ (((uint32) ((uchar) (A)[3])) << 24)) +\ (((ulonglong) ((uchar) (A)[4])) << 32)) +#define uint6korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) + \ + (((uint32) ((uchar) (A)[1])) << 8) + \ + (((uint32) ((uchar) (A)[2])) << 16) + \ + (((uint32) ((uchar) (A)[3])) << 24)) + \ + (((ulonglong) ((uchar) (A)[4])) << 32) + \ + (((ulonglong) ((uchar) (A)[5])) << 40)) #define uint8korr(A) (*((ulonglong *) (A))) #define sint8korr(A) (*((longlong *) (A))) #define int2store(T,A) *((uint16*) (T))= (uint16) (A) @@ -292,6 +298,12 @@ inline double ulonglong2double(ulonglong value) *((T)+2)=(uchar) (((A) >> 16));\ *((T)+3)=(uchar) (((A) >> 24)); \ *((T)+4)=(uchar) (((A) >> 32)); } +#define int6store(T,A) { *(T) =(uchar)((A)); \ + *((T)+1)=(uchar) (((A) >> 8)); \ + *((T)+2)=(uchar) (((A) >> 16)); \ + *((T)+3)=(uchar) (((A) >> 24)); \ + *((T)+4)=(uchar) (((A) >> 32)); \ + *((T)+5)=(uchar) (((A) >> 40)); } #define int8store(T,A) *((ulonglong *) (T))= (ulonglong) (A) #define doubleget(V,M) do { *((long *) &V) = *((long*) M); \ @@ -341,6 +353,9 @@ inline double ulonglong2double(ulonglong value) #define HAVE_VIO_READ_BUFF #define HAVE_STRNLEN +#define strcasecmp stricmp +#define strncasecmp strnicmp + #ifndef __NT__ #undef FILE_SHARE_DELETE #define FILE_SHARE_DELETE 0 /* Not implemented on Win 98/ME */ @@ -421,6 +436,7 @@ inline double ulonglong2double(ulonglong value) #define HAVE_SPATIAL 1 #define HAVE_RTREE_KEYS 1 +#define HAVE_ROW_BASED_REPLICATION 1 #define HAVE_OPENSSL 1 #define HAVE_YASSL 1 diff --git a/include/decimal.h b/include/decimal.h index 2648e04c1cf..3b4cafbfd26 100644 --- a/include/decimal.h +++ b/include/decimal.h @@ -48,6 +48,7 @@ int decimal_bin_size(int precision, int scale); int decimal_result_size(decimal_t *from1, decimal_t *from2, char op, int param); +int decimal_intg(decimal_t *from); int decimal_add(decimal_t *from1, decimal_t *from2, decimal_t *to); int decimal_sub(decimal_t *from1, decimal_t *from2, decimal_t *to); int decimal_cmp(decimal_t *from1, decimal_t *from2); diff --git a/include/errmsg.h b/include/errmsg.h index aca7c4b6a1f..f24ea2bf396 100644 --- a/include/errmsg.h +++ b/include/errmsg.h @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* Error messages for MySQL clients */ -/* (Error messages for the daemon are in share/language/errmsg.sys) */ +/* (Error messages for the daemon are in sql/share/errmsg.txt) */ #ifdef __cplusplus extern "C" { @@ -29,9 +29,7 @@ extern const char *client_errors[]; /* Error messages */ #define CR_MIN_ERROR 2000 /* For easier client code */ #define CR_MAX_ERROR 2999 -#if defined(OS2) && defined(MYSQL_SERVER) -#define CER(X) client_errors[(X)-CR_MIN_ERROR] -#elif !defined(ER) +#if !defined(ER) #define ER(X) client_errors[(X)-CR_MIN_ERROR] #endif #define CLIENT_ERRMAP 2 /* Errormap used by my_error() */ diff --git a/include/ft_global.h b/include/ft_global.h index c3f60d13a7a..8f02e48f61d 100644 --- a/include/ft_global.h +++ b/include/ft_global.h @@ -53,6 +53,7 @@ extern ulong ft_min_word_len; extern ulong ft_max_word_len; extern ulong ft_query_expansion_limit; extern char ft_boolean_syntax[15]; +extern struct st_mysql_ftparser ft_default_parser; int ft_init_stopwords(void); void ft_free_stopwords(void); diff --git a/include/heap.h b/include/heap.h index 4255ee52b18..ea02b30e49b 100644 --- a/include/heap.h +++ b/include/heap.h @@ -111,7 +111,7 @@ struct st_heap_info; /* For referense */ typedef struct st_hp_keydef /* Key definition with open */ { - uint flag; /* HA_NOSAME | HA_NULL_PART_KEY */ + uint flag; /* HA_NOSAME | HA_NULL_PART_KEY */ uint keysegs; /* Number of key-segment */ uint length; /* Length of key (automatic) */ uint8 algorithm; /* HASH / BTREE */ @@ -207,7 +207,9 @@ extern int heap_create(const char *name, uint keys, HP_KEYDEF *keydef, uint reclength, ulong max_records, ulong min_records, HP_CREATE_INFO *create_info); extern int heap_delete_table(const char *name); +extern void heap_drop_table(HP_INFO *info); extern int heap_extra(HP_INFO *info,enum ha_extra_function function); +extern int heap_reset(HP_INFO *info); extern int heap_rename(const char *old_name,const char *new_name); extern int heap_panic(enum ha_panic_function flag); extern int heap_rsame(HP_INFO *info,byte *record,int inx); @@ -223,6 +225,7 @@ extern int heap_indexes_are_disabled(HP_INFO *info); extern void heap_update_auto_increment(HP_INFO *info, const byte *record); ha_rows hp_rb_records_in_range(HP_INFO *info, int inx, key_range *min_key, key_range *max_key); +int hp_panic(enum ha_panic_function flag); int heap_rkey(HP_INFO *info, byte *record, int inx, const byte *key, uint key_len, enum ha_rkey_function find_flag); extern gptr heap_find(HP_INFO *info,int inx,const byte *key); diff --git a/include/m_ctype.h b/include/m_ctype.h index ffecadd9836..d98663c8db4 100644 --- a/include/m_ctype.h +++ b/include/m_ctype.h @@ -48,6 +48,13 @@ typedef struct unicase_info_st extern MY_UNICASE_INFO *my_unicase_default[256]; extern MY_UNICASE_INFO *my_unicase_turkish[256]; +typedef struct uni_ctype_st +{ + unsigned char pctype; + unsigned char *ctype; +} MY_UNI_CTYPE; + +extern MY_UNI_CTYPE my_uni_ctype[256]; /* wm_wc and wc_mb return codes */ #define MY_CS_ILSEQ 0 /* Wrong by sequence: wb_wc */ @@ -76,7 +83,8 @@ extern MY_UNICASE_INFO *my_unicase_turkish[256]; #define MY_CS_UNICODE 128 /* is a charset is full unicode */ #define MY_CS_READY 256 /* if a charset is initialized */ #define MY_CS_AVAILABLE 512 /* If either compiled-in or loaded*/ -#define MY_CS_CSSORT 1024 /* if case sensitive sort order */ +#define MY_CS_CSSORT 1024 /* if case sensitive sort order */ +#define MY_CS_HIDDEN 2048 /* don't display in SHOW */ #define MY_CHARSET_UNDEFINED 0 @@ -171,13 +179,17 @@ typedef struct my_charset_handler_st uint (*lengthsp)(struct charset_info_st *, const char *ptr, uint length); uint (*numcells)(struct charset_info_st *, const char *b, const char *e); - /* Unicode convertion */ + /* Unicode conversion */ int (*mb_wc)(struct charset_info_st *cs,my_wc_t *wc, const unsigned char *s,const unsigned char *e); int (*wc_mb)(struct charset_info_st *cs,my_wc_t wc, unsigned char *s,unsigned char *e); - /* Functions for case and sort convertion */ + /* CTYPE scanner */ + int (*ctype)(struct charset_info_st *cs, int *ctype, + const unsigned char *s, const unsigned char *e); + + /* Functions for case and sort conversion */ uint (*caseup_str)(struct charset_info_st *, char *); uint (*casedn_str)(struct charset_info_st *, char *); uint (*caseup)(struct charset_info_st *, char *src, uint srclen, @@ -195,7 +207,7 @@ typedef struct my_charset_handler_st void (*fill)(struct charset_info_st *, char *to, uint len, int fill); - /* String-to-number convertion routines */ + /* String-to-number conversion routines */ long (*strntol)(struct charset_info_st *, const char *s, uint l, int base, char **e, int *err); ulong (*strntoul)(struct charset_info_st *, const char *s, uint l, @@ -286,6 +298,7 @@ extern CHARSET_INFO my_charset_ujis_bin; extern CHARSET_INFO my_charset_utf8_general_ci; extern CHARSET_INFO my_charset_utf8_bin; extern CHARSET_INFO my_charset_cp1250_czech_ci; +extern CHARSET_INFO my_charset_filename; /* declarations for simple charsets */ extern int my_strnxfrm_simple(CHARSET_INFO *, uchar *, uint, const uchar *, @@ -323,6 +336,9 @@ extern int my_strcasecmp_8bit(CHARSET_INFO * cs, const char *, const char *); int my_mb_wc_8bit(CHARSET_INFO *cs,my_wc_t *wc, const uchar *s,const uchar *e); int my_wc_mb_8bit(CHARSET_INFO *cs,my_wc_t wc, uchar *s, uchar *e); +int my_mb_ctype_8bit(CHARSET_INFO *,int *, const uchar *,const uchar *); +int my_mb_ctype_mb(CHARSET_INFO *,int *, const uchar *,const uchar *); + ulong my_scan_8bit(CHARSET_INFO *cs, const char *b, const char *e, int sq); int my_snprintf_8bit(struct charset_info_st *, char *to, uint n, @@ -429,6 +445,8 @@ int my_wildcmp_unicode(CHARSET_INFO *cs, extern my_bool my_parse_charset_xml(const char *bug, uint len, int (*add)(CHARSET_INFO *cs)); +extern char *my_strchr(CHARSET_INFO *cs, const char *str, const char *end, + pchar c); my_bool my_propagate_simple(CHARSET_INFO *cs, const uchar *str, uint len); my_bool my_propagate_complex(CHARSET_INFO *cs, const uchar *str, uint len); diff --git a/include/m_string.h b/include/m_string.h index 8a526d70d1d..caccc59abd5 100644 --- a/include/m_string.h +++ b/include/m_string.h @@ -34,25 +34,12 @@ /* need by my_vsnprintf */ #include <stdarg.h> -/* Correct some things for UNIXWARE7 */ -#ifdef HAVE_UNIXWARE7_THREADS -#undef HAVE_STRINGS_H -#undef HAVE_MEMORY_H -#define HAVE_MEMCPY -#ifndef HAVE_MEMMOVE -#define HAVE_MEMMOVE -#endif -#undef HAVE_BCMP -#undef bcopy -#undef bcmp -#undef bzero -#endif /* HAVE_UNIXWARE7_THREADS */ #ifdef _AIX #undef HAVE_BCMP #endif /* This is needed for the definitions of bzero... on solaris */ -#if defined(HAVE_STRINGS_H) && !defined(HAVE_mit_thread) +#if defined(HAVE_STRINGS_H) #include <strings.h> #endif @@ -84,7 +71,7 @@ # define bmove_align(A,B,C) memcpy((A),(B),(C)) #endif -#if defined(__cplusplus) && !defined(OS2) +#if defined(__cplusplus) extern "C" { #endif @@ -95,7 +82,7 @@ extern "C" { extern void *(*my_str_malloc)(size_t); extern void (*my_str_free)(void *); -#if defined(HAVE_STPCPY) && !defined(HAVE_mit_thread) +#if defined(HAVE_STPCPY) #define strmov(A,B) stpcpy((A),(B)) #ifndef stpcpy extern char *stpcpy(char *, const char *); /* For AIX with gcc 2.95.3 */ @@ -119,12 +106,6 @@ extern char NEAR _dig_vec_lower[]; #define memcpy_fixed(A,B,C) memcpy((A),(B),(C)) #endif -#ifdef MSDOS -#undef bmove_align -#define bmove512(A,B,C) bmove_align(A,B,C) -extern void bmove_align(gptr dst,const gptr src,uint len); -#endif - #if (!defined(USE_BMOVE512) || defined(HAVE_purify)) && !defined(bmove512) #define bmove512(A,B,C) memcpy(A,B,C) #endif @@ -243,7 +224,7 @@ longlong my_strtoll10(const char *nptr, char **endptr, int *error); #ifdef HAVE_LONG_LONG extern char *longlong2str(longlong val,char *dst,int radix); extern char *longlong10_to_str(longlong val,char *dst,int radix); -#if (!defined(HAVE_STRTOULL) || defined(HAVE_mit_thread)) || defined(NO_STRTOLL_PROTO) +#if (!defined(HAVE_STRTOULL) || defined(NO_STRTOLL_PROTO)) extern longlong strtoll(const char *str, char **ptr, int base); extern ulonglong strtoull(const char *str, char **ptr, int base); #endif @@ -257,7 +238,25 @@ extern int my_vsnprintf( char *str, size_t n, extern int my_snprintf(char *to, size_t n, const char *fmt, ...) ATTRIBUTE_FORMAT(printf, 3, 4); -#if defined(__cplusplus) && !defined(OS2) +#if defined(__cplusplus) } #endif + +/* + LEX_STRING -- a pair of a C-string and its length. + + NOTE: this exactly form of declaration is required for some C-compilers + (for one, Sun C 5.7 2005/01/07). Unfortunatelt with such declaration + LEX_STRING can not be forward declared. +*/ + +typedef struct +{ + char *str; + uint length; +} LEX_STRING; + +#define STRING_WITH_LEN(X) (X), ((uint) (sizeof(X) - 1)) +#define C_STRING_WITH_LEN(X) ((char *) (X)), ((uint) (sizeof(X) - 1)) + #endif diff --git a/include/my_atomic.h b/include/my_atomic.h new file mode 100644 index 00000000000..9a319f84451 --- /dev/null +++ b/include/my_atomic.h @@ -0,0 +1,151 @@ +/* Copyright (C) 2006 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 */ + +#ifndef my_atomic_rwlock_init + +#define intptr void * + +#ifndef MY_ATOMIC_MODE_RWLOCKS +#include "atomic/nolock.h" +#endif + +#ifndef make_atomic_cas_body +#include "atomic/rwlock.h" +#endif + +#ifndef make_atomic_add_body +#define make_atomic_add_body(S) \ + int ## S tmp=*a; \ + while (!my_atomic_cas ## S(a, &tmp, tmp+v)); \ + v=tmp; +#endif + +#ifdef HAVE_INLINE + +#define make_atomic_add(S) \ +static inline int ## S my_atomic_add ## S( \ + int ## S volatile *a, int ## S v) \ +{ \ + make_atomic_add_body(S); \ + return v; \ +} + +#define make_atomic_swap(S) \ +static inline int ## S my_atomic_swap ## S( \ + int ## S volatile *a, int ## S v) \ +{ \ + make_atomic_swap_body(S); \ + return v; \ +} + +#define make_atomic_cas(S) \ +static inline int my_atomic_cas ## S(int ## S volatile *a, \ + int ## S *cmp, int ## S set) \ +{ \ + int8 ret; \ + make_atomic_cas_body(S); \ + return ret; \ +} + +#define make_atomic_load(S) \ +static inline int ## S my_atomic_load ## S(int ## S volatile *a) \ +{ \ + int ## S ret; \ + make_atomic_load_body(S); \ + return ret; \ +} + +#define make_atomic_store(S) \ +static inline void my_atomic_store ## S( \ + int ## S volatile *a, int ## S v) \ +{ \ + make_atomic_store_body(S); \ +} + +#else /* no inline functions */ + +#define make_atomic_add(S) \ +extern int ## S my_atomic_add ## S(int ## S volatile *a, int ## S v); + +#define make_atomic_swap(S) \ +extern int ## S my_atomic_swap ## S(int ## S volatile *a, int ## S v); + +#define make_atomic_cas(S) \ +extern int my_atomic_cas ## S(int ## S volatile *a, int ## S *cmp, int ## S set); + +#define make_atomic_load(S) \ +extern int ## S my_atomic_load ## S(int ## S volatile *a); + +#define make_atomic_store(S) \ +extern void my_atomic_store ## S(int ## S volatile *a, int ## S v); + +#endif + +make_atomic_cas( 8) +make_atomic_cas(16) +make_atomic_cas(32) +make_atomic_cas(ptr) + +make_atomic_add( 8) +make_atomic_add(16) +make_atomic_add(32) + +make_atomic_load( 8) +make_atomic_load(16) +make_atomic_load(32) +make_atomic_load(ptr) + +make_atomic_store( 8) +make_atomic_store(16) +make_atomic_store(32) +make_atomic_store(ptr) + +make_atomic_swap( 8) +make_atomic_swap(16) +make_atomic_swap(32) +make_atomic_swap(ptr) + +#undef make_atomic_add +#undef make_atomic_cas +#undef make_atomic_load +#undef make_atomic_store +#undef make_atomic_swap +#undef make_atomic_add_body +#undef make_atomic_cas_body +#undef make_atomic_load_body +#undef make_atomic_store_body +#undef make_atomic_swap_body +#undef intptr + +#ifdef _atomic_h_cleanup_ +#include _atomic_h_cleanup_ +#undef _atomic_h_cleanup_ +#endif + +#if SIZEOF_CHARP == SIZEOF_INT +typedef int intptr; +#elif SIZEOF_CHARP == SIZEOF_LONG +typedef long intptr; +#else +#error +#endif + +#define MY_ATOMIC_OK 0 +#define MY_ATOMIC_NOT_1CPU 1 +extern int my_atomic_initialize(); + +#endif + diff --git a/include/my_base.h b/include/my_base.h index dda64db2ef9..cf254f5e0d0 100644 --- a/include/my_base.h +++ b/include/my_base.h @@ -21,7 +21,6 @@ #define _my_base_h #ifndef stdin /* Included first in handler */ -#define USES_TYPES /* my_dir with sys/types is included */ #define CHSIZE_USED #include <my_global.h> #include <my_dir.h> /* This includes types */ @@ -33,9 +32,6 @@ #define EOVERFLOW 84 #endif -#ifdef MSDOS -#include <share.h> /* Neaded for sopen() */ -#endif #if !defined(USE_MY_FUNC) && !defined(THREAD) #include <my_nosys.h> /* For faster code, after test */ #endif /* USE_MY_FUNC */ @@ -51,6 +47,7 @@ #define HA_OPEN_DELAY_KEY_WRITE 8 /* Don't update index */ #define HA_OPEN_ABORT_IF_CRASHED 16 #define HA_OPEN_FOR_REPAIR 32 /* open even if crashed */ +#define HA_OPEN_FROM_SQL_LAYER 64 /* The following is parameter to ha_rkey() how to use key */ @@ -104,7 +101,7 @@ enum ha_key_alg { enum ha_extra_function { HA_EXTRA_NORMAL=0, /* Optimize for space (def) */ HA_EXTRA_QUICK=1, /* Optimize for speed */ - HA_EXTRA_RESET=2, /* Reset database to after open */ + HA_EXTRA_NOT_USED=2, HA_EXTRA_CACHE=3, /* Cache record in HA_rrnd() */ HA_EXTRA_NO_CACHE=4, /* End caching of records (def) */ HA_EXTRA_NO_READCHECK=5, /* No readcheck on update */ @@ -130,15 +127,6 @@ enum ha_extra_function { HA_EXTRA_RESET_STATE, /* Reset positions */ HA_EXTRA_IGNORE_DUP_KEY, /* Dup keys don't rollback everything*/ HA_EXTRA_NO_IGNORE_DUP_KEY, - /* - Instructs InnoDB to retrieve all columns (except in key read), not just - those where field->query_id is the same as the current query id - */ - HA_EXTRA_RETRIEVE_ALL_COLS, - /* - Instructs InnoDB to retrieve at least all the primary key columns - */ - HA_EXTRA_RETRIEVE_PRIMARY_KEY, HA_EXTRA_PREPARE_FOR_DELETE, HA_EXTRA_PREPARE_FOR_UPDATE, /* Remove read cache if problems */ HA_EXTRA_PRELOAD_BUFFER_SIZE, /* Set buffer size for preloading */ @@ -153,6 +141,21 @@ enum ha_extra_function { to overwrite entire row. */ HA_EXTRA_KEYREAD_PRESERVE_FIELDS, + HA_EXTRA_MMAP, + /* + Ignore if the a tuple is not found, continue processing the + transaction and ignore that 'row'. Needed for idempotency + handling on the slave + + Currently only used by NDB storage engine. Partition handler ignores flag. + */ + HA_EXTRA_IGNORE_NO_KEY, + HA_EXTRA_NO_IGNORE_NO_KEY, + /* + Mark the table as a log table. For some handlers (e.g. CSV) this results + in a special locking for the table. + */ + HA_EXTRA_MARK_AS_LOG_TABLE, /* Informs handler that write_row() which tries to insert new row into the table and encounters some already existing row with same primary/unique @@ -213,17 +216,19 @@ enum ha_base_keytype { #define HA_NULL_ARE_EQUAL 2048 /* NULL in key are cmp as equal */ #define HA_GENERATED_KEY 8192 /* Automaticly generated key */ + /* The combination of the above can be used for key type comparison. */ +#define HA_KEYFLAG_MASK (HA_NOSAME | HA_PACK_KEY | HA_AUTO_KEY | \ + HA_BINARY_PACK_KEY | HA_FULLTEXT | HA_UNIQUE_CHECK | \ + HA_SPATIAL | HA_NULL_ARE_EQUAL | HA_GENERATED_KEY) + /* Automatic bits in key-flag */ #define HA_SPACE_PACK_USED 4 /* Test for if SPACE_PACK used */ #define HA_VAR_LENGTH_KEY 8 #define HA_NULL_PART_KEY 64 -#ifndef ISAM_LIBRARY +#define HA_USES_PARSER 16384 /* Fulltext index uses [pre]parser */ +#define HA_USES_BLOCK_SIZE ((uint) 32768) #define HA_SORT_ALLOWS_SAME 512 /* Intern bit when sorting records */ -#else -/* poor old NISAM has 8-bit flags :-( */ -#define HA_SORT_ALLOWS_SAME 128 /* Intern bit when sorting records */ -#endif #if MYSQL_VERSION_ID < 0x50200 /* Key has a part that can have end space. If this is an unique key @@ -263,6 +268,7 @@ enum ha_base_keytype { #define HA_OPTION_DELAY_KEY_WRITE 64 #define HA_OPTION_NO_PACK_KEYS 128 /* Reserved for MySQL */ #define HA_OPTION_CREATE_FROM_ENGINE 256 +#define HA_OPTION_RELIES_ON_SQL_LAYER 512 #define HA_OPTION_TEMP_COMPRESS_RECORD ((uint) 16384) /* set by isamchk */ #define HA_OPTION_READ_ONLY_DATA ((uint) 32768) /* Set by isamchk */ @@ -273,6 +279,7 @@ enum ha_base_keytype { #define HA_CREATE_TMP_TABLE 4 #define HA_CREATE_CHECKSUM 8 #define HA_CREATE_DELAY_KEY_WRITE 64 +#define HA_CREATE_RELIES_ON_SQL_LAYER 128 /* The following flags (OR-ed) are passed to handler::info() method. @@ -334,7 +341,7 @@ enum ha_base_keytype { #define HA_ERR_WRONG_COMMAND 131 /* Command not supported */ #define HA_ERR_OLD_FILE 132 /* old databasfile */ #define HA_ERR_NO_ACTIVE_RECORD 133 /* No record read in update() */ -#define HA_ERR_RECORD_DELETED 134 /* Intern error-code */ +#define HA_ERR_RECORD_DELETED 134 /* A record is not there */ #define HA_ERR_RECORD_FILE_FULL 135 /* No more room in file */ #define HA_ERR_INDEX_FILE_FULL 136 /* No more room in file */ #define HA_ERR_END_OF_FILE 137 /* end in next/prev/first/last */ @@ -360,12 +367,19 @@ enum ha_base_keytype { #define HA_ERR_NO_CONNECTION 157 /* Could not connect to storage engine */ #define HA_ERR_NULL_IN_SPATIAL 158 /* NULLs are not supported in spatial index */ #define HA_ERR_TABLE_DEF_CHANGED 159 /* The table changed in storage engine */ -#define HA_ERR_TABLE_NEEDS_UPGRADE 160 /* The table changed in storage engine */ -#define HA_ERR_TABLE_READONLY 161 /* The table is not writable */ -#define HA_ERR_AUTOINC_READ_FAILED 162/* Failed to get the next autoinc value */ -#define HA_ERR_AUTOINC_ERANGE 163 /* Failed to set the row autoinc value */ - -#define HA_ERR_LAST 163 /*Copy last error nr.*/ +#define HA_ERR_NO_PARTITION_FOUND 160 /* There's no partition in table for + given value */ +#define HA_ERR_RBR_LOGGING_FAILED 161 /* Row-based binlogging of row failed */ +#define HA_ERR_DROP_INDEX_FK 162 /* Index needed in foreign key constr. */ +#define HA_ERR_FOREIGN_DUPLICATE_KEY 163 /* Upholding foreign key constraints + would lead to a duplicate key + error in some other table. */ +#define HA_ERR_TABLE_NEEDS_UPGRADE 164 /* The table changed in storage engine */ +#define HA_ERR_TABLE_READONLY 165 /* The table is not writable */ + +#define HA_ERR_AUTOINC_READ_FAILED 166/* Failed to get the next autoinc value */ +#define HA_ERR_AUTOINC_ERANGE 167 /* Failed to set the row autoinc value */ +#define HA_ERR_LAST 167 /*Copy last error nr.*/ /* Add error numbers before HA_ERR_LAST and change it accordingly. */ #define HA_ERR_ERRORS (HA_ERR_LAST - HA_ERR_FIRST + 1) @@ -440,6 +454,7 @@ enum data_file_type { #define EQ_RANGE 32 #define NULL_RANGE 64 #define GEOM_FLAG 128 +#define SKIP_RANGE 256 typedef struct st_key_range { diff --git a/include/my_bitmap.h b/include/my_bitmap.h index f4fe28266e4..0b16a1b4832 100644 --- a/include/my_bitmap.h +++ b/include/my_bitmap.h @@ -17,14 +17,18 @@ #ifndef _my_bitmap_h_ #define _my_bitmap_h_ -#include <my_pthread.h> - #define MY_BIT_NONE (~(uint) 0) +#include <m_string.h> + +typedef uint32 my_bitmap_map; + typedef struct st_bitmap { - uchar *bitmap; - uint bitmap_size; /* number of bytes occupied by the above */ + my_bitmap_map *bitmap; + uint n_bits; /* number of bits occupied by the above */ + my_bitmap_map last_word_mask; + my_bitmap_map *last_word_ptr; /* mutex will be acquired for the duration of each bitmap operation if thread_safe flag in bitmap_init was set. Otherwise, we optimize by not @@ -38,33 +42,111 @@ typedef struct st_bitmap #ifdef __cplusplus extern "C" { #endif -extern my_bool bitmap_cmp(const MY_BITMAP *map1, const MY_BITMAP *map2); -extern my_bool bitmap_init(MY_BITMAP *map, uchar *buf, uint bitmap_size, my_bool thread_safe); +extern my_bool bitmap_init(MY_BITMAP *map, my_bitmap_map *buf, uint n_bits, + my_bool thread_safe); extern my_bool bitmap_is_clear_all(const MY_BITMAP *map); extern my_bool bitmap_is_prefix(const MY_BITMAP *map, uint prefix_size); -extern my_bool bitmap_is_set(const MY_BITMAP *map, uint bitmap_bit); extern my_bool bitmap_is_set_all(const MY_BITMAP *map); extern my_bool bitmap_is_subset(const MY_BITMAP *map1, const MY_BITMAP *map2); +extern my_bool bitmap_is_overlapping(const MY_BITMAP *map1, + const MY_BITMAP *map2); extern my_bool bitmap_test_and_set(MY_BITMAP *map, uint bitmap_bit); +extern my_bool bitmap_test_and_clear(MY_BITMAP *map, uint bitmap_bit); extern my_bool bitmap_fast_test_and_set(MY_BITMAP *map, uint bitmap_bit); extern uint bitmap_set_next(MY_BITMAP *map); extern uint bitmap_get_first(const MY_BITMAP *map); +extern uint bitmap_get_first_set(const MY_BITMAP *map); extern uint bitmap_bits_set(const MY_BITMAP *map); -extern void bitmap_clear_all(MY_BITMAP *map); -extern void bitmap_clear_bit(MY_BITMAP *map, uint bitmap_bit); extern void bitmap_free(MY_BITMAP *map); -extern void bitmap_intersect(MY_BITMAP *map, const MY_BITMAP *map2); extern void bitmap_set_above(MY_BITMAP *map, uint from_byte, uint use_bit); -extern void bitmap_set_all(MY_BITMAP *map); -extern void bitmap_set_bit(MY_BITMAP *map, uint bitmap_bit); extern void bitmap_set_prefix(MY_BITMAP *map, uint prefix_size); +extern void bitmap_intersect(MY_BITMAP *map, const MY_BITMAP *map2); extern void bitmap_subtract(MY_BITMAP *map, const MY_BITMAP *map2); extern void bitmap_union(MY_BITMAP *map, const MY_BITMAP *map2); +extern void bitmap_xor(MY_BITMAP *map, const MY_BITMAP *map2); +extern void bitmap_invert(MY_BITMAP *map); +extern void bitmap_copy(MY_BITMAP *map, const MY_BITMAP *map2); +extern uint bitmap_lock_set_next(MY_BITMAP *map); +extern void bitmap_lock_clear_bit(MY_BITMAP *map, uint bitmap_bit); +#ifdef NOT_USED +extern uint bitmap_lock_bits_set(const MY_BITMAP *map); +extern my_bool bitmap_lock_is_set_all(const MY_BITMAP *map); +extern uint bitmap_lock_get_first(const MY_BITMAP *map); +extern uint bitmap_lock_get_first_set(const MY_BITMAP *map); +extern my_bool bitmap_lock_is_subset(const MY_BITMAP *map1, + const MY_BITMAP *map2); +extern my_bool bitmap_lock_is_prefix(const MY_BITMAP *map, uint prefix_size); +extern my_bool bitmap_lock_is_set(const MY_BITMAP *map, uint bitmap_bit); +extern my_bool bitmap_lock_is_clear_all(const MY_BITMAP *map); +extern my_bool bitmap_lock_cmp(const MY_BITMAP *map1, const MY_BITMAP *map2); +extern void bitmap_lock_set_all(MY_BITMAP *map); +extern void bitmap_lock_clear_all(MY_BITMAP *map); +extern void bitmap_lock_set_bit(MY_BITMAP *map, uint bitmap_bit); +extern void bitmap_lock_flip_bit(MY_BITMAP *map, uint bitmap_bit); +extern void bitmap_lock_set_prefix(MY_BITMAP *map, uint prefix_size); +extern void bitmap_lock_intersect(MY_BITMAP *map, const MY_BITMAP *map2); +extern void bitmap_lock_subtract(MY_BITMAP *map, const MY_BITMAP *map2); +extern void bitmap_lock_union(MY_BITMAP *map, const MY_BITMAP *map2); +extern void bitmap_lock_xor(MY_BITMAP *map, const MY_BITMAP *map2); +extern void bitmap_lock_invert(MY_BITMAP *map); +#endif /* Fast, not thread safe, bitmap functions */ -#define bitmap_fast_set_bit(MAP, BIT) (MAP)->bitmap[(BIT) / 8] |= (1 << ((BIT) & 7)) -#define bitmap_fast_clear_bit(MAP, BIT) (MAP)->bitmap[(BIT) / 8] &= ~ (1 << ((BIT) & 7)) -#define bitmap_fast_is_set(MAP, BIT) (MAP)->bitmap[(BIT) / 8] & (1 << ((BIT) & 7)) +#define bitmap_buffer_size(bits) (((bits)+31)/32)*4 +#define no_bytes_in_map(map) (((map)->n_bits + 7)/8) +#define no_words_in_map(map) (((map)->n_bits + 31)/32) +#define bytes_word_aligned(bytes) (4*((bytes + 3)/4)) +#define _bitmap_set_bit(MAP, BIT) (((uchar*)(MAP)->bitmap)[(BIT) / 8] \ + |= (1 << ((BIT) & 7))) +#define _bitmap_flip_bit(MAP, BIT) (((uchar*)(MAP)->bitmap)[(BIT) / 8] \ + ^= (1 << ((BIT) & 7))) +#define _bitmap_clear_bit(MAP, BIT) (((uchar*)(MAP)->bitmap)[(BIT) / 8] \ + &= ~ (1 << ((BIT) & 7))) +#define _bitmap_is_set(MAP, BIT) (uint) (((uchar*)(MAP)->bitmap)[(BIT) / 8] \ + & (1 << ((BIT) & 7))) +#ifndef DBUG_OFF +static inline void +bitmap_set_bit(MY_BITMAP *map,uint bit) +{ + DBUG_ASSERT(bit < (map)->n_bits); + _bitmap_set_bit(map,bit); +} +static inline void +bitmap_flip_bit(MY_BITMAP *map,uint bit) +{ + DBUG_ASSERT(bit < (map)->n_bits); + _bitmap_flip_bit(map,bit); +} +static inline void +bitmap_clear_bit(MY_BITMAP *map,uint bit) +{ + DBUG_ASSERT(bit < (map)->n_bits); + _bitmap_clear_bit(map,bit); +} +static inline uint +bitmap_is_set(const MY_BITMAP *map,uint bit) +{ + DBUG_ASSERT(bit < (map)->n_bits); + return _bitmap_is_set(map,bit); +} +#else +#define bitmap_set_bit(MAP, BIT) _bitmap_set_bit(MAP, BIT) +#define bitmap_flip_bit(MAP, BIT) _bitmap_flip_bit(MAP, BIT) +#define bitmap_clear_bit(MAP, BIT) _bitmap_clear_bit(MAP, BIT) +#define bitmap_is_set(MAP, BIT) _bitmap_is_set(MAP, BIT) +#endif + +static inline my_bool bitmap_cmp(const MY_BITMAP *map1, const MY_BITMAP *map2) +{ + *(map1)->last_word_ptr|= (map1)->last_word_mask; + *(map2)->last_word_ptr|= (map2)->last_word_mask; + return memcmp((map1)->bitmap, (map2)->bitmap, 4*no_words_in_map((map1)))==0; +} + +#define bitmap_clear_all(MAP) \ + { memset((MAP)->bitmap, 0, 4*no_words_in_map((MAP))); } +#define bitmap_set_all(MAP) \ + (memset((MAP)->bitmap, 0xFF, 4*no_words_in_map((MAP)))) #ifdef __cplusplus } diff --git a/include/my_dbug.h b/include/my_dbug.h index 8a8d622e2a3..f4aaa41b201 100644 --- a/include/my_dbug.h +++ b/include/my_dbug.h @@ -21,15 +21,18 @@ extern "C" { #endif #if !defined(DBUG_OFF) && !defined(_lint) -extern int _db_on_,_no_db_; -extern FILE *_db_fp_; -extern char *_db_process_; -extern int _db_keyword_(const char *keyword); +struct _db_code_state_; +extern int _db_keyword_(struct _db_code_state_ *cs, const char *keyword); extern int _db_strict_keyword_(const char *keyword); +extern int _db_explain_(struct _db_code_state_ *cs, char *buf, int len); +extern int _db_explain_init_(char *buf, int len); extern void _db_setjmp_(void); extern void _db_longjmp_(void); +extern void _db_process_(const char *name); extern void _db_push_(const char *control); extern void _db_pop_(void); +extern void _db_set_(struct _db_code_state_ *cs, const char *control); +extern void _db_set_init_(const char *control); extern void _db_enter_(const char *_func_,const char *_file_,uint _line_, const char **_sfunc_,const char **_sfile_, uint *_slevel_, char ***); @@ -40,65 +43,70 @@ extern void _db_doprnt_ _VARARGS((const char *format,...)) ATTRIBUTE_FORMAT(printf, 1, 2); extern void _db_dump_(uint _line_,const char *keyword,const char *memory, uint length); -extern void _db_output_(uint flag); extern void _db_end_(void); -extern void _db_lock_file(void); -extern void _db_unlock_file(void); +extern void _db_lock_file_(void); +extern void _db_unlock_file_(void); +extern FILE *_db_fp_(void); #define DBUG_ENTER(a) const char *_db_func_, *_db_file_; uint _db_level_; \ char **_db_framep_; \ _db_enter_ (a,__FILE__,__LINE__,&_db_func_,&_db_file_,&_db_level_, \ &_db_framep_) #define DBUG_LEAVE \ - (_db_return_ (__LINE__, &_db_func_, &_db_file_, &_db_level_)) -#define DBUG_RETURN(a1) {DBUG_LEAVE; return(a1);} -#define DBUG_VOID_RETURN {DBUG_LEAVE; return;} + _db_return_ (__LINE__, &_db_func_, &_db_file_, &_db_level_) +#define DBUG_RETURN(a1) do {DBUG_LEAVE; return(a1);} while(0) +#define DBUG_VOID_RETURN do {DBUG_LEAVE; return;} while(0) #define DBUG_EXECUTE(keyword,a1) \ - {if (_db_on_) {if (_db_keyword_ (keyword)) { a1 }}} + do {if (_db_keyword_(0, (keyword))) { a1 }} while(0) +#define DBUG_EXECUTE_IF(keyword,a1) \ + do {if (_db_strict_keyword_ (keyword)) { a1 } } while(0) +#define DBUG_EVALUATE(keyword,a1,a2) \ + (_db_keyword_(0,(keyword)) ? (a1) : (a2)) +#define DBUG_EVALUATE_IF(keyword,a1,a2) \ + (_db_strict_keyword_((keyword)) ? (a1) : (a2)) #define DBUG_PRINT(keyword,arglist) \ - {if (_db_on_) {_db_pargs_(__LINE__,keyword); _db_doprnt_ arglist;}} + do {_db_pargs_(__LINE__,keyword); _db_doprnt_ arglist;} while(0) #define DBUG_PUSH(a1) _db_push_ (a1) #define DBUG_POP() _db_pop_ () -#define DBUG_PROCESS(a1) (_db_process_ = a1) -#define DBUG_FILE (_db_fp_) +#define DBUG_SET(a1) _db_set_ (0, (a1)) +#define DBUG_SET_INITIAL(a1) _db_set_init_ (a1) +#define DBUG_PROCESS(a1) _db_process_(a1) +#define DBUG_FILE _db_fp_() #define DBUG_SETJMP(a1) (_db_setjmp_ (), setjmp (a1)) #define DBUG_LONGJMP(a1,a2) (_db_longjmp_ (), longjmp (a1, a2)) -#define DBUG_DUMP(keyword,a1,a2)\ - {if (_db_on_) {_db_dump_(__LINE__,keyword,a1,a2);}} -#define DBUG_IN_USE (_db_fp_ && _db_fp_ != stderr) -#define DEBUGGER_OFF _no_db_=1;_db_on_=0; -#define DEBUGGER_ON _no_db_=0 +#define DBUG_DUMP(keyword,a1,a2) _db_dump_(__LINE__,keyword,a1,a2) #define DBUG_END() _db_end_ () -#define DBUG_LOCK_FILE { _db_lock_file(); } -#define DBUG_UNLOCK_FILE { _db_unlock_file(); } -#define DBUG_OUTPUT(A) { _db_output_(A); } +#define DBUG_LOCK_FILE _db_lock_file_() +#define DBUG_UNLOCK_FILE _db_unlock_file_() #define DBUG_ASSERT(A) assert(A) -#define DBUG_EXECUTE_IF(keyword,a1) \ - {if (_db_on_) {if (_db_strict_keyword_ (keyword)) { a1 }}} +#define DBUG_EXPLAIN(buf,len) _db_explain_(0, (buf),(len)) +#define DBUG_EXPLAIN_INITIAL(buf,len) _db_explain_init_((buf),(len)) #else /* No debugger */ #define DBUG_ENTER(a1) -#define DBUG_RETURN(a1) return(a1) -#define DBUG_VOID_RETURN return -#define DBUG_EXECUTE(keyword,a1) {} -#define DBUG_EXECUTE_IF(keyword,a1) {} -#define DBUG_PRINT(keyword,arglist) {} -#define DBUG_PUSH(a1) {} -#define DBUG_POP() {} -#define DBUG_PROCESS(a1) {} -#define DBUG_FILE (stderr) -#define DBUG_SETJMP setjmp -#define DBUG_LONGJMP longjmp -#define DBUG_DUMP(keyword,a1,a2) {} -#define DBUG_IN_USE 0 -#define DEBUGGER_OFF -#define DEBUGGER_ON +#define DBUG_LEAVE +#define DBUG_RETURN(a1) do { return(a1); } while(0) +#define DBUG_VOID_RETURN do { return; } while(0) +#define DBUG_EXECUTE(keyword,a1) do { } while(0) +#define DBUG_EXECUTE_IF(keyword,a1) do { } while(0) +#define DBUG_EVALUATE(keyword,a1,a2) (a2) +#define DBUG_EVALUATE_IF(keyword,a1,a2) (a2) +#define DBUG_PRINT(keyword,arglist) do { } while(0) +#define DBUG_PUSH(a1) +#define DBUG_SET(a1) +#define DBUG_SET_INITIAL(a1) +#define DBUG_POP() +#define DBUG_PROCESS(a1) (a1) +#define DBUG_SETJMP(a1) setjmp(a1) +#define DBUG_LONGJMP(a1) longjmp(a1) +#define DBUG_DUMP(keyword,a1,a2) #define DBUG_END() +#define DBUG_ASSERT(A) #define DBUG_LOCK_FILE +#define DBUG_FILE (stderr) #define DBUG_UNLOCK_FILE -#define DBUG_OUTPUT(A) -#define DBUG_ASSERT(A) {} -#define DBUG_LEAVE +#define DBUG_EXPLAIN(buf,len) +#define DBUG_EXPLAIN_INITIAL(buf,len) #endif #ifdef __cplusplus } diff --git a/include/my_global.h b/include/my_global.h index 7c072b2fc5c..80654051b5b 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -24,13 +24,6 @@ #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 @@ -72,8 +65,6 @@ #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> @@ -87,6 +78,15 @@ #endif #endif /* _WIN32... */ +#ifndef EMBEDDED_LIBRARY +#ifdef WITH_ROW_BASED_REPLICATION +#define HAVE_ROW_BASED_REPLICATION 1 +#endif +#ifdef WITH_NDB_BINLOG +#define HAVE_NDB_BINLOG 1 +#endif +#endif /* !EMBEDDED_LIBRARY */ + /* Some defines to avoid ifdefs in the code */ #ifndef NETWARE_YIELD #define NETWARE_YIELD @@ -110,6 +110,105 @@ #define unlikely(x) __builtin_expect((x),0) +/* + The macros below are useful in optimising places where it has been + discovered that cache misses stall the process and where a prefetch + of the cache line can improve matters. This is available in GCC 3.1.1 + and later versions. + PREFETCH_READ says that addr is going to be used for reading and that + it is to be kept in caches if possible for a while + PREFETCH_WRITE also says that the item to be cached is likely to be + updated. + The *LOCALITY scripts are also available for experimentation purposes + mostly and should only be used if they are verified to improve matters. + For more input see GCC manual (available in GCC 3.1.1 and later) +*/ + +#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR > 10) +#define PREFETCH_READ(addr) __builtin_prefetch(addr, 0, 3) +#define PREFETCH_WRITE(addr) \ + __builtin_prefetch(addr, 1, 3) +#define PREFETCH_READ_LOCALITY(addr, locality) \ + __builtin_prefetch(addr, 0, locality) +#define PREFETCH_WRITE_LOCALITY(addr, locality) \ + __builtin_prefetch(addr, 1, locality) +#else +#define PREFETCH_READ(addr) +#define PREFETCH_READ_LOCALITY(addr, locality) +#define PREFETCH_WRITE(addr) +#define PREFETCH_WRITE_LOCALITY(addr, locality) +#endif + +/* + The following macro is used to ensure that code often used in most + SQL statements and definitely for parts of the SQL processing are + kept in a code segment by itself. This has the advantage that the + risk of common code being overlapping in caches of the CPU is less. + This can be a cause of big performance problems. + Routines should be put in this category with care and when they are + put there one should also strive to make as much of the error handling + as possible (or uncommon code of the routine) to execute in a + separate method to avoid moving to much code to this code segment. + + It is very easy to use, simply add HOT_METHOD at the end of the + function declaration. + For more input see GCC manual (available in GCC 2.95 and later) +*/ + +#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR > 94) +#define HOT_METHOD \ + __attribute__ ((section ("hot_code_section"))) +#else +#define HOT_METHOD +#endif + +/* + The following macro is used to ensure that popular global variables + are located next to each other to avoid that they contend for the + same cache lines. + + It is very easy to use, simply add HOT_DATA at the end of the declaration + of the variable, the variable must be initialised because of the way + that linker works so a declaration using HOT_DATA should look like: + uint global_hot_data HOT_DATA = 0; + For more input see GCC manual (available in GCC 2.95 and later) +*/ + +#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR > 94) +#define HOT_DATA \ + __attribute__ ((section ("hot_data_section"))) +#else +#define HOT_DATA +#endif + +/* + now let's figure out if inline functions are supported + autoconf defines 'inline' to be empty, if not +*/ +#define inline_test_1(X) X ## 1 +#define inline_test_2(X) inline_test_1(X) +#if inline_test_2(inline) != 1 +#define HAVE_INLINE +#endif +#undef inline_test_2 +#undef inline_test_1 + +/* + The following macros are used to control inlining a bit more than + usual. These macros are used to ensure that inlining always or + never occurs (independent of compilation mode). + For more input see GCC manual (available in GCC 3.1.1 and later) +*/ + +#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR > 10) +#define ALWAYS_INLINE __attribute__ ((always_inline)) +#define NEVER_INLINE __attribute__ ((noinline)) +#else +#define ALWAYS_INLINE +#define NEVER_INLINE +#endif + + /* Fix problem with S_ISLNK() on Linux */ #if defined(TARGET_OS_LINUX) || defined(__GLIBC__) #undef _GNU_SOURCE @@ -127,10 +226,8 @@ /* 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 @@ -175,7 +272,7 @@ #endif #endif -#if defined(THREAD) && !defined(__WIN__) && !defined(OS2) +#if defined(THREAD) && !defined(__WIN__) #ifndef _POSIX_PTHREAD_SEMANTICS #define _POSIX_PTHREAD_SEMANTICS /* We want posix threads */ #endif @@ -186,10 +283,6 @@ #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> @@ -197,8 +290,6 @@ 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 @@ -336,6 +427,9 @@ C_MODE_END #include <assert.h> /* Go around some bugs in different OS and compilers */ +#if defined (HPUX11) && defined(_LARGEFILE_SOURCE) +#define _LARGEFILE64_SOURCE +#endif #if defined(_HPUX_SOURCE) && defined(HAVE_SYS_STREAM_H) #include <sys/stream.h> /* HPUX 10.20 defines ulong here. UGLY !!! */ #define HAVE_ULONG @@ -377,9 +471,7 @@ extern "C" int madvise(void *addr, size_t len, int behav); #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 */ @@ -424,7 +516,7 @@ int __void__; #define min(a, b) ((a) < (b) ? (a) : (b)) #endif -#if defined(__EMX__) || !defined(HAVE_UINT) +#if !defined(HAVE_UINT) #undef HAVE_UINT #define HAVE_UINT typedef unsigned int uint; @@ -522,12 +614,17 @@ C_MODE_END #define _STATIC_VARARGS(X) X #define _PC(X) X +/* The DBUG_ON flag always takes precedence over default DBUG_OFF */ #if defined(DBUG_ON) && defined(DBUG_OFF) #undef DBUG_OFF #endif -#if defined(_lint) && !defined(DBUG_OFF) -#define DBUG_OFF +/* We might be forced to turn debug off, if not turned off already */ +#if (defined(FORCE_DBUG_OFF) || defined(_lint)) && !defined(DBUG_OFF) +# define DBUG_OFF +# ifdef DBUG_ON +# undef DBUG_ON +# endif #endif #include <my_dbug.h> @@ -565,21 +662,11 @@ C_MODE_START typedef int (*qsort_cmp)(const void *,const void *); typedef int (*qsort_cmp2)(void*, const void *,const void *); C_MODE_END -#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> #endif typedef SOCKET_SIZE_TYPE size_socket; -#endif #ifndef SOCKOPT_OPTLEN_TYPE #define SOCKOPT_OPTLEN_TYPE size_socket @@ -639,14 +726,9 @@ typedef SOCKET_SIZE_TYPE size_socket; #define FN_PARENTDIR ".." /* Parent directory; Must be a string */ #ifndef FN_LIBCHAR -#ifdef __EMX__ -#define FN_LIBCHAR '\\' -#define FN_ROOTDIR "\\" -#else #define FN_LIBCHAR '/' #define FN_ROOTDIR "/" #endif -#endif #define MY_NFILE 64 /* This is only used to save filenames */ #ifndef OS_FILE_LIMIT #define OS_FILE_LIMIT 65535 @@ -693,11 +775,7 @@ typedef SOCKET_SIZE_TYPE size_socket; #undef remove /* Crashes MySQL on SCO 5.0.0 */ #ifndef __WIN__ -#ifdef OS2 -#define closesocket(A) soclose(A) -#else #define closesocket(A) close(A) -#endif #ifndef ulonglong2double #define ulonglong2double(A) ((double) (ulonglong) (A)) #define my_off_t2double(A) ((double) (my_off_t) (A)) @@ -710,21 +788,10 @@ typedef SOCKET_SIZE_TYPE size_socket; #define ulong_to_double(X) ((double) (ulong) (X)) #define SET_STACK_SIZE(X) /* Not needed on real machines */ -#if !defined(HAVE_mit_thread) && !defined(HAVE_STRTOK_R) +#if !defined(HAVE_STRTOK_R) #define strtok_r(A,B,C) strtok((A),(B)) #endif -/* Remove some things that mit_thread break or doesn't support */ -#if defined(HAVE_mit_thread) && defined(THREAD) -#undef HAVE_PREAD -#undef HAVE_REALPATH -#undef HAVE_MLOCK -#undef HAVE_TEMPNAM /* Use ours */ -#undef HAVE_PTHREAD_SETPRIO -#undef HAVE_FTRUNCATE -#undef HAVE_READLINK -#endif - /* This is from the old m-machine.h file */ #if SIZEOF_LONG_LONG > 4 @@ -802,6 +869,13 @@ typedef long my_ptrdiff_t; typedef long long my_ptrdiff_t; #endif +/* We can't set my_size_t to size_t as we want my_size_t to be unsigned */ +#if SIZEOF_CHARP <= SIZEOF_LONG +typedef unsigned long my_size_t; +#else +typedef unsigned long long my_size_t; +#endif + #define MY_ALIGN(A,L) (((A) + (L) - 1) & ~((L) - 1)) #define ALIGN_SIZE(A) MY_ALIGN((A),sizeof(double)) /* Size to make adressable obj. */ @@ -811,6 +885,22 @@ typedef long long my_ptrdiff_t; #define ADD_TO_PTR(ptr,size,type) (type) ((byte*) (ptr)+size) #define PTR_BYTE_DIFF(A,B) (my_ptrdiff_t) ((byte*) (A) - (byte*) (B)) +/* + Custom version of standard offsetof() macro which can be used to get + offsets of members in class for non-POD types (according to the current + version of C++ standard offsetof() macro can't be used in such cases and + attempt to do so causes warnings to be emitted, OTOH in many cases it is + still OK to assume that all instances of the class has the same offsets + for the same members). + + This is temporary solution which should be removed once File_parser class + and related routines are refactored. +*/ + +#define my_offsetof(TYPE, MEMBER) \ + ((size_t)((char *)&(((TYPE *)0x10)->MEMBER) - (char*)0x10)) + + #define NullS (char *) 0 /* Nowdays we do not support MessyDos */ #ifndef NEAR @@ -834,31 +924,41 @@ typedef void *gptr; /* Generic pointer */ #else typedef char *gptr; /* Generic pointer */ #endif -#ifndef HAVE_INT_8_16_32 -typedef signed char int8; /* Signed integer >= 8 bits */ -typedef short int16; /* Signed integer >= 16 bits */ -#endif #ifndef HAVE_UCHAR typedef unsigned char uchar; /* Short for unsigned char */ #endif -typedef unsigned char uint8; /* Short for unsigned integer >= 8 bits */ -typedef unsigned short uint16; /* Short for unsigned integer >= 16 bits */ +#ifndef HAVE_INT8 +typedef signed char int8; /* Signed integer >= 8 bits */ +#endif +#ifndef HAVE_UINT8 +typedef unsigned char uint8; /* Unsigned integer >= 8 bits */ +#endif +#ifndef HAVE_INT16 +typedef short int16; +#endif +#ifndef HAVE_UINT16 +typedef unsigned short uint16; +#endif #if SIZEOF_INT == 4 -#ifndef HAVE_INT_8_16_32 -typedef int int32; +#ifndef HAVE_INT32 +typedef int int32; +#endif +#ifndef HAVE_UINT32 +typedef unsigned int uint32; #endif -typedef unsigned int uint32; /* Short for unsigned integer >= 32 bits */ #elif SIZEOF_LONG == 4 -#ifndef HAVE_INT_8_16_32 -typedef long int32; +#ifndef HAVE_INT32 +typedef long int32; +#endif +#ifndef HAVE_UINT32 +typedef unsigned long uint32; #endif -typedef unsigned long uint32; /* Short for unsigned integer >= 32 bits */ #else #error "Neither int or long is of 4 bytes width" #endif -#if !defined(HAVE_ULONG) && !defined(TARGET_OS_LINUX) && !defined(__USE_MISC) +#if !defined(HAVE_ULONG) && !defined(__USE_MISC) typedef unsigned long ulong; /* Short for unsigned long */ #endif #ifndef longlong_defined @@ -870,6 +970,12 @@ typedef unsigned long ulonglong; /* ulong or unsigned long long */ typedef long longlong; #endif #endif +#ifndef HAVE_INT64 +typedef longlong int64; +#endif +#ifndef HAVE_UINT64 +typedef ulonglong uint64; +#endif #if defined(NO_CLIENT_LONG_LONG) typedef unsigned long my_ulonglong; @@ -901,7 +1007,7 @@ typedef ulonglong my_off_t; typedef unsigned long my_off_t; #endif #define MY_FILEPOS_ERROR (~(my_off_t) 0) -#if !defined(__WIN__) && !defined(OS2) +#if !defined(__WIN__) typedef off_t os_off_t; #endif @@ -914,16 +1020,6 @@ typedef off_t os_off_t; #define SOCKET_EADDRINUSE WSAEADDRINUSE #define SOCKET_ENFILE ENFILE #define SOCKET_EMFILE EMFILE -#elif defined(OS2) -#define socket_errno sock_errno() -#define SOCKET_EINTR SOCEINTR -#define SOCKET_EAGAIN SOCEINPROGRESS -#define SOCKET_ETIMEDOUT SOCKET_EINTR -#define SOCKET_EWOULDBLOCK SOCEWOULDBLOCK -#define SOCKET_EADDRINUSE SOCEADDRINUSE -#define SOCKET_ENFILE SOCENFILE -#define SOCKET_EMFILE SOCEMFILE -#define closesocket(A) soclose(A) #else /* Unix */ #define socket_errno errno #define closesocket(A) close(A) @@ -1083,6 +1179,12 @@ typedef char bool; /* Ordinary boolean values 0 1 */ (((uint32) ((uchar) (A)[2])) << 16) +\ (((uint32) ((uchar) (A)[3])) << 24)) +\ (((ulonglong) ((uchar) (A)[4])) << 32)) +#define uint6korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) + \ + (((uint32) ((uchar) (A)[1])) << 8) + \ + (((uint32) ((uchar) (A)[2])) << 16) + \ + (((uint32) ((uchar) (A)[3])) << 24)) + \ + (((ulonglong) ((uchar) (A)[4])) << 32) + \ + (((ulonglong) ((uchar) (A)[5])) << 40)) #define uint8korr(A) (*((ulonglong *) (A))) #define sint8korr(A) (*((longlong *) (A))) #define int2store(T,A) *((uint16*) (T))= (uint16) (A) @@ -1095,6 +1197,12 @@ typedef char bool; /* Ordinary boolean values 0 1 */ *((T)+2)=(uchar) (((A) >> 16));\ *((T)+3)=(uchar) (((A) >> 24)); \ *((T)+4)=(uchar) (((A) >> 32)); } while(0) +#define int6store(T,A) do { *(T)= (uchar)((A)); \ + *((T)+1)=(uchar) (((A) >> 8)); \ + *((T)+2)=(uchar) (((A) >> 16)); \ + *((T)+3)=(uchar) (((A) >> 24)); \ + *((T)+4)=(uchar) (((A) >> 32)); \ + *((T)+5)=(uchar) (((A) >> 40)); } while(0) #define int8store(T,A) *((ulonglong *) (T))= (ulonglong) (A) typedef union { @@ -1151,6 +1259,12 @@ do { doubleget_union _tmp; \ (((uint32) ((uchar) (A)[2])) << 16) +\ (((uint32) ((uchar) (A)[3])) << 24)) +\ (((ulonglong) ((uchar) (A)[4])) << 32)) +#define uint6korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) + \ + (((uint32) ((uchar) (A)[1])) << 8) + \ + (((uint32) ((uchar) (A)[2])) << 16) + \ + (((uint32) ((uchar) (A)[3])) << 24)) + \ + (((ulonglong) ((uchar) (A)[4])) << 32) + \ + (((ulonglong) ((uchar) (A)[5])) << 40)) #define uint8korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\ (((uint32) ((uchar) (A)[1])) << 8) +\ (((uint32) ((uchar) (A)[2])) << 16) +\ @@ -1178,6 +1292,12 @@ do { doubleget_union _tmp; \ *(((char *)(T))+2)=(((A) >> 16));\ *(((char *)(T))+3)=(((A) >> 24)); \ *(((char *)(T))+4)=(((A) >> 32)); } while(0) +#define int6store(T,A) do { *((char *)(T))=((A));\ + *(((char *)(T))+1)=(((A) >> 8)); \ + *(((char *)(T))+2)=(((A) >> 16)); \ + *(((char *)(T))+3)=(((A) >> 24)); \ + *(((char *)(T))+4)=(((A) >> 32)); \ + *(((char *)(T))+5)=(((A) >> 40)); } while(0) #define int8store(T,A) do { uint def_temp= (uint) (A), def_temp2= (uint) ((A) >> 32); \ int4store((T),def_temp); \ int4store((T+4),def_temp2); } while(0) @@ -1341,4 +1461,23 @@ do { doubleget_union _tmp; \ #define NO_EMBEDDED_ACCESS_CHECKS #endif +#ifdef HAVE_DLOPEN +#if defined(__WIN__) +#define dlsym(lib, name) GetProcAddress((HMODULE)lib, name) +#define dlopen(libname, unused) LoadLibraryEx(libname, NULL, 0) +#define dlclose(lib) FreeLibrary((HMODULE)lib) +#elif defined(HAVE_DLFCN_H) +#include <dlfcn.h> +#endif +#endif + +/* FreeBSD 2.2.2 does not define RTLD_NOW) */ +#ifndef RTLD_NOW +#define RTLD_NOW 1 +#endif + +#ifndef HAVE_DLERROR +#define dlerror() "" +#endif + #endif /* my_global_h */ diff --git a/include/my_net.h b/include/my_net.h index 43360b6153c..678025b31f4 100644 --- a/include/my_net.h +++ b/include/my_net.h @@ -44,7 +44,7 @@ C_MODE_START #include <sys/ioctl.h> #endif -#if !defined(MSDOS) && !defined(__WIN__) && !defined(HAVE_BROKEN_NETINET_INCLUDES) && !defined(__BEOS__) && !defined(__NETWARE__) +#if !defined(__WIN__) && !defined(HAVE_BROKEN_NETINET_INCLUDES) && !defined(__BEOS__) && !defined(__NETWARE__) #include <netinet/in_systm.h> #include <netinet/in.h> #include <netinet/ip.h> @@ -53,13 +53,7 @@ C_MODE_START #endif #endif -#if defined(__EMX__) -#include <sys/ioctl.h> -#define ioctlsocket(A,B,C) ioctl((A),(B),(void *)(C),sizeof(*(C))) -#undef HAVE_FCNTL -#endif /* defined(__EMX__) */ - -#if defined(MSDOS) || defined(__WIN__) +#if defined(__WIN__) #define O_NONBLOCK 1 /* For emulation of fcntl() */ /* diff --git a/include/my_no_pthread.h b/include/my_no_pthread.h index 5691de08783..c47da5b1978 100644 --- a/include/my_no_pthread.h +++ b/include/my_no_pthread.h @@ -26,11 +26,7 @@ even in non-threaded builds. Case in point: 'mf_keycache.c' */ -#if defined(__WIN__) || defined(OS2) - -#elif defined(HAVE_UNIXWARE7_THREADS) -/* #include <thread.h> Currently, not relevant. Enable if needed. */ - +#if defined(__WIN__) #else /* Normal threads */ #include <pthread.h> diff --git a/include/my_nosys.h b/include/my_nosys.h index 605906f0e07..41b919c1a72 100644 --- a/include/my_nosys.h +++ b/include/my_nosys.h @@ -27,9 +27,6 @@ extern "C" { #ifndef __MY_NOSYS__ #define __MY_NOSYS__ -#ifdef MSDOS -#include <io.h> /* Get prototypes for read()... */ -#endif #ifndef HAVE_STDLIB_H #include <malloc.h> #endif diff --git a/include/my_pthread.h b/include/my_pthread.h index 300291610d3..b3d84e70d6a 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -31,19 +31,9 @@ extern "C" { #define EXTERNC #endif /* __cplusplus */ -#if defined(__WIN__) || defined(OS2) +#if defined(__WIN__) -#ifdef OS2 -typedef ULONG HANDLE; -typedef ULONG DWORD; -typedef int sigset_t; -#endif - -#ifdef OS2 -typedef HMTX pthread_mutex_t; -#else typedef CRITICAL_SECTION pthread_mutex_t; -#endif typedef HANDLE pthread_t; typedef struct thread_attr { DWORD dwStackSize ; @@ -62,30 +52,19 @@ typedef struct st_pthread_link { typedef struct { uint32 waiting; -#ifdef OS2 - HEV semaphore; -#else HANDLE semaphore; -#endif } pthread_cond_t; -#ifndef OS2 struct timespec { /* For pthread_cond_timedwait() */ time_t tv_sec; long tv_nsec; }; -#endif typedef int pthread_mutexattr_t; #define win_pthread_self my_thread_var->pthread_self -#ifdef OS2 -#define pthread_handler_t EXTERNC void * _Optlink -typedef void * (_Optlink *pthread_handler)(void *); -#else #define pthread_handler_t EXTERNC void * __cdecl typedef void * (__cdecl *pthread_handler)(void *); -#endif void win_pthread_init(void); int win_pthread_setspecific(void *A,void *B,uint length); @@ -107,15 +86,20 @@ struct tm *gmtime_r(const time_t *timep,struct tm *tmp); void pthread_exit(void *a); /* was #define pthread_exit(A) ExitThread(A)*/ -#ifndef OS2 #define ETIMEDOUT 145 /* Win32 doesn't have this */ #define getpid() GetCurrentThreadId() -#endif #define pthread_self() win_pthread_self #define HAVE_LOCALTIME_R 1 #define _REENTRANT 1 #define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1 +/* + Windows has two ways to use thread local storage. The most efficient + is using __declspec(thread), but that does not work properly when + used in a .dll that is loaded at runtime, after program load. So for + libmysql.dll and libmysqld.dll we define USE_TLS in order to use the + TlsXxx() API instead, which works in all cases. +*/ #ifdef USE_TLS /* For LIBMYSQL.DLL */ #undef SAFE_MUTEX /* This will cause conflicts */ #define pthread_key(T,V) DWORD V @@ -138,15 +122,6 @@ void pthread_exit(void *a); /* was #define pthread_exit(A) ExitThread(A)*/ #endif /* USE_TLS */ #define pthread_equal(A,B) ((A) == (B)) -#ifdef OS2 -extern int pthread_mutex_init (pthread_mutex_t *, const pthread_mutexattr_t *); -extern int pthread_mutex_lock (pthread_mutex_t *); -extern int pthread_mutex_unlock (pthread_mutex_t *); -extern int pthread_mutex_destroy (pthread_mutex_t *); -#define my_pthread_setprio(A,B) DosSetPriority(PRTYS_THREAD,PRTYC_NOCHANGE, B, A) -#define pthread_kill(A,B) raise(B) -#define pthread_exit(A) pthread_dummy() -#else #define pthread_mutex_init(A,B) (InitializeCriticalSection(A),0) #define pthread_mutex_lock(A) (EnterCriticalSection(A),0) #define pthread_mutex_trylock(A) (WaitForSingleObject((A), 0) == WAIT_TIMEOUT) @@ -154,7 +129,9 @@ extern int pthread_mutex_destroy (pthread_mutex_t *); #define pthread_mutex_destroy(A) DeleteCriticalSection(A) #define my_pthread_setprio(A,B) SetThreadPriority(GetCurrentThread(), (B)) #define pthread_kill(A,B) pthread_dummy(0) -#endif /* OS2 */ + +#define pthread_join(A,B) \ + ((WaitForSingleObject((A), INFINITE) != WAIT_OBJECT_0) || !CloseHandle(A)) /* Dummy defines for easier code */ #define pthread_attr_setdetachstate(A,B) pthread_dummy(0) @@ -168,68 +145,6 @@ extern int pthread_mutex_destroy (pthread_mutex_t *); /*#define my_pthread_getprio(pthread_t thread_id) pthread_dummy(0) */ #define my_pthread_getprio(thread_id) pthread_dummy(0) -#elif defined(HAVE_UNIXWARE7_THREADS) - -#include <thread.h> -#include <synch.h> - -#ifndef _REENTRANT -#define _REENTRANT -#endif - -#define HAVE_NONPOSIX_SIGWAIT -#define pthread_t thread_t -#define pthread_cond_t cond_t -#define pthread_mutex_t mutex_t -#define pthread_key_t thread_key_t -typedef int pthread_attr_t; /* Needed by Unixware 7.0.0 */ - -#define pthread_key_create(A,B) thr_keycreate((A),(B)) -#define pthread_key_delete(A) thr_keydelete(A) - -#define pthread_handler_t EXTERNC void * -#define pthread_key(T,V) pthread_key_t V - -void * my_pthread_getspecific_imp(pthread_key_t key); -#define my_pthread_getspecific(A,B) ((A) my_pthread_getspecific_imp(B)) -#define my_pthread_getspecific_ptr(T,V) my_pthread_getspecific(T,V) - -#define pthread_setspecific(A,B) thr_setspecific(A,B) -#define my_pthread_setspecific_ptr(T,V) pthread_setspecific(T,V) - -#define pthread_create(A,B,C,D) thr_create(NULL,65536L,(C),(D),THR_DETACHED,(A)) -#define pthread_cond_init(a,b) cond_init((a),USYNC_THREAD,NULL) -#define pthread_cond_destroy(a) cond_destroy(a) -#define pthread_cond_signal(a) cond_signal(a) -#define pthread_cond_wait(a,b) cond_wait((a),(b)) -#define pthread_cond_timedwait(a,b,c) cond_timedwait((a),(b),(c)) -#define pthread_cond_broadcast(a) cond_broadcast(a) - -#define pthread_mutex_init(a,b) mutex_init((a),USYNC_THREAD,NULL) -#define pthread_mutex_lock(a) mutex_lock(a) -#define pthread_mutex_unlock(a) mutex_unlock(a) -#define pthread_mutex_destroy(a) mutex_destroy(a) - -#define pthread_self() thr_self() -#define pthread_exit(A) thr_exit(A) -#define pthread_equal(A,B) (((A) == (B)) ? 1 : 0) -#define pthread_kill(A,B) thr_kill((A),(B)) -#define HAVE_PTHREAD_KILL - -#define pthread_sigmask(A,B,C) thr_sigsetmask((A),(B),(C)) - -extern int my_sigwait(const sigset_t *set,int *sig); - -#define pthread_detach_this_thread() pthread_dummy(0) - -#define pthread_attr_init(A) pthread_dummy(0) -#define pthread_attr_destroy(A) pthread_dummy(0) -#define pthread_attr_setscope(A,B) pthread_dummy(0) -#define pthread_attr_setdetachstate(A,B) pthread_dummy(0) -#define my_pthread_setprio(A,B) pthread_dummy (0) -#define my_pthread_getprio(A) pthread_dummy (0) -#define my_pthread_attr_setprio(A,B) pthread_dummy(0) - #else /* Normal threads */ #ifdef HAVE_rts_threads @@ -250,9 +165,6 @@ extern int my_sigwait(const sigset_t *set,int *sig); #ifdef HAVE_SYNCH_H #include <synch.h> #endif -#if defined(__EMX__) && (!defined(EMX_PTHREAD_REV) || (EMX_PTHREAD_REV < 2)) -#error Requires at least rev 2 of EMX pthreads library. -#endif #ifdef __NETWARE__ void my_pthread_exit(void *status); @@ -278,21 +190,6 @@ extern int my_pthread_create_detached; #define PTHREAD_SCOPE_SYSTEM PTHREAD_SCOPE_GLOBAL #define PTHREAD_SCOPE_PROCESS PTHREAD_SCOPE_LOCAL #define USE_ALARM_THREAD -#elif defined(HAVE_mit_thread) -#define USE_ALARM_THREAD -#undef HAVE_LOCALTIME_R -#define HAVE_LOCALTIME_R -#undef HAVE_GMTIME_R -#define HAVE_GMTIME_R -#undef HAVE_PTHREAD_ATTR_SETSCOPE -#define HAVE_PTHREAD_ATTR_SETSCOPE -#undef HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE /* If we are running linux */ -#undef HAVE_RWLOCK_T -#undef HAVE_RWLOCK_INIT -#undef HAVE_PTHREAD_RWLOCK_RDLOCK -#undef HAVE_SNPRINTF - -#define my_pthread_attr_setprio(A,B) #endif /* defined(PTHREAD_SCOPE_GLOBAL) && !defined(PTHREAD_SCOPE_SYSTEM) */ #if defined(_BSDI_VERSION) && _BSDI_VERSION < 199910 @@ -320,7 +217,7 @@ extern int my_pthread_cond_init(pthread_cond_t *mp, #define pthread_sigmask(A,B,C) sigthreadmask((A),(B),(C)) #endif -#if !defined(HAVE_SIGWAIT) && !defined(HAVE_mit_thread) && !defined(HAVE_rts_threads) && !defined(sigwait) && !defined(alpha_linux_port) && !defined(HAVE_NONPOSIX_SIGWAIT) && !defined(HAVE_DEC_3_2_THREADS) && !defined(_AIX) +#if !defined(HAVE_SIGWAIT) && !defined(HAVE_rts_threads) && !defined(sigwait) && !defined(alpha_linux_port) && !defined(HAVE_NONPOSIX_SIGWAIT) && !defined(HAVE_DEC_3_2_THREADS) && !defined(_AIX) int sigwait(sigset_t *setp, int *sigp); /* Use our implemention */ #endif @@ -377,15 +274,12 @@ extern int my_pthread_cond_timedwait(pthread_cond_t *cond, #define pthread_cond_timedwait(A,B,C) my_pthread_cond_timedwait((A),(B),(C)) #endif -#if defined(OS2) -#define my_pthread_getspecific(T,A) ((T) &(A)) -#define pthread_setspecific(A,B) win_pthread_setspecific(&(A),(B),sizeof(A)) -#elif !defined( HAVE_NONPOSIX_PTHREAD_GETSPECIFIC) +#if !defined( HAVE_NONPOSIX_PTHREAD_GETSPECIFIC) #define my_pthread_getspecific(A,B) ((A) pthread_getspecific(B)) #else #define my_pthread_getspecific(A,B) ((A) my_pthread_getspecific_imp(B)) void *my_pthread_getspecific_imp(pthread_key_t key); -#endif /* OS2 */ +#endif #ifndef HAVE_LOCALTIME_R struct tm *localtime_r(const time_t *clock, struct tm *res); @@ -549,6 +443,37 @@ void safe_mutex_end(FILE *file); #define safe_mutex_assert_not_owner(mp) #endif /* SAFE_MUTEX */ +#if defined(MY_PTHREAD_FASTMUTEX) && !defined(SAFE_MUTEX) +typedef struct st_my_pthread_fastmutex_t +{ + pthread_mutex_t mutex; + uint spins; +} my_pthread_fastmutex_t; + +int my_pthread_fastmutex_init(my_pthread_fastmutex_t *mp, + const pthread_mutexattr_t *attr); +int my_pthread_fastmutex_lock(my_pthread_fastmutex_t *mp); + +#undef pthread_mutex_init +#undef pthread_mutex_lock +#undef pthread_mutex_unlock +#undef pthread_mutex_destroy +#undef pthread_mutex_wait +#undef pthread_mutex_timedwait +#undef pthread_mutex_t +#undef pthread_cond_wait +#undef pthread_cond_timedwait +#undef pthread_mutex_trylock +#define pthread_mutex_init(A,B) my_pthread_fastmutex_init((A),(B)) +#define pthread_mutex_lock(A) my_pthread_fastmutex_lock(A) +#define pthread_mutex_unlock(A) pthread_mutex_unlock(&(A)->mutex) +#define pthread_mutex_destroy(A) pthread_mutex_destroy(&(A)->mutex) +#define pthread_cond_wait(A,B) pthread_cond_wait((A),&(B)->mutex) +#define pthread_cond_timedwait(A,B,C) pthread_cond_timedwait((A),&(B)->mutex,(C)) +#define pthread_mutex_trylock(A) pthread_mutex_trylock(&(A)->mutex) +#define pthread_mutex_t my_pthread_fastmutex_t +#endif /* defined(MY_PTHREAD_FASTMUTEX) && !defined(SAFE_MUTEX) */ + /* READ-WRITE thread locking */ #ifdef HAVE_BROKEN_RWLOCK /* For OpenUnix */ diff --git a/include/my_sys.h b/include/my_sys.h index d19091a85e8..7faffd6a18f 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -77,6 +77,10 @@ extern int NEAR my_errno; /* Last error in mysys */ #define MY_GIVE_INFO 2 /* Give time info about process*/ #define MY_DONT_FREE_DBUG 4 /* Do not call DBUG_END() in my_end() */ +#define MY_REMOVE_NONE 0 /* Params for modify_defaults_file */ +#define MY_REMOVE_OPTION 1 +#define MY_REMOVE_SECTION 2 + #define ME_HIGHBYTE 8 /* Shift for colours */ #define ME_NOCUR 1 /* Don't use curses message */ #define ME_OLDWIN 2 /* Use old window */ @@ -99,6 +103,8 @@ extern int NEAR my_errno; /* Last error in mysys */ #define MY_RETURN_REAL_PATH 32 /* return full path for file */ #define MY_SAFE_PATH 64 /* Return NULL if too long path */ #define MY_RELATIVE_PATH 128 /* name is relative to 'dir' */ +#define MY_APPEND_EXT 256 /* add 'ext' as additional extension*/ + /* My seek flags */ #define MY_SEEK_SET 0 @@ -135,7 +141,7 @@ extern int NEAR my_errno; /* Last error in mysys */ #define my_free(PTR,FLAG) _myfree((PTR), __FILE__, __LINE__,FLAG) #define my_memdup(A,B,C) _my_memdup((A),(B), __FILE__,__LINE__,C) #define my_strdup(A,C) _my_strdup((A), __FILE__,__LINE__,C) -#define my_strdup_with_length(A,B,C) _my_strdup_with_length((A),(B),__FILE__,__LINE__,C) +#define my_strndup(A,B,C) _my_strndup((A),(B),__FILE__,__LINE__,C) #define TRASH(A,B) bfill(A, B, 0x8F) #define QUICK_SAFEMALLOC sf_malloc_quick=1 #define NORMAL_SAFEMALLOC sf_malloc_quick=0 @@ -157,7 +163,7 @@ extern gptr my_realloc(gptr oldpoint,uint Size,myf MyFlags); extern void my_no_flags_free(gptr ptr); extern gptr my_memdup(const byte *from,uint length,myf MyFlags); extern char *my_strdup(const char *from,myf MyFlags); -extern char *my_strdup_with_length(const char *from, uint length, +extern char *my_strndup(const char *from, uint length, myf MyFlags); /* we do use FG (as a no-op) in below so that a typo on FG is caught */ #define my_free(PTR,FG) ((void)FG,my_no_flags_free(PTR)) @@ -195,22 +201,6 @@ extern void my_large_free(gptr ptr, myf my_flags); #define my_afree(PTR) my_free(PTR,MYF(MY_WME)) #endif /* HAVE_ALLOCA */ -#ifdef MSDOS -#ifdef __ZTC__ -void * __CDECL halloc(long count,size_t length); -void __CDECL hfree(void *ptr); -#endif -#if defined(USE_HALLOC) -#if defined(_VCM_) || defined(M_IC80386) -#undef USE_HALLOC -#endif -#endif -#ifdef USE_HALLOC -#define malloc(a) halloc((long) (a),1) -#define free(a) hfree(a) -#endif -#endif /* MSDOS */ - #ifndef errno /* did we already get it? */ #ifdef HAVE_ERRNO_AS_DEFINE #include <errno.h> /* errno is a define */ @@ -533,6 +523,7 @@ typedef int (*qsort2_cmp)(const void *, const void *, const void *); (uint) (*(info)->current_pos - (info)->request_pos)) /* tell write offset in the SEQ_APPEND cache */ +int my_b_copy_to_file(IO_CACHE *cache, FILE *file); my_off_t my_b_append_tell(IO_CACHE* info); my_off_t my_b_safe_tell(IO_CACHE* info); /* picks the correct tell() */ @@ -565,7 +556,7 @@ extern File my_register_filename(File fd, const char *FileName, enum file_type type_of_file, uint error_message_number, myf MyFlags); extern File my_create(const char *FileName,int CreateFlags, - int AccsesFlags, myf MyFlags); + int AccessFlags, myf MyFlags); extern int my_close(File Filedes,myf MyFlags); extern File my_dup(File file, myf MyFlags); extern int my_mkdir(const char *dir, int Flags, myf MyFlags); @@ -603,7 +594,7 @@ extern gptr _my_memdup(const byte *from,uint length, const char *sFile, uint uLine,myf MyFlag); extern my_string _my_strdup(const char *from, const char *sFile, uint uLine, myf MyFlag); -extern char *_my_strdup_with_length(const char *from, uint length, +extern char *_my_strndup(const char *from, uint length, const char *sFile, uint uLine, myf MyFlag); @@ -619,6 +610,7 @@ extern File my_sopen(const char *path, int oflag, int shflag, int pmode); #define my_access access #endif extern int check_if_legal_filename(const char *path); +extern int check_if_legal_tablename(const char *path); #if defined(__WIN__) && defined(__NT__) extern int nt_share_delete(const char *name,myf MyFlags); @@ -659,6 +651,12 @@ extern void allow_break(void); #define allow_break() #endif +#ifdef EXTRA_DEBUG +void my_print_open_files(void); +#else +#define my_print_open_files() +#endif + extern my_bool init_tmpdir(MY_TMPDIR *tmpdir, const char *pathlist); extern char *my_tmpdir(MY_TMPDIR *tmpdir); extern void free_tmpdir(MY_TMPDIR *tmpdir); @@ -688,13 +686,15 @@ extern my_string my_path(my_string to,const char *progname, const char *own_pathname_part); extern my_string my_load_path(my_string to, const char *path, const char *own_path_prefix); -extern int wild_compare(const char *str,const char *wildstr,pbool str_is_pattern); +extern int wild_compare(const char *str,const char *wildstr, + pbool str_is_pattern); extern WF_PACK *wf_comp(my_string str); extern int wf_test(struct wild_file_pack *wf_pack,const char *name); extern void wf_end(struct wild_file_pack *buffer); extern size_s strip_sp(my_string str); extern void get_date(my_string to,int timeflag,time_t use_time); -extern void soundex(CHARSET_INFO *, my_string out_pntr, my_string in_pntr,pbool remove_garbage); +extern void soundex(CHARSET_INFO *, my_string out_pntr, my_string in_pntr, + pbool remove_garbage); extern int init_record_cache(RECORD_CACHE *info,uint cachesize,File file, uint reclength,enum cache_type type, pbool use_async_io); @@ -771,10 +771,12 @@ extern void get_dynamic(DYNAMIC_ARRAY *array,gptr element,uint array_index); extern void delete_dynamic(DYNAMIC_ARRAY *array); extern void delete_dynamic_element(DYNAMIC_ARRAY *array, uint array_index); extern void freeze_size(DYNAMIC_ARRAY *array); +extern int get_index_dynamic(DYNAMIC_ARRAY *array, gptr element); #define dynamic_array_ptr(array,array_index) ((array)->buffer+(array_index)*(array)->size_of_element) #define dynamic_element(array,array_index,type) ((type)((array)->buffer) +(array_index)) -#define push_dynamic(A,B) insert_dynamic(A,B) +#define push_dynamic(A,B) insert_dynamic((A),(B)) #define reset_dynamic(array) ((array)->elements= 0) +#define sort_dynamic(A,cmp) qsort((A)->buffer, (A)->elements, (A)->size_of_element, (cmp)) extern my_bool init_dynamic_string(DYNAMIC_STRING *str, const char *init_str, uint init_alloc,uint alloc_increment); @@ -783,6 +785,7 @@ my_bool dynstr_append_mem(DYNAMIC_STRING *str, const char *append, uint length); extern my_bool dynstr_set(DYNAMIC_STRING *str, const char *init_str); extern my_bool dynstr_realloc(DYNAMIC_STRING *str, ulong additional_size); +extern my_bool dynstr_trunc(DYNAMIC_STRING *str, int n); extern void dynstr_free(DYNAMIC_STRING *str); #ifdef HAVE_MLOCK extern byte *my_malloc_lock(uint length,myf flags); @@ -822,8 +825,12 @@ extern void print_defaults(const char *conf_file, const char **groups); extern my_bool my_compress(byte *, ulong *, ulong *); extern my_bool my_uncompress(byte *, ulong *, ulong *); extern byte *my_compress_alloc(const byte *packet, ulong *len, ulong *complen); +extern int packfrm(const void *, uint, const void **, uint *); +extern int unpackfrm(const void **, uint *, const void *); + extern ha_checksum my_checksum(ha_checksum crc, const byte *mem, uint count); extern uint my_bit_log2(ulong value); +extern uint32 my_round_up_to_next_power(uint32 v); extern uint my_count_bits(ulonglong v); extern uint my_count_bits_ushort(ushort v); extern void my_sleep(ulong m_seconds); @@ -831,8 +838,9 @@ extern ulong crc32(ulong crc, const uchar *buf, uint len); extern uint my_set_max_open_files(uint files); void my_free_open_file_info(void); -ulonglong my_getsystime(void); -my_bool my_gethwaddr(uchar *to); +extern ulonglong my_getsystime(void); +extern my_bool my_gethwaddr(uchar *to); +extern int my_getncpus(); #ifdef HAVE_SYS_MMAN_H #include <sys/mman.h> @@ -840,15 +848,24 @@ my_bool my_gethwaddr(uchar *to); #ifndef MAP_NOSYNC #define MAP_NOSYNC 0 #endif +#ifndef MAP_NORESERVE +#define MAP_NORESERVE 0 /* For irix and AIX */ +#endif +#ifdef HAVE_MMAP64 +#define my_mmap(a,b,c,d,e,f) mmap64(a,b,c,d,e,f) +#else #define my_mmap(a,b,c,d,e,f) mmap(a,b,c,d,e,f) +#endif #define my_munmap(a,b) munmap((a),(b)) #else /* not a complete set of mmap() flags, but only those that nesessary */ #define PROT_READ 1 #define PROT_WRITE 2 +#define MAP_NORESERVE 0 #define MAP_SHARED 0x0001 +#define MAP_PRIVATE 0x0002 #define MAP_NOSYNC 0x0800 #define MAP_FAILED ((void *)-1) #define MS_SYNC 0x0000 @@ -920,5 +937,4 @@ void netware_reg_user(const char *ip, const char *user, #endif C_MODE_END -#include "raid.h" #endif /* _my_sys_h */ diff --git a/include/my_time.h b/include/my_time.h index 5361c47d57f..c680c92ce46 100644 --- a/include/my_time.h +++ b/include/my_time.h @@ -33,20 +33,27 @@ extern uchar days_in_month[]; Portable time_t replacement. Should be signed and hold seconds for 1902-2038 range. */ -typedef long my_time_t; +#if defined(_WIN64) || defined(WIN64) +/* on Win64 long is still 4 bytes (not 8!) */ +typedef LONG64 my_time_t; +#else +typedef time_t my_time_t; + +#endif #define MY_TIME_T_MAX LONG_MAX #define MY_TIME_T_MIN LONG_MIN - /* Time handling defaults */ #define TIMESTAMP_MAX_YEAR 2038 -#define YY_PART_YEAR 70 #define TIMESTAMP_MIN_YEAR (1900 + YY_PART_YEAR - 1) #define TIMESTAMP_MAX_VALUE INT_MAX32 #define TIMESTAMP_MIN_VALUE 1 +/* two-digit years < this are 20..; >= this are 19.. */ #define YY_PART_YEAR 70 +/* apply above magic to years < this */ +#define YY_MAGIC_BELOW 200 /* Flags to str_to_datetime */ #define TIME_FUZZY_DATE 1 @@ -135,6 +142,31 @@ int my_date_to_str(const MYSQL_TIME *l_time, char *to); int my_datetime_to_str(const MYSQL_TIME *l_time, char *to); int my_TIME_to_str(const MYSQL_TIME *l_time, char *to); +/* + Available interval types used in any statement. + + 'interval_type' must be sorted so that simple intervals comes first, + ie year, quarter, month, week, day, hour, etc. The order based on + interval size is also important and the intervals should be kept in a + large to smaller order. (get_interval_value() depends on this) + + Note: If you change the order of elements in this enum you should fix + order of elements in 'interval_type_to_name' and 'interval_names' + arrays + + See also interval_type_to_name, get_interval_value, interval_names +*/ + +enum interval_type +{ + INTERVAL_YEAR, INTERVAL_QUARTER, INTERVAL_MONTH, INTERVAL_WEEK, INTERVAL_DAY, + INTERVAL_HOUR, INTERVAL_MINUTE, INTERVAL_SECOND, INTERVAL_MICROSECOND, + INTERVAL_YEAR_MONTH, INTERVAL_DAY_HOUR, INTERVAL_DAY_MINUTE, + INTERVAL_DAY_SECOND, INTERVAL_HOUR_MINUTE, INTERVAL_HOUR_SECOND, + INTERVAL_MINUTE_SECOND, INTERVAL_DAY_MICROSECOND, INTERVAL_HOUR_MICROSECOND, + INTERVAL_MINUTE_MICROSECOND, INTERVAL_SECOND_MICROSECOND, INTERVAL_LAST +}; + C_MODE_END #endif /* _my_time_h_ */ diff --git a/include/my_tree.h b/include/my_tree.h index a047f914e55..68a2ea777c0 100644 --- a/include/my_tree.h +++ b/include/my_tree.h @@ -40,19 +40,11 @@ typedef int (*tree_walk_action)(void *,element_count,void *); typedef enum { free_init, free_free, free_end } TREE_FREE; typedef void (*tree_element_free)(void*, TREE_FREE, void *); -#ifdef MSDOS -typedef struct st_tree_element { - struct st_tree_element *left,*right; - unsigned long count; - uchar colour; /* black is marked as 1 */ -} TREE_ELEMENT; -#else typedef struct st_tree_element { struct st_tree_element *left,*right; uint32 count:31, colour:1; /* black is marked as 1 */ } TREE_ELEMENT; -#endif /* MSDOS */ #define ELEMENT_CHILD(element, offs) (*(TREE_ELEMENT**)((char*)element + offs)) diff --git a/include/my_trie.h b/include/my_trie.h new file mode 100644 index 00000000000..a8534cb11c1 --- /dev/null +++ b/include/my_trie.h @@ -0,0 +1,142 @@ +/* Copyright (C) 2005 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 */ + +#ifndef _trie_h +#define _trie_h +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct st_trie_node +{ + uint16 leaf; /* Depth from root node if match, 0 else */ + byte c; /* Label on this edge */ + struct st_trie_node *next; /* Next label */ + struct st_trie_node *links; /* Array of edges leaving this node */ + struct st_trie_node *fail; /* AC failure function */ +} TRIE_NODE; + +typedef struct st_trie +{ + TRIE_NODE root; + MEM_ROOT mem_root; + CHARSET_INFO *charset; + uint32 nnodes; + uint32 nwords; +} TRIE; + +typedef struct st_ac_trie_state +{ + TRIE *trie; + TRIE_NODE *node; +} AC_TRIE_STATE; + +extern TRIE *trie_init (TRIE *trie, CHARSET_INFO *charset); +extern void trie_free (TRIE *trie); +extern my_bool trie_insert (TRIE *trie, const byte *key, uint keylen); +extern my_bool ac_trie_prepare (TRIE *trie); +extern void ac_trie_init (TRIE *trie, AC_TRIE_STATE *state); + + +/* `trie_goto' is internal function and shouldn't be used. */ + +static inline TRIE_NODE *trie_goto (TRIE_NODE *root, TRIE_NODE *node, byte c) +{ + TRIE_NODE *next; + DBUG_ENTER("trie_goto"); + for (next= node->links; next; next= next->next) + if (next->c == c) + DBUG_RETURN(next); + if (root == node) + DBUG_RETURN(root); + DBUG_RETURN(NULL); +} + + +/* + SYNOPSIS + int ac_trie_next (AC_TRIE_STATE *state, byte *c); + state - valid pointer to `AC_TRIE_STATE' + c - character to lookup + + DESCRIPTION + Implementation of search using Aho-Corasick automaton. + Performs char-by-char search. + + RETURN VALUE + `ac_trie_next' returns length of matched word or 0. +*/ + +static inline int ac_trie_next (AC_TRIE_STATE *state, byte *c) +{ + TRIE_NODE *root, *node; + DBUG_ENTER("ac_trie_next"); + DBUG_ASSERT(state && c); + root= &state->trie->root; + node= state->node; + while (! (state->node= trie_goto(root, node, *c))) + node= node->fail; + DBUG_RETURN(state->node->leaf); +} + + +/* + SYNOPSIS + my_bool trie_search (TRIE *trie, const byte *key, uint keylen); + trie - valid pointer to `TRIE' + key - valid pointer to key to insert + keylen - non-0 key length + + DESCRIPTION + Performs key lookup in trie. + + RETURN VALUE + `trie_search' returns `true' if key is in `trie'. Otherwise, + `false' is returned. + + NOTES + Consecutive search here is "best by test". arrays are very short, so + binary search or hashing would add too much complexity that would + overweight speed gain. Especially because compiler can optimize simple + consecutive loop better (tested) +*/ + +static inline my_bool trie_search (TRIE *trie, const byte *key, uint keylen) +{ + TRIE_NODE *node; + uint k; + DBUG_ENTER("trie_search"); + DBUG_ASSERT(trie && key && keylen); + node= &trie->root; + + for (k= 0; k < keylen; k++) + { + byte p; + if (! (node= node->links)) + DBUG_RETURN(FALSE); + p= key[k]; + while (p != node->c) + if (! (node= node->next)) + DBUG_RETURN(FALSE); + } + + DBUG_RETURN(node->leaf > 0); +} + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/my_uctype.h b/include/my_uctype.h new file mode 100644 index 00000000000..d82349a8618 --- /dev/null +++ b/include/my_uctype.h @@ -0,0 +1,1464 @@ +/* + Unicode ctype data + Generated from UnicodeData-5.0.0d9.txt +*/ +static unsigned char uctype_page00[256]= +{ + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 8, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 16, 16, 16, 16, 16, 16, + 16, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 16, 16, 16, 16, 16, + 16, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 16, 16, 16, 16, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 8, 16, 16, 16, 16, 16, 16, 16, 16, 16, 2, 16, 16, 32, 16, 16, + 16, 16, 20, 20, 16, 2, 16, 16, 16, 20, 2, 16, 20, 20, 20, 16, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 16, 1, 1, 1, 1, 1, 1, 1, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 16, 2, 2, 2, 2, 2, 2, 2, 2 +}; + +static unsigned char uctype_page01[256]= +{ + 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 1, 2, 1, + 2, 1, 2, 1, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 2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 16, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 2, 2, 2, 2, 2, 16, 16, 16, 16, 16, 16, 16, 16, 16, 2, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16 +}; + +static unsigned char uctype_page03[256]= +{ + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 0, 0, 0, 0, 16, 16, 0, 0, 0, 0, 2, 2, 2, 2, 16, 0, + 0, 0, 0, 0, 16, 16, 1, 16, 1, 1, 1, 0, 1, 0, 1, 1, + 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, + 2, 2, 1, 1, 1, 2, 2, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 2, 2, 2, 2, 1, 2, 16, 1, 2, 1, 1, 2, 2, 1, 1, 1 +}; + +static unsigned char uctype_page04[256]= +{ + 1, 1, 1, 1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1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 0, 0, 2, 16, 16, 16, 16, 16, 16, + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 0, 16, 16, 0, 0, 0, 0, 0, + 0, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 16, 18, + 16, 18, 18, 16, 18, 18, 16, 18, 0, 0, 0, 0, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, + 2, 2, 2, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static unsigned char uctype_page06[256]= +{ + 32, 32, 32, 32, 0, 0, 0, 0, 0, 0, 0, 16, 16, 16, 16, 16, + 18, 18, 18, 18, 18, 18, 0, 0, 0, 0, 0, 16, 0, 0, 16, 16, + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 16, 16, 16, 16, 2, 2, + 18, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 16, 2, 18, 18, 18, 18, 18, 18, 18, 32, 18, 18, + 18, 18, 18, 18, 18, 2, 2, 18, 18, 16, 18, 18, 18, 18, 2, 2, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 16, 16, 2 +}; + +static unsigned char uctype_page07[256]= +{ + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 32, + 2, 18, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0, 0, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 2, 2, 16, 16, 16, 16, 2, 0, 0, 0, 0, 0 +}; + +static unsigned char uctype_page09[256]= +{ + 0, 18, 18, 18, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 18, 2, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0, 0, + 2, 18, 18, 18, 18, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 18, 18, 16, 16, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, + 0, 18, 18, 18, 0, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 2, + 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, + 2, 0, 2, 0, 0, 0, 2, 2, 2, 2, 0, 0, 18, 2, 18, 18, + 18, 18, 18, 18, 18, 0, 0, 18, 18, 0, 0, 18, 18, 18, 2, 0, + 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 2, 2, 0, 2, + 2, 2, 18, 18, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 2, 2, 16, 16, 20, 20, 20, 20, 20, 20, 16, 0, 0, 0, 0, 0 +}; + +static unsigned char uctype_page0A[256]= +{ + 0, 18, 18, 18, 0, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, + 2, 0, 0, 2, 2, 2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0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 18, 18, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static unsigned char uctype_page0E[256]= +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 18, 2, 2, 18, 18, 18, 18, 18, 18, 18, 0, 0, 0, 0, 16, + 2, 2, 2, 2, 2, 2, 2, 18, 18, 18, 18, 18, 18, 18, 18, 16, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 16, 16, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 2, 2, 0, 2, 0, 0, 2, 2, 0, 2, 0, 0, 2, 0, 0, + 0, 0, 0, 0, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, + 0, 2, 2, 2, 0, 2, 0, 2, 0, 0, 2, 2, 0, 2, 2, 2, + 2, 18, 2, 2, 18, 18, 18, 18, 18, 18, 0, 18, 18, 2, 0, 0, + 2, 2, 2, 2, 2, 0, 2, 0, 18, 18, 18, 18, 18, 18, 0, 0, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 2, 2, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static unsigned char uctype_page0F[256]= +{ + 2, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 18, 18, 16, 16, 16, 16, 16, 16, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 16, 18, 16, 18, 16, 18, 16, 16, 16, 16, 18, 18, + 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, + 0, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 16, 18, 18, 2, 2, 2, 2, 0, 0, 0, 0, + 18, 18, 18, 18, 18, 18, 18, 18, 0, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0, 16, 16, + 16, 16, 16, 16, 16, 16, 18, 16, 16, 16, 16, 16, 16, 0, 0, 16, + 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static unsigned char uctype_page10[256]= +{ + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 0, 2, 2, 2, 2, 2, 0, 2, 2, 0, 18, 18, 18, 18, + 18, 18, 18, 0, 0, 0, 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 16, 16, 16, 16, 16, 16, + 2, 2, 2, 2, 2, 2, 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 2, 2, 2, 2, 2, 2 +}; + +static unsigned char uctype_page13[256]= +{ + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 0, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 18, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static unsigned char uctype_page14[256]= +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2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, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 16, 16, 16, 2, 16, 16, 16, 16, 2, 18, 0, 0, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0 +}; + +static unsigned char uctype_page18[256]= +{ + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 18, 18, 18, 8, 0, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 18, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static unsigned char uctype_page19[256]= +{ + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0, 0, 0, 0, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0, 0, 0, 0, + 16, 0, 0, 0, 16, 16, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, + 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 2, 2, 2, 2, 2, 2, 2, 18, 18, 0, 0, 0, 0, 0, 0, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16 +}; + +static unsigned char uctype_page1A[256]= +{ + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 18, 18, 18, 18, 18, 0, 0, 16, 16, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static unsigned char uctype_page1B[256]= +{ + 18, 18, 18, 18, 18, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0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 2, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 1, 0, 1, 0, 1, + 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 0, 2, 2, 1, 1, 1, 1, 1, 16, 2, 16, + 16, 16, 2, 2, 2, 0, 2, 2, 1, 1, 1, 1, 1, 16, 16, 16, + 2, 2, 2, 2, 0, 0, 2, 2, 1, 1, 1, 1, 0, 16, 16, 16, + 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 16, 16, 16, + 0, 0, 2, 2, 2, 0, 2, 2, 1, 1, 1, 1, 1, 16, 16, 0 +}; + +static unsigned char uctype_page20[256]= +{ + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 32, 32, 32, 32, 32, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 8, 8, 32, 32, 32, 32, 32, 8, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 8, + 32, 32, 32, 32, 0, 0, 0, 0, 0, 0, 32, 32, 32, 32, 32, 32, + 20, 2, 0, 0, 20, 20, 20, 20, 20, 20, 16, 16, 16, 16, 16, 2, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 16, 16, 16, 16, 16, 0, + 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static unsigned char uctype_page21[256]= +{ + 16, 16, 1, 16, 16, 16, 16, 1, 16, 16, 2, 1, 1, 1, 2, 2, + 1, 1, 1, 2, 16, 1, 16, 16, 16, 1, 1, 1, 1, 1, 16, 16, + 16, 16, 16, 16, 1, 16, 1, 16, 1, 16, 1, 1, 1, 1, 16, 2, + 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 16, 16, 2, 2, 1, 1, + 16, 16, 16, 16, 16, 1, 2, 2, 2, 2, 16, 16, 16, 16, 2, 0, + 0, 0, 0, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16 +}; + +static unsigned char uctype_page23[256]= +{ + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static unsigned char uctype_page24[256]= +{ + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 +}; + +static unsigned char uctype_page26[256]= +{ + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static unsigned char uctype_page27[256]= +{ + 0, 16, 16, 16, 16, 0, 16, 16, 16, 16, 0, 0, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 0, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 16, 0, 16, + 16, 16, 16, 0, 0, 0, 16, 0, 16, 16, 16, 16, 16, 16, 16, 0, + 0, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 16, 0, 0, 0, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 0, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16 +}; + +static unsigned char uctype_page2B[256]= +{ + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, + 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,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0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static unsigned char uctype_page2F[256]= +{ + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0 +}; + +static unsigned char uctype_page30[256]= +{ + 8, 16, 16, 16, 16, 2, 2, 7, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 7, 7, 7, 7, 7, 7, 7, 7, 7, 18, 18, 18, 18, 18, 18, + 16, 2, 2, 2, 2, 2, 16, 16, 7, 7, 7, 2, 2, 16, 16, 16, + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 0, 0, 18, 18, 16, 16, 2, 2, 2, + 16, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 16, 2, 2, 2, 2 +}; + +static unsigned char uctype_page31[256]= +{ + 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, + 16, 16, 20, 20, 20, 20, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 +}; + +static unsigned char uctype_page32[256]= +{ + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 16, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0 +}; + +static unsigned char uctype_page4D[256]= +{ + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16 +}; + +static unsigned char uctype_page9F[256]= +{ + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, +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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 16, 16, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 16, 16, 0, 0 +}; + +static unsigned char uctype_pageFE[256]= +{ + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, + 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 0, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 0, 16, 16, 16, 16, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 0, 2, 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2, 2, 0, + 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, + 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 0, 0, 0, + 16, 16, 16, 16, 16, 16, 16, 0, 16, 16, 16, 16, 16, 16, 16, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 32, 32, 16, 16, 0, 0 +}; + +MY_UNI_CTYPE my_uni_ctype[256]={ + {0,uctype_page00}, + {0,uctype_page01}, + {0,uctype_page02}, + {0,uctype_page03}, + {0,uctype_page04}, + {0,uctype_page05}, + {0,uctype_page06}, + {0,uctype_page07}, + {0,NULL}, + {0,uctype_page09}, + {0,uctype_page0A}, + {0,uctype_page0B}, + {0,uctype_page0C}, + {0,uctype_page0D}, + {0,uctype_page0E}, + {0,uctype_page0F}, + {0,uctype_page10}, + {0,uctype_page11}, + {0,uctype_page12}, + {0,uctype_page13}, + {0,uctype_page14}, + {2,NULL}, + {0,uctype_page16}, + {0,uctype_page17}, + {0,uctype_page18}, + {0,uctype_page19}, + {0,uctype_page1A}, + {0,uctype_page1B}, + {0,NULL}, + {0,uctype_page1D}, + {0,uctype_page1E}, + {0,uctype_page1F}, + {0,uctype_page20}, + {0,uctype_page21}, + {16,NULL}, + {0,uctype_page23}, + {0,uctype_page24}, + {16,NULL}, + {0,uctype_page26}, + {0,uctype_page27}, + {16,NULL}, + {16,NULL}, + {16,NULL}, + {0,uctype_page2B}, + {0,uctype_page2C}, + {0,uctype_page2D}, + {0,uctype_page2E}, + {0,uctype_page2F}, + {0,uctype_page30}, + {0,uctype_page31}, + {0,uctype_page32}, + {16,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {0,uctype_page4D}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {0,uctype_page9F}, + {2,NULL}, + {2,NULL}, + {2,NULL}, + {2,NULL}, + {0,uctype_pageA4}, + {0,NULL}, + {0,NULL}, + {0,uctype_pageA7}, + {0,uctype_pageA8}, + {0,NULL}, + {0,NULL}, + {0,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {0,uctype_pageD7}, + {0,uctype_pageD8}, + {0,NULL}, + {0,NULL}, + {0,uctype_pageDB}, + {0,uctype_pageDC}, + {0,NULL}, + {0,NULL}, + {0,uctype_pageDF}, + {0,uctype_pageE0}, + {0,NULL}, + {0,NULL}, + {0,NULL}, + {0,NULL}, + {0,NULL}, + {0,NULL}, + {0,NULL}, + {0,NULL}, + {0,NULL}, + {0,NULL}, + {0,NULL}, + {0,NULL}, + {0,NULL}, + {0,NULL}, + {0,NULL}, + {0,NULL}, + {0,NULL}, + {0,NULL}, + {0,NULL}, + {0,NULL}, + {0,NULL}, + {0,NULL}, + {0,NULL}, + {0,uctype_pageF8}, + {2,NULL}, + {0,uctype_pageFA}, + {0,uctype_pageFB}, + {2,NULL}, + {0,uctype_pageFD}, + {0,uctype_pageFE}, + {0,uctype_pageFF} +}; + + diff --git a/include/my_vle.h b/include/my_vle.h new file mode 100644 index 00000000000..94d293487f4 --- /dev/null +++ b/include/my_vle.h @@ -0,0 +1,42 @@ +/* + Copyright (C) 2005 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 +*/ + +#ifndef VLE_H +#define VLE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "my_global.h" + +/* + The size (in bytes) required to store the object ITEM, which can be + either an expression or a type (since sizeof() is used on the item). +*/ +#define my_vle_sizeof(ITEM) (((sizeof(ITEM) * CHAR_BIT) + 6) / 7) + +byte *my_vle_encode(byte *vle, my_size_t max, ulong value); +byte const *my_vle_decode(ulong *value_ptr, byte const *vle); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/my_xml.h b/include/my_xml.h index 82de995e700..0d779ea6fb9 100644 --- a/include/my_xml.h +++ b/include/my_xml.h @@ -26,8 +26,31 @@ extern "C" { #define MY_XML_OK 0 #define MY_XML_ERROR 1 +/* + A flag whether to use absolute tag names in call-back functions, + like "a", "a.b" and "a.b.c" (used in character set file parser), + or relative names like "a", "b" and "c". +*/ +#define MY_XML_FLAG_RELATIVE_NAMES 1 + +/* + A flag whether to skip normilization of text values before calling + call-back functions: i.e. skip leading/trailing spaces, + \r, \n, \t characters. +*/ +#define MY_XML_FLAG_SKIP_TEXT_NORMALIZATION 2 + +enum my_xml_node_type +{ + MY_XML_NODE_TAG, /* can have TAG, ATTR and TEXT children */ + MY_XML_NODE_ATTR, /* can have TEXT children */ + MY_XML_NODE_TEXT /* cannot have children */ +}; + typedef struct xml_stack_st { + int flags; + enum my_xml_node_type current_node_type; char errstr[128]; char attr[128]; char *attrend; diff --git a/include/myisam.h b/include/myisam.h index 95852366251..9e492372f34 100644 --- a/include/myisam.h +++ b/include/myisam.h @@ -32,6 +32,7 @@ extern "C" { #include "keycache.h" #endif #include "my_handler.h" +#include <mysql/plugin.h> /* There is a hard limit for the maximum number of keys as there are only @@ -158,8 +159,6 @@ typedef struct st_mi_isaminfo /* Struct from h_info */ uint reflength; ulong record_offset; ulong *rec_per_key; /* for sql optimizing */ - uint raid_type,raid_chunks; - ulong raid_chunksize; } MI_ISAMINFO; @@ -171,8 +170,6 @@ typedef struct st_mi_create_info ulonglong auto_increment; ulonglong data_file_length; ulonglong key_file_length; - uint raid_type,raid_chunks; - ulong raid_chunksize; uint old_options; uint8 language; my_bool with_auto_increment; @@ -195,10 +192,12 @@ typedef struct st_mi_keydef /* Key definition with open & info */ uint16 keylength; /* Tot length of keyparts (auto) */ uint16 minlength; /* min length of (packed) key (auto) */ uint16 maxlength; /* max length of (packed) key (auto) */ - uint16 block_size; /* block_size (auto) */ + uint16 block_size_index; /* block_size (auto) */ uint32 version; /* For concurrent read/write */ + uint32 ftparser_nr; /* distinct ftparser number */ HA_KEYSEG *seg,*end; + struct st_mysql_ftparser *parser; /* Fulltext [pre]parser */ int (*bin_search)(struct st_myisam_info *info,struct st_mi_keydef *keyinfo, uchar *page,uchar *key, uint key_len,uint comp_flag,uchar * *ret_pos, @@ -304,6 +303,7 @@ extern int mi_rename(const char *from, const char *to); extern int mi_extra(struct st_myisam_info *file, enum ha_extra_function function, void *extra_arg); +extern int mi_reset(struct st_myisam_info *file); extern ha_rows mi_records_in_range(struct st_myisam_info *info,int inx, key_range *min_key, key_range *max_key); extern int mi_log(int activate_log); diff --git a/include/myisammrg.h b/include/myisammrg.h index de8a36c2d0a..f23759e22e1 100644 --- a/include/myisammrg.h +++ b/include/myisammrg.h @@ -99,6 +99,7 @@ extern int myrg_create(const char *name, const char **table_names, uint insert_method, my_bool fix_names); extern int myrg_extra(MYRG_INFO *file,enum ha_extra_function function, void *extra_arg); +extern int myrg_reset(MYRG_INFO *info); extern void myrg_extrafunc(MYRG_INFO *info,invalidator_by_filename inv); extern ha_rows myrg_records_in_range(MYRG_INFO *info,int inx, key_range *min_key, key_range *max_key); diff --git a/include/mysql.h b/include/mysql.h index f2a82c99fc3..7f8941e68f1 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -85,9 +85,9 @@ extern char *mysql_unix_port; #define IS_PRI_KEY(n) ((n) & PRI_KEY_FLAG) #define IS_NOT_NULL(n) ((n) & NOT_NULL_FLAG) #define IS_BLOB(n) ((n) & BLOB_FLAG) -#define IS_NUM(t) ((t) <= FIELD_TYPE_INT24 || (t) == FIELD_TYPE_YEAR || (t) == FIELD_TYPE_NEWDECIMAL) +#define IS_NUM(t) ((t) <= MYSQL_TYPE_INT24 || (t) == MYSQL_TYPE_YEAR || (t) == MYSQL_TYPE_NEWDECIMAL) #define IS_NUM_FIELD(f) ((f)->flags & NUM_FLAG) -#define INTERNAL_NUM_FIELD(f) (((f)->type <= FIELD_TYPE_INT24 && ((f)->type != FIELD_TYPE_TIMESTAMP || (f)->length == 14 || (f)->length == 8)) || (f)->type == FIELD_TYPE_YEAR) +#define INTERNAL_NUM_FIELD(f) (((f)->type <= MYSQL_TYPE_INT24 && ((f)->type != MYSQL_TYPE_TIMESTAMP || (f)->length == 14 || (f)->length == 8)) || (f)->type == MYSQL_TYPE_YEAR) typedef struct st_mysql_field { diff --git a/include/mysql/plugin.h b/include/mysql/plugin.h new file mode 100644 index 00000000000..1385bb502bb --- /dev/null +++ b/include/mysql/plugin.h @@ -0,0 +1,335 @@ +/* Copyright (C) 2005 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 */ + +#ifndef _my_plugin_h +#define _my_plugin_h + +/************************************************************************* + Plugin API. Common for all plugin types. +*/ + +#define MYSQL_PLUGIN_INTERFACE_VERSION 0x0002 + +/* + The allowable types of plugins +*/ +#define MYSQL_UDF_PLUGIN 0 /* User-defined function */ +#define MYSQL_STORAGE_ENGINE_PLUGIN 1 /* Storage Engine */ +#define MYSQL_FTPARSER_PLUGIN 2 /* Full-text parser plugin */ +#define MYSQL_DAEMON_PLUGIN 3 /* The daemon/raw plugin type */ +#define MYSQL_MAX_PLUGIN_TYPE_NUM 4 /* The number of plugin types */ + +/* We use the following strings to define licenses for plugins */ +#define PLUGIN_LICENSE_PROPRIETARY 0 +#define PLUGIN_LICENSE_GPL 1 +#define PLUGIN_LICENSE_BSD 2 + +#define PLUGIN_LICENSE_PROPRIETARY_STRING "PROPRIETARY" +#define PLUGIN_LICENSE_GPL_STRING "GPL" +#define PLUGIN_LICENSE_BSD_STRING "BSD" + +/* + Macros for beginning and ending plugin declarations. Between + mysql_declare_plugin and mysql_declare_plugin_end there should + be a st_mysql_plugin struct for each plugin to be declared. +*/ + + +#ifndef MYSQL_DYNAMIC_PLUGIN +#define __MYSQL_DECLARE_PLUGIN(NAME, VERSION, PSIZE, DECLS) \ +int VERSION= MYSQL_PLUGIN_INTERFACE_VERSION; \ +int PSIZE= sizeof(struct st_mysql_plugin); \ +struct st_mysql_plugin DECLS[]= { +#else +#define __MYSQL_DECLARE_PLUGIN(NAME, VERSION, PSIZE, DECLS) \ +int _mysql_plugin_interface_version_= MYSQL_PLUGIN_INTERFACE_VERSION; \ +int _mysql_sizeof_struct_st_plugin_= sizeof(struct st_mysql_plugin); \ +struct st_mysql_plugin _mysql_plugin_declarations_[]= { +#endif + +#define mysql_declare_plugin(NAME) \ +__MYSQL_DECLARE_PLUGIN(NAME, \ + builtin_ ## NAME ## _plugin_interface_version, \ + builtin_ ## NAME ## _sizeof_struct_st_plugin, \ + builtin_ ## NAME ## _plugin) + +#define mysql_declare_plugin_end ,{0,0,0,0,0,0,0,0,0,0,0,0}} + +/* + declarations for SHOW STATUS support in plugins +*/ +enum enum_mysql_show_type +{ + SHOW_UNDEF, SHOW_BOOL, SHOW_INT, SHOW_LONG, + SHOW_LONGLONG, SHOW_CHAR, SHOW_CHAR_PTR, + SHOW_ARRAY, SHOW_FUNC +}; + +struct st_mysql_show_var { + const char *name; + char *value; + enum enum_mysql_show_type type; +}; + +#define SHOW_VAR_FUNC_BUFF_SIZE 1024 +typedef int (*mysql_show_var_func)(void *, struct st_mysql_show_var*, char *); + +/* + Plugin description structure. +*/ + +struct st_mysql_plugin +{ + int type; /* the plugin type (a MYSQL_XXX_PLUGIN value) */ + void *info; /* pointer to type-specific plugin descriptor */ + const char *name; /* plugin name */ + const char *author; /* plugin author (for SHOW PLUGINS) */ + const char *descr; /* general descriptive text (for SHOW PLUGINS ) */ + int license; /* the plugin type (a MYSQL_XXX_PLUGIN value) */ + int (*init)(void *); /* the function to invoke when plugin is loaded */ + int (*deinit)(void *);/* the function to invoke when plugin is unloaded */ + unsigned int version; /* plugin version (for SHOW PLUGINS) */ + struct st_mysql_show_var *status_vars; + void * __reserved1; /* placeholder for system variables */ + void * __reserved2; /* placeholder for config options */ +}; + +/************************************************************************* + API for Full-text parser plugin. (MYSQL_FTPARSER_PLUGIN) +*/ + +#define MYSQL_FTPARSER_INTERFACE_VERSION 0x0100 + +/* Parsing modes. Set in MYSQL_FTPARSER_PARAM::mode */ +enum enum_ftparser_mode +{ +/* + Fast and simple mode. This mode is used for indexing, and natural + language queries. + + The parser is expected to return only those words that go into the + index. Stopwords or too short/long words should not be returned. The + 'boolean_info' argument of mysql_add_word() does not have to be set. +*/ + MYSQL_FTPARSER_SIMPLE_MODE= 0, + +/* + Parse with stopwords mode. This mode is used in boolean searches for + "phrase matching." + + The parser is not allowed to ignore words in this mode. Every word + should be returned, including stopwords and words that are too short + or long. The 'boolean_info' argument of mysql_add_word() does not + have to be set. +*/ + MYSQL_FTPARSER_WITH_STOPWORDS= 1, + +/* + Parse in boolean mode. This mode is used to parse a boolean query string. + + The parser should provide a valid MYSQL_FTPARSER_BOOLEAN_INFO + structure in the 'boolean_info' argument to mysql_add_word(). + Usually that means that the parser should recognize boolean operators + in the parsing stream and set appropriate fields in + MYSQL_FTPARSER_BOOLEAN_INFO structure accordingly. As for + MYSQL_FTPARSER_WITH_STOPWORDS mode, no word should be ignored. + Instead, use FT_TOKEN_STOPWORD for the token type of such a word. +*/ + MYSQL_FTPARSER_FULL_BOOLEAN_INFO= 2 +}; + +/* + Token types for boolean mode searching (used for the type member of + MYSQL_FTPARSER_BOOLEAN_INFO struct) + + FT_TOKEN_EOF: End of data. + FT_TOKEN_WORD: Regular word. + FT_TOKEN_LEFT_PAREN: Left parenthesis (start of group/sub-expression). + FT_TOKEN_RIGHT_PAREN: Right parenthesis (end of group/sub-expression). + FT_TOKEN_STOPWORD: Stopword. +*/ + +enum enum_ft_token_type +{ + FT_TOKEN_EOF= 0, + FT_TOKEN_WORD= 1, + FT_TOKEN_LEFT_PAREN= 2, + FT_TOKEN_RIGHT_PAREN= 3, + FT_TOKEN_STOPWORD= 4 +}; + +/* + This structure is used in boolean search mode only. It conveys + boolean-mode metadata to the MySQL search engine for every word in + the search query. A valid instance of this structure must be filled + in by the plugin parser and passed as an argument in the call to + mysql_add_word (the callback function in the MYSQL_FTPARSER_PARAM + structure) when a query is parsed in boolean mode. + + type: The token type. Should be one of the enum_ft_token_type values. + + yesno: Whether the word must be present for a match to occur: + >0 Must be present + <0 Must not be present + 0 Neither; the word is optional but its presence increases the relevance + With the default settings of the ft_boolean_syntax system variable, + >0 corresponds to the '+' operator, <0 corrresponds to the '-' operator, + and 0 means neither operator was used. + + weight_adjust: A weighting factor that determines how much a match + for the word counts. Positive values increase, negative - decrease the + relative word's importance in the query. + + wasign: The sign of the word's weight in the query. If it's non-negative + the match for the word will increase document relevance, if it's + negative - decrease (the word becomes a "noise word", the less of it the + better). + + trunc: Corresponds to the '*' operator in the default setting of the + ft_boolean_syntax system variable. +*/ + +typedef struct st_mysql_ftparser_boolean_info +{ + enum enum_ft_token_type type; + int yesno; + int weight_adjust; + char wasign; + char trunc; + /* These are parser state and must be removed. */ + char prev; + char *quot; +} MYSQL_FTPARSER_BOOLEAN_INFO; + +/* + The following flag means that buffer with a string (document, word) + may be overwritten by the caller before the end of the parsing (that is + before st_mysql_ftparser::deinit() call). If one needs the string + to survive between two successive calls of the parsing function, she + needs to save a copy of it. The flag may be set by MySQL before calling + st_mysql_ftparser::parse(), or it may be set by a plugin before calling + st_mysql_ftparser_param::mysql_parse() or + st_mysql_ftparser_param::mysql_add_word(). +*/ +#define MYSQL_FTFLAGS_NEED_COPY 1 + +/* + An argument of the full-text parser plugin. This structure is + filled in by MySQL server and passed to the parsing function of the + plugin as an in/out parameter. + + mysql_parse: A pointer to the built-in parser implementation of the + server. It's set by the server and can be used by the parser plugin + to invoke the MySQL default parser. If plugin's role is to extract + textual data from .doc, .pdf or .xml content, it might extract + plaintext from the content, and then pass the text to the default + MySQL parser to be parsed. + + mysql_add_word: A server callback to add a new word. When parsing + a document, the server sets this to point at a function that adds + the word to MySQL full-text index. When parsing a search query, + this function will add the new word to the list of words to search + for. The boolean_info argument can be NULL for all cases except + when mode is MYSQL_FTPARSER_FULL_BOOLEAN_INFO. + + ftparser_state: A generic pointer. The plugin can set it to point + to information to be used internally for its own purposes. + + mysql_ftparam: This is set by the server. It is used by MySQL functions + called via mysql_parse() and mysql_add_word() callback. The plugin + should not modify it. + + cs: Information about the character set of the document or query string. + + doc: A pointer to the document or query string to be parsed. + + length: Length of the document or query string, in bytes. + + flags: See MYSQL_FTFLAGS_* constants above. + + mode: The parsing mode. With boolean operators, with stopwords, or + nothing. See enum_ftparser_mode above. +*/ + +typedef struct st_mysql_ftparser_param +{ + int (*mysql_parse)(struct st_mysql_ftparser_param *, + char *doc, int doc_len); + int (*mysql_add_word)(struct st_mysql_ftparser_param *, + char *word, int word_len, + MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info); + void *ftparser_state; + void *mysql_ftparam; + struct charset_info_st *cs; + char *doc; + int length; + int flags; + enum enum_ftparser_mode mode; +} MYSQL_FTPARSER_PARAM; + +/* + Full-text parser descriptor. + + interface_version is, e.g., MYSQL_FTPARSER_INTERFACE_VERSION. + The parsing, initialization, and deinitialization functions are + invoked per SQL statement for which the parser is used. +*/ + +struct st_mysql_ftparser +{ + int interface_version; + int (*parse)(MYSQL_FTPARSER_PARAM *param); + int (*init)(MYSQL_FTPARSER_PARAM *param); + int (*deinit)(MYSQL_FTPARSER_PARAM *param); +}; + +/************************************************************************* + API for Storage Engine plugin. (MYSQL_DAEMON_PLUGIN) +*/ + +/* handlertons of different MySQL releases are incompatible */ +#define MYSQL_DAEMON_INTERFACE_VERSION (MYSQL_VERSION_ID << 8) + +/************************************************************************* + API for Storage Engine plugin. (MYSQL_STORAGE_ENGINE_PLUGIN) +*/ + +/* handlertons of different MySQL releases are incompatible */ +#define MYSQL_HANDLERTON_INTERFACE_VERSION (MYSQL_VERSION_ID << 8) + +/* + The real API is in the sql/handler.h + Here we define only the descriptor structure, that is referred from + st_mysql_plugin. +*/ + +struct st_mysql_storage_engine +{ + int interface_version; +}; + +/* + Here we define only the descriptor structure, that is referred from + st_mysql_plugin. +*/ + +struct st_mysql_daemon +{ + int interface_version; +}; + +#endif + diff --git a/include/mysql_com.h b/include/mysql_com.h index 1bbb3cf1737..7a1e2e30ac7 100644 --- a/include/mysql_com.h +++ b/include/mysql_com.h @@ -57,7 +57,7 @@ enum enum_server_command COM_TIME, COM_DELAYED_INSERT, COM_CHANGE_USER, COM_BINLOG_DUMP, COM_TABLE_DUMP, COM_CONNECT_OUT, COM_REGISTER_SLAVE, COM_STMT_PREPARE, COM_STMT_EXECUTE, COM_STMT_SEND_LONG_DATA, COM_STMT_CLOSE, - COM_STMT_RESET, COM_SET_OPTION, COM_STMT_FETCH, + COM_STMT_RESET, COM_SET_OPTION, COM_STMT_FETCH, COM_DAEMON, /* don't forget to update const char *command_name[] in sql_parse.cc */ /* Must be last */ @@ -96,6 +96,10 @@ enum enum_server_command #define GROUP_FLAG 32768 /* Intern: Group field */ #define UNIQUE_FLAG 65536 /* Intern: Used by sql_yacc */ #define BINCMP_FLAG 131072 /* Intern: Used by sql_yacc */ +#define GET_FIXED_FIELDS_FLAG (1 << 18) /* Used to get fields in item tree */ +#define FIELD_IN_PART_FUNC_FLAG (1 << 19)/* Field part of partition func */ +#define FIELD_IN_ADD_INDEX (1<< 20) /* Intern: Field used in ADD INDEX */ +#define FIELD_IS_RENAMED (1<< 21) /* Intern: Field is being renamed */ #define REFRESH_GRANT 1 /* Refresh grant tables */ #define REFRESH_LOG 2 /* Start on new log file */ @@ -175,7 +179,7 @@ typedef struct st_vio Vio; #define MAX_INT_WIDTH 10 /* Max width for a LONG w.o. sign */ #define MAX_BIGINT_WIDTH 20 /* Max width for a LONGLONG */ #define MAX_CHAR_WIDTH 255 /* Max length for a CHAR colum */ -#define MAX_BLOB_WIDTH 8192 /* Default width for blob */ +#define MAX_BLOB_WIDTH 16777216 /* Default width for blob */ typedef struct st_net { #if !defined(CHECK_EMBEDDED_DIFFERENCES) || !defined(EMBEDDED_LIBRARY) @@ -336,7 +340,7 @@ extern "C" { my_bool my_net_init(NET *net, Vio* vio); void my_net_local_init(NET *net); void net_end(NET *net); -void net_clear(NET *net); + void net_clear(NET *net, my_bool clear_buffer); my_bool net_realloc(NET *net, unsigned long length); my_bool net_flush(NET *net); my_bool my_net_write(NET *net,const char *packet,unsigned long len); @@ -428,17 +432,11 @@ char *octet2hex(char *to, const char *str, unsigned int len); /* end of password.c */ -char *get_tty_password(char *opt_message); +char *get_tty_password(const char *opt_message); const char *mysql_errno_to_sqlstate(unsigned int mysql_errno); /* Some other useful functions */ -my_bool my_init(void); -extern int modify_defaults_file(const char *file_location, const char *option, - const char *option_value, - const char *section_name, int remove_option); -int load_defaults(const char *conf_file, const char **groups, - int *argc, char ***argv); my_bool my_thread_init(void); void my_thread_end(void); diff --git a/include/mysql_h.ic b/include/mysql_h.ic index 0e546acef92..51cbb1fb7eb 100644 --- a/include/mysql_h.ic +++ b/include/mysql_h.ic @@ -58,11 +58,11 @@ typedef MYSQL_ROWS * MYSQL_ROW_OFFSET; typedef struct st_mysql_stmt MYSQL_STMT; # 236 "mysql.h" typedef struct character_set MY_CHARSET_INFO; -# 180 "mysql_com.h" +# 184 "mysql_com.h" typedef struct st_net NET; # 21 "typelib.h" typedef struct st_typelib TYPELIB; -# 170 "mysql_com.h" +# 174 "mysql_com.h" typedef struct st_vio Vio; # 57 "mysql.h" typedef char * gptr; @@ -84,9 +84,9 @@ typedef struct st_mysql_data MYSQL_DATA; typedef struct st_mysql_methods MYSQL_METHODS; # 48 "mysql_time.h" typedef struct st_mysql_time MYSQL_TIME; -# 371 "mysql_com.h" +# 375 "mysql_com.h" typedef struct st_udf_args UDF_ARGS; -# 384 "mysql_com.h" +# 388 "mysql_com.h" typedef struct st_udf_init UDF_INIT; # 27 "my_alloc.h" typedef struct st_used_mem USED_MEM; @@ -102,7 +102,7 @@ struct __attribute__((aligned(__alignof__(unsigned int)), aligned(__alignof__(vo unsigned int mbminlen; unsigned int mbmaxlen; }; -# 357 "mysql_com.h" +# 361 "mysql_com.h" struct __attribute__((aligned(__alignof__(unsigned long int)), aligned(__alignof__(double)))) rand_struct { unsigned long int seed1; @@ -383,7 +383,7 @@ struct __attribute__((aligned(__alignof__(unsigned long int)))) st_mysql_time my_bool neg; enum enum_mysql_timestamp_type time_type; }; -# 180 "mysql_com.h" +# 184 "mysql_com.h" struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned long int)))) st_net { Vio * vio; @@ -427,7 +427,7 @@ struct __attribute__((aligned(__alignof__(unsigned int)), aligned(__alignof__(vo char const * * type_names; unsigned int * type_lengths; }; -# 371 "mysql_com.h" +# 375 "mysql_com.h" struct __attribute__((aligned(__alignof__(unsigned int)), aligned(__alignof__(void *)))) st_udf_args { unsigned int arg_count; @@ -438,7 +438,7 @@ struct __attribute__((aligned(__alignof__(unsigned int)), aligned(__alignof__(vo char * * attributes; unsigned long int * attribute_lengths; }; -# 384 "mysql_com.h" +# 388 "mysql_com.h" struct __attribute__((aligned(__alignof__(unsigned long int)), aligned(__alignof__(void *)))) st_udf_init { my_bool maybe_null; @@ -454,7 +454,7 @@ struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned unsigned int left; unsigned int size; }; -# 368 "mysql_com.h" +# 372 "mysql_com.h" enum Item_result { STRING_RESULT = 0, @@ -463,7 +463,7 @@ enum Item_result ROW_RESULT = 3, DECIMAL_RESULT = 4, }; -# 314 "mysql_com.h" +# 318 "mysql_com.h" enum enum_cursor_type { CURSOR_TYPE_NO_CURSOR = 0, @@ -471,7 +471,7 @@ enum enum_cursor_type CURSOR_TYPE_FOR_UPDATE = 2, CURSOR_TYPE_SCROLLABLE = 4, }; -# 227 "mysql_com.h" +# 231 "mysql_com.h" enum enum_field_types { MYSQL_TYPE_DECIMAL = 0, @@ -502,7 +502,7 @@ enum enum_field_types MYSQL_TYPE_STRING = 254, MYSQL_TYPE_GEOMETRY = 255, }; -# 324 "mysql_com.h" +# 328 "mysql_com.h" enum enum_mysql_set_option { MYSQL_OPTION_MULTI_STATEMENTS_ON = 0, @@ -557,7 +557,8 @@ enum enum_server_command COM_STMT_RESET = 26, COM_SET_OPTION = 27, COM_STMT_FETCH = 28, - COM_END = 29, + COM_DAEMON = 29, + COM_END = 30, }; # 727 "mysql.h" enum enum_stmt_attr_type @@ -566,7 +567,7 @@ enum enum_stmt_attr_type STMT_ATTR_CURSOR_TYPE = 1, STMT_ATTR_PREFETCH_ROWS = 2, }; -# 289 "mysql_com.h" +# 293 "mysql_com.h" enum mysql_enum_shutdown_level { SHUTDOWN_DEFAULT = 0, @@ -626,23 +627,23 @@ enum mysql_status MYSQL_STATUS_GET_RESULT = 1, MYSQL_STATUS_USE_RESULT = 2, }; -# 423 "mysql_com.h" +# 427 "mysql_com.h" extern my_bool check_scramble(char const * reply, char const * message, unsigned char const * hash_stage2); -# 416 "mysql_com.h" +# 420 "mysql_com.h" extern my_bool check_scramble_323(char const *, char const * message, unsigned long int * salt); -# 411 "mysql_com.h" +# 415 "mysql_com.h" extern void create_random_string(char * to, unsigned int, struct rand_struct * rand_st); # 28 "typelib.h" extern int find_type(char * x, TYPELIB * typelib, unsigned int); -# 425 "mysql_com.h" +# 429 "mysql_com.h" extern void get_salt_from_password(unsigned char * res, char const * password); -# 418 "mysql_com.h" +# 422 "mysql_com.h" extern void get_salt_from_password_323(unsigned long int * res, char const * password); -# 431 "mysql_com.h" -extern char * get_tty_password(char * opt_message); +# 435 "mysql_com.h" +extern char * get_tty_password(char const * opt_message); # 30 "typelib.h" extern char const * get_type(TYPELIB * typelib, unsigned int); -# 413 "mysql_com.h" +# 417 "mysql_com.h" extern void hash_password(unsigned long int * to, char const * password, unsigned int); # 31 "my_list.h" extern LIST * list_add(LIST * root, LIST * element); @@ -658,37 +659,31 @@ extern unsigned int list_length(LIST *); extern LIST * list_reverse(LIST * root); # 37 "my_list.h" extern int list_walk(LIST *, list_walk_action, gptr); -# 440 "mysql_com.h" -extern int load_defaults(char const * conf_file, char const * * groups, int * argc, char * * * argv); -# 426 "mysql_com.h" +# 430 "mysql_com.h" extern void make_password_from_salt(char * to, unsigned char const * hash_stage2); -# 419 "mysql_com.h" +# 423 "mysql_com.h" extern void make_password_from_salt_323(char * to, unsigned long int const * salt); -# 421 "mysql_com.h" +# 425 "mysql_com.h" extern void make_scrambled_password(char * to, char const * password); -# 414 "mysql_com.h" +# 418 "mysql_com.h" extern void make_scrambled_password_323(char * to, char const * password); # 29 "typelib.h" extern void make_type(char * to, unsigned int, TYPELIB * typelib); -# 437 "mysql_com.h" -extern int modify_defaults_file(char const * file_location, char const * option, char const * option_value, char const * section_name, int); -# 354 "mysql_com.h" +# 358 "mysql_com.h" extern int my_connect(my_socket, struct sockaddr const * name, unsigned int, unsigned int); -# 436 "mysql_com.h" -extern my_bool my_init(void); -# 336 "mysql_com.h" +# 340 "mysql_com.h" extern my_bool my_net_init(NET * net, Vio * vio); -# 337 "mysql_com.h" +# 341 "mysql_com.h" extern void my_net_local_init(NET * net); -# 347 "mysql_com.h" +# 351 "mysql_com.h" extern unsigned long int my_net_read(NET * net); -# 342 "mysql_com.h" +# 346 "mysql_com.h" extern my_bool my_net_write(NET * net, char const * packet, unsigned long int); -# 410 "mysql_com.h" +# 414 "mysql_com.h" extern double my_rnd(struct rand_struct *); -# 443 "mysql_com.h" +# 441 "mysql_com.h" extern void my_thread_end(void); -# 442 "mysql_com.h" +# 440 "mysql_com.h" extern my_bool my_thread_init(void); # 559 "mysql.h" extern void myodbc_remove_escape(MYSQL * mysql, char * name); @@ -726,7 +721,7 @@ extern void mysql_enable_rpl_parse(MYSQL * mysql); extern my_bool mysql_eof(MYSQL_RES * res); # 412 "mysql.h" extern unsigned int mysql_errno(MYSQL * mysql); -# 432 "mysql_com.h" +# 436 "mysql_com.h" extern char const * mysql_errno_to_sqlstate(unsigned int); # 413 "mysql.h" extern char const * mysql_error(MYSQL * mysql); @@ -942,25 +937,25 @@ extern char * mysql_unix_port; extern MYSQL_RES * mysql_use_result(MYSQL * mysql); # 415 "mysql.h" extern unsigned int mysql_warning_count(MYSQL * mysql); -# 339 "mysql_com.h" +# 343 "mysql_com.h" extern void net_clear(NET * net); -# 338 "mysql_com.h" +# 342 "mysql_com.h" extern void net_end(NET * net); -# 341 "mysql_com.h" +# 345 "mysql_com.h" extern my_bool net_flush(NET * net); -# 346 "mysql_com.h" +# 350 "mysql_com.h" extern int net_real_write(NET * net, char const * packet, unsigned long int); -# 340 "mysql_com.h" +# 344 "mysql_com.h" extern my_bool net_realloc(NET * net, unsigned long int); -# 343 "mysql_com.h" +# 347 "mysql_com.h" extern my_bool net_write_command(NET * net, unsigned char, char const * header, unsigned long int, char const * packet, unsigned long int); -# 427 "mysql_com.h" +# 431 "mysql_com.h" extern char * octet2hex(char * to, char const * str, unsigned int); -# 408 "mysql_com.h" +# 412 "mysql_com.h" extern void randominit(struct rand_struct *, unsigned long int, unsigned long int); -# 422 "mysql_com.h" +# 426 "mysql_com.h" extern void scramble(char * to, char const * message, char const * password); -# 415 "mysql_com.h" +# 419 "mysql_com.h" extern void scramble_323(char * to, char const * message, char const * password); # 32 "typelib.h" extern TYPELIB sql_protocol_typelib; diff --git a/include/mysys_err.h b/include/mysys_err.h index 341e6950792..9f104357f41 100644 --- a/include/mysys_err.h +++ b/include/mysys_err.h @@ -62,7 +62,8 @@ extern const char * NEAR globerrs[]; /* my_error_messages is here */ #define EE_SYNC 27 #define EE_UNKNOWN_COLLATION 28 #define EE_FILENOTFOUND 29 -#define EE_ERROR_LAST 29 /*Copy last error nr.*/ +#define EE_FILE_NOT_CLOSED 30 +#define EE_ERROR_LAST 30 /* Copy last error nr */ /* Add error numbers before EE_ERROR_LAST and change it accordingly. */ /* exit codes for all MySQL programs */ diff --git a/include/queues.h b/include/queues.h index 02ab768198e..8cb053831f2 100644 --- a/include/queues.h +++ b/include/queues.h @@ -35,25 +35,34 @@ typedef struct st_queue { uint offset_to_key; /* compare is done on element+offset */ int max_at_top; /* Set if queue_top gives max */ int (*compare)(void *, byte *,byte *); + uint auto_extent; } QUEUE; #define queue_top(queue) ((queue)->root[1]) #define queue_element(queue,index) ((queue)->root[index+1]) #define queue_end(queue) ((queue)->root[(queue)->elements]) #define queue_replaced(queue) _downheap(queue,1) +#define queue_set_cmp_arg(queue, set_arg) (queue)->first_cmp_arg= set_arg +#define queue_set_max_at_top(queue, set_arg) \ + (queue)->max_at_top= set_arg ? (-1 ^ 1) : 0 typedef int (*queue_compare)(void *,byte *, byte *); int init_queue(QUEUE *queue,uint max_elements,uint offset_to_key, pbool max_at_top, queue_compare compare, void *first_cmp_arg); +int init_queue_ex(QUEUE *queue,uint max_elements,uint offset_to_key, + pbool max_at_top, queue_compare compare, + void *first_cmp_arg, uint auto_extent); int reinit_queue(QUEUE *queue,uint max_elements,uint offset_to_key, pbool max_at_top, queue_compare compare, void *first_cmp_arg); int resize_queue(QUEUE *queue, uint max_elements); void delete_queue(QUEUE *queue); void queue_insert(QUEUE *queue,byte *element); +int queue_insert_safe(QUEUE *queue, byte *element); byte *queue_remove(QUEUE *queue,uint idx); #define queue_remove_all(queue) { (queue)->elements= 0; } +#define queue_is_full(queue) (queue->elements == queue->max_elements) void _downheap(QUEUE *queue,uint idx); void queue_fix(QUEUE *queue); #define is_queue_inited(queue) ((queue)->root != 0) diff --git a/include/raid.h b/include/raid.h deleted file mode 100644 index c840afcbaab..00000000000 --- a/include/raid.h +++ /dev/null @@ -1,159 +0,0 @@ -/* Copyright (C) 2000 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 */ - -/* Parser needs these defines always, even if USE_RAID is not defined */ -#define RAID_TYPE_0 1 /* Striping */ -#define RAID_TYPE_x 2 /* Some new modes */ -#define RAID_TYPE_y 3 - -#define RAID_DEFAULT_CHUNKS 4 -#define RAID_DEFAULT_CHUNKSIZE 256*1024 /* 256kB */ - -C_MODE_START -#define my_raid_type(raid_type) raid_type_string[(int)(raid_type)] -extern const char *raid_type_string[]; -C_MODE_END - -#ifdef DONT_USE_RAID -#undef USE_RAID -#endif -#if defined(USE_RAID) - -#include "my_dir.h" - -/* Trap all occurences of my_...() in source and use our wrapper around this function */ - -#ifdef MAP_TO_USE_RAID -#define my_read(A,B,C,D) my_raid_read(A,B,C,D) -#define my_write(A,B,C,D) my_raid_write(A,B,C,D) -#define my_pwrite(A,B,C,D,E) my_raid_pwrite(A,B,C,D,E) -#define my_pread(A,B,C,D,E) my_raid_pread(A,B,C,D,E) -#define my_chsize(A,B,C,D) my_raid_chsize(A,B,C,D) -#define my_close(A,B) my_raid_close(A,B) -#define my_tell(A,B) my_raid_tell(A,B) -#define my_seek(A,B,C,D) my_raid_seek(A,B,C,D) -#define my_lock(A,B,C,D,E) my_raid_lock(A,B,C,D,E) -#define my_fstat(A,B,C) my_raid_fstat(A,B,C) -#endif /* MAP_TO_USE_RAID */ - -#ifdef __cplusplus -extern "C" { -#endif - - void init_raid(void); - void end_raid(void); - - bool is_raid(File fd); - File my_raid_create(const char *FileName, int CreateFlags, int access_flags, - uint raid_type, uint raid_chunks, ulong raid_chunksize, - myf MyFlags); - File my_raid_open(const char *FileName, int Flags, - uint raid_type, uint raid_chunks, ulong raid_chunksize, - myf MyFlags); - int my_raid_rename(const char *from, const char *to, uint raid_chunks, - myf MyFlags); - int my_raid_delete(const char *from, uint raid_chunks, myf MyFlags); - int my_raid_redel(const char *old_name, const char *new_name, - uint raid_chunks, myf MyFlags); - - my_off_t my_raid_seek(File fd, my_off_t pos, int whence, myf MyFlags); - my_off_t my_raid_tell(File fd, myf MyFlags); - - uint my_raid_write(File,const byte *Buffer, uint Count, myf MyFlags); - uint my_raid_read(File Filedes, byte *Buffer, uint Count, myf MyFlags); - - uint my_raid_pread(File Filedes, byte *Buffer, uint Count, my_off_t offset, - myf MyFlags); - uint my_raid_pwrite(int Filedes, const byte *Buffer, uint Count, - my_off_t offset, myf MyFlags); - - int my_raid_lock(File,int locktype, my_off_t start, my_off_t length, - myf MyFlags); - int my_raid_chsize(File fd, my_off_t newlength, int filler, myf MyFlags); - int my_raid_close(File, myf MyFlags); - int my_raid_fstat(int Filedes, struct stat *buf, myf MyFlags); - -#ifdef __cplusplus -} - -#ifdef USE_PRAGMA_INTERFACE -#pragma interface /* gcc class implementation */ -#endif - -class RaidName { - public: - RaidName(const char *FileName); - ~RaidName(); - bool IsRaid(); - int Rename(const char * from, const char * to, myf MyFlags); - private: - uint _raid_type; /* RAID_TYPE_0 or RAID_TYPE_1 or RAID_TYPE_5 */ - uint _raid_chunks; /* 1..n */ - ulong _raid_chunksize; /* 1..n in bytes */ -}; - -class RaidFd { - public: - RaidFd(uint raid_type, uint raid_chunks , ulong raid_chunksize); - ~RaidFd(); - File Create(const char *FileName, int CreateFlags, int access_flags, - myf MyFlags); - File Open(const char *FileName, int Flags, myf MyFlags); - my_off_t Seek(my_off_t pos,int whence,myf MyFlags); - my_off_t Tell(myf MyFlags); - int Write(const byte *Buffer, uint Count, myf MyFlags); - int Read(const byte *Buffer, uint Count, myf MyFlags); - int Lock(int locktype, my_off_t start, my_off_t length, myf MyFlags); - int Chsize(File fd, my_off_t newlength, int filler, myf MyFlags); - int Fstat(int fd, MY_STAT *stat_area, myf MyFlags ); - int Close(myf MyFlags); - static bool IsRaid(File fd); - static DYNAMIC_ARRAY _raid_map; /* Map of RaidFD* */ - private: - - uint _raid_type; /* RAID_TYPE_0 or RAID_TYPE_1 or RAID_TYPE_5 */ - uint _raid_chunks; /* 1..n */ - ulong _raid_chunksize; /* 1..n in bytes */ - - ulong _total_block; /* We are operating with block no x (can be 0..many). */ - uint _this_block; /* can be 0.._raid_chunks */ - uint _remaining_bytes; /* Maximum bytes that can be written in this block */ - - my_off_t _position; - my_off_t _size; /* Cached file size for faster seek(SEEK_END) */ - File _fd; - File *_fd_vector; /* Array of File */ - off_t *_seek_vector; /* Array of cached seek positions */ - - inline void Calculate() - { - DBUG_ENTER("RaidFd::_Calculate"); - DBUG_PRINT("info",("_position: %lu _raid_chunksize: %d, _size: %lu", - (ulong) _position, _raid_chunksize, (ulong) _size)); - - _total_block = (ulong) (_position / _raid_chunksize); - _this_block = _total_block % _raid_chunks; /* can be 0.._raid_chunks */ - _remaining_bytes = (uint) (_raid_chunksize - - (_position - _total_block * _raid_chunksize)); - DBUG_PRINT("info", - ("_total_block: %d this_block: %d _remaining_bytes:%d", - _total_block, _this_block, _remaining_bytes)); - DBUG_VOID_RETURN; - } -}; - -#endif /* __cplusplus */ -#endif /* USE_RAID */ diff --git a/include/thr_alarm.h b/include/thr_alarm.h index 7a10d6886ce..c49bc2588d1 100644 --- a/include/thr_alarm.h +++ b/include/thr_alarm.h @@ -73,14 +73,6 @@ typedef struct st_thr_alarm_entry rf_SetTimer crono; } thr_alarm_entry; -#elif defined(__EMX__) || defined(OS2) - -typedef struct st_thr_alarm_entry -{ - uint crono; - uint event; -} thr_alarm_entry; - #else /* System with posix threads */ typedef int thr_alarm_entry; diff --git a/include/thr_lock.h b/include/thr_lock.h index 251d8e7c9cf..c3a7909175f 100644 --- a/include/thr_lock.h +++ b/include/thr_lock.h @@ -143,10 +143,12 @@ void thr_unlock(THR_LOCK_DATA *data); enum enum_thr_lock_result thr_multi_lock(THR_LOCK_DATA **data, uint count, THR_LOCK_OWNER *owner); void thr_multi_unlock(THR_LOCK_DATA **data,uint count); -void thr_abort_locks(THR_LOCK *lock); +void thr_abort_locks(THR_LOCK *lock, bool upgrade_lock); my_bool thr_abort_locks_for_thread(THR_LOCK *lock, pthread_t thread); void thr_print_locks(void); /* For debugging */ my_bool thr_upgrade_write_delay_lock(THR_LOCK_DATA *data); +void thr_downgrade_write_lock(THR_LOCK_DATA *data, + enum thr_lock_type new_lock_type); my_bool thr_reschedule_write_lock(THR_LOCK_DATA *data); #ifdef __cplusplus } diff --git a/include/violite.h b/include/violite.h index a9651120002..323e72e82d3 100644 --- a/include/violite.h +++ b/include/violite.h @@ -122,6 +122,7 @@ struct st_VioSSLFd *new_VioSSLAcceptorFd(const char *key_file, const char *cert_file, const char *ca_file,const char *ca_path, const char *cipher); +void free_vio_ssl_acceptor_fd(struct st_VioSSLFd *fd); #endif /* HAVE_OPENSSL */ #ifdef HAVE_SMEM |