From 03197d471033c3d3da50108461ec4dc5aab069fa Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 25 May 1999 13:26:48 +0000 Subject: Update. 1999-05-25 Ulrich Drepper * stdlib/strtol.c: Moved to ... * sysdeps/generic/strtol.c: ...here. * stdlib/strtoul.c: Moved to ... * sysdeps/generic/strtoul.c: ...here. * stdlib/strtoll.c: Moved to ... * sysdeps/generic/strtoll.c: ...here. * stdlib/strtoull.c: Moved to ... * sysdeps/generic/strtoull.c: ...here. * stdlib/strtol_l.c: Moved to ... * sysdeps/generic/strtol_l.c: ...here. * stdlib/strtoul_l.c: Moved to ... * sysdeps/generic/strtoul_l.c: ...here. * stdlib/strtoll_l.c: Moved to ... * sysdeps/generic/strtoll_l.c: ...here. * stdlib/strtoull_l.c: Moved to ... * sysdeps/generic/strtoull_l.c: ...here. * sysdeps/wordexp-64/strtol.c: New file. * sysdeps/wordexp-64/strtoul.c: New file. * sysdeps/wordexp-64/strtoll.c: New file. * sysdeps/wordexp-64/strtoull.c: New file. * sysdeps/wordexp-64/strtol_l.c: New file. * sysdeps/wordexp-64/strtoul_l.c: New file. * sysdeps/wordexp-64/strtoll_l.c: New file. * sysdeps/wordexp-64/strtoull_l.c: New file. --- ChangeLog | 28 +++ stdlib/strtol.c | 481 --------------------------------------- stdlib/strtol_l.c | 28 --- stdlib/strtoll.c | 25 -- stdlib/strtoll_l.c | 28 --- stdlib/strtoul.c | 21 -- stdlib/strtoul_l.c | 28 --- stdlib/strtoull.c | 27 --- stdlib/strtoull_l.c | 28 --- sysdeps/generic/strtol.c | 481 +++++++++++++++++++++++++++++++++++++++ sysdeps/generic/strtol_l.c | 28 +++ sysdeps/generic/strtoll.c | 25 ++ sysdeps/generic/strtoll_l.c | 28 +++ sysdeps/generic/strtoul.c | 21 ++ sysdeps/generic/strtoul_l.c | 28 +++ sysdeps/generic/strtoull.c | 27 +++ sysdeps/generic/strtoull_l.c | 28 +++ sysdeps/wordsize-64/strtol.c | 10 + sysdeps/wordsize-64/strtol_l.c | 10 + sysdeps/wordsize-64/strtoll.c | 1 + sysdeps/wordsize-64/strtoll_l.c | 1 + sysdeps/wordsize-64/strtoul.c | 10 + sysdeps/wordsize-64/strtoul_l.c | 10 + sysdeps/wordsize-64/strtoull.c | 1 + sysdeps/wordsize-64/strtoull_l.c | 1 + 25 files changed, 738 insertions(+), 666 deletions(-) delete mode 100644 stdlib/strtol.c delete mode 100644 stdlib/strtol_l.c delete mode 100644 stdlib/strtoll.c delete mode 100644 stdlib/strtoll_l.c delete mode 100644 stdlib/strtoul.c delete mode 100644 stdlib/strtoul_l.c delete mode 100644 stdlib/strtoull.c delete mode 100644 stdlib/strtoull_l.c create mode 100644 sysdeps/generic/strtol.c create mode 100644 sysdeps/generic/strtol_l.c create mode 100644 sysdeps/generic/strtoll.c create mode 100644 sysdeps/generic/strtoll_l.c create mode 100644 sysdeps/generic/strtoul.c create mode 100644 sysdeps/generic/strtoul_l.c create mode 100644 sysdeps/generic/strtoull.c create mode 100644 sysdeps/generic/strtoull_l.c create mode 100644 sysdeps/wordsize-64/strtol.c create mode 100644 sysdeps/wordsize-64/strtol_l.c create mode 100644 sysdeps/wordsize-64/strtoll.c create mode 100644 sysdeps/wordsize-64/strtoll_l.c create mode 100644 sysdeps/wordsize-64/strtoul.c create mode 100644 sysdeps/wordsize-64/strtoul_l.c create mode 100644 sysdeps/wordsize-64/strtoull.c create mode 100644 sysdeps/wordsize-64/strtoull_l.c diff --git a/ChangeLog b/ChangeLog index 519671b18a..a205ae10fd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,31 @@ +1999-05-25 Ulrich Drepper + + * stdlib/strtol.c: Moved to ... + * sysdeps/generic/strtol.c: ...here. + * stdlib/strtoul.c: Moved to ... + * sysdeps/generic/strtoul.c: ...here. + * stdlib/strtoll.c: Moved to ... + * sysdeps/generic/strtoll.c: ...here. + * stdlib/strtoull.c: Moved to ... + * sysdeps/generic/strtoull.c: ...here. + * stdlib/strtol_l.c: Moved to ... + * sysdeps/generic/strtol_l.c: ...here. + * stdlib/strtoul_l.c: Moved to ... + * sysdeps/generic/strtoul_l.c: ...here. + * stdlib/strtoll_l.c: Moved to ... + * sysdeps/generic/strtoll_l.c: ...here. + * stdlib/strtoull_l.c: Moved to ... + * sysdeps/generic/strtoull_l.c: ...here. + + * sysdeps/wordexp-64/strtol.c: New file. + * sysdeps/wordexp-64/strtoul.c: New file. + * sysdeps/wordexp-64/strtoll.c: New file. + * sysdeps/wordexp-64/strtoull.c: New file. + * sysdeps/wordexp-64/strtol_l.c: New file. + * sysdeps/wordexp-64/strtoul_l.c: New file. + * sysdeps/wordexp-64/strtoll_l.c: New file. + * sysdeps/wordexp-64/strtoull_l.c: New file. + 1999-05-24 Jakub Jelinek * sysdeps/sparc/bits/wordsize.h: New file. diff --git a/stdlib/strtol.c b/stdlib/strtol.c deleted file mode 100644 index 6ba2960f29..0000000000 --- a/stdlib/strtol.c +++ /dev/null @@ -1,481 +0,0 @@ -/* Convert string representation of a number into an integer value. - Copyright (C) 1991,92,94,95,96,97,98,99 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., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#if HAVE_CONFIG_H -# include -#endif - -#ifdef _LIBC -# define USE_NUMBER_GROUPING -# define STDC_HEADERS -# define HAVE_LIMITS_H -#endif - -#include -#include -#ifndef errno -extern int errno; -#endif -#ifndef __set_errno -# define __set_errno(Val) errno = (Val) -#endif - -#ifdef HAVE_LIMITS_H -# include -#endif - -#ifdef STDC_HEADERS -# include -# include -# include -#else -# ifndef NULL -# define NULL 0 -# endif -#endif - -#ifdef USE_NUMBER_GROUPING -# include "../locale/localeinfo.h" -#endif - -/* Nonzero if we are defining `strtoul' or `strtoull', operating on - unsigned integers. */ -#ifndef UNSIGNED -# define UNSIGNED 0 -# define INT LONG int -#else -# define INT unsigned LONG int -#endif - -/* Determine the name. */ -#ifdef USE_IN_EXTENDED_LOCALE_MODEL -# if UNSIGNED -# ifdef USE_WIDE_CHAR -# ifdef QUAD -# define strtol __wcstoull_l -# else -# define strtol __wcstoul_l -# endif -# else -# ifdef QUAD -# define strtol __strtoull_l -# else -# define strtol __strtoul_l -# endif -# endif -# else -# ifdef USE_WIDE_CHAR -# ifdef QUAD -# define strtol __wcstoll_l -# else -# define strtol __wcstol_l -# endif -# else -# ifdef QUAD -# define strtol __strtoll_l -# else -# define strtol __strtol_l -# endif -# endif -# endif -#else -# if UNSIGNED -# ifdef USE_WIDE_CHAR -# ifdef QUAD -# define strtol wcstoull -# else -# define strtol wcstoul -# endif -# else -# ifdef QUAD -# define strtol strtoull -# else -# define strtol strtoul -# endif -# endif -# else -# ifdef USE_WIDE_CHAR -# ifdef QUAD -# define strtol wcstoll -# else -# define strtol wcstol -# endif -# else -# ifdef QUAD -# define strtol strtoll -# endif -# endif -# endif -#endif - -/* If QUAD is defined, we are defining `strtoll' or `strtoull', - operating on `long long int's. */ -#ifdef QUAD -# define LONG long long -# define STRTOL_LONG_MIN LONG_LONG_MIN -# define STRTOL_LONG_MAX LONG_LONG_MAX -# define STRTOL_ULONG_MAX ULONG_LONG_MAX -# if __GNUC__ == 2 && __GNUC_MINOR__ < 7 - /* Work around gcc bug with using this constant. */ - static const unsigned long long int maxquad = ULONG_LONG_MAX; -# undef STRTOL_ULONG_MAX -# define STRTOL_ULONG_MAX maxquad -# endif -#else -# define LONG long - -# ifndef ULONG_MAX -# define ULONG_MAX ((unsigned long) ~(unsigned long) 0) -# endif -# ifndef LONG_MAX -# define LONG_MAX ((long int) (ULONG_MAX >> 1)) -# endif -# define STRTOL_LONG_MIN LONG_MIN -# define STRTOL_LONG_MAX LONG_MAX -# define STRTOL_ULONG_MAX ULONG_MAX -#endif - - -/* We use this code also for the extended locale handling where the - function gets as an additional argument the locale which has to be - used. To access the values we have to redefine the _NL_CURRENT - macro. */ -#ifdef USE_IN_EXTENDED_LOCALE_MODEL -# undef _NL_CURRENT -# define _NL_CURRENT(category, item) \ - (current->values[_NL_ITEM_INDEX (item)].string) -# define LOCALE_PARAM , loc -# define LOCALE_PARAM_DECL __locale_t loc; -#else -# define LOCALE_PARAM -# define LOCALE_PARAM_DECL -#endif - -#if defined _LIBC || defined HAVE_WCHAR_H -# include -#endif - -#ifdef USE_WIDE_CHAR -# include -# define L_(Ch) L##Ch -# define UCHAR_TYPE wint_t -# define STRING_TYPE wchar_t -# ifdef USE_IN_EXTENDED_LOCALE_MODEL -# define ISSPACE(Ch) __iswspace_l ((Ch), loc) -# define ISALPHA(Ch) __iswalpha_l ((Ch), loc) -# define TOUPPER(Ch) __towupper_l ((Ch), loc) -# else -# define ISSPACE(Ch) iswspace (Ch) -# define ISALPHA(Ch) iswalpha (Ch) -# define TOUPPER(Ch) towupper (Ch) -# endif -# else -# if defined STDC_HEADERS || (!defined isascii && !defined HAVE_ISASCII) -# define IN_CTYPE_DOMAIN(c) 1 -# else -# define IN_CTYPE_DOMAIN(c) isascii(c) -# endif -# define L_(Ch) Ch -# define UCHAR_TYPE unsigned char -# define STRING_TYPE char -# ifdef USE_IN_EXTENDED_LOCALE_MODEL -# define ISSPACE(Ch) __isspace_l ((Ch), loc) -# define ISALPHA(Ch) __isalpha_l ((Ch), loc) -# define TOUPPER(Ch) __toupper_l ((Ch), loc) -# else -# define ISSPACE(Ch) (IN_CTYPE_DOMAIN (Ch) && isspace (Ch)) -# define ISALPHA(Ch) (IN_CTYPE_DOMAIN (Ch) && isalpha (Ch)) -# define TOUPPER(Ch) (IN_CTYPE_DOMAIN (Ch) ? toupper (Ch) : (Ch)) -# endif -#endif - -#ifdef __STDC__ -# define INTERNAL(X) INTERNAL1(X) -# define INTERNAL1(X) __##X##_internal -# define WEAKNAME(X) WEAKNAME1(X) -#else -# define INTERNAL(X) __/**/X/**/_internal -#endif - -#ifdef USE_NUMBER_GROUPING -/* This file defines a function to check for correct grouping. */ -# include "grouping.h" -#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. */ - -INT -INTERNAL (strtol) (nptr, endptr, base, group LOCALE_PARAM) - const STRING_TYPE *nptr; - STRING_TYPE **endptr; - int base; - int group; - LOCALE_PARAM_DECL -{ - int negative; - register unsigned LONG int cutoff; - register unsigned int cutlim; - register unsigned LONG int i; - register const STRING_TYPE *s; - register UCHAR_TYPE c; - const STRING_TYPE *save, *end; - int overflow; - -#ifdef USE_NUMBER_GROUPING -# ifdef USE_IN_EXTENDED_LOCALE_MODEL - struct locale_data *current = loc->__locales[LC_NUMERIC]; -# endif - /* The thousands character of the current locale. */ - wchar_t thousands = L'\0'; - /* The numeric grouping specification of the current locale, - in the format described in . */ - const char *grouping; - - if (group) - { - grouping = _NL_CURRENT (LC_NUMERIC, GROUPING); - if (*grouping <= 0 || *grouping == CHAR_MAX) - grouping = NULL; - else - { - /* Figure out the thousands separator character. */ -# if defined _LIBC || defined _HAVE_BTOWC - thousands = __btowc (*_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP)); - if (thousands == WEOF) - thousands = L'\0'; -# endif - if (thousands == L'\0') - grouping = NULL; - } - } - else - grouping = NULL; -#endif - - if (base < 0 || base == 1 || base > 36) - { - __set_errno (EINVAL); - return 0; - } - - save = s = nptr; - - /* Skip white space. */ - while (ISSPACE (*s)) - ++s; - if (*s == L_('\0')) - goto noconv; - - /* Check for a sign. */ - if (*s == L_('-')) - { - negative = 1; - ++s; - } - else if (*s == L_('+')) - { - negative = 0; - ++s; - } - else - negative = 0; - - /* Recognize number prefix and if BASE is zero, figure it out ourselves. */ - if (*s == L_('0')) - { - if ((base == 0 || base == 16) && TOUPPER (s[1]) == L_('X')) - { - s += 2; - base = 16; - } - else if (base == 0) - base = 8; - } - else if (base == 0) - base = 10; - - /* Save the pointer so we can check later if anything happened. */ - save = s; - -#ifdef USE_NUMBER_GROUPING - if (group) - { - /* Find the end of the digit string and check its grouping. */ - end = s; - for (c = *end; c != L_('\0'); c = *++end) - if ((wchar_t) c != thousands - && ((wchar_t) c < L_('0') || (wchar_t) c > L_('9')) - && (!ISALPHA (c) || (int) (TOUPPER (c) - L_('A') + 10) >= base)) - break; - if (*s == thousands) - end = s; - else - end = correctly_grouped_prefix (s, end, thousands, grouping); - } - else -#endif - end = NULL; - - cutoff = STRTOL_ULONG_MAX / (unsigned LONG int) base; - cutlim = STRTOL_ULONG_MAX % (unsigned LONG int) base; - - overflow = 0; - i = 0; - c = *s; - if (sizeof (long int) != sizeof (LONG int)) - { - unsigned long int j = 0; - - for (;c != L_('\0'); c = *++s) - { - if (s == end) - break; - if (c >= L_('0') && c <= L_('9')) - c -= L_('0'); - else if (ISALPHA (c)) - c = TOUPPER (c) - L_('A') + 10; - else - break; - if ((int) c >= base) - break; - /* Note that we never can have an overflow. */ - else - { - unsigned long int jj = j * (unsigned long int) base; - if (jj < j) - { - /* We have an overflow. Now use the long representation. */ - i = (unsigned LONG int) j; - goto use_long; - } - j = jj; - j += c; - } - } - - i = (unsigned LONG int) j; - } - else - for (;c != L_('\0'); c = *++s) - { - if (s == end) - break; - if (c >= L_('0') && c <= L_('9')) - c -= L_('0'); - else if (ISALPHA (c)) - c = TOUPPER (c) - L_('A') + 10; - else - break; - if ((int) c >= base) - break; - /* Check for overflow. */ - if (i > cutoff || (i == cutoff && c > cutlim)) - overflow = 1; - else - { - use_long: - i *= (unsigned LONG int) 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 = (STRING_TYPE *) s; - -#if !UNSIGNED - /* Check for a value that is within the range of - `unsigned LONG int', but outside the range of `LONG int'. */ - if (overflow == 0 - && i > (negative - ? -((unsigned LONG int) (STRTOL_LONG_MIN + 1)) + 1 - : (unsigned LONG int) STRTOL_LONG_MAX)) - overflow = 1; -#endif - - if (overflow) - { - __set_errno (ERANGE); -#if UNSIGNED - return STRTOL_ULONG_MAX; -#else - return negative ? STRTOL_LONG_MIN : STRTOL_LONG_MAX; -#endif - } - - /* Return the result of the appropriate sign. */ - return negative ? -i : i; - -noconv: - /* We must handle a special case here: the base is 0 or 16 and the - first two characters are '0' and 'x', but the rest are no - hexadecimal digits. This is no error case. We return 0 and - ENDPTR points to the `x`. */ - if (endptr != NULL) - { - if (save - nptr >= 2 && TOUPPER (save[-1]) == L_('X') - && save[-2] == L_('0')) - *endptr = (STRING_TYPE *) &save[-1]; - else - /* There was no number to convert. */ - *endptr = (STRING_TYPE *) nptr; - } - - return 0L; -} - -/* External user entry point. */ - -#if _LIBC - 0 == 0 -# undef PARAMS -# if defined (__STDC__) && __STDC__ -# define PARAMS(Args) Args -# else -# define PARAMS(Args) () -# endif - -/* Prototype. */ -INT strtol PARAMS ((const STRING_TYPE *nptr, STRING_TYPE **endptr, int base)); -#endif - - -INT -#ifdef weak_function -weak_function -#endif -strtol (nptr, endptr, base LOCALE_PARAM) - const STRING_TYPE *nptr; - STRING_TYPE **endptr; - int base; - LOCALE_PARAM_DECL -{ - return INTERNAL (strtol) (nptr, endptr, base, 0 LOCALE_PARAM); -} diff --git a/stdlib/strtol_l.c b/stdlib/strtol_l.c deleted file mode 100644 index f6f9bd8dcf..0000000000 --- a/stdlib/strtol_l.c +++ /dev/null @@ -1,28 +0,0 @@ -/* Convert string representing a number to integer value, using given locale. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - 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., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#define USE_IN_EXTENDED_LOCALE_MODEL 1 - -#include - -extern long int ____strtol_l_internal (const char *, char **, int, int, - __locale_t); - -#include diff --git a/stdlib/strtoll.c b/stdlib/strtoll.c deleted file mode 100644 index cfa98c841f..0000000000 --- a/stdlib/strtoll.c +++ /dev/null @@ -1,25 +0,0 @@ -/* Function to parse a `long long int' from text. - Copyright (C) 1995, 1996, 1997, 1999 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., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#define QUAD 1 - -#include - -strong_alias (__strtoll_internal, __strtoq_internal) -weak_alias (strtoll, strtoq) diff --git a/stdlib/strtoll_l.c b/stdlib/strtoll_l.c deleted file mode 100644 index 2372b844d5..0000000000 --- a/stdlib/strtoll_l.c +++ /dev/null @@ -1,28 +0,0 @@ -/* Convert string representing a number to integer value, using given locale. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - 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., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#define USE_IN_EXTENDED_LOCALE_MODEL 1 - -#include - -extern long long int ____strtoll_l_internal (const char *, char **, int, int, - __locale_t); - -#include diff --git a/stdlib/strtoul.c b/stdlib/strtoul.c deleted file mode 100644 index f1e0e16667..0000000000 --- a/stdlib/strtoul.c +++ /dev/null @@ -1,21 +0,0 @@ -/* Copyright (C) 1991, 1997 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., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#define UNSIGNED 1 - -#include diff --git a/stdlib/strtoul_l.c b/stdlib/strtoul_l.c deleted file mode 100644 index c64c0c0097..0000000000 --- a/stdlib/strtoul_l.c +++ /dev/null @@ -1,28 +0,0 @@ -/* Convert string representing a number to integer value, using given locale. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - 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., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#define USE_IN_EXTENDED_LOCALE_MODEL 1 - -#include - -extern unsigned long int ____strtoul_l_internal (const char *, char **, int, - int, __locale_t); - -#include diff --git a/stdlib/strtoull.c b/stdlib/strtoull.c deleted file mode 100644 index 80ccf91c5e..0000000000 --- a/stdlib/strtoull.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Function to parse an `unsigned long long int' from text. - Copyright (C) 1995, 1996, 1997, 1999 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., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#define QUAD 1 - -#include - -#ifdef _LIBC -strong_alias (__strtoull_internal, __strtouq_internal) -weak_alias (strtoull, strtouq) -#endif diff --git a/stdlib/strtoull_l.c b/stdlib/strtoull_l.c deleted file mode 100644 index 59d6fd7a37..0000000000 --- a/stdlib/strtoull_l.c +++ /dev/null @@ -1,28 +0,0 @@ -/* Convert string representing a number to integer value, using given locale. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - 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., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#define USE_IN_EXTENDED_LOCALE_MODEL 1 - -#include - -extern unsigned long long int ____strtoull_l_internal (const char *, char **, - int, int, __locale_t); - -#include diff --git a/sysdeps/generic/strtol.c b/sysdeps/generic/strtol.c new file mode 100644 index 0000000000..6ba2960f29 --- /dev/null +++ b/sysdeps/generic/strtol.c @@ -0,0 +1,481 @@ +/* Convert string representation of a number into an integer value. + Copyright (C) 1991,92,94,95,96,97,98,99 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., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#if HAVE_CONFIG_H +# include +#endif + +#ifdef _LIBC +# define USE_NUMBER_GROUPING +# define STDC_HEADERS +# define HAVE_LIMITS_H +#endif + +#include +#include +#ifndef errno +extern int errno; +#endif +#ifndef __set_errno +# define __set_errno(Val) errno = (Val) +#endif + +#ifdef HAVE_LIMITS_H +# include +#endif + +#ifdef STDC_HEADERS +# include +# include +# include +#else +# ifndef NULL +# define NULL 0 +# endif +#endif + +#ifdef USE_NUMBER_GROUPING +# include "../locale/localeinfo.h" +#endif + +/* Nonzero if we are defining `strtoul' or `strtoull', operating on + unsigned integers. */ +#ifndef UNSIGNED +# define UNSIGNED 0 +# define INT LONG int +#else +# define INT unsigned LONG int +#endif + +/* Determine the name. */ +#ifdef USE_IN_EXTENDED_LOCALE_MODEL +# if UNSIGNED +# ifdef USE_WIDE_CHAR +# ifdef QUAD +# define strtol __wcstoull_l +# else +# define strtol __wcstoul_l +# endif +# else +# ifdef QUAD +# define strtol __strtoull_l +# else +# define strtol __strtoul_l +# endif +# endif +# else +# ifdef USE_WIDE_CHAR +# ifdef QUAD +# define strtol __wcstoll_l +# else +# define strtol __wcstol_l +# endif +# else +# ifdef QUAD +# define strtol __strtoll_l +# else +# define strtol __strtol_l +# endif +# endif +# endif +#else +# if UNSIGNED +# ifdef USE_WIDE_CHAR +# ifdef QUAD +# define strtol wcstoull +# else +# define strtol wcstoul +# endif +# else +# ifdef QUAD +# define strtol strtoull +# else +# define strtol strtoul +# endif +# endif +# else +# ifdef USE_WIDE_CHAR +# ifdef QUAD +# define strtol wcstoll +# else +# define strtol wcstol +# endif +# else +# ifdef QUAD +# define strtol strtoll +# endif +# endif +# endif +#endif + +/* If QUAD is defined, we are defining `strtoll' or `strtoull', + operating on `long long int's. */ +#ifdef QUAD +# define LONG long long +# define STRTOL_LONG_MIN LONG_LONG_MIN +# define STRTOL_LONG_MAX LONG_LONG_MAX +# define STRTOL_ULONG_MAX ULONG_LONG_MAX +# if __GNUC__ == 2 && __GNUC_MINOR__ < 7 + /* Work around gcc bug with using this constant. */ + static const unsigned long long int maxquad = ULONG_LONG_MAX; +# undef STRTOL_ULONG_MAX +# define STRTOL_ULONG_MAX maxquad +# endif +#else +# define LONG long + +# ifndef ULONG_MAX +# define ULONG_MAX ((unsigned long) ~(unsigned long) 0) +# endif +# ifndef LONG_MAX +# define LONG_MAX ((long int) (ULONG_MAX >> 1)) +# endif +# define STRTOL_LONG_MIN LONG_MIN +# define STRTOL_LONG_MAX LONG_MAX +# define STRTOL_ULONG_MAX ULONG_MAX +#endif + + +/* We use this code also for the extended locale handling where the + function gets as an additional argument the locale which has to be + used. To access the values we have to redefine the _NL_CURRENT + macro. */ +#ifdef USE_IN_EXTENDED_LOCALE_MODEL +# undef _NL_CURRENT +# define _NL_CURRENT(category, item) \ + (current->values[_NL_ITEM_INDEX (item)].string) +# define LOCALE_PARAM , loc +# define LOCALE_PARAM_DECL __locale_t loc; +#else +# define LOCALE_PARAM +# define LOCALE_PARAM_DECL +#endif + +#if defined _LIBC || defined HAVE_WCHAR_H +# include +#endif + +#ifdef USE_WIDE_CHAR +# include +# define L_(Ch) L##Ch +# define UCHAR_TYPE wint_t +# define STRING_TYPE wchar_t +# ifdef USE_IN_EXTENDED_LOCALE_MODEL +# define ISSPACE(Ch) __iswspace_l ((Ch), loc) +# define ISALPHA(Ch) __iswalpha_l ((Ch), loc) +# define TOUPPER(Ch) __towupper_l ((Ch), loc) +# else +# define ISSPACE(Ch) iswspace (Ch) +# define ISALPHA(Ch) iswalpha (Ch) +# define TOUPPER(Ch) towupper (Ch) +# endif +# else +# if defined STDC_HEADERS || (!defined isascii && !defined HAVE_ISASCII) +# define IN_CTYPE_DOMAIN(c) 1 +# else +# define IN_CTYPE_DOMAIN(c) isascii(c) +# endif +# define L_(Ch) Ch +# define UCHAR_TYPE unsigned char +# define STRING_TYPE char +# ifdef USE_IN_EXTENDED_LOCALE_MODEL +# define ISSPACE(Ch) __isspace_l ((Ch), loc) +# define ISALPHA(Ch) __isalpha_l ((Ch), loc) +# define TOUPPER(Ch) __toupper_l ((Ch), loc) +# else +# define ISSPACE(Ch) (IN_CTYPE_DOMAIN (Ch) && isspace (Ch)) +# define ISALPHA(Ch) (IN_CTYPE_DOMAIN (Ch) && isalpha (Ch)) +# define TOUPPER(Ch) (IN_CTYPE_DOMAIN (Ch) ? toupper (Ch) : (Ch)) +# endif +#endif + +#ifdef __STDC__ +# define INTERNAL(X) INTERNAL1(X) +# define INTERNAL1(X) __##X##_internal +# define WEAKNAME(X) WEAKNAME1(X) +#else +# define INTERNAL(X) __/**/X/**/_internal +#endif + +#ifdef USE_NUMBER_GROUPING +/* This file defines a function to check for correct grouping. */ +# include "grouping.h" +#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. */ + +INT +INTERNAL (strtol) (nptr, endptr, base, group LOCALE_PARAM) + const STRING_TYPE *nptr; + STRING_TYPE **endptr; + int base; + int group; + LOCALE_PARAM_DECL +{ + int negative; + register unsigned LONG int cutoff; + register unsigned int cutlim; + register unsigned LONG int i; + register const STRING_TYPE *s; + register UCHAR_TYPE c; + const STRING_TYPE *save, *end; + int overflow; + +#ifdef USE_NUMBER_GROUPING +# ifdef USE_IN_EXTENDED_LOCALE_MODEL + struct locale_data *current = loc->__locales[LC_NUMERIC]; +# endif + /* The thousands character of the current locale. */ + wchar_t thousands = L'\0'; + /* The numeric grouping specification of the current locale, + in the format described in . */ + const char *grouping; + + if (group) + { + grouping = _NL_CURRENT (LC_NUMERIC, GROUPING); + if (*grouping <= 0 || *grouping == CHAR_MAX) + grouping = NULL; + else + { + /* Figure out the thousands separator character. */ +# if defined _LIBC || defined _HAVE_BTOWC + thousands = __btowc (*_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP)); + if (thousands == WEOF) + thousands = L'\0'; +# endif + if (thousands == L'\0') + grouping = NULL; + } + } + else + grouping = NULL; +#endif + + if (base < 0 || base == 1 || base > 36) + { + __set_errno (EINVAL); + return 0; + } + + save = s = nptr; + + /* Skip white space. */ + while (ISSPACE (*s)) + ++s; + if (*s == L_('\0')) + goto noconv; + + /* Check for a sign. */ + if (*s == L_('-')) + { + negative = 1; + ++s; + } + else if (*s == L_('+')) + { + negative = 0; + ++s; + } + else + negative = 0; + + /* Recognize number prefix and if BASE is zero, figure it out ourselves. */ + if (*s == L_('0')) + { + if ((base == 0 || base == 16) && TOUPPER (s[1]) == L_('X')) + { + s += 2; + base = 16; + } + else if (base == 0) + base = 8; + } + else if (base == 0) + base = 10; + + /* Save the pointer so we can check later if anything happened. */ + save = s; + +#ifdef USE_NUMBER_GROUPING + if (group) + { + /* Find the end of the digit string and check its grouping. */ + end = s; + for (c = *end; c != L_('\0'); c = *++end) + if ((wchar_t) c != thousands + && ((wchar_t) c < L_('0') || (wchar_t) c > L_('9')) + && (!ISALPHA (c) || (int) (TOUPPER (c) - L_('A') + 10) >= base)) + break; + if (*s == thousands) + end = s; + else + end = correctly_grouped_prefix (s, end, thousands, grouping); + } + else +#endif + end = NULL; + + cutoff = STRTOL_ULONG_MAX / (unsigned LONG int) base; + cutlim = STRTOL_ULONG_MAX % (unsigned LONG int) base; + + overflow = 0; + i = 0; + c = *s; + if (sizeof (long int) != sizeof (LONG int)) + { + unsigned long int j = 0; + + for (;c != L_('\0'); c = *++s) + { + if (s == end) + break; + if (c >= L_('0') && c <= L_('9')) + c -= L_('0'); + else if (ISALPHA (c)) + c = TOUPPER (c) - L_('A') + 10; + else + break; + if ((int) c >= base) + break; + /* Note that we never can have an overflow. */ + else + { + unsigned long int jj = j * (unsigned long int) base; + if (jj < j) + { + /* We have an overflow. Now use the long representation. */ + i = (unsigned LONG int) j; + goto use_long; + } + j = jj; + j += c; + } + } + + i = (unsigned LONG int) j; + } + else + for (;c != L_('\0'); c = *++s) + { + if (s == end) + break; + if (c >= L_('0') && c <= L_('9')) + c -= L_('0'); + else if (ISALPHA (c)) + c = TOUPPER (c) - L_('A') + 10; + else + break; + if ((int) c >= base) + break; + /* Check for overflow. */ + if (i > cutoff || (i == cutoff && c > cutlim)) + overflow = 1; + else + { + use_long: + i *= (unsigned LONG int) 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 = (STRING_TYPE *) s; + +#if !UNSIGNED + /* Check for a value that is within the range of + `unsigned LONG int', but outside the range of `LONG int'. */ + if (overflow == 0 + && i > (negative + ? -((unsigned LONG int) (STRTOL_LONG_MIN + 1)) + 1 + : (unsigned LONG int) STRTOL_LONG_MAX)) + overflow = 1; +#endif + + if (overflow) + { + __set_errno (ERANGE); +#if UNSIGNED + return STRTOL_ULONG_MAX; +#else + return negative ? STRTOL_LONG_MIN : STRTOL_LONG_MAX; +#endif + } + + /* Return the result of the appropriate sign. */ + return negative ? -i : i; + +noconv: + /* We must handle a special case here: the base is 0 or 16 and the + first two characters are '0' and 'x', but the rest are no + hexadecimal digits. This is no error case. We return 0 and + ENDPTR points to the `x`. */ + if (endptr != NULL) + { + if (save - nptr >= 2 && TOUPPER (save[-1]) == L_('X') + && save[-2] == L_('0')) + *endptr = (STRING_TYPE *) &save[-1]; + else + /* There was no number to convert. */ + *endptr = (STRING_TYPE *) nptr; + } + + return 0L; +} + +/* External user entry point. */ + +#if _LIBC - 0 == 0 +# undef PARAMS +# if defined (__STDC__) && __STDC__ +# define PARAMS(Args) Args +# else +# define PARAMS(Args) () +# endif + +/* Prototype. */ +INT strtol PARAMS ((const STRING_TYPE *nptr, STRING_TYPE **endptr, int base)); +#endif + + +INT +#ifdef weak_function +weak_function +#endif +strtol (nptr, endptr, base LOCALE_PARAM) + const STRING_TYPE *nptr; + STRING_TYPE **endptr; + int base; + LOCALE_PARAM_DECL +{ + return INTERNAL (strtol) (nptr, endptr, base, 0 LOCALE_PARAM); +} diff --git a/sysdeps/generic/strtol_l.c b/sysdeps/generic/strtol_l.c new file mode 100644 index 0000000000..f6f9bd8dcf --- /dev/null +++ b/sysdeps/generic/strtol_l.c @@ -0,0 +1,28 @@ +/* Convert string representing a number to integer value, using given locale. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + 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., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#define USE_IN_EXTENDED_LOCALE_MODEL 1 + +#include + +extern long int ____strtol_l_internal (const char *, char **, int, int, + __locale_t); + +#include diff --git a/sysdeps/generic/strtoll.c b/sysdeps/generic/strtoll.c new file mode 100644 index 0000000000..cfa98c841f --- /dev/null +++ b/sysdeps/generic/strtoll.c @@ -0,0 +1,25 @@ +/* Function to parse a `long long int' from text. + Copyright (C) 1995, 1996, 1997, 1999 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., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#define QUAD 1 + +#include + +strong_alias (__strtoll_internal, __strtoq_internal) +weak_alias (strtoll, strtoq) diff --git a/sysdeps/generic/strtoll_l.c b/sysdeps/generic/strtoll_l.c new file mode 100644 index 0000000000..2372b844d5 --- /dev/null +++ b/sysdeps/generic/strtoll_l.c @@ -0,0 +1,28 @@ +/* Convert string representing a number to integer value, using given locale. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + 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., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#define USE_IN_EXTENDED_LOCALE_MODEL 1 + +#include + +extern long long int ____strtoll_l_internal (const char *, char **, int, int, + __locale_t); + +#include diff --git a/sysdeps/generic/strtoul.c b/sysdeps/generic/strtoul.c new file mode 100644 index 0000000000..f1e0e16667 --- /dev/null +++ b/sysdeps/generic/strtoul.c @@ -0,0 +1,21 @@ +/* Copyright (C) 1991, 1997 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., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#define UNSIGNED 1 + +#include diff --git a/sysdeps/generic/strtoul_l.c b/sysdeps/generic/strtoul_l.c new file mode 100644 index 0000000000..c64c0c0097 --- /dev/null +++ b/sysdeps/generic/strtoul_l.c @@ -0,0 +1,28 @@ +/* Convert string representing a number to integer value, using given locale. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + 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., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#define USE_IN_EXTENDED_LOCALE_MODEL 1 + +#include + +extern unsigned long int ____strtoul_l_internal (const char *, char **, int, + int, __locale_t); + +#include diff --git a/sysdeps/generic/strtoull.c b/sysdeps/generic/strtoull.c new file mode 100644 index 0000000000..80ccf91c5e --- /dev/null +++ b/sysdeps/generic/strtoull.c @@ -0,0 +1,27 @@ +/* Function to parse an `unsigned long long int' from text. + Copyright (C) 1995, 1996, 1997, 1999 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., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#define QUAD 1 + +#include + +#ifdef _LIBC +strong_alias (__strtoull_internal, __strtouq_internal) +weak_alias (strtoull, strtouq) +#endif diff --git a/sysdeps/generic/strtoull_l.c b/sysdeps/generic/strtoull_l.c new file mode 100644 index 0000000000..59d6fd7a37 --- /dev/null +++ b/sysdeps/generic/strtoull_l.c @@ -0,0 +1,28 @@ +/* Convert string representing a number to integer value, using given locale. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + 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., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#define USE_IN_EXTENDED_LOCALE_MODEL 1 + +#include + +extern unsigned long long int ____strtoull_l_internal (const char *, char **, + int, int, __locale_t); + +#include diff --git a/sysdeps/wordsize-64/strtol.c b/sysdeps/wordsize-64/strtol.c new file mode 100644 index 0000000000..2a18f7a642 --- /dev/null +++ b/sysdeps/wordsize-64/strtol.c @@ -0,0 +1,10 @@ +/* We have to irritate the compiler a bit. */ +#define __strtoll_internal __strtoll_internal_XXX +#define strtoll strtoll_XXX + +#include + +#undef __strtoll_internal +#undef strtoll +strong_alias (__strtol_internal, __strtoll_internal) +weak_alias (__strtoll_internal, strtoll) diff --git a/sysdeps/wordsize-64/strtol_l.c b/sysdeps/wordsize-64/strtol_l.c new file mode 100644 index 0000000000..a2de0247fd --- /dev/null +++ b/sysdeps/wordsize-64/strtol_l.c @@ -0,0 +1,10 @@ +/* We have to irritate the compiler a bit. */ +#define ____strtoll_l_internal ____strtoll_l_internal_XXX +#define __strtoll_l __strtoll_l_XXX + +#include + +#undef ____strtoll_l_internal +#undef __strtoll_l +strong_alias (____strtol_l_internal, ____strtoll_l_internal) +weak_alias (____strtoll_l_internal, __strtoll_l) diff --git a/sysdeps/wordsize-64/strtoll.c b/sysdeps/wordsize-64/strtoll.c new file mode 100644 index 0000000000..c943e6af34 --- /dev/null +++ b/sysdeps/wordsize-64/strtoll.c @@ -0,0 +1 @@ +/* Not needed, it's the same as strtol. */ diff --git a/sysdeps/wordsize-64/strtoll_l.c b/sysdeps/wordsize-64/strtoll_l.c new file mode 100644 index 0000000000..5a5d0d0c6b --- /dev/null +++ b/sysdeps/wordsize-64/strtoll_l.c @@ -0,0 +1 @@ +/* Not needed, it's the same as __strtol_l. */ diff --git a/sysdeps/wordsize-64/strtoul.c b/sysdeps/wordsize-64/strtoul.c new file mode 100644 index 0000000000..838474f436 --- /dev/null +++ b/sysdeps/wordsize-64/strtoul.c @@ -0,0 +1,10 @@ +/* We have to irritate the compiler a bit. */ +#define __strtoull_internal __strtoull_internal_XXX +#define strtoull strtoull_XXX + +#include + +#undef __strtoull_internal +#undef strtoull +strong_alias (__strtoul_internal, __strtoull_internal) +weak_alias (__strtoull_internal, strtoull) diff --git a/sysdeps/wordsize-64/strtoul_l.c b/sysdeps/wordsize-64/strtoul_l.c new file mode 100644 index 0000000000..2997afa6c2 --- /dev/null +++ b/sysdeps/wordsize-64/strtoul_l.c @@ -0,0 +1,10 @@ +/* We have to irritate the compiler a bit. */ +#define ____strtoull_l_internal ____strtoull_l_internal_XXX +#define __strtoull_l __strtoull_l_XXX + +#include + +#undef ____strtoull_l_internal +#undef __strtoull_l +strong_alias (____strtoul_l_internal, ____strtoull_l_internal) +weak_alias (____strtoull_l_internal, __strtoull_l) diff --git a/sysdeps/wordsize-64/strtoull.c b/sysdeps/wordsize-64/strtoull.c new file mode 100644 index 0000000000..c472bde1ec --- /dev/null +++ b/sysdeps/wordsize-64/strtoull.c @@ -0,0 +1 @@ +/* Not needed, it's the same as strtoul. */ diff --git a/sysdeps/wordsize-64/strtoull_l.c b/sysdeps/wordsize-64/strtoull_l.c new file mode 100644 index 0000000000..c33466bb0d --- /dev/null +++ b/sysdeps/wordsize-64/strtoull_l.c @@ -0,0 +1 @@ +/* Not needed, it's the same as __strtoul_l. */ -- cgit v1.2.3