diff options
author | Ulrich Drepper <drepper@redhat.com> | 1996-09-10 01:59:36 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1996-09-10 01:59:36 +0000 |
commit | 16d6b38e4db6f3b9e41508d8ab902208f0ab9b04 (patch) | |
tree | 829ec94b66946bfbdc43ee27556b771a89de3f47 | |
parent | 44b8acdd3a2f181b415a43e3f7c7dad66b0e4556 (diff) | |
download | glibc-16d6b38e4db6f3b9e41508d8ab902208f0ab9b04.tar glibc-16d6b38e4db6f3b9e41508d8ab902208f0ab9b04.tar.gz glibc-16d6b38e4db6f3b9e41508d8ab902208f0ab9b04.tar.bz2 glibc-16d6b38e4db6f3b9e41508d8ab902208f0ab9b04.zip |
update from main archive 960909
28 files changed, 37 insertions, 404 deletions
diff --git a/sysdeps/alpha/copysign.S b/sysdeps/alpha/s_copysign.S index 95eb608666..95eb608666 100644 --- a/sysdeps/alpha/copysign.S +++ b/sysdeps/alpha/s_copysign.S diff --git a/sysdeps/alpha/fabs.S b/sysdeps/alpha/s_fabs.S index dff8390b5a..12c0abdf75 100644 --- a/sysdeps/alpha/fabs.S +++ b/sysdeps/alpha/s_fabs.S @@ -19,9 +19,10 @@ Cambridge, MA 02139, USA. */ #include <sysdep.h> -ENTRY(fabs) +ENTRY(__fabs) .prologue 0 cpys $f31,$f16,$f0 ret - END(fabs) + END(__fabs) +weak_alias (__fabs, fabs) diff --git a/sysdeps/m68k/fpu/__math.h b/sysdeps/m68k/fpu/__math.h index 2cbb4ca388..4992aea561 100644 --- a/sysdeps/m68k/fpu/__math.h +++ b/sysdeps/m68k/fpu/__math.h @@ -20,7 +20,7 @@ Cambridge, MA 02139, USA. */ #include <sys/cdefs.h> -#ifdef __NO_MATH_INLINES +#ifdef __NO_M81_MATH_INLINES /* This is used when defining the functions themselves. Define them with __ names, and with `static inline' instead of `extern inline' so the bodies will always be used, never an external function call. */ @@ -29,7 +29,7 @@ Cambridge, MA 02139, USA. */ #else #define __m81_u(x) x #define __m81_inline extern __inline -#define __MATH_INLINES 1 +#define __M81_MATH_INLINES 1 #endif /* Define a const math function. */ diff --git a/sysdeps/m68k/fpu/e_acos.c b/sysdeps/m68k/fpu/e_acos.c index ae77dabf98..61c374d917 100644 --- a/sysdeps/m68k/fpu/e_acos.c +++ b/sysdeps/m68k/fpu/e_acos.c @@ -16,8 +16,9 @@ License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <ansidecl.h> +#define __NO_M81_MATH_INLINES #include <math.h> +#include "math_private.h" #ifndef FUNC #define FUNC __ieee754_acos @@ -27,7 +28,8 @@ Cambridge, MA 02139, USA. */ #endif float_type -DEFUN(FUNC, (x), float_type x) +FUNC (x) + float_type x; { return __m81_u(FUNC)(x); } diff --git a/sysdeps/m68k/fpu/e_fmod.c b/sysdeps/m68k/fpu/e_fmod.c index 0b2468c06d..bf2f7ed1bb 100644 --- a/sysdeps/m68k/fpu/e_fmod.c +++ b/sysdeps/m68k/fpu/e_fmod.c @@ -16,8 +16,9 @@ License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <ansidecl.h> +#define __NO_M81_MATH_INLINES #include <math.h> +#include "math_private.h" #ifndef FUNC #define FUNC __ieee754_fmod @@ -27,7 +28,9 @@ Cambridge, MA 02139, USA. */ #endif float_type -DEFUN(FUNC, (x, y), float_type x AND float_type y) +FUNC (x, y) + float_type x; + float_type y; { return __m81_u(FUNC)(x, y); } diff --git a/sysdeps/m68k/fpu/k_cos.c b/sysdeps/m68k/fpu/k_cos.c index 61f566f6a1..6bb9090568 100644 --- a/sysdeps/m68k/fpu/k_cos.c +++ b/sysdeps/m68k/fpu/k_cos.c @@ -16,7 +16,9 @@ License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#define __NO_M81_MATH_INLINES #include <math.h> +#include "math_private.h" #ifndef FUNC #define FUNC cos diff --git a/sysdeps/m68k/fpu/k_sin.c b/sysdeps/m68k/fpu/k_sin.c index 3eed1d466c..f10c7f9801 100644 --- a/sysdeps/m68k/fpu/k_sin.c +++ b/sysdeps/m68k/fpu/k_sin.c @@ -16,7 +16,9 @@ License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#define __NO_M81_MATH_INLINES #include <math.h> +#include "math_private.h" #ifndef FUNC #define FUNC sin @@ -35,7 +37,7 @@ __CONCATX(__kernel_,FUNC) (x, y, iy) { float_type sin_x, cos_x, sin_y, cos_y; if (iy == 0) - return __m81_u_(__CONCATX(__,FUNC)) (x); + return __m81_u(__CONCATX(__,FUNC)) (x); __asm__ __volatile__ ("fsincosx %2,%0:%1" : "=f" (cos_x), "=f" (sin_x) : "f" (x)); __asm__ __volatile__ ("fsincosx %2,%0:%1" : "=f" (cos_y), "=f" (sin_y) diff --git a/sysdeps/m68k/fpu/k_tan.c b/sysdeps/m68k/fpu/k_tan.c index 7f1b729b96..9c222cd6e1 100644 --- a/sysdeps/m68k/fpu/k_tan.c +++ b/sysdeps/m68k/fpu/k_tan.c @@ -16,7 +16,9 @@ License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#define __NO_M81_MATH_INLINES #include <math.h> +#include "math_private.h" #ifndef FUNC #define FUNC tan @@ -34,8 +36,8 @@ __CONCATX(__kernel_,FUNC) (x, y, iy) int iy; { float_type tan_x, tan_y; - tan_x = __m81_u_(__CONCATX(__,FUNC)) (x); - tan_y = __m81_u_(__CONCATX(__,FUNC)) (y); + tan_x = __m81_u(__CONCATX(__,FUNC)) (x); + tan_y = __m81_u(__CONCATX(__,FUNC)) (y); if (iy > 0) return (tan_x + tan_y) / (1 - tan_x * tan_y); else diff --git a/sysdeps/m68k/fpu/s_atan.c b/sysdeps/m68k/fpu/s_atan.c index 29717d4395..99b3024326 100644 --- a/sysdeps/m68k/fpu/s_atan.c +++ b/sysdeps/m68k/fpu/s_atan.c @@ -17,6 +17,7 @@ not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <ansidecl.h> +#define __NO_M81_MATH_INLINES #include <math.h> #ifndef FUNC diff --git a/sysdeps/m68k/fpu/s_frexp.c b/sysdeps/m68k/fpu/s_frexp.c index 16f30394b2..8b38086e27 100644 --- a/sysdeps/m68k/fpu/s_frexp.c +++ b/sysdeps/m68k/fpu/s_frexp.c @@ -17,6 +17,7 @@ not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <ansidecl.h> +#define __NO_M81_MATH_INLINES #include <math.h> #ifndef FUNC diff --git a/sysdeps/m68k/fpu/s_ilogb.c b/sysdeps/m68k/fpu/s_ilogb.c index c80a288949..39c871481d 100644 --- a/sysdeps/m68k/fpu/s_ilogb.c +++ b/sysdeps/m68k/fpu/s_ilogb.c @@ -17,6 +17,7 @@ not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <ansidecl.h> +#define __NO_M81_MATH_INLINES #include <math.h> #ifndef FUNC diff --git a/sysdeps/m68k/fpu/s_isinf.c b/sysdeps/m68k/fpu/s_isinf.c index 570a7ba7bb..7d4b1c44a5 100644 --- a/sysdeps/m68k/fpu/s_isinf.c +++ b/sysdeps/m68k/fpu/s_isinf.c @@ -17,6 +17,7 @@ not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <ansidecl.h> +#define __NO_M81_MATH_INLINES #include <math.h> #ifndef FUNC diff --git a/sysdeps/m68k/fpu/s_ldexp.c b/sysdeps/m68k/fpu/s_ldexp.c index ea8bfbab88..18f4d43c37 100644 --- a/sysdeps/m68k/fpu/s_ldexp.c +++ b/sysdeps/m68k/fpu/s_ldexp.c @@ -17,6 +17,7 @@ not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <ansidecl.h> +#define __NO_M81_MATH_INLINES #include <math.h> #ifndef FUNC diff --git a/sysdeps/m68k/fpu/s_modf.c b/sysdeps/m68k/fpu/s_modf.c index f704260e21..426d847ebd 100644 --- a/sysdeps/m68k/fpu/s_modf.c +++ b/sysdeps/m68k/fpu/s_modf.c @@ -17,6 +17,7 @@ not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <ansidecl.h> +#define __NO_M81_MATH_INLINES #include <math.h> #ifndef FUNC diff --git a/sysdeps/m68k/isinfl.c b/sysdeps/m68k/s_isinfl.c index 1b06d47d52..1b06d47d52 100644 --- a/sysdeps/m68k/isinfl.c +++ b/sysdeps/m68k/s_isinfl.c diff --git a/sysdeps/m68k/isnanl.c b/sysdeps/m68k/s_isnanl.c index 38a9616593..38a9616593 100644 --- a/sysdeps/m68k/isnanl.c +++ b/sysdeps/m68k/s_isnanl.c diff --git a/sysdeps/tahoe/log10.c b/sysdeps/tahoe/log10.c deleted file mode 100644 index 2cf2cee58b..0000000000 --- a/sysdeps/tahoe/log10.c +++ /dev/null @@ -1,22 +0,0 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. -This file is part of the GNU C Library. - -The GNU C Library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. - -The GNU C 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 the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ - -#define FPCONST(hi0, lo0, hi1, lo1) { (hi0), (lo0), (hi1), (lo1) } - -#include <../sysdeps/vax/log10.c> - diff --git a/sysdeps/unix/sysv/linux/alpha/Dist b/sysdeps/unix/sysv/linux/alpha/Dist index d898d041a2..d79f1f2970 100644 --- a/sysdeps/unix/sysv/linux/alpha/Dist +++ b/sysdeps/unix/sysv/linux/alpha/Dist @@ -4,3 +4,4 @@ ioperm.c init-first.h clone.S sys/io.h +llseek.S diff --git a/sysdeps/unix/sysv/linux/m68k/init-first.h b/sysdeps/unix/sysv/linux/m68k/init-first.h deleted file mode 100644 index 7d8c320b0a..0000000000 --- a/sysdeps/unix/sysv/linux/m68k/init-first.h +++ /dev/null @@ -1,12 +0,0 @@ -/* This fragment is invoked in the stack context of program start. - Its job is to set up a pointer to argc as an argument, pass - control to `INIT', and, if necessary, clean up after the call - to leave the stack in the same condition it was found in. */ - -#define SYSDEP_CALL_INIT(NAME, INIT) \ - asm(".globl " #NAME "\n\t" \ - #NAME ":\n\t" \ - "pea %sp@(4)\n\t" \ - "jbsr " #INIT "\n\t" \ - "addq #4,%sp\n\t" \ - "rts"); diff --git a/sysdeps/vax/Dist b/sysdeps/vax/Dist index 9830be29a4..22a693094a 100644 --- a/sysdeps/vax/Dist +++ b/sysdeps/vax/Dist @@ -1 +1,2 @@ DEFS.h +fl.h diff --git a/sysdeps/vax/bcmp.s b/sysdeps/vax/bcmp.s deleted file mode 100644 index d980feb8e4..0000000000 --- a/sysdeps/vax/bcmp.s +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 1983 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) - .asciz "@(#)bcmp.s 5.6 (Berkeley) 6/1/90" -#endif /* LIBC_SCCS and not lint */ - -/* bcmp(s1, s2, n) */ - -#include "DEFS.h" - -ENTRY(bcmp, 0) - movl 4(ap),r1 - movl 8(ap),r3 - movl 12(ap),r4 -1: - movzwl $65535,r0 - cmpl r4,r0 - jleq 2f - subl2 r0,r4 - cmpc3 r0,(r1),(r3) - jeql 1b - addl2 r4,r0 - ret -2: - cmpc3 r4,(r1),(r3) - ret diff --git a/sysdeps/vax/index.s b/sysdeps/vax/index.s deleted file mode 100644 index e599b276f0..0000000000 --- a/sysdeps/vax/index.s +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 1980 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) - .asciz "@(#)index.s 5.6 (Berkeley) 6/1/90" -#endif /* LIBC_SCCS and not lint */ - -/* - * Find the first occurence of c in the string cp. - * Return pointer to match or null pointer. - * - * char * - * index(cp, c) - * char *cp, c; - */ -#include "DEFS.h" - -ENTRY(index, 0) - movq 4(ap),r1 # r1 = cp; r2 = c - tstl r2 # check for special case c == '\0' - bneq 2f -1: - locc $0,$65535,(r1) # just find end of string - beql 1b # still looking - movl r1,r0 # found it - ret -2: - moval tbl,r3 # r3 = address of table - bbss $0,(r3),5f # insure not reentering - movab (r3)[r2],r5 # table entry for c - incb (r5) - movzwl $65535,r4 # fast access -3: - scanc r4,(r1),(r3),$1 # look for c or '\0' - beql 3b # still looking - movl r1,r0 # return pointer to char - tstb (r0) # if have found '\0' - bneq 4f - clrl r0 # else return 0 -4: - clrb (r5) # clean up table - clrb (r3) - ret - - .data -tbl: .space 256 - .text - -/* - * Reentrant, but slower version of index - */ -5: - movl r1,r3 -6: - locc $0,$65535,(r3) # look for '\0' - bneq 7f - locc r2,$65535,(r3) # look for c - bneq 8f - movl r1,r3 # reset pointer and ... - jbr 6b # ... try again -7: - subl3 r3,r1,r4 # length of short block - incl r4 # +1 for '\0' - locc r2,r4,(r3) # look for c - bneq 8f - ret -8: - movl r1,r0 # return pointer to char - ret diff --git a/sysdeps/vax/infnan.c b/sysdeps/vax/infnan.c deleted file mode 100644 index 62ec9dca0f..0000000000 --- a/sysdeps/vax/infnan.c +++ /dev/null @@ -1,62 +0,0 @@ -/* Copyright (C) 1991, 1992, 1995 Free Software Foundation, Inc. -This file is part of the GNU C Library. - -The GNU C Library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. - -The GNU C 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 the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ - -#ifndef __GNUC__ - #error This file uses GNU C extensions; you must compile with GCC. -#else - -#include <ansidecl.h> -#include <errno.h> -#include <math.h> - -/* Deal with an infinite or NaN result. - If ERROR is ERANGE, result is +Inf; - if ERROR is - ERANGE, result is -Inf; - otherwise result is NaN. - This will set `errno' to either ERANGE or EDOM, - and may return an infinity or NaN, or may do something else. */ -double -DEFUN(__infnan, (error), int error) -{ - switch (error) - { - case ERANGE: - errno = ERANGE; - break; - - case - ERANGE: - errno = ERANGE; - break; - - default: - errno = EDOM; - break; - } - - /* Trigger a reserved operand fault. */ - { - double result; - asm volatile("emodd %1, %1, %2, %0, %0" : "=r" (result) : - "i" (0), "i" (0x8000)); - return result; - } -} - -#endif - -weak_alias (__infnan, infnan) diff --git a/sysdeps/vax/log10.c b/sysdeps/vax/log10.c deleted file mode 100644 index 08741779eb..0000000000 --- a/sysdeps/vax/log10.c +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. -This file is part of the GNU C Library. - -The GNU C Library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. - -The GNU C 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 the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ - -#include <ansidecl.h> - -#ifndef FPCONST -#define FPCONST(hi0, lo0, hi1, lo1) { (lo0), (hi0), (lo1), (hi1) } -#endif - -static CONST short int ln10[] = FPCONST(0x4113, 0x5d8d, 0xddaa, 0xa8ac); -#define LN10 (*(CONST double *) ln10) - -#include <../sysdeps/generic/log10.c> diff --git a/sysdeps/vax/memcmp.s b/sysdeps/vax/memcmp.s index 3854fd8e4a..f7e47ded46 100644 --- a/sysdeps/vax/memcmp.s +++ b/sysdeps/vax/memcmp.s @@ -59,3 +59,5 @@ ENTRY(memcmp, 0) cmpc3 r5,(r1),(r3) jeql 0b /* loop if same */ jbr 1b + +weak_alias (memcmp, bcmp) diff --git a/sysdeps/vax/rindex.s b/sysdeps/vax/rindex.s deleted file mode 100644 index 76d7e29597..0000000000 --- a/sysdeps/vax/rindex.s +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (c) 1983 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) - .asciz "@(#)rindex.s 5.6 (Berkeley) 6/1/90" -#endif /* LIBC_SCCS and not lint */ - -/* - * Find the last occurence of c in the string cp. - * Return pointer to match or null pointer. - * - * char * - * rindex(cp, c) - * char *cp, c; - */ -#include "DEFS.h" - -ENTRY(rindex, 0) - movq 4(ap),r1 # r1 = cp; r2 = c - tstl r2 # check for special case c == '\0' - bneq 2f -1: - locc $0,$65535,(r1) # just find end of string - beql 1b # still looking - movl r1,r0 # found it - ret -2: - moval tbl,r3 # r3 = address of table - bbss $0,(r3),5f # insure not reentering - movab (r3)[r2],r5 # table entry for c - incb (r5) - clrl r4 # last found -3: - scanc $65535,(r1),(r3),$1 # look for c or '\0' - beql 3b # keep looking - tstb (r1) # if have found '\0' - beql 4f # we are done - movl r1,r4 # save most recently found - incl r1 # skip over character - jbr 3b # keep looking -4: - movl r4,r0 # return last found (if any) - clrb (r5) # clean up table - clrb (r3) - ret - - .data -tbl: .space 256 - .text - -/* - * Reentrant, but slower version of rindex - */ -5: - movl r1,r3 - clrl r4 # r4 = pointer to last match -6: - locc $0,$65535,(r3) # look for '\0' - bneq 8f - decw r0 # r0 = 65535 -1: - locc r2,r0,(r3) # look for c - bneq 7f - movl r1,r3 # reset pointer and ... - jbr 6b # ... try again -7: - movl r1,r4 # stash pointer ... - addl3 $1,r1,r3 # ... skip over match and ... - decl r0 # ... decrement count - jbr 6b # ... try again -8: - subl3 r3,r1,r0 # length of short block - incl r0 # +1 for '\0' -9: - locc r2,r0,(r3) # look for c - beql 0f - movl r1,r4 # stash pointer ... - addl3 $1,r1,r3 # ... skip over match ... - decl r0 # ... adjust count and ... - jbr 9b # ... try again -0: - movl r4,r0 # return stashed pointer - ret diff --git a/sysdeps/vax/strchr.s b/sysdeps/vax/strchr.s index 18b53838ec..1683f564e2 100644 --- a/sysdeps/vax/strchr.s +++ b/sysdeps/vax/strchr.s @@ -103,3 +103,5 @@ Lreent: beql 2f /* not found: return NULL */ movl r1,r0 2: ret + +weak_alias (strchr, index) diff --git a/sysdeps/vax/strrchr.s b/sysdeps/vax/strrchr.s index f292eaceab..dffcddaef0 100644 --- a/sysdeps/vax/strrchr.s +++ b/sysdeps/vax/strrchr.s @@ -112,3 +112,5 @@ Lreent: 3: movl r5,r0 /* return stashed pointer */ ret + +weak_alias (strrchr, rindex) |