mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
WL#5665: Removal of the autotools-based build system
Remove some more leftovers from the initial removal: o Update relevant mentions of configure.in throughout the source code. o Remove win/configure.js, which at this point just duplicates logic already present in CMake based build system. o Remove support files which relied on the autotools build system. In any case, MySQL is no longer officially supported on SCO. o Remove files which are no longer part of the build.
This commit is contained in:
@@ -7,18 +7,3 @@ extra_flags="$amd64_cflags $debug_cflags $valgrind_flags"
|
|||||||
extra_configs="$amd64_configs $debug_configs $valgrind_configs $max_configs"
|
extra_configs="$amd64_configs $debug_configs $valgrind_configs $max_configs"
|
||||||
|
|
||||||
. "$path/FINISH.sh"
|
. "$path/FINISH.sh"
|
||||||
|
|
||||||
if test -z "$just_print"
|
|
||||||
then
|
|
||||||
set +v +x
|
|
||||||
echo "\
|
|
||||||
******************************************************************************
|
|
||||||
Note that by default BUILD/compile-pentium-valgrind-max calls 'configure' with
|
|
||||||
--enable-assembler. When Valgrind detects an error involving an assembly
|
|
||||||
function (for example an uninitialized value used as an argument of an
|
|
||||||
assembly function), Valgrind will not print the stacktrace and 'valgrind
|
|
||||||
--gdb-attach=yes' will not work either. If you need a stacktrace in those
|
|
||||||
cases, you have to run BUILD/compile-pentium-valgrind-max with the
|
|
||||||
--disable-assembler argument.
|
|
||||||
******************************************************************************"
|
|
||||||
fi
|
|
||||||
|
@@ -7,18 +7,3 @@ extra_flags="$pentium_cflags $debug_cflags $valgrind_flags"
|
|||||||
extra_configs="$pentium_configs $debug_configs $valgrind_configs $max_configs"
|
extra_configs="$pentium_configs $debug_configs $valgrind_configs $max_configs"
|
||||||
|
|
||||||
. "$path/FINISH.sh"
|
. "$path/FINISH.sh"
|
||||||
|
|
||||||
if test -z "$just_print"
|
|
||||||
then
|
|
||||||
set +v +x
|
|
||||||
echo "\
|
|
||||||
******************************************************************************
|
|
||||||
Note that by default BUILD/compile-pentium-valgrind-max calls 'configure' with
|
|
||||||
--enable-assembler. When Valgrind detects an error involving an assembly
|
|
||||||
function (for example an uninitialized value used as an argument of an
|
|
||||||
assembly function), Valgrind will not print the stacktrace and 'valgrind
|
|
||||||
--gdb-attach=yes' will not work either. If you need a stacktrace in those
|
|
||||||
cases, you have to run BUILD/compile-pentium-valgrind-max with the
|
|
||||||
--disable-assembler argument.
|
|
||||||
******************************************************************************"
|
|
||||||
fi
|
|
||||||
|
@@ -7,18 +7,3 @@ extra_flags="$pentium_cflags $debug_cflags $valgrind_flags"
|
|||||||
extra_configs="$pentium_configs $debug_configs $valgrind_configs $max_no_ndb_configs"
|
extra_configs="$pentium_configs $debug_configs $valgrind_configs $max_no_ndb_configs"
|
||||||
|
|
||||||
. "$path/FINISH.sh"
|
. "$path/FINISH.sh"
|
||||||
|
|
||||||
if test -z "$just_print"
|
|
||||||
then
|
|
||||||
set +v +x
|
|
||||||
echo "\
|
|
||||||
******************************************************************************
|
|
||||||
Note that by default BUILD/compile-pentium-valgrind-max calls 'configure' with
|
|
||||||
--enable-assembler. When Valgrind detects an error involving an assembly
|
|
||||||
function (for example an uninitialized value used as an argument of an
|
|
||||||
assembly function), Valgrind will not print the stacktrace and 'valgrind
|
|
||||||
--gdb-attach=yes' will not work either. If you need a stacktrace in those
|
|
||||||
cases, you have to run BUILD/compile-pentium-valgrind-max with the
|
|
||||||
--disable-assembler argument.
|
|
||||||
******************************************************************************"
|
|
||||||
fi
|
|
||||||
|
@@ -7,18 +7,3 @@ extra_flags="$pentium64_cflags $debug_cflags $valgrind_flags"
|
|||||||
extra_configs="$pentium_configs $debug_configs $valgrind_configs $max_configs"
|
extra_configs="$pentium_configs $debug_configs $valgrind_configs $max_configs"
|
||||||
|
|
||||||
. "$path/FINISH.sh"
|
. "$path/FINISH.sh"
|
||||||
|
|
||||||
if test -z "$just_print"
|
|
||||||
then
|
|
||||||
set +v +x
|
|
||||||
echo "\
|
|
||||||
******************************************************************************
|
|
||||||
Note that by default BUILD/compile-pentium-valgrind-max calls 'configure' with
|
|
||||||
--enable-assembler. When Valgrind detects an error involving an assembly
|
|
||||||
function (for example an uninitialized value used as an argument of an
|
|
||||||
assembly function), Valgrind will not print the stacktrace and 'valgrind
|
|
||||||
--gdb-attach=yes' will not work either. If you need a stacktrace in those
|
|
||||||
cases, you have to run BUILD/compile-pentium-valgrind-max with the
|
|
||||||
--disable-assembler argument.
|
|
||||||
******************************************************************************"
|
|
||||||
fi
|
|
||||||
|
@@ -21,7 +21,7 @@ SET(SHARED_LIB_MAJOR_VERSION "16")
|
|||||||
SET(PROTOCOL_VERSION "10")
|
SET(PROTOCOL_VERSION "10")
|
||||||
SET(DOT_FRM_VERSION "6")
|
SET(DOT_FRM_VERSION "6")
|
||||||
|
|
||||||
# Read value for a variable from configure.in
|
# Read value for a variable from VERSION.
|
||||||
|
|
||||||
MACRO(MYSQL_GET_CONFIG_VALUE keyword var)
|
MACRO(MYSQL_GET_CONFIG_VALUE keyword var)
|
||||||
IF(NOT ${var})
|
IF(NOT ${var})
|
||||||
|
@@ -52,8 +52,6 @@
|
|||||||
# define memmove(d, s, n) bmove ((d), (s), (n))
|
# define memmove(d, s, n) bmove ((d), (s), (n))
|
||||||
#elif defined(HAVE_MEMMOVE)
|
#elif defined(HAVE_MEMMOVE)
|
||||||
# define bmove(d, s, n) memmove((d), (s), (n))
|
# define bmove(d, s, n) memmove((d), (s), (n))
|
||||||
#else
|
|
||||||
# define memmove(d, s, n) bmove((d), (s), (n)) /* our bmove */
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Unixware 7 */
|
/* Unixware 7 */
|
||||||
@@ -96,14 +94,6 @@ extern char _dig_vec_lower[];
|
|||||||
|
|
||||||
/* Prototypes for string functions */
|
/* Prototypes for string functions */
|
||||||
|
|
||||||
#if !defined(bfill) && !defined(HAVE_BFILL)
|
|
||||||
extern void bfill(uchar *dst,size_t len,pchar fill);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(HAVE_BMOVE) && !defined(bmove)
|
|
||||||
extern void bmove(uuchar *dst, const uchar *src,size_t len);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern void bmove_upp(uchar *dst,const uchar *src,size_t len);
|
extern void bmove_upp(uchar *dst,const uchar *src,size_t len);
|
||||||
extern void bchange(uchar *dst,size_t old_len,const uchar *src,
|
extern void bchange(uchar *dst,size_t old_len,const uchar *src,
|
||||||
size_t new_len,size_t tot_len);
|
size_t new_len,size_t tot_len);
|
||||||
@@ -128,11 +118,6 @@ extern char *strxnmov(char *dst, size_t len, const char *src, ...);
|
|||||||
extern size_t strnlen(const char *s, size_t n);
|
extern size_t strnlen(const char *s, size_t n);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(__cplusplus)
|
|
||||||
#ifndef HAVE_STRSTR
|
|
||||||
extern char *strstr(const char *, const char *);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
extern int is_prefix(const char *, const char *);
|
extern int is_prefix(const char *, const char *);
|
||||||
|
|
||||||
/* Conversion routines */
|
/* Conversion routines */
|
||||||
|
@@ -17,11 +17,10 @@
|
|||||||
This file defines the client API to MySQL and also the ABI of the
|
This file defines the client API to MySQL and also the ABI of the
|
||||||
dynamically linked libmysqlclient.
|
dynamically linked libmysqlclient.
|
||||||
|
|
||||||
The ABI should never be changed in a released product of MySQL
|
The ABI should never be changed in a released product of MySQL,
|
||||||
thus you need to take great care when changing the file. In case
|
thus you need to take great care when changing the file. In case
|
||||||
the file is changed so the ABI is broken, you must also
|
the file is changed so the ABI is broken, you must also update
|
||||||
update the SHAREDLIB_MAJOR_VERSION in configure.in .
|
the SHARED_LIB_MAJOR_VERSION in cmake/mysql_version.cmake
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _mysql_h
|
#ifndef _mysql_h
|
||||||
|
@@ -868,14 +868,8 @@ void my_timer_init(MY_TIMER_INFO *mti)
|
|||||||
|
|
||||||
clock() -- We don't use because it would overflow frequently.
|
clock() -- We don't use because it would overflow frequently.
|
||||||
|
|
||||||
clock_gettime() -- Often we don't use this even when it exists.
|
clock_gettime() -- In tests, clock_gettime often had
|
||||||
In configure.in, we use AC_CHECK_FUNCS(clock_gettime). Not
|
resolution = 1000.
|
||||||
AC_CHECK_LIB(rc,clock_gettime)
|
|
||||||
AC_CHECK_FUNCS(clock_gettime)
|
|
||||||
If we had the above lines in configure.in, we'd have to use
|
|
||||||
/usr/lib/librt.so or /usr/lib64/librt.so when linking, and
|
|
||||||
the size of librt.so is 40KB. In tests, clock_gettime often
|
|
||||||
had resolution = 1000.
|
|
||||||
|
|
||||||
ftime() -- A "man ftime" says: "This function is obsolete.
|
ftime() -- A "man ftime" says: "This function is obsolete.
|
||||||
Don't use it." On every platform that we tested, if ftime()
|
Don't use it." On every platform that we tested, if ftime()
|
||||||
|
@@ -1,41 +0,0 @@
|
|||||||
/* Copyright (C) 2002 MySQL AB
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Library General Public
|
|
||||||
License as published by the Free Software Foundation; version 2
|
|
||||||
of the License.
|
|
||||||
|
|
||||||
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 */
|
|
||||||
|
|
||||||
/* File : bfill.c
|
|
||||||
Author : Richard A. O'Keefe.
|
|
||||||
Michael Widenius; ifdef MC68000
|
|
||||||
Updated: 23 April 1984
|
|
||||||
Defines: bfill()
|
|
||||||
|
|
||||||
bfill(dst, len, fill) moves "len" fill characters to "dst".
|
|
||||||
Thus to set a buffer to 80 spaces, do bfill(buff, 80, ' ').
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <my_global.h>
|
|
||||||
#include "m_string.h"
|
|
||||||
|
|
||||||
#if !defined(bfill) && !defined(HAVE_BFILL)
|
|
||||||
|
|
||||||
void bfill(dst, len, fill)
|
|
||||||
register byte *dst;
|
|
||||||
register uint len;
|
|
||||||
register pchar fill;
|
|
||||||
{
|
|
||||||
while (len-- != 0) *dst++ = fill;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
@@ -1,48 +0,0 @@
|
|||||||
/* Copyright (C) 2002 MySQL AB
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Library General Public
|
|
||||||
License as published by the Free Software Foundation; version 2
|
|
||||||
of the License.
|
|
||||||
|
|
||||||
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 */
|
|
||||||
|
|
||||||
/* File : bmove.c
|
|
||||||
Author : Richard A. O'Keefe.
|
|
||||||
Michael Widenius; ifdef MC68000
|
|
||||||
Updated: 23 April 1984
|
|
||||||
Defines: bmove()
|
|
||||||
|
|
||||||
bmove(dst, src, len) moves exactly "len" bytes from the source "src"
|
|
||||||
to the destination "dst". It does not check for NUL characters as
|
|
||||||
strncpy() and strnmov() do. Thus if your C compiler doesn't support
|
|
||||||
structure assignment, you can simulate it with
|
|
||||||
bmove(&to, &from, sizeof from);
|
|
||||||
The standard 4.2bsd routine for this purpose is bcopy. But as bcopy
|
|
||||||
has its first two arguments the other way around you may find this a
|
|
||||||
bit easier to get right.
|
|
||||||
No value is returned.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <my_global.h>
|
|
||||||
#include "m_string.h"
|
|
||||||
|
|
||||||
#if !defined(HAVE_BMOVE) && !defined(bmove)
|
|
||||||
|
|
||||||
void bmove(dst, src, len)
|
|
||||||
register char *dst;
|
|
||||||
register const char *src;
|
|
||||||
register uint len;
|
|
||||||
{
|
|
||||||
while (len-- != 0) *dst++ = *src++;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
@@ -1,216 +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; version 2 of the License.
|
|
||||||
#
|
|
||||||
# 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
|
|
||||||
|
|
||||||
# Optimized longlong2str function for Intel 80x86 (gcc/gas syntax)
|
|
||||||
# Some set sequences are optimized for pentuimpro II
|
|
||||||
|
|
||||||
.file "longlong2str-x86.s"
|
|
||||||
.version "1.02"
|
|
||||||
|
|
||||||
.text
|
|
||||||
.align 4
|
|
||||||
|
|
||||||
.globl longlong2str_with_dig_vector
|
|
||||||
.type longlong2str_with_dig_vector,@function
|
|
||||||
|
|
||||||
longlong2str_with_dig_vector:
|
|
||||||
subl $80,%esp # Temporary buffer for up to 64 radix-2 digits
|
|
||||||
pushl %ebp
|
|
||||||
pushl %esi
|
|
||||||
pushl %edi
|
|
||||||
pushl %ebx
|
|
||||||
movl 100(%esp),%esi # esi = Lower part of val
|
|
||||||
movl 112(%esp),%ebx # ebx = Radix
|
|
||||||
movl 104(%esp),%ebp # ebp = Higher part of val
|
|
||||||
movl 108(%esp),%edi # edi = dst
|
|
||||||
|
|
||||||
testl %ebx,%ebx
|
|
||||||
jge .L144 # Radix was positive
|
|
||||||
negl %ebx # Change radix to positive
|
|
||||||
testl %ebp,%ebp # Test if given value is negative
|
|
||||||
jge .L144
|
|
||||||
movb $45,(%edi) # Add sign
|
|
||||||
incl %edi # Change sign of val
|
|
||||||
negl %esi
|
|
||||||
adcl $0,%ebp
|
|
||||||
negl %ebp
|
|
||||||
|
|
||||||
.L144: # Test that radix is between 2 and 36
|
|
||||||
movl %ebx, %eax
|
|
||||||
addl $-2,%eax # Test that radix is between 2 and 36
|
|
||||||
cmpl $34,%eax
|
|
||||||
ja .Lerror # Radix was not in range
|
|
||||||
|
|
||||||
leal 92(%esp),%ecx # End of buffer
|
|
||||||
movl %edi, 108(%esp) # Store possible modified dest
|
|
||||||
movl 116(%esp), %edi # dig_vec_upper
|
|
||||||
testl %ebp,%ebp # Test if value > 0xFFFFFFFF
|
|
||||||
jne .Llongdiv
|
|
||||||
cmpl %ebx, %esi # Test if <= radix, for easy loop
|
|
||||||
movl %esi, %eax # Value in eax (for Llow)
|
|
||||||
jae .Llow
|
|
||||||
|
|
||||||
# Value is one digit (negative or positive)
|
|
||||||
movb (%eax,%edi),%bl
|
|
||||||
movl 108(%esp),%edi # get dst
|
|
||||||
movb %bl,(%edi)
|
|
||||||
incl %edi # End null here
|
|
||||||
jmp .L10_end
|
|
||||||
|
|
||||||
.Llongdiv:
|
|
||||||
# Value in ebp:esi. div the high part by the radix,
|
|
||||||
# then div remainder + low part by the radix.
|
|
||||||
movl %ebp,%eax # edx=0,eax=high(from ebp)
|
|
||||||
xorl %edx,%edx
|
|
||||||
decl %ecx
|
|
||||||
divl %ebx
|
|
||||||
movl %eax,%ebp # edx=result of last, eax=low(from esi)
|
|
||||||
movl %esi,%eax
|
|
||||||
divl %ebx
|
|
||||||
movl %eax,%esi # ebp:esi = quotient
|
|
||||||
movb (%edx,%edi),%dl # Store result number in temporary buffer
|
|
||||||
testl %ebp,%ebp
|
|
||||||
movb %dl,(%ecx) # store value in buff
|
|
||||||
ja .Llongdiv # (Higher part of val still > 0)
|
|
||||||
|
|
||||||
.align 4
|
|
||||||
.Llow: # Do rest with integer precision
|
|
||||||
# Value in 0:eax. div 0 + low part by the radix.
|
|
||||||
xorl %edx,%edx
|
|
||||||
decl %ecx
|
|
||||||
divl %ebx
|
|
||||||
movb (%edx,%edi),%dl # bh is always zero as ebx=radix < 36
|
|
||||||
testl %eax,%eax
|
|
||||||
movb %dl,(%ecx)
|
|
||||||
jne .Llow
|
|
||||||
|
|
||||||
.L160:
|
|
||||||
movl 108(%esp),%edi # get dst
|
|
||||||
|
|
||||||
.Lcopy_end:
|
|
||||||
leal 92(%esp),%esi # End of buffer
|
|
||||||
.Lmov: # mov temporary buffer to result (%ecx -> %edi)
|
|
||||||
movb (%ecx), %al
|
|
||||||
movb %al, (%edi)
|
|
||||||
incl %ecx
|
|
||||||
incl %edi
|
|
||||||
cmpl %ecx,%esi
|
|
||||||
jne .Lmov
|
|
||||||
|
|
||||||
.L10_end:
|
|
||||||
movl %edi,%eax # Pointer to end null
|
|
||||||
movb $0,(%edi) # Store the end null
|
|
||||||
|
|
||||||
.L165:
|
|
||||||
popl %ebx
|
|
||||||
popl %edi
|
|
||||||
popl %esi
|
|
||||||
popl %ebp
|
|
||||||
addl $80,%esp
|
|
||||||
ret
|
|
||||||
|
|
||||||
.Lerror:
|
|
||||||
xorl %eax,%eax # Wrong radix
|
|
||||||
jmp .L165
|
|
||||||
|
|
||||||
.Lfe3:
|
|
||||||
.size longlong2str_with_dig_vector,.Lfe3-longlong2str_with_dig_vector
|
|
||||||
|
|
||||||
#
|
|
||||||
# This is almost equal to the above, except that we can do the final
|
|
||||||
# loop much more efficient
|
|
||||||
#
|
|
||||||
|
|
||||||
.align 4
|
|
||||||
|
|
||||||
.globl longlong10_to_str
|
|
||||||
.type longlong10_to_str,@function
|
|
||||||
longlong10_to_str:
|
|
||||||
subl $80,%esp
|
|
||||||
pushl %ebp
|
|
||||||
pushl %esi
|
|
||||||
pushl %edi
|
|
||||||
pushl %ebx
|
|
||||||
movl 100(%esp),%esi # Lower part of val
|
|
||||||
movl 104(%esp),%ebp # Higher part of val
|
|
||||||
movl 108(%esp),%edi # get dst
|
|
||||||
movl 112(%esp),%ebx # Radix (10 or -10)
|
|
||||||
testl %ebx,%ebx
|
|
||||||
jge .L10_10 # Positive radix
|
|
||||||
|
|
||||||
negl %ebx # Change radix to positive (= 10)
|
|
||||||
|
|
||||||
testl %ebp,%ebp # Test if negative value
|
|
||||||
jge .L10_10
|
|
||||||
movb $45,(%edi) # Add sign
|
|
||||||
incl %edi
|
|
||||||
negl %esi # Change sign of val (ebp:esi)
|
|
||||||
adcl $0,%ebp
|
|
||||||
negl %ebp
|
|
||||||
|
|
||||||
.L10_10:
|
|
||||||
leal 92(%esp),%ecx # End of buffer
|
|
||||||
testl %ebp,%ebp # Test if value > 0xFFFFFFFF
|
|
||||||
jne .L10_longdiv
|
|
||||||
cmpl $10, %esi # Test if <= radix, for easy loop
|
|
||||||
movl %esi, %ebx # Value in eax (for L10_low)
|
|
||||||
jae .L10_low
|
|
||||||
|
|
||||||
# Value is one digit (negative or positive)
|
|
||||||
addb $48, %bl
|
|
||||||
movb %bl,(%edi)
|
|
||||||
incl %edi
|
|
||||||
jmp .L10_end
|
|
||||||
.align 4
|
|
||||||
|
|
||||||
.L10_longdiv:
|
|
||||||
# val is stored in in ebp:esi
|
|
||||||
movl %ebp,%eax # High part of value
|
|
||||||
xorl %edx,%edx
|
|
||||||
divl %ebx # Divide by 10
|
|
||||||
movl %eax,%ebp
|
|
||||||
movl %esi,%eax
|
|
||||||
divl %ebx # Divide by 10
|
|
||||||
decl %ecx
|
|
||||||
movl %eax,%esi # quotent in ebp:esi
|
|
||||||
addl $48,%edx # Convert to ascii
|
|
||||||
movb %dl,(%ecx) # store value in buff
|
|
||||||
|
|
||||||
.L10_30:
|
|
||||||
testl %ebp,%ebp
|
|
||||||
ja .L10_longdiv
|
|
||||||
movl %esi,%ebx # Move val to %ebx
|
|
||||||
|
|
||||||
.L10_low:
|
|
||||||
# The following code uses some tricks to change division by 10 to
|
|
||||||
# multiplication and shifts
|
|
||||||
movl $0xcccccccd,%esi
|
|
||||||
|
|
||||||
.L10_40: # Divide %ebx with 10
|
|
||||||
movl %ebx,%eax
|
|
||||||
mull %esi
|
|
||||||
decl %ecx
|
|
||||||
shrl $3,%edx
|
|
||||||
leal (%edx,%edx,4),%eax
|
|
||||||
addl %eax,%eax
|
|
||||||
subb %al,%bl # %bl now contains val % 10
|
|
||||||
addb $48,%bl
|
|
||||||
movb %bl,(%ecx)
|
|
||||||
movl %edx,%ebx
|
|
||||||
testl %ebx,%ebx
|
|
||||||
jne .L10_40
|
|
||||||
jmp .Lcopy_end # Shared end with longlong2str
|
|
||||||
|
|
||||||
.L10end:
|
|
||||||
.size longlong10_to_str,.L10end-longlong10_to_str
|
|
@@ -1,33 +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; version 2 of the License.
|
|
||||||
|
|
||||||
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 */
|
|
||||||
|
|
||||||
/*
|
|
||||||
Wrapper for longlong2str.s
|
|
||||||
|
|
||||||
We need this because the assembler code can't access the local variable
|
|
||||||
_dig_vector in a portable manner.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <my_global.h>
|
|
||||||
#include "m_string.h"
|
|
||||||
|
|
||||||
extern char *longlong2str_with_dig_vector(longlong val,char *dst,int radix,
|
|
||||||
const char *dig_vector);
|
|
||||||
|
|
||||||
char *ll2str(longlong val,char *dst,int radix, int upcase)
|
|
||||||
{
|
|
||||||
return longlong2str_with_dig_vector(val, dst, radix,
|
|
||||||
upcase ? _dig_vec_upper : _dig_vec_lower);
|
|
||||||
}
|
|
@@ -1,418 +0,0 @@
|
|||||||
# Copyright (C) 2003 MySQL AB
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; version 2 of the License.
|
|
||||||
#
|
|
||||||
# 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
|
|
||||||
|
|
||||||
# Implemention of my_strtoll(): Converting a string to a 64 bit integer.
|
|
||||||
# For documentation, check my_strtoll.c
|
|
||||||
|
|
||||||
.file "my_strtoll10-x86.s"
|
|
||||||
.version "01.02"
|
|
||||||
|
|
||||||
.text
|
|
||||||
.align 4
|
|
||||||
|
|
||||||
.globl my_strtoll10
|
|
||||||
.type my_strtoll10,@function
|
|
||||||
|
|
||||||
|
|
||||||
# Used stack variables
|
|
||||||
# ebp-4 dummy for storing endptr if endptr = 0
|
|
||||||
# ebp-8 First 9 digits of return values
|
|
||||||
# ebp-12 Pointer to first digit of second part
|
|
||||||
# ebp-16 Store lowest 2 digits
|
|
||||||
# ebp-20 != 0 if value was negative
|
|
||||||
# ebp-24 High max value
|
|
||||||
# ebp-28 Middle max value
|
|
||||||
# ebp-32 Low max value
|
|
||||||
# ebp-36 Temp value
|
|
||||||
|
|
||||||
# esi Pointer to input string
|
|
||||||
# ebx End of string
|
|
||||||
|
|
||||||
my_strtoll10:
|
|
||||||
pushl %ebp
|
|
||||||
movl %esp,%ebp
|
|
||||||
subl $48,%esp
|
|
||||||
pushl %esi
|
|
||||||
pushl %edi
|
|
||||||
pushl %ebx
|
|
||||||
movl 8(%ebp),%esi # esi= nptr
|
|
||||||
movl 16(%ebp),%ecx # ecx= error (Will be overwritten later)
|
|
||||||
movl 12(%ebp),%eax # eax= endptr
|
|
||||||
cmpl $0,%eax # if (endptr)
|
|
||||||
je .L110
|
|
||||||
|
|
||||||
# Fixed length string
|
|
||||||
movl (%eax),%ebx # bx= end-of-string
|
|
||||||
.p2align 4,,7
|
|
||||||
.L100:
|
|
||||||
cmpl %ebx,%esi
|
|
||||||
je .Lno_conv
|
|
||||||
movb (%esi), %al # al= next byte
|
|
||||||
incl %esi
|
|
||||||
cmpb $32,%al # Skip space
|
|
||||||
je .L100
|
|
||||||
cmpb $9,%al # Skip tab
|
|
||||||
je .L100
|
|
||||||
jmp .L130
|
|
||||||
|
|
||||||
# String that ends with \0
|
|
||||||
|
|
||||||
.L110:
|
|
||||||
leal -4(%ebp),%edi
|
|
||||||
movl %edi,12(%ebp) # endptr= &dummy, for easier end check
|
|
||||||
.p2align 4,,7
|
|
||||||
.L120:
|
|
||||||
movb (%esi), %al # al= next byte
|
|
||||||
incl %esi
|
|
||||||
cmpb $32,%al
|
|
||||||
je .L120
|
|
||||||
cmpb $9,%al
|
|
||||||
je .L120
|
|
||||||
testb %al,%al # Test if we found end \0
|
|
||||||
je .Lno_conv
|
|
||||||
leal 65535(%esi),%ebx # ebx = end-of-string
|
|
||||||
|
|
||||||
.L130:
|
|
||||||
cmpb $45,%al # Test if '-'
|
|
||||||
jne .Lpositive
|
|
||||||
|
|
||||||
# negative number
|
|
||||||
movl $-1,(%ecx) # error = -1 (mark that number is negative)
|
|
||||||
movl $1,-20(%ebp) # negative= 1
|
|
||||||
movl $92233720,-24(%ebp)
|
|
||||||
movl $368547758,-28(%ebp)
|
|
||||||
movl $8,-32(%ebp)
|
|
||||||
jmp .L460
|
|
||||||
|
|
||||||
.p2align 4,,7
|
|
||||||
.Lpositive:
|
|
||||||
movl $0,(%ecx) # error=0
|
|
||||||
movl $0,-20(%ebp) # negative= 0
|
|
||||||
movl $184467440,-24(%ebp)
|
|
||||||
movl $737095516,-28(%ebp)
|
|
||||||
movl $15,-32(%ebp)
|
|
||||||
cmpb $43,%al # Check if '+'
|
|
||||||
jne .L462
|
|
||||||
|
|
||||||
.L460:
|
|
||||||
cmpl %ebx,%esi # Check if overflow
|
|
||||||
je .Lno_conv
|
|
||||||
movb (%esi), %al # al= next byte after sign
|
|
||||||
incl %esi
|
|
||||||
|
|
||||||
# Remove pre zero to be able to handle a lot of pre-zero
|
|
||||||
.L462:
|
|
||||||
cmpb $48,%al
|
|
||||||
jne .L475 # Number doesn't start with 0
|
|
||||||
decl %esi
|
|
||||||
.p2align 4,,7
|
|
||||||
|
|
||||||
# Skip pre zeros
|
|
||||||
.L481:
|
|
||||||
incl %esi # Skip processed byte
|
|
||||||
cmpl %ebx,%esi
|
|
||||||
je .Lms_return_zero
|
|
||||||
cmpb (%esi),%al # Test if next byte is also zero
|
|
||||||
je .L481
|
|
||||||
leal 9(%esi),%ecx # ecx = end-of-current-part
|
|
||||||
xorl %edi,%edi # Store first 9 digits in edi
|
|
||||||
jmp .L482
|
|
||||||
.p2align 4,,7
|
|
||||||
|
|
||||||
# Check if first char is a valid number
|
|
||||||
.L475:
|
|
||||||
addb $-48,%al
|
|
||||||
cmpb $9,%al
|
|
||||||
ja .Lno_conv
|
|
||||||
.L477:
|
|
||||||
movzbl %al,%edi # edi = first digit
|
|
||||||
leal 8(%esi),%ecx # ecx = end-of-current-part
|
|
||||||
|
|
||||||
# Handle first 8/9 digits and store them in edi
|
|
||||||
.L482:
|
|
||||||
cmpl %ebx,%ecx
|
|
||||||
jbe .L522
|
|
||||||
movl %ebx,%ecx # ecx = min(end-of-current-part, end-of-string)
|
|
||||||
jmp .L522
|
|
||||||
|
|
||||||
.p2align 4,,7
|
|
||||||
.L488:
|
|
||||||
movb (%esi), %al # al= next byte
|
|
||||||
incl %esi
|
|
||||||
addb $-48,%al
|
|
||||||
cmpb $9,%al
|
|
||||||
ja .Lend_i_dec_esi
|
|
||||||
|
|
||||||
# Calculate edi= edi*10 + al
|
|
||||||
leal (%edi,%edi,4),%edx
|
|
||||||
movzbl %al,%eax
|
|
||||||
leal (%eax,%edx,2),%edi
|
|
||||||
.L522:
|
|
||||||
cmpl %ecx,%esi # If more digits at this level
|
|
||||||
jne .L488
|
|
||||||
cmpl %ebx,%esi # If end of string
|
|
||||||
je .Lend_i
|
|
||||||
|
|
||||||
movl %edi,-8(%ebp) # Store first 9 digits
|
|
||||||
movl %esi,-12(%ebp) # store pos to first digit of second part
|
|
||||||
|
|
||||||
# Calculate next 9 digits and store them in edi
|
|
||||||
|
|
||||||
xorl %edi,%edi
|
|
||||||
leal 9(%esi),%ecx # ecx= end-of-current-part
|
|
||||||
movl %ecx,-36(%ebp) # Store max length
|
|
||||||
cmpl %ebx,%ecx
|
|
||||||
jbe .L498
|
|
||||||
movl %ebx,%ecx # ecx = min(end-of-current-part, end-of-string)
|
|
||||||
|
|
||||||
.p2align 4,,7
|
|
||||||
.L498:
|
|
||||||
movb (%esi), %al # al= next byte
|
|
||||||
incl %esi
|
|
||||||
addb $-48,%al
|
|
||||||
cmpb $9,%al
|
|
||||||
ja .Lend_i_and_j_decl_esi
|
|
||||||
|
|
||||||
# Calculate edi= edi*10 + al
|
|
||||||
leal (%edi,%edi,4),%edx
|
|
||||||
movzbl %al,%eax
|
|
||||||
leal (%eax,%edx,2),%edi
|
|
||||||
|
|
||||||
cmpl %ecx,%esi # If end of current part
|
|
||||||
jne .L498
|
|
||||||
cmpl %ebx,%esi # If end of string
|
|
||||||
jne .L500
|
|
||||||
cmpl -36(%ebp),%esi # Test if string is less than 18 digits
|
|
||||||
jne .Lend_i_and_j
|
|
||||||
.L499:
|
|
||||||
movl $1000000000,%eax
|
|
||||||
jmp .Lgot_factor # 18 digit string
|
|
||||||
|
|
||||||
# Handle the possible next to last digit and store in ecx
|
|
||||||
.L500:
|
|
||||||
movb (%esi),%al
|
|
||||||
addb $-48,%al
|
|
||||||
cmpb $9,%al
|
|
||||||
ja .L499 # 18 digit string
|
|
||||||
|
|
||||||
incl %esi
|
|
||||||
movzbl %al,%ecx
|
|
||||||
cmpl %ebx,%esi # If end of string
|
|
||||||
je .Lend4
|
|
||||||
|
|
||||||
movb (%esi),%al # Read last digit
|
|
||||||
addb $-48,%al
|
|
||||||
cmpb $9,%al
|
|
||||||
ja .Lend4
|
|
||||||
|
|
||||||
# ecx= ecx*10 + al
|
|
||||||
leal (%ecx,%ecx,4),%edx
|
|
||||||
movzbl %al,%eax
|
|
||||||
leal (%eax,%edx,2),%ecx
|
|
||||||
|
|
||||||
movl 12(%ebp),%eax # eax = endptr
|
|
||||||
incl %esi
|
|
||||||
movl %esi,(%eax) # *endptr = end-of-string
|
|
||||||
cmpl %ebx,%esi
|
|
||||||
je .L505 # At end of string
|
|
||||||
|
|
||||||
movb (%esi),%al # check if extra digits
|
|
||||||
addb $-48,%al
|
|
||||||
cmpb $9,%al
|
|
||||||
jbe .Loverflow
|
|
||||||
|
|
||||||
# At this point we have:
|
|
||||||
# -8(%ebp) First 9 digits
|
|
||||||
# edi Next 9 digits
|
|
||||||
# ecx Last 2 digits
|
|
||||||
# *endpos end-of-string
|
|
||||||
|
|
||||||
.L505: # Check that we are not going to get overflow for unsigned long long
|
|
||||||
movl -8(%ebp),%eax # First 9 digits
|
|
||||||
cmpl -24(%ebp),%eax
|
|
||||||
ja .Loverflow
|
|
||||||
jne .L507
|
|
||||||
cmpl -28(%ebp),%edi
|
|
||||||
ja .Loverflow
|
|
||||||
jne .L507
|
|
||||||
cmpl -32(%ebp),%ecx
|
|
||||||
ja .Loverflow
|
|
||||||
|
|
||||||
.L507:
|
|
||||||
movl %edi,-4(%ebp) # Save middle bytes
|
|
||||||
movl %ecx,%esi # esi = 2 last digits
|
|
||||||
movl $1215752192,%ecx # %ecx= lower_32_bits(100000000000)
|
|
||||||
mull %ecx
|
|
||||||
imull $23,-8(%ebp),%ecx
|
|
||||||
movl $0,-36(%ebp)
|
|
||||||
movl %eax,%ebx
|
|
||||||
imull $1215752192,-36(%ebp),%eax
|
|
||||||
movl %edx,%edi
|
|
||||||
addl %ecx,%edi
|
|
||||||
addl %eax,%edi # Temp in edi:ebx
|
|
||||||
|
|
||||||
movl $100,%eax # j= j*100
|
|
||||||
mull -4(%ebp)
|
|
||||||
addl %ebx,%eax # edx:eax+= edi:ebx
|
|
||||||
adcl %edi,%edx
|
|
||||||
addl %esi,%eax
|
|
||||||
adcl $0,%edx
|
|
||||||
jmp .Lms_return
|
|
||||||
|
|
||||||
.Loverflow:
|
|
||||||
# When we come here, *endptr is already updated
|
|
||||||
|
|
||||||
movl 16(%ebp),%edx # edx= error
|
|
||||||
movl $34,(%edx) # *error = 34
|
|
||||||
movl $-1,%eax
|
|
||||||
movl %eax,%edx
|
|
||||||
cmpl $0,-20(%ebp) # If negative
|
|
||||||
je .Lms_return
|
|
||||||
xor %eax,%eax # edx:eax = LONGLONG_LMIN
|
|
||||||
movl $-2147483648,%edx
|
|
||||||
jmp .Lms_return
|
|
||||||
|
|
||||||
# Return value that is in %edi as long long
|
|
||||||
.p2align 4,,7
|
|
||||||
.Lend_i_dec_esi:
|
|
||||||
decl %esi # Fix so that it points at last digit
|
|
||||||
.Lend_i:
|
|
||||||
xorl %edx,%edx
|
|
||||||
movl %edi,%eax
|
|
||||||
cmpl $0,-20(%ebp)
|
|
||||||
je .Lreturn_save_endptr # Positive number
|
|
||||||
negl %eax
|
|
||||||
cltd # Neg result in edx:eax
|
|
||||||
jmp .Lreturn_save_endptr
|
|
||||||
|
|
||||||
# Return value (%ebp-8) * lfactor[(uint) (edx-start)] + edi
|
|
||||||
.p2align 4,,7
|
|
||||||
.Lend_i_and_j_decl_esi:
|
|
||||||
decl %esi # Fix so that it points at last digit
|
|
||||||
.Lend_i_and_j:
|
|
||||||
movl %esi,%ecx
|
|
||||||
subl -12(%ebp),%ecx # ecx= number of digits in second part
|
|
||||||
|
|
||||||
# Calculate %eax= 10 ** %cl, where %cl <= 8
|
|
||||||
# With an array one could do this with:
|
|
||||||
# movl 10_factor_table(,%ecx,4),%eax
|
|
||||||
# We calculate the table here to avoid problems in
|
|
||||||
# position independent code (gcc -pic)
|
|
||||||
|
|
||||||
cmpb $3,%cl
|
|
||||||
ja .L4_to_8
|
|
||||||
movl $1000, %eax
|
|
||||||
je .Lgot_factor # %cl=3, eax= 1000
|
|
||||||
movl $10, %eax
|
|
||||||
cmpb $1,%cl # %cl is here 0 - 2
|
|
||||||
je .Lgot_factor # %cl=1, eax= 10
|
|
||||||
movl $100, %eax
|
|
||||||
ja .Lgot_factor # %cl=2, eax=100
|
|
||||||
movl $1, %eax
|
|
||||||
jmp .Lgot_factor # %cl=0, eax=1
|
|
||||||
|
|
||||||
.L4_to_8: # %cl is here 4-8
|
|
||||||
cmpb $5,%cl
|
|
||||||
movl $100000, %eax
|
|
||||||
je .Lgot_factor # %cl=5, eax=100000
|
|
||||||
movl $10000, %eax
|
|
||||||
jbe .Lgot_factor # %cl=4, eax=10000
|
|
||||||
movl $10000000, %eax
|
|
||||||
cmpb $7,%cl
|
|
||||||
je .Lgot_factor # %cl=7, eax=10000000
|
|
||||||
movl $100000000, %eax
|
|
||||||
ja .Lgot_factor # %cl=8, eax=100000000
|
|
||||||
movl $1000000, %eax # %cl=6, eax=1000000
|
|
||||||
|
|
||||||
# Return -8(%ebp) * %eax + edi
|
|
||||||
.p2align 4,,7
|
|
||||||
.Lgot_factor:
|
|
||||||
mull -8(%ebp)
|
|
||||||
addl %edi,%eax
|
|
||||||
adcl $0,%edx
|
|
||||||
cmpl $0,-20(%ebp) # if negative
|
|
||||||
je .Lreturn_save_endptr
|
|
||||||
negl %eax # Neg edx:%eax
|
|
||||||
adcl $0,%edx
|
|
||||||
negl %edx
|
|
||||||
jmp .Lreturn_save_endptr
|
|
||||||
|
|
||||||
# Return -8(%ebp) * $10000000000 + edi*10 + ecx
|
|
||||||
.p2align 4,,7
|
|
||||||
.Lend4:
|
|
||||||
movl %ecx,-16(%ebp) # store lowest digits
|
|
||||||
movl 12(%ebp),%ebx
|
|
||||||
movl %esi,(%ebx) # *endpos = end-of-string
|
|
||||||
movl -8(%ebp),%eax # First 9 digits
|
|
||||||
movl $1410065408,%ecx # ecx= lower_32_bits(10000000000)
|
|
||||||
mull %ecx
|
|
||||||
movl $0,-36(%ebp)
|
|
||||||
movl %eax,%ebx # Store lowest 32 byte from multiplication
|
|
||||||
imull $1410065408,-36(%ebp),%eax
|
|
||||||
movl -8(%ebp),%ecx # First 9 digits
|
|
||||||
movl %edx,%esi
|
|
||||||
addl %ecx,%ecx
|
|
||||||
addl %ecx,%esi
|
|
||||||
addl %eax,%esi # %esi:%ebx now has -8(%ebp) * $10000000000
|
|
||||||
|
|
||||||
movl $10,%eax # Calc edi*10
|
|
||||||
mull %edi
|
|
||||||
addl %ebx,%eax # And add to result
|
|
||||||
adcl %esi,%edx
|
|
||||||
addl -16(%ebp),%eax # Add lowest digit
|
|
||||||
adcl $0,%edx
|
|
||||||
cmpl $0,-20(%ebp) # if negative
|
|
||||||
je .Lms_return
|
|
||||||
|
|
||||||
cmpl $-2147483648,%edx # Test if too big signed integer
|
|
||||||
ja .Loverflow
|
|
||||||
jne .L516
|
|
||||||
testl %eax,%eax
|
|
||||||
ja .Loverflow
|
|
||||||
|
|
||||||
.L516:
|
|
||||||
negl %eax
|
|
||||||
adcl $0,%edx
|
|
||||||
negl %edx
|
|
||||||
jmp .Lms_return
|
|
||||||
|
|
||||||
.p2align 4,,7
|
|
||||||
.Lno_conv: # Not a legal number
|
|
||||||
movl 16(%ebp),%eax
|
|
||||||
movl $33,(%eax) # error= edom
|
|
||||||
|
|
||||||
.Lms_return_zero:
|
|
||||||
xorl %eax,%eax # Return zero
|
|
||||||
xorl %edx,%edx
|
|
||||||
|
|
||||||
.p2align 4,,7
|
|
||||||
.Lreturn_save_endptr:
|
|
||||||
movl 12(%ebp),%ecx # endptr= end-of-string
|
|
||||||
movl %esi,(%ecx) # *endptr= end-of-string
|
|
||||||
|
|
||||||
.Lms_return:
|
|
||||||
popl %ebx
|
|
||||||
popl %edi
|
|
||||||
popl %esi
|
|
||||||
movl %ebp,%esp
|
|
||||||
popl %ebp
|
|
||||||
ret
|
|
||||||
|
|
||||||
.my_strtoll10_end:
|
|
||||||
.size my_strtoll10,.my_strtoll10_end-my_strtoll10
|
|
||||||
.comm res,240,32
|
|
||||||
.comm end_ptr,120,32
|
|
||||||
.comm error,120,32
|
|
||||||
.ident "Monty"
|
|
@@ -1,275 +0,0 @@
|
|||||||
/* Copyright (C) 2000-2003 MySQL AB
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation; version 2 of the License.
|
|
||||||
|
|
||||||
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 */
|
|
||||||
|
|
||||||
/* Test of all stringfunktions that is coded in assembler */
|
|
||||||
|
|
||||||
#include <my_global.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include "m_string.h"
|
|
||||||
|
|
||||||
#define F_LEN 8
|
|
||||||
#define F_CHAR 'A'
|
|
||||||
#define F_FILL 'B'
|
|
||||||
#define T_LEN 15
|
|
||||||
#define T_CHAR 'D'
|
|
||||||
#define T_FILL 'E'
|
|
||||||
#define F_PREFILL '0'
|
|
||||||
#define T_PREFILL '1'
|
|
||||||
|
|
||||||
static char from_buff[100],to_buff[100];
|
|
||||||
static char * from, *to;
|
|
||||||
static int errors,tests;
|
|
||||||
static int test_strarg(const char *name,...);
|
|
||||||
static void init_strings (void); /* Init from and to */
|
|
||||||
void test_arg (const char *message,long func_value,long value);
|
|
||||||
int compare_buff(const char *message,char * b1,char * b2,int length,
|
|
||||||
pchar fill, pchar prefill);
|
|
||||||
|
|
||||||
static int my_test(int a)
|
|
||||||
{
|
|
||||||
return a ? 1 : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
static char v1[]="Monty",v2[]="on",v3[]="Montys",v4[]="ty",v5[]="gr",
|
|
||||||
v6[]="hohohoo",v7[]="hohoo",v8[]="hohooo",v9[]="t",
|
|
||||||
cont[]="qwet";
|
|
||||||
errors=tests=0;
|
|
||||||
init_strings();
|
|
||||||
|
|
||||||
test_arg("memcmp(from,to,5)",(long) my_test(memcmp(from,to,5)),1L);
|
|
||||||
test_arg("memcmp(from,from,5)",(long) memcmp(from,from,5),0L);
|
|
||||||
|
|
||||||
test_arg("memcmp(from,to,0)",(long) memcmp(from,to,0),0L);
|
|
||||||
test_arg("strend(from)",(long) strend(from),(long) from+F_LEN);
|
|
||||||
test_arg("strchr(v1,'M')",(long) strchr(v1,'M'),(long) v1);
|
|
||||||
test_arg("strchr(v1,'y')",(long) strchr(v1,'y'),(long) v1+4);
|
|
||||||
test_arg("strchr(v1,'x')",(long) strchr(v1,'x'),0L);
|
|
||||||
test_arg("strcont(v1,cont)",(long) strcont(v1,cont),(long) v1+3);
|
|
||||||
test_arg("strcont(v1,v2)",(long) strcont(v1,v2),(long) v1+1);
|
|
||||||
test_arg("strcont(v1,v5)",(long) strcont(v1,v5),0L);
|
|
||||||
test_arg("is_prefix(v3,v1)",(long) is_prefix(v3,v1),1L);
|
|
||||||
test_arg("is_prefix(v1,v3)",(long) is_prefix(v1,v3),0L);
|
|
||||||
test_arg("is_prefix(v3,v4)",(long) is_prefix(v3,v4),0L);
|
|
||||||
test_arg("strstr(v1,v1)",(long) strstr(v1,v1),(long) v1);
|
|
||||||
test_arg("strstr(v1,v2)",(long) strstr(v1,v2),(long) v1+1);
|
|
||||||
test_arg("strstr(v1,v4)",(long) strstr(v1,v4),(long) v1+3);
|
|
||||||
test_arg("strstr(v6,v7)",(long) strstr(v6,v7),(long) v6+2);
|
|
||||||
test_arg("strstr(v1,v9)",(long) strstr(v1,v9),(long) v1+3);
|
|
||||||
test_arg("strstr(v1,v3)",(long) strstr(v1,v3),0L);
|
|
||||||
test_arg("strstr(v1,v5)",(long) strstr(v1,v5),0L);
|
|
||||||
test_arg("strstr(v6,v8)",(long) strstr(v6,v8),0L);
|
|
||||||
|
|
||||||
test_arg("strlen(from)",(long) strlen(from),(long) F_LEN);
|
|
||||||
test_arg("strlen(\"\")",(long) strlen(""),0L);
|
|
||||||
#ifdef HAVE_STRNLEN
|
|
||||||
test_arg("strnlen(from,3)",(long) strnlen(from,3),3L);
|
|
||||||
test_arg("strnlen(from,0)",(long) strnlen(from,0),0L);
|
|
||||||
test_arg("strnlen(from,1000)",(long) strnlen(from,1000),(long) F_LEN);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
test_strarg("bfill(to,4,' ')",(bfill(to,4,' '),0L),INT_MAX32,4,' ',0,0);
|
|
||||||
test_strarg("bfill(from,0,' ')",(bfill(from,0,' '),0L),INT_MAX32,0,0);
|
|
||||||
test_strarg("bzero(to,3)",(bzero(to,3),0L),INT_MAX32,3,0,0,0);
|
|
||||||
test_strarg("bzero(to,0)",(bzero(to,0),0L),INT_MAX32,0,0);
|
|
||||||
test_strarg("bmove(to,from,4)",(bmove(to,from,4),0L),INT_MAX32,4,F_CHAR,
|
|
||||||
0,0);
|
|
||||||
test_strarg("bmove(to,from,0)",(bmove(to,from,0),0L),INT_MAX32,0,0);
|
|
||||||
test_strarg("bmove_upp(to+6,from+6,3)",(bmove_upp(to+6,from+6,3),0L),INT_MAX32,
|
|
||||||
3,T_CHAR,3,F_CHAR,0,0);
|
|
||||||
test_strarg("bmove_upp(to,from,0)",(bmove_upp(to,from,0),0L),INT_MAX32,0,0);
|
|
||||||
test_strarg("memcpy(to,from,8)",(memcpy(to,from,8),0L),INT_MAX32,
|
|
||||||
8,F_CHAR,0,0);
|
|
||||||
test_strarg("strappend(to,3,' ')",(strappend(to,3,' '),0L),INT_MAX32,
|
|
||||||
3,T_CHAR,1,0,T_LEN-4,T_CHAR,1,0,0,0);
|
|
||||||
test_strarg("strappend(to,T_LEN+5,' ')",(strappend(to,T_LEN+5,' '),0L),INT_MAX32,
|
|
||||||
T_LEN,T_CHAR,5,' ',1,0,0,0);
|
|
||||||
test_strarg("strcat(to,from)",strcat(to,from),to,T_LEN,T_CHAR,
|
|
||||||
F_LEN,F_CHAR,1,0,0,0);
|
|
||||||
test_strarg("strcat(to,\"\")",strcat(to,""),INT_MAX32,0,0);
|
|
||||||
test_strarg("strfill(to,4,' ')",strfill(to,4,' '),to+4,4,' ',1,0,0,0);
|
|
||||||
test_strarg("strfill(from,0,' ')",strfill(from,0,' '),from,0,1,0,0);
|
|
||||||
test_strarg("strmake(to,from,4)",strmake(to,from,4),to+4,4,F_CHAR,
|
|
||||||
1,0,0,0);
|
|
||||||
test_strarg("strmake(to,from,0)",strmake(to,from,0),to+0,1,0,0,0);
|
|
||||||
test_strarg("strmov(to,from)",strmov(to,from),to+F_LEN,F_LEN,F_CHAR,0,0);
|
|
||||||
test_strarg("strmov(to,\"\")",strmov(to,""),to,1,0,0,0);
|
|
||||||
test_strarg("strnmov(to,from,2)",strnmov(to,from,2),to+2,2,F_CHAR,0,0);
|
|
||||||
test_strarg("strnmov(to,from,F_LEN+5)",strnmov(to,from,F_LEN+5),to+F_LEN,
|
|
||||||
F_LEN,F_CHAR,1,0,0,0);
|
|
||||||
test_strarg("strnmov(to,\"\",2)",strnmov(to,"",2),to,1,0,0,0);
|
|
||||||
test_strarg("strxmov(to,from,\"!!\",NullS)",strxmov(to,from,"!!",NullS),to+F_LEN+2,F_LEN,F_CHAR,2,'!',0,0,0);
|
|
||||||
test_strarg("strxmov(to,NullS)",strxmov(to,NullS),to,1,0,0,0);
|
|
||||||
test_strarg("strxmov(to,from,from,from,from,from,'!!',from,NullS)",strxmov(to,from,from,from,from,from,"!!",from,NullS),to+F_LEN*6+2,F_LEN,F_CHAR,F_LEN,F_CHAR,F_LEN,F_CHAR,F_LEN,F_CHAR,F_LEN,F_CHAR,2,'!',F_LEN,F_CHAR,1,0,0,0);
|
|
||||||
|
|
||||||
test_strarg("strxnmov(to,100,from,\"!!\",NullS)",strxnmov(to,100,from,"!!",NullS),to+F_LEN+2,F_LEN,F_CHAR,2,'!',0,0,0);
|
|
||||||
test_strarg("strxnmov(to,2,NullS)",strxnmov(to,2,NullS),to,1,0,0,0);
|
|
||||||
test_strarg("strxnmov(to,100,from,from,from,from,from,'!!',from,NullS)",strxnmov(to,100,from,from,from,from,from,"!!",from,NullS),to+F_LEN*6+2,F_LEN,F_CHAR,F_LEN,F_CHAR,F_LEN,F_CHAR,F_LEN,F_CHAR,F_LEN,F_CHAR,2,'!',F_LEN,F_CHAR,1,0,0,0);
|
|
||||||
test_strarg("strxnmov(to,2,\"!!!\",NullS)",strxnmov(to,2,"!!!",NullS),to+2,2,'!',0,0,0);
|
|
||||||
test_strarg("strxnmov(to,2,\"!!\",NullS)",strxnmov(to,2,"!!","xx",NullS),to+2,2,'!',0,0,0);
|
|
||||||
test_strarg("strxnmov(to,2,\"!\",\"x\",\"y\",NullS)",strxnmov(to,2,"!","x","y",NullS),to+2,1,'!',1,'x',0,0,0);
|
|
||||||
|
|
||||||
test_strarg("bchange(to,2,from,4,6)",(bchange(to,2,from,4,6),0L),INT_MAX32,
|
|
||||||
4,F_CHAR,2,T_CHAR,0,0);
|
|
||||||
|
|
||||||
printf("tests: %d errors: %d\n",tests,errors);
|
|
||||||
if (errors)
|
|
||||||
fputs("--- Some functions doesn't work!! Fix them\n",stderr);
|
|
||||||
return(errors > 0);
|
|
||||||
} /* main */
|
|
||||||
|
|
||||||
|
|
||||||
/* Init strings */
|
|
||||||
|
|
||||||
void init_strings(void)
|
|
||||||
{
|
|
||||||
reg1 int i;
|
|
||||||
reg2 char *pos;
|
|
||||||
|
|
||||||
from=from_buff+3; to=to_buff+3;
|
|
||||||
|
|
||||||
pos=from_buff; *pos++= F_FILL; *pos++=F_FILL; *pos++=F_PREFILL;
|
|
||||||
for (i=0 ; i < F_LEN ; i++)
|
|
||||||
*pos++=F_CHAR;
|
|
||||||
*pos++=0;
|
|
||||||
for (i=0; i<50 ; i++)
|
|
||||||
*pos++= F_FILL;
|
|
||||||
|
|
||||||
pos=to_buff; *pos++= T_FILL; *pos++=T_FILL; *pos++=T_PREFILL;
|
|
||||||
for (i=0 ; i < T_LEN ; i++)
|
|
||||||
*pos++=T_CHAR;
|
|
||||||
*pos++=0;
|
|
||||||
for (i=0; i<50 ; i++)
|
|
||||||
*pos++= T_FILL;
|
|
||||||
} /* init_strings */
|
|
||||||
|
|
||||||
|
|
||||||
/* Test that function return rigth value */
|
|
||||||
|
|
||||||
void test_arg(const char *message, long int func_value, long int value)
|
|
||||||
{
|
|
||||||
tests++;
|
|
||||||
printf("testing '%s'\n",message);
|
|
||||||
if (func_value != value)
|
|
||||||
{
|
|
||||||
printf("func: '%s' = %ld Should be: %ld\n",message,func_value,value);
|
|
||||||
errors++;
|
|
||||||
}
|
|
||||||
} /* test_arg */
|
|
||||||
|
|
||||||
/* Test function return value and from and to arrays */
|
|
||||||
|
|
||||||
static int test_strarg(const char *message,...)
|
|
||||||
{
|
|
||||||
long func_value,value;
|
|
||||||
int error,length;
|
|
||||||
char chr,cmp_buff[100],*pos,*pos2;
|
|
||||||
va_list pvar;
|
|
||||||
|
|
||||||
tests++;
|
|
||||||
va_start(pvar,message);
|
|
||||||
func_value=va_arg(pvar,long);
|
|
||||||
value=va_arg(pvar,long);
|
|
||||||
|
|
||||||
printf("testing '%s'\n",message);
|
|
||||||
if (func_value != value && value != INT_MAX32)
|
|
||||||
{
|
|
||||||
printf("func: '%s' = %ld Should be: %ld\n",message,func_value,value);
|
|
||||||
errors++;
|
|
||||||
}
|
|
||||||
pos= cmp_buff;
|
|
||||||
while ((length = va_arg(pvar, int)) != 0)
|
|
||||||
{
|
|
||||||
chr= (char) (va_arg(pvar, int));
|
|
||||||
while (length--)
|
|
||||||
*pos++=chr;
|
|
||||||
}
|
|
||||||
pos2=to+ (int)(pos-cmp_buff);
|
|
||||||
while (pos <= cmp_buff+T_LEN)
|
|
||||||
*pos++= *pos2++;
|
|
||||||
if (compare_buff(message,to,cmp_buff,(int) (pos-cmp_buff),T_FILL,T_PREFILL))
|
|
||||||
{
|
|
||||||
init_strings();
|
|
||||||
va_end(pvar);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
pos= cmp_buff;
|
|
||||||
while ((length = va_arg(pvar, int)) != 0)
|
|
||||||
{
|
|
||||||
chr= (char) (va_arg(pvar, int));
|
|
||||||
while (length--)
|
|
||||||
*pos++=chr;
|
|
||||||
}
|
|
||||||
pos2=from+ (int)(pos-cmp_buff);
|
|
||||||
while (pos <= cmp_buff+F_LEN)
|
|
||||||
*pos++= *pos2++;
|
|
||||||
error=compare_buff(message,from,cmp_buff,(int) (pos-cmp_buff),F_FILL,F_PREFILL);
|
|
||||||
init_strings();
|
|
||||||
va_end(pvar);
|
|
||||||
return (error != 0);
|
|
||||||
} /* test_strarg */
|
|
||||||
|
|
||||||
|
|
||||||
/* test if function made right value */
|
|
||||||
|
|
||||||
int compare_buff(const char *message, char * b1, char * b2, int length,
|
|
||||||
pchar fill, pchar prefill)
|
|
||||||
{
|
|
||||||
int i,error=0;
|
|
||||||
|
|
||||||
if (memcmp(b1,b2,length))
|
|
||||||
{
|
|
||||||
errors++;
|
|
||||||
printf("func: '%s' Buffers differ\nIs: ",message);
|
|
||||||
for (i=0 ; i<length ; i++)
|
|
||||||
printf("%3d ",b1[i]);
|
|
||||||
printf("\nShould be: ");
|
|
||||||
for (i=0 ; i<length ; i++)
|
|
||||||
printf("%3d ",b2[i]);
|
|
||||||
puts("");
|
|
||||||
}
|
|
||||||
else if (b1[-1] != prefill || b1[-2] != fill || b1[-3] != fill)
|
|
||||||
{
|
|
||||||
printf("func: '%s' Chars before buffer is changed\n",message);
|
|
||||||
errors++;
|
|
||||||
error=1;
|
|
||||||
}
|
|
||||||
else if (b1[length] != fill || b1[length+1] != fill)
|
|
||||||
{
|
|
||||||
printf("func: '%s' Chars after buffer is changed\n",message);
|
|
||||||
errors++;
|
|
||||||
error=1;
|
|
||||||
}
|
|
||||||
return error;
|
|
||||||
} /* compare_buff */
|
|
||||||
|
|
||||||
/* These are here to be loaded and examined */
|
|
||||||
|
|
||||||
extern void dummy_functions(void);
|
|
||||||
|
|
||||||
void dummy_functions(void)
|
|
||||||
{
|
|
||||||
(void) memchr(from,'a',5);
|
|
||||||
(void) memcmp(from,to,5);
|
|
||||||
(void) memcpy(from,to,5);
|
|
||||||
(void) memset(from,' ',5);
|
|
||||||
(void) strcmp(from,to);
|
|
||||||
(void) strcpy(from,to);
|
|
||||||
(void) strstr(from,to);
|
|
||||||
(void) strrchr(from,'a');
|
|
||||||
return;
|
|
||||||
}
|
|
@@ -1,393 +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; version 2 of the License.
|
|
||||||
#
|
|
||||||
# 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
|
|
||||||
|
|
||||||
# Optimized string functions Intel 80x86 (gcc/gas syntax)
|
|
||||||
|
|
||||||
.file "strings.s"
|
|
||||||
.version "1.00"
|
|
||||||
|
|
||||||
.text
|
|
||||||
|
|
||||||
# Move a alligned, not overlapped, by (long) divided memory area
|
|
||||||
# Args: to,from,length
|
|
||||||
|
|
||||||
.globl bmove_align
|
|
||||||
.type bmove_align,@function
|
|
||||||
bmove_align:
|
|
||||||
movl %edi,%edx
|
|
||||||
push %esi
|
|
||||||
movl 4(%esp),%edi # to
|
|
||||||
movl 8(%esp),%esi # from
|
|
||||||
movl 12(%esp),%ecx # length
|
|
||||||
addw $3,%cx # fix if not divisible with long
|
|
||||||
shrw $2,%cx
|
|
||||||
jz .ba_20
|
|
||||||
.p2align 4,,7
|
|
||||||
.ba_10:
|
|
||||||
movl -4(%esi,%ecx),%eax
|
|
||||||
movl %eax,-4(%edi,%ecx)
|
|
||||||
decl %ecx
|
|
||||||
jnz .ba_10
|
|
||||||
.ba_20: pop %esi
|
|
||||||
movl %edx,%edi
|
|
||||||
ret
|
|
||||||
|
|
||||||
.bmove_align_end:
|
|
||||||
.size bmove_align,.bmove_align_end-bmove_align
|
|
||||||
|
|
||||||
# Move a string from higher to lower
|
|
||||||
# Arg from_end+1,to_end+1,length
|
|
||||||
|
|
||||||
.globl bmove_upp
|
|
||||||
.type bmove_upp,@function
|
|
||||||
bmove_upp:
|
|
||||||
movl %edi,%edx # Remember %edi
|
|
||||||
push %esi
|
|
||||||
movl 8(%esp),%edi # dst
|
|
||||||
movl 16(%esp),%ecx # length
|
|
||||||
movl 12(%esp),%esi # source
|
|
||||||
test %ecx,%ecx
|
|
||||||
jz .bu_20
|
|
||||||
subl %ecx,%esi # To start of strings
|
|
||||||
subl %ecx,%edi
|
|
||||||
|
|
||||||
.p2align 4,,7
|
|
||||||
.bu_10: movb -1(%esi,%ecx),%al
|
|
||||||
movb %al,-1(%edi,%ecx)
|
|
||||||
decl %ecx
|
|
||||||
jnz .bu_10
|
|
||||||
.bu_20: pop %esi
|
|
||||||
movl %edx,%edi
|
|
||||||
ret
|
|
||||||
|
|
||||||
.bmove_upp_end:
|
|
||||||
.size bmove_upp,.bmove_upp_end-bmove_upp
|
|
||||||
|
|
||||||
# Append fillchars to string
|
|
||||||
# Args: dest,len,fill
|
|
||||||
|
|
||||||
.globl strappend
|
|
||||||
.type strappend,@function
|
|
||||||
strappend:
|
|
||||||
pushl %edi
|
|
||||||
movl 8(%esp),%edi # Memory pointer
|
|
||||||
movl 12(%esp),%ecx # Length
|
|
||||||
clrl %eax # Find end of string
|
|
||||||
repne
|
|
||||||
scasb
|
|
||||||
jnz sa_99 # String to long, shorten it
|
|
||||||
movzb 16(%esp),%eax # Fillchar
|
|
||||||
decl %edi # Point at end null
|
|
||||||
incl %ecx # rep made one dec for null-char
|
|
||||||
|
|
||||||
movb %al,%ah # (2) Set up a 32 bit pattern.
|
|
||||||
movw %ax,%dx # (2)
|
|
||||||
shll $16,%eax # (3)
|
|
||||||
movw %dx,%ax # (2) %eax has the 32 bit pattern.
|
|
||||||
|
|
||||||
movl %ecx,%edx # (2) Save the count of bytes.
|
|
||||||
shrl $2,%ecx # (2) Number of dwords.
|
|
||||||
rep
|
|
||||||
stosl # (5 + 5n)
|
|
||||||
movb $3,%cl # (2)
|
|
||||||
and %edx,%ecx # (2) Fill in the odd bytes
|
|
||||||
rep
|
|
||||||
stosb # Move last bytes if any
|
|
||||||
|
|
||||||
sa_99: movb $0,(%edi) # End of string
|
|
||||||
popl %edi
|
|
||||||
ret
|
|
||||||
.strappend_end:
|
|
||||||
.size strappend,.strappend_end-strappend
|
|
||||||
|
|
||||||
# Find if string contains any char in another string
|
|
||||||
# Arg: str,set
|
|
||||||
# Ret: Pointer to first found char in str
|
|
||||||
|
|
||||||
.globl strcont
|
|
||||||
.type strcont,@function
|
|
||||||
strcont:
|
|
||||||
movl %edi,%edx
|
|
||||||
pushl %esi
|
|
||||||
movl 8(%esp),%esi # str
|
|
||||||
movl 12(%esp),%ecx # set
|
|
||||||
clrb %ah # For endtest
|
|
||||||
jmp sc_60
|
|
||||||
|
|
||||||
sc_10: scasb
|
|
||||||
jz sc_fo # Found char
|
|
||||||
sc_20: cmp (%edi),%ah # Test if null
|
|
||||||
jnz sc_10 # Not end of set yet
|
|
||||||
incl %esi # Next char in str
|
|
||||||
sc_60: movl %ecx,%edi # %edi = Set
|
|
||||||
movb (%esi),%al # Test if this char exist
|
|
||||||
andb %al,%al
|
|
||||||
jnz sc_20 # Not end of string
|
|
||||||
clrl %esi # Return Null
|
|
||||||
sc_fo: movl %esi,%eax # Char found here
|
|
||||||
movl %edx,%edi # Restore
|
|
||||||
popl %esi
|
|
||||||
ret
|
|
||||||
.strcont_end:
|
|
||||||
.size strcont,.strcont_end-strcont
|
|
||||||
|
|
||||||
# Find end of string
|
|
||||||
# Arg: str
|
|
||||||
# ret: Pointer to end null
|
|
||||||
|
|
||||||
.globl strend
|
|
||||||
.type strend,@function
|
|
||||||
strend:
|
|
||||||
movl %edi,%edx # Save
|
|
||||||
movl 4(%esp),%edi # str
|
|
||||||
clrl %eax # Find end of string
|
|
||||||
movl %eax,%ecx
|
|
||||||
decl %ecx # ECX = -1
|
|
||||||
repne
|
|
||||||
scasb
|
|
||||||
movl %edi,%eax
|
|
||||||
decl %eax # End of string
|
|
||||||
movl %edx,%edi # Restore
|
|
||||||
ret
|
|
||||||
.strend_end:
|
|
||||||
.size strend,.strend_end-strend
|
|
||||||
|
|
||||||
# Make a string with len fill-chars and endnull
|
|
||||||
# Args: dest,len,fill
|
|
||||||
# Ret: dest+len
|
|
||||||
|
|
||||||
.globl strfill
|
|
||||||
.type strfill,@function
|
|
||||||
strfill:
|
|
||||||
pushl %edi
|
|
||||||
movl 8(%esp),%edi # Memory pointer
|
|
||||||
movl 12(%esp),%ecx # Length
|
|
||||||
movzb 16(%esp),%eax # Fill
|
|
||||||
|
|
||||||
movb %al,%ah # (2) Set up a 32 bit pattern
|
|
||||||
movw %ax,%dx # (2)
|
|
||||||
shll $16,%eax # (3)
|
|
||||||
movw %dx,%ax # (2) %eax has the 32 bit pattern.
|
|
||||||
|
|
||||||
movl %ecx,%edx # (2) Save the count of bytes.
|
|
||||||
shrl $2,%ecx # (2) Number of dwords.
|
|
||||||
rep
|
|
||||||
stosl # (5 + 5n)
|
|
||||||
movb $3,%cl # (2)
|
|
||||||
and %edx,%ecx # (2) Fill in the odd bytes
|
|
||||||
rep
|
|
||||||
stosb # Move last bytes if any
|
|
||||||
|
|
||||||
movb %cl,(%edi) # End NULL
|
|
||||||
movl %edi,%eax # End i %eax
|
|
||||||
popl %edi
|
|
||||||
ret
|
|
||||||
.strfill_end:
|
|
||||||
.size strfill,.strfill_end-strfill
|
|
||||||
|
|
||||||
|
|
||||||
# Find a char in or end of a string
|
|
||||||
# Arg: str,char
|
|
||||||
# Ret: pointer to found char or NullS
|
|
||||||
|
|
||||||
.globl strcend
|
|
||||||
.type strcend,@function
|
|
||||||
strcend:
|
|
||||||
movl %edi,%edx
|
|
||||||
movl 4(%esp),%edi # str
|
|
||||||
movb 8(%esp),%ah # search
|
|
||||||
clrb %al # for scasb to find end
|
|
||||||
|
|
||||||
se_10: cmpb (%edi),%ah
|
|
||||||
jz se_20 # Found char
|
|
||||||
scasb
|
|
||||||
jnz se_10 # Not end
|
|
||||||
dec %edi # Not found, point at end of string
|
|
||||||
se_20: movl %edi,%eax
|
|
||||||
movl %edx,%edi # Restore
|
|
||||||
ret
|
|
||||||
.strcend_end:
|
|
||||||
.size strcend,.strcend_end-strcend
|
|
||||||
|
|
||||||
# Test if string has a given suffix
|
|
||||||
|
|
||||||
.globl is_prefix
|
|
||||||
.type is_prefix,@function
|
|
||||||
is_prefix:
|
|
||||||
movl %edi,%edx # Save %edi
|
|
||||||
pushl %esi # and %esi
|
|
||||||
movl 12(%esp),%esi # get suffix
|
|
||||||
movl 8(%esp),%edi # s1
|
|
||||||
movl $1,%eax # Ok and zero-test
|
|
||||||
ip_10: cmpb (%esi),%ah
|
|
||||||
jz suf_ok # End of string/ found suffix
|
|
||||||
cmpsb # Compare strings
|
|
||||||
jz ip_10 # Same, possible prefix
|
|
||||||
xor %eax,%eax # Not suffix
|
|
||||||
suf_ok: popl %esi
|
|
||||||
movl %edx,%edi
|
|
||||||
ret
|
|
||||||
.is_prefix_end:
|
|
||||||
.size is_prefix,.is_prefix_end-is_prefix
|
|
||||||
|
|
||||||
# Find a substring in string
|
|
||||||
# Arg: str,search
|
|
||||||
|
|
||||||
.globl strstr
|
|
||||||
.type strstr,@function
|
|
||||||
|
|
||||||
strstr:
|
|
||||||
pushl %edi
|
|
||||||
pushl %esi
|
|
||||||
movl 12(%esp),%esi # str
|
|
||||||
movl 16(%esp),%edi # search
|
|
||||||
movl %edi,%ecx
|
|
||||||
incl %ecx # %ecx = search+1
|
|
||||||
movb (%edi),%ah # %ah = First char in search
|
|
||||||
jmp sf_10
|
|
||||||
|
|
||||||
sf_00: movl %edx,%esi # si = Current str-pos
|
|
||||||
sf_10: movb (%esi),%al # Test if this char exist
|
|
||||||
andb %al,%al
|
|
||||||
jz sf_90 # End of string, didn't find search
|
|
||||||
incl %esi
|
|
||||||
cmpb %al,%ah
|
|
||||||
jnz sf_10 # Didn't find first char, continue
|
|
||||||
movl %esi,%edx # Save str-pos in %edx
|
|
||||||
movl %ecx,%edi
|
|
||||||
sf_20: cmpb $0,(%edi)
|
|
||||||
jz sf_fo # Found substring
|
|
||||||
cmpsb
|
|
||||||
jz sf_20 # Char ok
|
|
||||||
jmp sf_00 # Next str-pos
|
|
||||||
|
|
||||||
sf_90: movl $1,%edx # Return Null
|
|
||||||
sf_fo: movl %edx,%eax # Char found here
|
|
||||||
decl %eax # Pointed one after
|
|
||||||
popl %esi
|
|
||||||
popl %edi
|
|
||||||
ret
|
|
||||||
.strstr_end:
|
|
||||||
.size strstr,.strstr_end-strstr
|
|
||||||
|
|
||||||
# Make a string of len length from another string
|
|
||||||
# Arg: dst,src,length
|
|
||||||
# ret: end of dst
|
|
||||||
|
|
||||||
.globl strmake
|
|
||||||
.type strmake,@function
|
|
||||||
|
|
||||||
strmake:
|
|
||||||
pushl %edi
|
|
||||||
pushl %esi
|
|
||||||
mov 12(%esp),%edi # dst
|
|
||||||
movl $0,%edx
|
|
||||||
movl 20(%esp),%ecx # length
|
|
||||||
movl 16(%esp),%esi # src
|
|
||||||
cmpl %edx,%ecx
|
|
||||||
jz sm_90
|
|
||||||
sm_00: movb (%esi,%edx),%al
|
|
||||||
cmpb $0,%al
|
|
||||||
jz sm_90
|
|
||||||
movb %al,(%edi,%edx)
|
|
||||||
incl %edx
|
|
||||||
cmpl %edx,%ecx
|
|
||||||
jnz sm_00
|
|
||||||
sm_90: movb $0,(%edi,%edx)
|
|
||||||
sm_99: lea (%edi,%edx),%eax # Return pointer to end null
|
|
||||||
pop %esi
|
|
||||||
pop %edi
|
|
||||||
ret
|
|
||||||
.strmake_end:
|
|
||||||
.size strmake,.strmake_end-strmake
|
|
||||||
|
|
||||||
# Move a string with max len chars
|
|
||||||
# arg: dst,src,len
|
|
||||||
# ret: pos to first null or dst+len
|
|
||||||
|
|
||||||
.globl strnmov
|
|
||||||
.type strnmov,@function
|
|
||||||
strnmov:
|
|
||||||
pushl %edi
|
|
||||||
pushl %esi
|
|
||||||
movl 12(%esp),%edi # dst
|
|
||||||
movl 16(%esp),%esi # src
|
|
||||||
movl 20(%esp),%ecx # Length of memory-area
|
|
||||||
jecxz snm_99 # Nothing to do
|
|
||||||
clrb %al # For test of end-null
|
|
||||||
|
|
||||||
snm_10: cmpb (%esi),%al # Next char to move
|
|
||||||
movsb # move arg
|
|
||||||
jz snm_20 # last char, fill with null
|
|
||||||
loop snm_10 # Continue moving
|
|
||||||
incl %edi # Point two after last
|
|
||||||
snm_20: decl %edi # Point at first null (or last+1)
|
|
||||||
snm_99: movl %edi,%eax # Pointer at last char
|
|
||||||
popl %esi
|
|
||||||
popl %edi
|
|
||||||
ret
|
|
||||||
.strnmov_end:
|
|
||||||
.size strnmov,.strnmov_end-strnmov
|
|
||||||
|
|
||||||
|
|
||||||
.globl strmov
|
|
||||||
.type strmov,@function
|
|
||||||
strmov:
|
|
||||||
movl %esi,%ecx # Save old %esi and %edi
|
|
||||||
movl %edi,%edx
|
|
||||||
movl 8(%esp),%esi # get source pointer (s2)
|
|
||||||
movl 4(%esp),%edi # %edi -> s1
|
|
||||||
smo_10: movb (%esi),%al
|
|
||||||
movsb # move arg
|
|
||||||
andb %al,%al
|
|
||||||
jnz smo_10 # Not last
|
|
||||||
movl %edi,%eax
|
|
||||||
dec %eax
|
|
||||||
movl %ecx,%esi # Restore
|
|
||||||
movl %edx,%edi
|
|
||||||
ret
|
|
||||||
.strmov_end:
|
|
||||||
.size strmov,.strmov_end-strmov
|
|
||||||
|
|
||||||
.globl strxmov
|
|
||||||
.type strxmov,@function
|
|
||||||
strxmov:
|
|
||||||
movl %ebx,%edx # Save %ebx, %esi and %edi
|
|
||||||
mov %esi,%ecx
|
|
||||||
push %edi
|
|
||||||
leal 8(%esp),%ebx # Get destination
|
|
||||||
movl (%ebx),%edi
|
|
||||||
xorb %al,%al
|
|
||||||
jmp next_str # Handle source ebx+4
|
|
||||||
|
|
||||||
start_str:
|
|
||||||
movsb
|
|
||||||
cmpb -1(%edi),%al
|
|
||||||
jne start_str
|
|
||||||
decl %edi # Don't copy last null
|
|
||||||
|
|
||||||
next_str:
|
|
||||||
addl $4,%ebx
|
|
||||||
movl (%ebx),%esi
|
|
||||||
orl %esi,%esi
|
|
||||||
jne start_str
|
|
||||||
movb %al,0(%edi) # Force last to ASCII 0
|
|
||||||
|
|
||||||
movl %edi,%eax # Return ptr to ASCII 0
|
|
||||||
pop %edi # Restore registers
|
|
||||||
movl %ecx,%esi
|
|
||||||
movl %edx,%ebx
|
|
||||||
ret
|
|
||||||
.strxmov_end:
|
|
||||||
.size strxmov,.strxmov_end-strxmov
|
|
@@ -1,52 +0,0 @@
|
|||||||
/* Copyright (C) 2002 MySQL AB
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Library General Public
|
|
||||||
License as published by the Free Software Foundation; version 2
|
|
||||||
of the License.
|
|
||||||
|
|
||||||
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 */
|
|
||||||
|
|
||||||
/* File : strstr.c
|
|
||||||
Author : Monty
|
|
||||||
Updated: 1986.11.24
|
|
||||||
Defines: strstr()
|
|
||||||
|
|
||||||
strstr(src, pat) looks for an instance of pat in src. pat is not a
|
|
||||||
regex(3) pattern, it is a literal string which must be matched exactly.
|
|
||||||
The result is a pointer to the first character of the located instance,
|
|
||||||
or NullS if pat does not occur in src.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <my_global.h>
|
|
||||||
#include "m_string.h"
|
|
||||||
|
|
||||||
#ifndef HAVE_STRSTR
|
|
||||||
|
|
||||||
char *strstr(register const char *str,const char *search)
|
|
||||||
{
|
|
||||||
register char *i,*j;
|
|
||||||
register char first= *search;
|
|
||||||
|
|
||||||
skip:
|
|
||||||
while (*str != '\0') {
|
|
||||||
if (*str++ == first) {
|
|
||||||
i=(char*) str; j=(char*) search+1;
|
|
||||||
while (*j)
|
|
||||||
if (*i++ != *j++) goto skip;
|
|
||||||
return ((char*) str-1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ((char*) 0);
|
|
||||||
} /* strstr */
|
|
||||||
|
|
||||||
#endif
|
|
209
strings/strto.c
209
strings/strto.c
@@ -1,209 +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; version 2 of the License.
|
|
||||||
|
|
||||||
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 */
|
|
||||||
|
|
||||||
/*
|
|
||||||
strtol,strtoul,strtoll,strtoull
|
|
||||||
convert string to long, unsigned long, long long or unsigned long long.
|
|
||||||
strtoxx(char *src,char **ptr,int base)
|
|
||||||
converts the string pointed to by src to an long of appropriate long and
|
|
||||||
returnes it. It skips leading spaces and tabs (but not newlines, formfeeds,
|
|
||||||
backspaces), then it accepts an optional sign and a sequence of digits
|
|
||||||
in the specified radix.
|
|
||||||
If the value of ptr is not (char **)NULL, a pointer to the character
|
|
||||||
terminating the scan is returned in the location pointed to by ptr.
|
|
||||||
Trailing spaces will NOT be skipped.
|
|
||||||
|
|
||||||
If an error is detected, the result will be LONG_MIN, 0 or LONG_MAX,
|
|
||||||
(or LONGLONG..) and errno will be set to
|
|
||||||
EDOM if there are no digits
|
|
||||||
ERANGE if the result would overflow.
|
|
||||||
the ptr will be set to src.
|
|
||||||
This file is based on the strtol from the the GNU C Library.
|
|
||||||
it can be compiled with the UNSIGNED and/or LONGLONG flag set
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#if !defined(_global_h) || !defined(_m_string_h)
|
|
||||||
# error Calling file must include 'my_global.h' and 'm_string.h'
|
|
||||||
/* see 'strtoll.c' and 'strtoull.c' for the reasons */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "m_ctype.h"
|
|
||||||
#include "my_sys.h" /* defines errno */
|
|
||||||
#include <errno.h>
|
|
||||||
|
|
||||||
#undef strtoull
|
|
||||||
#undef strtoll
|
|
||||||
#undef strtoul
|
|
||||||
#undef strtol
|
|
||||||
#ifdef USE_LONGLONG
|
|
||||||
#define UTYPE_MAX (~(ulonglong) 0)
|
|
||||||
#define TYPE_MIN LONGLONG_MIN
|
|
||||||
#define TYPE_MAX LONGLONG_MAX
|
|
||||||
#define longtype longlong
|
|
||||||
#define ulongtype ulonglong
|
|
||||||
#ifdef USE_UNSIGNED
|
|
||||||
#define function ulongtype strtoull
|
|
||||||
#else
|
|
||||||
#define function longtype strtoll
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#define UTYPE_MAX (ulong) ~0L
|
|
||||||
#define TYPE_MIN LONG_MIN
|
|
||||||
#define TYPE_MAX LONG_MAX
|
|
||||||
#define longtype long
|
|
||||||
#define ulongtype unsigned long
|
|
||||||
#ifdef USE_UNSIGNED
|
|
||||||
#define function ulongtype strtoul
|
|
||||||
#else
|
|
||||||
#define function longtype strtol
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* Convert NPTR to an `unsigned long int' or `long int' in base BASE.
|
|
||||||
If BASE is 0 the base is determined by the presence of a leading
|
|
||||||
zero, indicating octal or a leading "0x" or "0X", indicating hexadecimal.
|
|
||||||
If BASE is < 2 or > 36, it is reset to 10.
|
|
||||||
If ENDPTR is not NULL, a pointer to the character after the last
|
|
||||||
one converted is stored in *ENDPTR. */
|
|
||||||
|
|
||||||
|
|
||||||
function (const char *nptr,char **endptr,int base)
|
|
||||||
{
|
|
||||||
int negative;
|
|
||||||
register ulongtype cutoff;
|
|
||||||
register unsigned int cutlim;
|
|
||||||
register ulongtype i;
|
|
||||||
register const char *s;
|
|
||||||
register uchar c;
|
|
||||||
const char *save;
|
|
||||||
int overflow;
|
|
||||||
|
|
||||||
if (base < 0 || base == 1 || base > 36)
|
|
||||||
base = 10;
|
|
||||||
|
|
||||||
s = nptr;
|
|
||||||
|
|
||||||
/* Skip white space. */
|
|
||||||
while (my_isspace(&my_charset_latin1, *s))
|
|
||||||
++s;
|
|
||||||
if (*s == '\0')
|
|
||||||
{
|
|
||||||
goto noconv;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check for a sign. */
|
|
||||||
negative= 0;
|
|
||||||
if (*s == '-')
|
|
||||||
{
|
|
||||||
negative = 1;
|
|
||||||
++s;
|
|
||||||
}
|
|
||||||
else if (*s == '+')
|
|
||||||
{
|
|
||||||
++s;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (base == 16 && s[0] == '0' && my_toupper (&my_charset_latin1, s[1]) == 'X')
|
|
||||||
s += 2;
|
|
||||||
|
|
||||||
/* If BASE is zero, figure it out ourselves. */
|
|
||||||
if (base == 0)
|
|
||||||
{
|
|
||||||
if (*s == '0')
|
|
||||||
{
|
|
||||||
if (my_toupper (&my_charset_latin1, s[1]) == 'X')
|
|
||||||
{
|
|
||||||
s += 2;
|
|
||||||
base = 16;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
base = 8;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
base = 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Save the pointer so we can check later if anything happened. */
|
|
||||||
save = s;
|
|
||||||
|
|
||||||
cutoff = UTYPE_MAX / (unsigned long int) base;
|
|
||||||
cutlim = (uint) (UTYPE_MAX % (unsigned long int) base);
|
|
||||||
|
|
||||||
overflow = 0;
|
|
||||||
i = 0;
|
|
||||||
for (c = *s; c != '\0'; c = *++s)
|
|
||||||
{
|
|
||||||
if (my_isdigit (&my_charset_latin1, c))
|
|
||||||
c -= '0';
|
|
||||||
else if (my_isalpha (&my_charset_latin1, c))
|
|
||||||
c = my_toupper (&my_charset_latin1, c) - 'A' + 10;
|
|
||||||
else
|
|
||||||
break;
|
|
||||||
if (c >= base)
|
|
||||||
break;
|
|
||||||
/* Check for overflow. */
|
|
||||||
if (i > cutoff || (i == cutoff && c > cutlim))
|
|
||||||
overflow = 1;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
i *= (ulongtype) base;
|
|
||||||
i += c;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check if anything actually happened. */
|
|
||||||
if (s == save)
|
|
||||||
goto noconv;
|
|
||||||
|
|
||||||
/* Store in ENDPTR the address of one character
|
|
||||||
past the last character we converted. */
|
|
||||||
if (endptr != NULL)
|
|
||||||
*endptr = (char *) s;
|
|
||||||
|
|
||||||
#ifndef USE_UNSIGNED
|
|
||||||
/* Check for a value that is within the range of
|
|
||||||
`unsigned long int', but outside the range of `long int'. */
|
|
||||||
if (negative)
|
|
||||||
{
|
|
||||||
if (i > (ulongtype) TYPE_MIN)
|
|
||||||
overflow = 1;
|
|
||||||
}
|
|
||||||
else if (i > (ulongtype) TYPE_MAX)
|
|
||||||
overflow = 1;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (overflow)
|
|
||||||
{
|
|
||||||
my_errno=ERANGE;
|
|
||||||
#ifdef USE_UNSIGNED
|
|
||||||
return UTYPE_MAX;
|
|
||||||
#else
|
|
||||||
return negative ? TYPE_MIN : TYPE_MAX;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return the result of the appropriate sign. */
|
|
||||||
return (negative ? -((longtype) i) : (longtype) i);
|
|
||||||
|
|
||||||
noconv:
|
|
||||||
/* There was no number to convert. */
|
|
||||||
my_errno=EDOM;
|
|
||||||
if (endptr != NULL)
|
|
||||||
*endptr = (char *) nptr;
|
|
||||||
return 0L;
|
|
||||||
}
|
|
@@ -1,28 +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; version 2 of the License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
|
||||||
|
|
||||||
/* This implements strtol() if needed */
|
|
||||||
|
|
||||||
/*
|
|
||||||
These includes are mandatory because they check for type sizes and
|
|
||||||
functions, especially they handle tricks for Tru64 where 'long' is
|
|
||||||
64 bit already and our 'longlong' is just a 'long'.
|
|
||||||
*/
|
|
||||||
#include <my_global.h>
|
|
||||||
#include <m_string.h>
|
|
||||||
|
|
||||||
#if !defined(HAVE_STRTOL) && !defined(__WIN__)
|
|
||||||
#include "strto.c"
|
|
||||||
#endif
|
|
@@ -1,33 +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; version 2 of the License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
|
||||||
|
|
||||||
/* This implements strtoll() if needed */
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
These includes are mandatory because they check for type sizes and
|
|
||||||
functions, especially they handle tricks for Tru64 where 'long' is
|
|
||||||
64 bit already and our 'longlong' is just a 'long'.
|
|
||||||
This solves a problem on Tru64 where the C99 compiler has a prototype
|
|
||||||
for 'strtoll()' but no implementation, see "6.1 New C99 library functions"
|
|
||||||
in file '/usr/share/doclib/cc.dtk/release_notes.txt'.
|
|
||||||
*/
|
|
||||||
#include <my_global.h>
|
|
||||||
#include <m_string.h>
|
|
||||||
|
|
||||||
#if !defined(HAVE_STRTOLL) && defined(HAVE_LONG_LONG)
|
|
||||||
#define USE_LONGLONG
|
|
||||||
#include "strto.c"
|
|
||||||
#endif
|
|
@@ -1,29 +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; version 2 of the License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
|
||||||
|
|
||||||
/* This implements strtol() if needed */
|
|
||||||
|
|
||||||
/*
|
|
||||||
These includes are mandatory because they check for type sizes and
|
|
||||||
functions, especially they handle tricks for Tru64 where 'long' is
|
|
||||||
64 bit already and our 'longlong' is just a 'long'.
|
|
||||||
*/
|
|
||||||
#include <my_global.h>
|
|
||||||
#include <m_string.h>
|
|
||||||
|
|
||||||
#if !defined(HAVE_STRTOUL)
|
|
||||||
#define USE_UNSIGNED
|
|
||||||
#include "strto.c"
|
|
||||||
#endif
|
|
@@ -1,34 +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; version 2 of the License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
|
||||||
|
|
||||||
/* This implements strtoull() if needed */
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
These includes are mandatory because they check for type sizes and
|
|
||||||
functions, especially they handle tricks for Tru64 where 'long' is
|
|
||||||
64 bit already and our 'longlong' is just a 'long'.
|
|
||||||
This solves a problem on Tru64 where the C99 compiler has a prototype
|
|
||||||
for 'strtoull()' but no implementation, see "6.1 New C99 library functions"
|
|
||||||
in file '/usr/share/doclib/cc.dtk/release_notes.txt'.
|
|
||||||
*/
|
|
||||||
#include <my_global.h>
|
|
||||||
#include <m_string.h>
|
|
||||||
|
|
||||||
#if !defined(HAVE_STRTOULL) && defined(HAVE_LONG_LONG)
|
|
||||||
#define USE_UNSIGNED
|
|
||||||
#define USE_LONGLONG
|
|
||||||
#include "strto.c"
|
|
||||||
#endif
|
|
@@ -1,29 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# search & check GNU patch
|
|
||||||
PATCH="gpatch"
|
|
||||||
$PATCH --version || PATCH="patch"
|
|
||||||
$PATCH --version || exit
|
|
||||||
|
|
||||||
|
|
||||||
if /usr/bin/test ! -e PKG/stamp-pre ; then
|
|
||||||
grep VERSION configure | head -1 | sed 's/VERSION=//' > ./PKG/version
|
|
||||||
touch PKG/stamp-pre
|
|
||||||
fi
|
|
||||||
|
|
||||||
if /usr/bin/test ! -e PKG/stamp-patch ; then
|
|
||||||
${PATCH} -p0 < ./PKG/patch
|
|
||||||
touch PKG/stamp-patch
|
|
||||||
fi
|
|
||||||
|
|
||||||
if /usr/bin/test ! -e PKG/stamp-compile ; then
|
|
||||||
sh ./PKG/compile.sh ujis
|
|
||||||
touch PKG/stamp-compile
|
|
||||||
|
|
||||||
sh ./PKG/doc.sh ujis
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
cd PKG
|
|
||||||
sh mkpkg.sh ujis
|
|
@@ -1,102 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
# GNU ncurses
|
|
||||||
|
|
||||||
# search & check GNU make
|
|
||||||
GMAKE="gmake"
|
|
||||||
$GMAKE --version || GMAKE="make"
|
|
||||||
$GMAKE --version || exit
|
|
||||||
|
|
||||||
MAKE=$GMAKE
|
|
||||||
export MAKE
|
|
||||||
|
|
||||||
CC=gcc
|
|
||||||
CFLAGS="-O6 -fomit-frame-pointer"
|
|
||||||
CXX=gcc
|
|
||||||
CXXFLAGS="-O6 -fomit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti"
|
|
||||||
# LDFLAGS="-static"
|
|
||||||
LD=gcc
|
|
||||||
|
|
||||||
export CC
|
|
||||||
export CXX
|
|
||||||
export LD
|
|
||||||
export CFLAGS
|
|
||||||
export CXXFLAGS
|
|
||||||
# export LDFLAGS
|
|
||||||
# Solaris don't have libpthread.a.
|
|
||||||
|
|
||||||
if [ "x$1" = "x" ]; then
|
|
||||||
echo " please set character set"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
CHAR="$1"
|
|
||||||
case "$1" in
|
|
||||||
[uU]*)
|
|
||||||
CHAR=ujis
|
|
||||||
;;
|
|
||||||
[sS]*)
|
|
||||||
CHAR=sjis
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
#---------------
|
|
||||||
P=`pwd`
|
|
||||||
|
|
||||||
if [ -f Makefile ] ; then
|
|
||||||
${GMAKE} distclean
|
|
||||||
fi
|
|
||||||
|
|
||||||
for i in bin sbin include man share/doc/mysql mysql-data
|
|
||||||
do
|
|
||||||
/usr/bin/mkdir -p PKG/tmp-${CHAR}/usr/local/${i}
|
|
||||||
done
|
|
||||||
/usr/bin/mkdir -p PKG/tmp-${CHAR}/etc/init.d
|
|
||||||
|
|
||||||
#----------------------------
|
|
||||||
./configure \
|
|
||||||
--prefix=/usr/local \
|
|
||||||
--libexecdir=/usr/local/sbin \
|
|
||||||
--sbindir=/usr/local/sbin \
|
|
||||||
--localstatedir=/usr/local/mysql-data \
|
|
||||||
--with-charset=${CHAR} \
|
|
||||||
--with-extra-charsets=all \
|
|
||||||
--with-raid \
|
|
||||||
--without-docs \
|
|
||||||
--without-bench \
|
|
||||||
--without-perl \
|
|
||||||
--with-gcc \
|
|
||||||
--with-mysqld-ldflags="-static" \
|
|
||||||
--with-client-ldflags="-static" \
|
|
||||||
--with-named-curses-libs=/usr/local/lib/libncurses.a \
|
|
||||||
--with-mysqld-user=mysql
|
|
||||||
|
|
||||||
# --with-berkeley-db-includes=/usr/local/include/db3 \
|
|
||||||
# --with-berkeley-db-libs=/usr/local/lib/libdb3.a \
|
|
||||||
# --with-low-memory
|
|
||||||
|
|
||||||
${GMAKE}
|
|
||||||
${GMAKE} install DESTDIR=${P}/PKG/tmp-${CHAR}
|
|
||||||
|
|
||||||
v=`grep '^SHARED_LIB_VERSION' configure.in | sed 's@SHARED_LIB_VERSION@@' | sed -e 's@=@@' -e 's@:@ @g' | awk '{print $1}'`
|
|
||||||
km="libmysqlclient.so.$v"
|
|
||||||
export km
|
|
||||||
|
|
||||||
(cd ${P}/PKG/tmp-${CHAR}/usr/local/lib/mysql/ ; \
|
|
||||||
for i in libmysqlclient* ; do \
|
|
||||||
if /usr/bin/test ! -L $i ; then \
|
|
||||||
mv $i ../ ; ln -sf ../$i ; \
|
|
||||||
fi ; \
|
|
||||||
done ; \
|
|
||||||
k=`ls libmysqlclient.so.*.*.*` ; \
|
|
||||||
cd .. ; \
|
|
||||||
if /usr/bin/test ! -z libmysqlclient.so ; then \
|
|
||||||
ln -sf $k libmysqlclient.so ;
|
|
||||||
fi ; \
|
|
||||||
if /usr/bin/test ! -z $km ; then \
|
|
||||||
ln -sf $k $km ;
|
|
||||||
fi ; \
|
|
||||||
)
|
|
||||||
|
|
||||||
#
|
|
||||||
(cd ${P}/PKG/tmp-${CHAR}/usr/local/bin ; strip * )
|
|
||||||
(cd ${P}/PKG/tmp-${CHAR}/usr/local/sbin ; strip * )
|
|
@@ -1,17 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
CHAR="$1"
|
|
||||||
case "$1" in
|
|
||||||
[uU]*)
|
|
||||||
CHAR=ujis
|
|
||||||
;;
|
|
||||||
[sS]*)
|
|
||||||
CHAR=sjis
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
cp -r Docs/* PKG/tmp-${CHAR}/usr/local/share/doc/mysql/
|
|
||||||
cp INSTALL-SOURCE* COPYING* MIRRORS README* PKG/tmp-${CHAR}/usr/local/share/doc/mysql/
|
|
||||||
|
|
||||||
cd PKG/tmp-${CHAR}/usr/local/share/doc/mysql/
|
|
||||||
gzip *.txt *.texi *.info *.pdf
|
|
@@ -1,47 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
if [ "x$1" = "x" ]; then
|
|
||||||
echo " please set charset"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
CHAR="$1"
|
|
||||||
case "$1" in
|
|
||||||
[uU]*)
|
|
||||||
CHAR=ujis ; CH=uj
|
|
||||||
;;
|
|
||||||
[sS]*)
|
|
||||||
CHAR=sjis ; CH=sj
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
#-------------------
|
|
||||||
DIR=`pwd`
|
|
||||||
|
|
||||||
VERSION=`cat version`
|
|
||||||
|
|
||||||
T=`uname -p`
|
|
||||||
|
|
||||||
sed -e "s/@CHAR1@/${CH}/" \
|
|
||||||
-e "s/@CHAR2@/${CHAR}/" \
|
|
||||||
-e "s/@VERSION@/${VERSION}/" \
|
|
||||||
-e "s/@TYPE@/${T}/" \
|
|
||||||
pkginfo.ini > pkginfo.${CHAR}
|
|
||||||
|
|
||||||
sed -e "s,@DIR@,${DIR},g" \
|
|
||||||
-e "s,@PKGINFO@,${DIR}/pkginfo.${CHAR}," \
|
|
||||||
prototype.ini > prototype.${CHAR}
|
|
||||||
|
|
||||||
INIT="tmp-${CHAR}/etc/init.d/mysql"
|
|
||||||
cp ../support-files/mysql.server $INIT
|
|
||||||
chmod 755 $INIT
|
|
||||||
|
|
||||||
(cd tmp-${CHAR}; \
|
|
||||||
chown root etc usr ; \
|
|
||||||
chgrp sys etc usr ;\
|
|
||||||
chmod 755 usr etc; \
|
|
||||||
chgrp sys etc/init.d ; \
|
|
||||||
chmod 755 etc/init.d ; \
|
|
||||||
find . -print|pkgproto >> ../prototype.${CHAR})
|
|
||||||
|
|
||||||
pkgmk -o -f prototype.${CHAR} -r ${DIR}/tmp-${CHAR}
|
|
@@ -1,96 +0,0 @@
|
|||||||
--- scripts/safe_mysqld.sh.orig Sat Sep 2 17:28:26 2000
|
|
||||||
+++ scripts/safe_mysqld.sh Sat Sep 2 17:31:19 2000
|
|
||||||
@@ -89,10 +89,10 @@
|
|
||||||
|
|
||||||
|
|
||||||
NOHUP_NICENESS=`nohup nice`
|
|
||||||
-if test $? -ne 0 || test x"$NOHUP_NICENESS" = x0 || test ! nice --1 echo foo > /dev/null 2>&1; then
|
|
||||||
+if test $? -ne 0 || test x"$NOHUP_NICENESS" = x0 || test ! nice -1 echo foo > /dev/null 2>&1; then
|
|
||||||
NOHUP_NICENESS="nohup"
|
|
||||||
else
|
|
||||||
- NOHUP_NICENESS="nice --$NOHUP_NICENESS nohup"
|
|
||||||
+ NOHUP_NICENESS="nice -$NOHUP_NICENESS nohup"
|
|
||||||
fi
|
|
||||||
|
|
||||||
export MYSQL_UNIX_PORT
|
|
||||||
@@ -163,7 +163,8 @@
|
|
||||||
# The only thing is ps x => redhat 5 gives warnings when using ps -x.
|
|
||||||
# kill -9 is used or the process won't react on the kill.
|
|
||||||
numofproces=`ps xa | grep -v "grep" | grep -c $ledir/mysqld`
|
|
||||||
- echo -e "\nNumber of processes running now: $numofproces" | tee -a $err_log
|
|
||||||
+ echo | tee -a $err_log
|
|
||||||
+ echo "Number of processes running now: $numofproces" | tee -a $err_log
|
|
||||||
I=1
|
|
||||||
while test "$I" -le "$numofproces"
|
|
||||||
do
|
|
||||||
@@ -185,4 +186,6 @@
|
|
||||||
echo "`date +'%y%m%d %H:%M:%S mysqld restarted'`" | tee -a $err_log
|
|
||||||
done
|
|
||||||
|
|
||||||
-echo -e "`date +'%y%m%d %H:%M:%S mysqld ended\n'`" | tee -a $err_log
|
|
||||||
+echo | tee -a $err_log
|
|
||||||
+echo "`date +'%y%m%d %H:%M:%S mysqld ended'`" | tee -a $err_log
|
|
||||||
+echo | tee -a $err_log
|
|
||||||
--- support-files/mysql.server.sh.orig Sat Sep 2 17:35:56 2000
|
|
||||||
+++ support-files/mysql.server.sh Sat Sep 2 17:36:35 2000
|
|
||||||
@@ -23,6 +23,9 @@
|
|
||||||
mysql_daemon_user=@MYSQLD_USER@
|
|
||||||
export PATH
|
|
||||||
|
|
||||||
+## your options...
|
|
||||||
+OPT=""
|
|
||||||
+
|
|
||||||
mode=$1
|
|
||||||
|
|
||||||
if test -w / # determine if we should look at the root config file
|
|
||||||
@@ -82,8 +85,9 @@
|
|
||||||
then
|
|
||||||
# Give extra arguments to mysqld with the my.cnf file. This script may
|
|
||||||
# be overwritten at next upgrade.
|
|
||||||
- $bindir/safe_mysqld \
|
|
||||||
- --user=$mysql_daemon_user --datadir=$datadir --pid-file=$pid_file --log=$log_file &
|
|
||||||
+ $bindir/safe_mysqld $OPT \
|
|
||||||
+ --user=$mysql_daemon_user --datadir=$datadir --pid-file=$pid_file &
|
|
||||||
+# --log=$log_file &
|
|
||||||
else
|
|
||||||
echo "Can't execute $bindir/safe_mysqld"
|
|
||||||
fi
|
|
||||||
--- configure.orig Sat Sep 2 17:54:03 2000
|
|
||||||
+++ configure Sat Sep 2 17:54:18 2000
|
|
||||||
@@ -202,7 +202,7 @@
|
|
||||||
--with-charset=CHARSET use CHARSET by default (one of: big5 cp1251 cp1257
|
|
||||||
croat czech danish dec8 dos estonia euc_kr gb2312 gbk
|
|
||||||
german1 greek hebrew hp8 hungarian koi8_ru koi8_ukr
|
|
||||||
- latin1 latin2 swe7 usa7 win1250 win1251 win1251ukr
|
|
||||||
+ latin1 latin2 swe7 usa7 win1250 win1251ukr
|
|
||||||
ujis sjis tis620; default is latin1)"
|
|
||||||
ac_help="$ac_help
|
|
||||||
--with-extra-charsets=cs1,cs2
|
|
||||||
@@ -8843,7 +8843,7 @@
|
|
||||||
|
|
||||||
# Choose a character set
|
|
||||||
|
|
||||||
-CHARSETS_AVAILABLE="big5 cp1251 cp1257 croat czech danish dec8 dos estonia euc_kr gb2312 gbk german1 greek hebrew hp8 hungarian koi8_ru koi8_ukr latin1 latin2 swe7 usa7 win1250 win1251 win1251ukr ujis sjis tis620"
|
|
||||||
+CHARSETS_AVAILABLE="big5 cp1251 cp1257 croat czech danish dec8 dos estonia euc_kr gb2312 gbk german1 greek hebrew hp8 hungarian koi8_ru koi8_ukr latin1 latin2 swe7 usa7 win1250 win1251ukr ujis sjis tis620"
|
|
||||||
DEFAULT_CHARSET=latin1
|
|
||||||
|
|
||||||
# Check whether --with-charset or --without-charset was given.
|
|
||||||
--- configure.in.orig Sat Sep 2 17:53:57 2000
|
|
||||||
+++ configure.in Sat Sep 2 17:54:36 2000
|
|
||||||
@@ -1517,14 +1517,14 @@
|
|
||||||
dnl or other special handling, you must also create
|
|
||||||
dnl strings/ctype-$charset_name.c
|
|
||||||
|
|
||||||
-CHARSETS_AVAILABLE="big5 cp1251 cp1257 croat czech danish dec8 dos estonia euc_kr gb2312 gbk german1 greek hebrew hp8 hungarian koi8_ru koi8_ukr latin1 latin2 swe7 usa7 win1250 win1251 win1251ukr ujis sjis tis620"
|
|
||||||
+CHARSETS_AVAILABLE="big5 cp1251 cp1257 croat czech danish dec8 dos estonia euc_kr gb2312 gbk german1 greek hebrew hp8 hungarian koi8_ru koi8_ukr latin1 latin2 swe7 usa7 win1250 win1251ukr ujis sjis tis620"
|
|
||||||
DEFAULT_CHARSET=latin1
|
|
||||||
|
|
||||||
AC_ARG_WITH(charset,
|
|
||||||
[ --with-charset=CHARSET use CHARSET by default (one of: big5 cp1251 cp1257
|
|
||||||
croat czech danish dec8 dos estonia euc_kr gb2312 gbk
|
|
||||||
german1 greek hebrew hp8 hungarian koi8_ru koi8_ukr
|
|
||||||
- latin1 latin2 swe7 usa7 win1250 win1251 win1251ukr
|
|
||||||
+ latin1 latin2 swe7 usa7 win1250 win1251ukr
|
|
||||||
ujis sjis tis620; default is latin1)],
|
|
||||||
[default_charset="$withval"],
|
|
||||||
[default_charset="$DEFAULT_CHARSET"])
|
|
@@ -1,8 +0,0 @@
|
|||||||
PKG=MySQL
|
|
||||||
NAME=MySQL
|
|
||||||
ARCH=@TYPE@
|
|
||||||
VERSION=@VERSION@
|
|
||||||
CATEGORY=utility
|
|
||||||
VENDOR=TcX DataKonsult AB, Detron HB and MySQL AB
|
|
||||||
BASEDIR=/
|
|
||||||
CLASSES=none
|
|
@@ -1,30 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
PATH=/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb:/usr/ccs/bin
|
|
||||||
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib
|
|
||||||
export PATH
|
|
||||||
export LD_LIBRARY_PATH
|
|
||||||
|
|
||||||
D0="/usr/local/mysql-data"
|
|
||||||
D="${D0}/mysql"
|
|
||||||
|
|
||||||
DOFIX=0
|
|
||||||
|
|
||||||
if /usr/bin/test ! -f ${D}/tables_priv.frm -a -d ${D} ; then
|
|
||||||
DOFIX=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -d ${D} ]; then
|
|
||||||
DOFIX=2
|
|
||||||
/usr/local/bin/mysql_install_db
|
|
||||||
fi
|
|
||||||
|
|
||||||
chown -R mysql $D0
|
|
||||||
chgrp -R mysql $D0
|
|
||||||
|
|
||||||
if /usr/bin/test $DOFIX -eq 1 ; then
|
|
||||||
/etc/init.d/mysql start
|
|
||||||
/usr/local/bin/mysql_fix_privilege_tables
|
|
||||||
else
|
|
||||||
/etc/init.d/mysql start || true
|
|
||||||
fi
|
|
@@ -1,21 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb:/usr/ccs/bin
|
|
||||||
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib
|
|
||||||
export PATH
|
|
||||||
export LD_LIBRARY_PATH
|
|
||||||
|
|
||||||
if /usr/bin/test -x /etc/init.d/mysql ; then
|
|
||||||
/etc/init.d/mysql stop || true
|
|
||||||
fi
|
|
||||||
|
|
||||||
#----- user check
|
|
||||||
P=`grep mysql /etc/passwd`
|
|
||||||
G=`grep mysql /etc/group`
|
|
||||||
|
|
||||||
if /usr/bin/test "x$G" = "x" ; then
|
|
||||||
/usr/sbin/groupadd mysql
|
|
||||||
fi
|
|
||||||
if /usr/bin/test "x$P" = "x" ; then
|
|
||||||
/usr/sbin/useradd -g mysql -d /usr/local/mysql-data -s /bin/false mysql
|
|
||||||
fi
|
|
@@ -1,25 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
PATH=/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb:/usr/ccs/bin
|
|
||||||
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib
|
|
||||||
export PATH
|
|
||||||
export LD_LIBRARY_PATH
|
|
||||||
|
|
||||||
pid=`/usr/bin/ps -e | /usr/bin/grep mysqld | /usr/bin/sed -e 's/^ *//' -e 's/ .*//'`
|
|
||||||
[ "$pid" != "" ] && /usr/local/bin/mysqladmin shutdown
|
|
||||||
|
|
||||||
#---
|
|
||||||
#/usr/ucb/echo -n "Remove DATA Directory (All data expire) [Y/N]? "
|
|
||||||
#read I
|
|
||||||
I=No
|
|
||||||
|
|
||||||
case "$I" in
|
|
||||||
Y*|y*)
|
|
||||||
/usr/ucb/echo -n "Removing MySQL DATA ALL..."
|
|
||||||
rm -rf /usr/local/mysql-data
|
|
||||||
echo "done."
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "not purge DATA directory"
|
|
||||||
;;
|
|
||||||
esac;
|
|
@@ -1,4 +0,0 @@
|
|||||||
i pkginfo=@PKGINFO@
|
|
||||||
i postinstall=@DIR@/postinstall
|
|
||||||
i preinstall=@DIR@/preinstall
|
|
||||||
i preremove=@DIR@/preremove
|
|
@@ -1 +0,0 @@
|
|||||||
3.23.23-beta
|
|
320
win/configure.js
320
win/configure.js
@@ -1,320 +0,0 @@
|
|||||||
// Configure.js
|
|
||||||
//
|
|
||||||
// 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; version 2 of the License.
|
|
||||||
//
|
|
||||||
// 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
ForReading = 1;
|
|
||||||
ForWriting = 2;
|
|
||||||
ForAppending = 8;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var fso = new ActiveXObject("Scripting.FileSystemObject");
|
|
||||||
|
|
||||||
var args = WScript.Arguments
|
|
||||||
|
|
||||||
// read in the Unix configure.in file
|
|
||||||
var configureInTS = fso.OpenTextFile("configure.in", ForReading);
|
|
||||||
var configureIn = configureInTS.ReadAll();
|
|
||||||
configureInTS.Close();
|
|
||||||
var default_comment = "Source distribution";
|
|
||||||
var default_port = GetValue(configureIn, "MYSQL_TCP_PORT_DEFAULT");
|
|
||||||
var actual_port = 0;
|
|
||||||
|
|
||||||
var configfile = fso.CreateTextFile("win\\configure.data", true);
|
|
||||||
for (i=0; i < args.Count(); i++)
|
|
||||||
{
|
|
||||||
var parts = args.Item(i).split('=');
|
|
||||||
switch (parts[0])
|
|
||||||
{
|
|
||||||
case "CYBOZU":
|
|
||||||
case "EMBED_MANIFESTS":
|
|
||||||
case "EXTRA_DEBUG":
|
|
||||||
case "WITH_EMBEDDED_SERVER":
|
|
||||||
case "WITHOUT_ATOMICS":
|
|
||||||
configfile.WriteLine("SET (" + args.Item(i) + " TRUE CACHE BOOL \"\")");
|
|
||||||
break;
|
|
||||||
case "MYSQL_SERVER_SUFFIX":
|
|
||||||
case "MYSQLD_EXE_SUFFIX":
|
|
||||||
configfile.WriteLine("SET (" + parts[0] + " \""
|
|
||||||
+ parts[1] + "\" CACHE STRING \"\")");
|
|
||||||
break;
|
|
||||||
case "COMPILATION_COMMENT":
|
|
||||||
default_comment = parts[1];
|
|
||||||
break;
|
|
||||||
case "MYSQL_TCP_PORT":
|
|
||||||
actual_port = parts[1];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (actual_port == 0)
|
|
||||||
{
|
|
||||||
// if we actually defaulted (as opposed to the pathological case of
|
|
||||||
// --with-tcp-port=<MYSQL_TCP_PORT_DEFAULT> which might in theory
|
|
||||||
// happen if whole batch of servers was built from a script), set
|
|
||||||
// the default to zero to indicate that; we don't lose information
|
|
||||||
// that way, because 0 obviously indicates that we can get the
|
|
||||||
// default value from MYSQL_TCP_PORT. this seems really evil, but
|
|
||||||
// testing for MYSQL_TCP_PORT==MYSQL_TCP_PORT_DEFAULT would make a
|
|
||||||
// a port of MYSQL_TCP_PORT_DEFAULT magic even if the builder did not
|
|
||||||
// intend it to mean "use the default, in fact, look up a good default
|
|
||||||
// from /etc/services if you can", but really, really meant 3306 when
|
|
||||||
// they passed in 3306. When they pass in a specific value, let them
|
|
||||||
// have it; don't second guess user and think we know better, this will
|
|
||||||
// just make people cross. this makes the the logic work like this
|
|
||||||
// (which is complicated enough):
|
|
||||||
//
|
|
||||||
// - if a port was set during build, use that as a default.
|
|
||||||
//
|
|
||||||
// - otherwise, try to look up a port in /etc/services; if that fails,
|
|
||||||
// use MYSQL_TCP_PORT_DEFAULT (at the time of this writing 3306)
|
|
||||||
//
|
|
||||||
// - allow the MYSQL_TCP_PORT environment variable to override that.
|
|
||||||
//
|
|
||||||
// - allow command-line parameters to override all of the above.
|
|
||||||
//
|
|
||||||
// the top-most MYSQL_TCP_PORT_DEFAULT is read from win/configure.js,
|
|
||||||
// so don't mess with that.
|
|
||||||
actual_port = default_port;
|
|
||||||
default_port = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
configfile.WriteLine("SET (COMPILATION_COMMENT \"" +
|
|
||||||
default_comment + "\" CACHE STRING \"\" )");
|
|
||||||
|
|
||||||
configfile.WriteLine("SET (PROTOCOL_VERSION \"" +
|
|
||||||
GetValue(configureIn, "PROTOCOL_VERSION") + "\" CACHE STRING \"\")");
|
|
||||||
configfile.WriteLine("SET (DOT_FRM_VERSION \"" +
|
|
||||||
GetValue(configureIn, "DOT_FRM_VERSION") + "\" CACHE STRING \"\")");
|
|
||||||
configfile.WriteLine("SET (MYSQL_TCP_PORT_DEFAULT \"" + default_port + "\" CACHE STRING \"\")");
|
|
||||||
configfile.WriteLine("SET (MYSQL_TCP_PORT \"" + actual_port + "\" CACHE STRING \"\")");
|
|
||||||
configfile.WriteLine("SET (MYSQL_UNIX_ADDR \"MySQL\" CACHE STRING \"\")");
|
|
||||||
var version = GetVersion(configureIn);
|
|
||||||
configfile.WriteLine("SET (VERSION \"" + version + "\" CACHE STRING \"\")");
|
|
||||||
configfile.WriteLine("SET (MYSQL_BASE_VERSION \"" +
|
|
||||||
GetBaseVersion(version) + "\" CACHE STRING \"\")");
|
|
||||||
configfile.WriteLine("SET (MYSQL_VERSION_ID \"" +
|
|
||||||
GetVersionId(version) + "\" CACHE STRING \"\")");
|
|
||||||
var engineOptions = ParsePlugins();
|
|
||||||
for (option in engineOptions)
|
|
||||||
{
|
|
||||||
configfile.WriteLine("SET(" + engineOptions[option] + " TRUE CACHE BOOL \"\")");
|
|
||||||
}
|
|
||||||
configfile.Close();
|
|
||||||
|
|
||||||
fso = null;
|
|
||||||
|
|
||||||
WScript.Echo("done!");
|
|
||||||
}
|
|
||||||
catch (e)
|
|
||||||
{
|
|
||||||
WScript.Echo("Error: " + e.description);
|
|
||||||
}
|
|
||||||
|
|
||||||
function GetValue(str, key)
|
|
||||||
{
|
|
||||||
var pos = str.indexOf(key+'=');
|
|
||||||
if (pos == -1) return null;
|
|
||||||
pos += key.length + 1;
|
|
||||||
var end = str.indexOf("\n", pos);
|
|
||||||
if (str.charAt(pos) == "\"")
|
|
||||||
pos++;
|
|
||||||
if (str.charAt(end-1) == "\"")
|
|
||||||
end--;
|
|
||||||
return str.substring(pos, end);
|
|
||||||
}
|
|
||||||
|
|
||||||
function GetVersion(str)
|
|
||||||
{
|
|
||||||
var key = "AC_INIT([MySQL Server], [";
|
|
||||||
var pos = str.indexOf(key);
|
|
||||||
if (pos == -1) return null;
|
|
||||||
pos += key.length;
|
|
||||||
var end = str.indexOf("]", pos);
|
|
||||||
if (end == -1) return null;
|
|
||||||
return str.substring(pos, end);
|
|
||||||
}
|
|
||||||
|
|
||||||
function GetBaseVersion(version)
|
|
||||||
{
|
|
||||||
var dot = version.indexOf(".");
|
|
||||||
if (dot == -1) return null;
|
|
||||||
dot = version.indexOf(".", dot+1);
|
|
||||||
if (dot == -1) dot = version.length;
|
|
||||||
return version.substring(0, dot);
|
|
||||||
}
|
|
||||||
|
|
||||||
function GetVersionId(version)
|
|
||||||
{
|
|
||||||
var dot = version.indexOf(".");
|
|
||||||
if (dot == -1) return null;
|
|
||||||
var major = parseInt(version.substring(0, dot), 10);
|
|
||||||
|
|
||||||
dot++;
|
|
||||||
var nextdot = version.indexOf(".", dot);
|
|
||||||
if (nextdot == -1) return null;
|
|
||||||
var minor = parseInt(version.substring(dot, nextdot), 10);
|
|
||||||
dot = nextdot+1;
|
|
||||||
|
|
||||||
var stop = version.indexOf("-", dot);
|
|
||||||
if (stop == -1) stop = version.length;
|
|
||||||
var build = parseInt(version.substring(dot, stop), 10);
|
|
||||||
|
|
||||||
var id = major;
|
|
||||||
if (minor < 10)
|
|
||||||
id += '0';
|
|
||||||
id += minor;
|
|
||||||
if (build < 10)
|
|
||||||
id += '0';
|
|
||||||
id += build;
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
function PluginConfig(isGroup, include)
|
|
||||||
{
|
|
||||||
this.isGroup = isGroup;
|
|
||||||
this.include = include;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Parse command line arguments specific to plugins (aka storage engines).
|
|
||||||
//
|
|
||||||
// --with-plugin-PLUGIN, --with-plugins=group, --with-plugins=PLUGIN[,PLUGIN...]
|
|
||||||
// --without-plugin-PLUGIN is supported.
|
|
||||||
//
|
|
||||||
// Legacy option WITH_<PLUGIN>_STORAGE_ENGINE is supported as well.
|
|
||||||
// The function returns string array with elements like WITH_SOME_STORAGE_ENGINE
|
|
||||||
// or WITHOUT_SOME_STORAGE_ENGINE.
|
|
||||||
//
|
|
||||||
// This function handles groups, for example effect of specifying --with-plugins=max
|
|
||||||
// is the same as --with-plugins==archive,federated,falcon,innobase...
|
|
||||||
|
|
||||||
function ParsePlugins()
|
|
||||||
{
|
|
||||||
|
|
||||||
var config = new Array();
|
|
||||||
|
|
||||||
config["DEFAULT"] = new PluginConfig(true,true);
|
|
||||||
|
|
||||||
// Parse command line parameters
|
|
||||||
for (i=0; i< WScript.Arguments.length;i++)
|
|
||||||
{
|
|
||||||
var option = WScript.Arguments.Item(i);
|
|
||||||
var match = /WITH_(\w+)_STORAGE_ENGINE/.exec(option);
|
|
||||||
if (match == null)
|
|
||||||
match = /--with-plugin-(\w+)/.exec(option);
|
|
||||||
if (match != null)
|
|
||||||
{
|
|
||||||
config[match[1].toUpperCase()] = new PluginConfig(false,true);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
match = /WITHOUT_(\w+)_STORAGE_ENGINE/.exec(option);
|
|
||||||
if (match == null)
|
|
||||||
match = /--without-plugin-(\w+)/.exec(option);
|
|
||||||
|
|
||||||
if (match != null)
|
|
||||||
{
|
|
||||||
config[match[1].toUpperCase()] =
|
|
||||||
new PluginConfig(false,false);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
match = /--with-plugins=([\w,\-_]+)/.exec(option);
|
|
||||||
if(match != null)
|
|
||||||
{
|
|
||||||
|
|
||||||
var plugins = match[1].split(",");
|
|
||||||
for(var key in plugins)
|
|
||||||
{
|
|
||||||
config[plugins[key].toUpperCase()] =
|
|
||||||
new PluginConfig(null,true);
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
match = /--without-plugins=([\w,\-_]+)/.exec(option);
|
|
||||||
if(match != null)
|
|
||||||
{
|
|
||||||
var plugins = match[1].split(",");
|
|
||||||
for(var key in plugins)
|
|
||||||
config[plugins[key].toUpperCase()] =
|
|
||||||
new PluginConfig(null, false);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Read plugin definitions, find out groups plugins belong to.
|
|
||||||
var fc = new Enumerator(fso.GetFolder("storage").SubFolders);
|
|
||||||
for (;!fc.atEnd(); fc.moveNext())
|
|
||||||
{
|
|
||||||
var subfolder = fc.item();
|
|
||||||
var name = subfolder.name.toUpperCase();
|
|
||||||
|
|
||||||
// Handle case where storage engine was already specified by name in
|
|
||||||
// --with-plugins or --without-plugins.
|
|
||||||
if (config[name] != undefined)
|
|
||||||
{
|
|
||||||
config[name].isGroup = false;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
config[name] = new PluginConfig(false,null);
|
|
||||||
|
|
||||||
// Handle groups. For each plugin, find out which group it belongs to
|
|
||||||
// If this group was specified on command line for inclusion/exclusion,
|
|
||||||
// then include/exclude the plugin.
|
|
||||||
filename = subfolder +"\\plug.in";
|
|
||||||
if (fso.FileExists(filename))
|
|
||||||
{
|
|
||||||
var content = fso.OpenTextFile(filename, ForReading).ReadAll();
|
|
||||||
var match =
|
|
||||||
/MYSQL_STORAGE_ENGINE([ ]*)[\(]([^\)]+)[\)]/.exec(content);
|
|
||||||
if (match== null)
|
|
||||||
continue;
|
|
||||||
match = /\[[\w,\-_]+\][\s]?\)/.exec(match[0]);
|
|
||||||
if (match == null)
|
|
||||||
continue;
|
|
||||||
groups = match[0].split(/[\,\(\)\[\] ]/);
|
|
||||||
for (var key in groups)
|
|
||||||
{
|
|
||||||
var group = groups[key].toUpperCase();
|
|
||||||
if (config[group] != undefined)
|
|
||||||
{
|
|
||||||
config[group].isGroup = true;
|
|
||||||
if (config[group].include != null)
|
|
||||||
{
|
|
||||||
config[name].include = config[group].include;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var arr = new Array();
|
|
||||||
for(key in config)
|
|
||||||
{
|
|
||||||
var eng = config[key];
|
|
||||||
if(eng.isGroup != undefined && !eng.isGroup && eng.include != undefined)
|
|
||||||
{
|
|
||||||
if (fso.FolderExists("storage\\"+key) || key=="PARTITION")
|
|
||||||
{
|
|
||||||
arr[arr.length] = eng.include?
|
|
||||||
"WITH_"+key+"_STORAGE_ENGINE":"WITHOUT_"+key+"_STORAGE_ENGINE";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return arr;
|
|
||||||
}
|
|
Reference in New Issue
Block a user