diff options
author | Manuel Novoa III <mjn3@codepoet.org> | 2003-08-01 20:08:59 +0000 |
---|---|---|
committer | Manuel Novoa III <mjn3@codepoet.org> | 2003-08-01 20:08:59 +0000 |
commit | 1217289737588e65b088b3535428b27c7287d699 (patch) | |
tree | 6a292ac767d219702e26a6a2111737f84a96900c /include | |
parent | 32b76c5ec3c257b7287913d0d1a96e0cbb2e9c6a (diff) |
Add a new *scanf implementation, includeing the *wscanf functions.
Should be standards compliant and with several optional features,
including support for hexadecimal float notation, locale awareness,
glibc-like locale-specific digit grouping with the `'' flag, and
positional arg support. I tested it pretty well (finding several
bugs in glibc's scanf in the process), but it is brand new so be
aware.
The *wprintf functions now support floating point output. Also, a
couple of bugs were squashed. Finally, %a/%A conversions are
now implemented.
Implement the glibc xlocale interface for thread-specific locale
support. Also add the various *_l(args, locale_t loc_arg) funcs.
NOTE!!! setlocale() is NOT threadsafe! NOTE!!!
The strto{floating point} conversion functions are now locale aware.
The also now support hexadecimal floating point notation.
Add the wcsto{floating point} conversion functions.
Fix a bug in mktime() related to dst. Note that unlike glibc's mktime,
uClibc's version always normalizes the struct tm before attempting
to determine the correct dst setting if tm_isdst == -1 on entry.
Add a stub version of the libintl functions. (untested)
Fixed a known memory leak in setlocale() related to the collation data.
Add lots of new config options (which Erik agreed to sort out :-),
including finally exposing some of the stripped down stdio configs.
Be careful with those though, as they haven't been tested in a
long time.
(temporary) GOTCHAs...
The ctype functions are currently incorrect for 8-bit locales. They
will be fixed shortly.
The ctype functions are now table-based, resulting in larger staticly
linked binaries. I'll be adding an option to use the old approach
in the stub locale configuration.
Diffstat (limited to 'include')
-rw-r--r-- | include/ctype.h | 443 | ||||
-rw-r--r-- | include/langinfo.h | 9 | ||||
-rw-r--r-- | include/libintl.h | 126 | ||||
-rw-r--r-- | include/locale.h | 97 | ||||
-rw-r--r-- | include/signal.h | 2 | ||||
-rw-r--r-- | include/stdio.h | 16 | ||||
-rw-r--r-- | include/stdlib.h | 313 | ||||
-rw-r--r-- | include/string.h | 75 | ||||
-rw-r--r-- | include/sys/cdefs.h | 48 | ||||
-rw-r--r-- | include/time.h | 90 | ||||
-rw-r--r-- | include/wchar.h | 411 | ||||
-rw-r--r-- | include/wctype.h | 108 | ||||
-rw-r--r-- | include/xlocale.h | 62 |
13 files changed, 1336 insertions, 464 deletions
diff --git a/include/ctype.h b/include/ctype.h index c6faf3d9b..23ff199e4 100644 --- a/include/ctype.h +++ b/include/ctype.h @@ -1,129 +1,382 @@ -/* Copyright (C) 2002 Manuel Novoa III +/* Copyright (C) 1991,92,93,95,96,97,98,99,2001,02 + 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* + * ISO C99 Standard 7.4: Character handling <ctype.h> + */ + +#ifndef _CTYPE_H +#define _CTYPE_H 1 + +#include <features.h> +#include <bits/types.h> + +__BEGIN_DECLS + +#ifndef _ISbit +/* These are all the characteristics of characters. + If there get to be more than 16 distinct characteristics, + many things must be changed that use `__uint16_t's. */ + +# define _ISbit(bit) (1 << (bit)) + +enum +{ + _ISupper = _ISbit (0), /* UPPERCASE. */ + _ISlower = _ISbit (1), /* lowercase. */ + _ISalpha = _ISbit (2), /* Alphabetic. */ + _ISdigit = _ISbit (3), /* Numeric. */ + _ISxdigit = _ISbit (4), /* Hexadecimal numeric. */ + _ISspace = _ISbit (5), /* Whitespace. */ + _ISprint = _ISbit (6), /* Printing. */ + _ISgraph = _ISbit (7), /* Graphical. */ + _ISblank = _ISbit (8), /* Blank (usually SPC and TAB). */ + _IScntrl = _ISbit (9), /* Control character. */ + _ISpunct = _ISbit (10), /* Punctuation. */ + _ISalnum = _ISbit (11) /* Alphanumeric. */ +}; +#else +#error _ISbit already defined! +#endif /* ! _ISbit */ + +#include <bits/uClibc_touplow.h> + +#ifdef __UCLIBC_HAS_CTYPE_SIGNED__ +# define __UCLIBC_CTYPE_IN_TO_DOMAIN(c) (((unsigned int)((c) + 128)) < 384) + +#else /* __UCLIBC_HAS_CTYPE_SIGNED__ */ +# define __UCLIBC_CTYPE_IN_TO_DOMAIN(c) (((unsigned int)(c)) < 256) + +#endif /* __UCLIBC_HAS_CTYPE_SIGNED__ */ + +/* In the thread-specific locale model (see `uselocale' in <locale.h>) + we cannot use global variables for these as was done in the past. + Instead, the following accessor functions return the address of + each variable, which is local to the current thread if multithreaded. + + These point into arrays of 384, so they can be indexed by any `unsigned + char' value [0,255]; by EOF (-1); or by any `signed char' value + [-128,-1). ISO C requires that the ctype functions work for `unsigned + char' values and for EOF; we also support negative `signed char' values + for broken old programs. The case conversion arrays are of `int's + rather than `unsigned char's because tolower (EOF) must be EOF, which + doesn't fit into an `unsigned char'. But today more important is that + the arrays are also used for multi-byte character sets. */ + +/* uClibc differences: + * + * When __UCLIBC_HAS_CTYPE_SIGNED is defined, * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * The upper and lower mapping arrays are type int16_t, so that + * they may store all char values plus EOF. The glibc reasoning + * given above for these being type int is questionable, as the + * ctype mapping functions map from the set of (unsigned) char + * and EOF back into the set. They have no awareness of multi-byte + * or wide characters. * - * 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. + * Otherwise, * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * The ctype array is defined for -1..255. + * The upper and lower mapping arrays are defined for 0..255. + * The upper and lower mapping arrays are type unsigned char. */ -/* NOTE: It is assumed here and throughout the library that the underlying - * char encoding for the portable C character set is ASCII (host & target). */ +/* Pointers to the default C-locale data. */ +extern const __uint16_t *__C_ctype_b; +extern const __ctype_touplow_t *__C_ctype_toupper; +extern const __ctype_touplow_t *__C_ctype_tolower; -#ifndef _CTYPE_H -#define _CTYPE_H +#ifdef __UCLIBC_HAS_XLOCALE__ -#include <features.h> -#include <bits/uClibc_ctype.h> +extern __const __uint16_t **__ctype_b_loc (void) + __attribute__ ((__const)); +extern __const __ctype_touplow_t **__ctype_tolower_loc (void) + __attribute__ ((__const)); +extern __const __ctype_touplow_t **__ctype_toupper_loc (void) + __attribute__ ((__const)); -__BEGIN_DECLS +#define __UCLIBC_CTYPE_B (*__ctype_b_loc()) +#define __UCLIBC_CTYPE_TOLOWER (*__ctype_tolower_loc()) +#define __UCLIBC_CTYPE_TOUPPER (*__ctype_toupper_loc()) -extern int isalnum(int c) __THROW; -extern int isalpha(int c) __THROW; -#ifdef __USE_ISOC99 -extern int isblank(int c) __THROW; -#endif -extern int iscntrl(int c) __THROW; -extern int isdigit(int c) __THROW; -extern int isgraph(int c) __THROW; -extern int islower(int c) __THROW; -extern int isprint(int c) __THROW; -extern int ispunct(int c) __THROW; -extern int isspace(int c) __THROW; -extern int isupper(int c) __THROW; -extern int isxdigit(int c) __THROW; - -extern int tolower(int c) __THROW; -extern int toupper(int c) __THROW; +#else /* __UCLIBC_HAS_XLOCALE__ */ -#if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN -extern int isascii(int c) __THROW; -extern int toascii(int c) __THROW; -#endif +/* Pointers to the current global locale data in use. */ +extern const __uint16_t *__ctype_b; +extern const __ctype_touplow_t *__ctype_toupper; +extern const __ctype_touplow_t *__ctype_tolower; + +#define __UCLIBC_CTYPE_B (__ctype_b) +#define __UCLIBC_CTYPE_TOLOWER (__ctype_tolower) +#define __UCLIBC_CTYPE_TOUPPER (__ctype_toupper) + +#endif /* __UCLIBC_HAS_XLOCALE__ */ + +#define __isctype(c, type) \ + ((__UCLIBC_CTYPE_B)[(int) (c)] & (__uint16_t) type) + +#define __isascii(c) (((c) & ~0x7f) == 0) /* If C is a 7 bit value. */ +#define __toascii(c) ((c) & 0x7f) /* Mask off high bits. */ -/* The following are included for compatibility with older versions of - * uClibc; but now they're only visible if MISC funcctionality is requested. - * However, as they are locale-independent, the hidden macro versions are - * always present. */ #ifdef __USE_MISC -extern int isxlower(int c) __THROW; /* uClibc-specific. */ -extern int isxupper(int c) __THROW; /* uClibc-specific. */ + +/* The following are included for compatibility with older versions of + * uClibc; but now they're only visible if MISC funcctionality is requested. */ +extern int isxlower(int c) __THROW; +extern int isxupper(int c) __THROW; + +/* isdigit() is really locale-invariant, so provide some small fast macros. + * These are uClibc-specific. */ +#define __isdigit_char(C) (((unsigned char)((C) - '0')) <= 9) +#define __isdigit_int(C) (((unsigned int)((C) - '0')) <= 9) + #endif -/* Next, some ctype macros which are valid for all supported locales. */ -/* WARNING: isspace and isblank need to be reverified if more 8-bit codesets - * are added!!! But isdigit and isxdigit are always valid. */ +#define __exctype(name) extern int name (int) __THROW -#define __isspace(c) __C_isspace(c) -#define __isblank(c) __C_isblank(c) +__BEGIN_NAMESPACE_STD -#define __isdigit(c) __C_isdigit(c) -#define __isxdigit(c) __C_isxdigit(c) +/* The following names are all functions: + int isCHARACTERISTIC(int c); + which return nonzero iff C has CHARACTERISTIC. + For the meaning of the characteristic names, see the `enum' above. */ +__exctype (isalnum); +__exctype (isalpha); +__exctype (iscntrl); +__exctype (isdigit); +__exctype (islower); +__exctype (isgraph); +__exctype (isprint); +__exctype (ispunct); +__exctype (isspace); +__exctype (isupper); +__exctype (isxdigit); -/* Now some non-ansi/iso c99 macros. */ -#define __isascii(c) (((c) & ~0x7f) == 0) -#define __toascii(c) ((c) & 0x7f) -#define _toupper(c) ((c) ^ 0x20) -#define _tolower(c) ((c) | 0x20) +/* Return the lowercase version of C. */ +extern int tolower (int __c) __THROW; +/* Return the uppercase version of C. */ +extern int toupper (int __c) __THROW; -/* For compatibility with older versions of uClibc. Are these ever used? */ -#define __isxlower(c) __C_isxlower(c) /* uClibc-specific. */ -#define __isxupper(c) __C_isxupper(c) /* uClibc-specific. */ +__END_NAMESPACE_STD -/* Apparently, glibc implements things as macros if __NO_CTYPE isn't defined. - * If we don't have locale support, we'll do the same. Otherwise, we'll - * only use macros for the supported-locale-invariant cases. */ -#if 0 -/* Currently broken, since masking macros, other than getc and putc, must - * evaluate their args exactly once. Will be fixed by the next release. mjn3 */ -/* #ifndef __NO_CTYPE */ -#define isdigit(c) __isdigit(c) -#define isxdigit(c) __isxdigit(c) -#define isspace(c) __isspace(c) -#ifdef __USE_ISOC99 -#define isblank(c) __isblank(c) -#endif +/* ISO C99 introduced one new function. */ +#ifdef __USE_ISOC99 +__BEGIN_NAMESPACE_C99 -#if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN -#define isascii(c) __isascii(c) -#define toascii(c) __toascii(c) +__exctype (isblank); + +__END_NAMESPACE_C99 #endif -#ifdef __USE_MISC -#define isxlower(c) __C_isxlower(c) /* uClibc-specific. */ -#define isxupper(c) __C_isxupper(c) /* uClibc-specific. */ +#ifdef __USE_GNU +/* Test C for a set of character classes according to MASK. */ +extern int isctype (int __c, int __mask) __THROW; #endif -/* TODO - Should test for 8-bit codesets instead, but currently impossible. */ -#ifndef __UCLIBC_HAS_LOCALE__ +#if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN + +/* Return nonzero iff C is in the ASCII set + (i.e., is no more than 7 bits wide). */ +extern int isascii (int __c) __THROW; + +/* Return the part of C that is in the ASCII set + (i.e., the low-order 7 bits of C). */ +extern int toascii (int __c) __THROW; + +/* These are the same as `toupper' and `tolower' except that they do not + check the argument for being in the range of a `char'. */ +__exctype (_toupper); +__exctype (_tolower); +#endif /* Use SVID or use misc. */ + +/* This code is needed for the optimized mapping functions. */ +#define __tobody(c, f, a, args) \ + (__extension__ \ + ({ int __res; \ + if (sizeof (c) > 1) \ + { \ + if (__builtin_constant_p (c)) \ + { \ + int __c = (c); \ + __res = __UCLIBC_CTYPE_IN_TO_DOMAIN(__c) ? (a)[__c] : __c; \ + } \ + else \ + __res = f args; \ + } \ + else \ + __res = (a)[(int) (c)]; \ + __res; })) + +#if !defined __NO_CTYPE && !defined __cplusplus +# define isalnum(c) __isctype((c), _ISalnum) +# define isalpha(c) __isctype((c), _ISalpha) +# define iscntrl(c) __isctype((c), _IScntrl) +# define isdigit(c) __isctype((c), _ISdigit) +# define islower(c) __isctype((c), _ISlower) +# define isgraph(c) __isctype((c), _ISgraph) +# define isprint(c) __isctype((c), _ISprint) +# define ispunct(c) __isctype((c), _ISpunct) +# define isspace(c) __isctype((c), _ISspace) +# define isupper(c) __isctype((c), _ISupper) +# define isxdigit(c) __isctype((c), _ISxdigit) + +# ifdef __USE_ISOC99 +# define isblank(c) __isctype((c), _ISblank) +# endif + +# ifdef __USE_EXTERN_INLINES +extern __inline int +tolower (int __c) __THROW +{ + return __UCLIBC_CTYPE_IN_TO_DOMAIN(__c) ? (__UCLIBC_CTYPE_TOLOWER)[__c] : __c; +} + +extern __inline int +toupper (int __c) __THROW +{ + return __UCLIBC_CTYPE_IN_TO_DOMAIN(__c) ? (__UCLIBC_CTYPE_TOUPPER)[__c] : __c; +} +# endif + +# if __GNUC__ >= 2 && defined __OPTIMIZE__ && !defined __cplusplus +# define tolower(c) __tobody (c, tolower, __UCLIBC_CTYPE_TOLOWER, (c)) +# define toupper(c) __tobody (c, toupper, __UCLIBC_CTYPE_TOUPPER, (c)) +# endif /* Optimizing gcc */ + +# if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN +# define isascii(c) __isascii (c) +# define toascii(c) __toascii (c) + +# define _tolower(c) ((int) (__UCLIBC_CTYPE_TOLOWER)[(int) (c)]) +# define _toupper(c) ((int) (__UCLIBC_CTYPE_TOUPPER)[(int) (c)]) +# endif + +#endif /* Not __NO_CTYPE. */ + + +#if defined(__USE_GNU) && defined(__UCLIBC_HAS_XLOCALE__) +/* The concept of one static locale per category is not very well + thought out. Many applications will need to process its data using + information from several different locales. Another application is + the implementation of the internationalization handling in the + upcoming ISO C++ standard library. To support this another set of + the functions using locale data exist which have an additional + argument. + + Attention: all these functions are *not* standardized in any form. + This is a proof-of-concept implementation. */ + +/* Structure for reentrant locale using functions. This is an + (almost) opaque type for the user level programs. */ +# include <xlocale.h> + +/* These definitions are similar to the ones above but all functions + take as an argument a handle for the locale which shall be used. */ +# define __isctype_l(c, type, locale) \ + ((locale)->__ctype_b[(int) (c)] & (__uint16_t) type) + +# define __exctype_l(name) \ + extern int name (int, __locale_t) __THROW + +/* The following names are all functions: + int isCHARACTERISTIC(int c, locale_t *locale); + which return nonzero iff C has CHARACTERISTIC. + For the meaning of the characteristic names, see the `enum' above. */ +__exctype_l (isalnum_l); +__exctype_l (isalpha_l); +__exctype_l (iscntrl_l); +__exctype_l (isdigit_l); +__exctype_l (islower_l); +__exctype_l (isgraph_l); +__exctype_l (isprint_l); +__exctype_l (ispunct_l); +__exctype_l (isspace_l); +__exctype_l (isupper_l); +__exctype_l (isxdigit_l); + +__exctype_l (isblank_l); + + +/* Return the lowercase version of C in locale L. */ +extern int __tolower_l (int __c, __locale_t __l) __THROW; +extern int tolower_l (int __c, __locale_t __l) __THROW; + +/* Return the uppercase version of C. */ +extern int __toupper_l (int __c, __locale_t __l) __THROW; +extern int toupper_l (int __c, __locale_t __l) __THROW; + +# if __GNUC__ >= 2 && defined __OPTIMIZE__ && !defined __cplusplus +# define __tolower_l(c, locale) \ + __tobody (c, __tolower_l, (locale)->__ctype_tolower, (c, locale)) +# define __toupper_l(c, locale) \ + __tobody (c, __toupper_l, (locale)->__ctype_toupper, (c, locale)) +# define tolower_l(c, locale) __tolower_l ((c), (locale)) +# define toupper_l(c, locale) __toupper_l ((c), (locale)) +# endif /* Optimizing gcc */ + + +# ifndef __NO_CTYPE +# define __isalnum_l(c,l) __isctype_l((c), _ISalnum, (l)) +# define __isalpha_l(c,l) __isctype_l((c), _ISalpha, (l)) +# define __iscntrl_l(c,l) __isctype_l((c), _IScntrl, (l)) +# define __isdigit_l(c,l) __isctype_l((c), _ISdigit, (l)) +# define __islower_l(c,l) __isctype_l((c), _ISlower, (l)) +# define __isgraph_l(c,l) __isctype_l((c), _ISgraph, (l)) +# define __isprint_l(c,l) __isctype_l((c), _ISprint, (l)) +# define __ispunct_l(c,l) __isctype_l((c), _ISpunct, (l)) +# define __isspace_l(c,l) __isctype_l((c), _ISspace, (l)) +# define __isupper_l(c,l) __isctype_l((c), _ISupper, (l)) +# define __isxdigit_l(c,l) __isctype_l((c), _ISxdigit, (l)) + +# define __isblank_l(c,l) __isctype_l((c), _ISblank, (l)) + +# if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN +# define __isascii_l(c,l) ((l), __isascii (c)) +# define __toascii_l(c,l) ((l), __toascii (c)) +# endif + +# define isalnum_l(c,l) __isalnum_l ((c), (l)) +# define isalpha_l(c,l) __isalpha_l ((c), (l)) +# define iscntrl_l(c,l) __iscntrl_l ((c), (l)) +# define isdigit_l(c,l) __isdigit_l ((c), (l)) +# define islower_l(c,l) __islower_l ((c), (l)) +# define isgraph_l(c,l) __isgraph_l ((c), (l)) +# define isprint_l(c,l) __isprint_l ((c), (l)) +# define ispunct_l(c,l) __ispunct_l ((c), (l)) +# define isspace_l(c,l) __isspace_l ((c), (l)) +# define isupper_l(c,l) __isupper_l ((c), (l)) +# define isxdigit_l(c,l) __isxdigit_l ((c), (l)) -#define isalnum(c) __C_isalnum(c) -#define isalpha(c) __C_isalpha(c) -#define iscntrl(c) __C_iscntrl(c) -#define isgraph(c) __C_isgraph(c) -#define islower(c) __C_islower(c) -#define isprint(c) __C_isprint(c) -#define ispunct(c) __C_ispunct(c) -#define isupper(c) __C_isupper(c) +# define isblank_l(c,l) __isblank_l ((c), (l)) -#define tolower(c) __C_tolower(c) -#define toupper(c) __C_toupper(c) +# if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN +# define isascii_l(c,l) __isascii_l ((c), (l)) +# define toascii_l(c,l) __toascii_l ((c), (l)) +# endif -#endif /* __UCLIBC_HAS_LOCALE__ */ +# endif /* Not __NO_CTYPE. */ -#endif /* __NO_CTYPE */ +#endif /* Use GNU. */ __END_DECLS -#endif /* _CTYPE_H */ +#endif /* ctype.h */ diff --git a/include/langinfo.h b/include/langinfo.h index a57a871c5..a129c12ae 100644 --- a/include/langinfo.h +++ b/include/langinfo.h @@ -605,8 +605,8 @@ enum extern char *nl_langinfo (nl_item __item) __THROW; -#if 0 -/*#ifdef __USE_GNU*/ +#ifdef __UCLIBC_HAS_XLOCALE__ +#ifdef __USE_GNU /* This interface is for the extended locale model. See <locale.h> for more information. */ @@ -614,8 +614,9 @@ extern char *nl_langinfo (nl_item __item) __THROW; # include <xlocale.h> /* Just like nl_langinfo but get the information from the locale object L. */ -extern char *__nl_langinfo_l (nl_item __item, __locale_t l); -#endif /* 0 */ +extern char *nl_langinfo_l (nl_item __item, __locale_t l); +#endif +#endif __END_DECLS diff --git a/include/libintl.h b/include/libintl.h index ae1ac88e8..89db38f3b 100644 --- a/include/libintl.h +++ b/include/libintl.h @@ -1,18 +1,122 @@ -/* Message catalog support for internationalization is not currently - * provided by uClibc, and so I have added macros here to disable it. - * Sorry about that. - */ +/* Message catalogs for internationalization. + Copyright (C) 1995-1999, 2000-2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + This file is derived from the file libgettext.h in the GNU gettext package. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ #ifndef _LIBINTL_H #define _LIBINTL_H 1 -#undef bindtextdomain -#define bindtextdomain(Domain, Directory) /* empty */ -#undef textdomain -#define textdomain(Domain) /* empty */ -#define _(Text) (Text) -#define N_(Text) (Text) +#include <features.h> + +/* We define an additional symbol to signal that we use the GNU + implementation of gettext. */ +#define __USE_GNU_GETTEXT 1 + +/* Provide information about the supported file formats. Returns the + maximum minor revision number supported for a given major revision. */ +#define __GNU_GETTEXT_SUPPORTED_REVISION(major) \ + ((major) == 0 ? 1 : -1) + +__BEGIN_DECLS + +/* Look up MSGID in the current default message catalog for the current + LC_MESSAGES locale. If not found, returns MSGID itself (the default + text). */ +extern char *gettext (__const char *__msgid) __THROW; + +/* Look up MSGID in the DOMAINNAME message catalog for the current + LC_MESSAGES locale. */ +extern char *dgettext (__const char *__domainname, __const char *__msgid) + __THROW; +extern char *__dgettext (__const char *__domainname, __const char *__msgid) + __THROW __attribute_format_arg__ (2); + +/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY + locale. */ +extern char *dcgettext (__const char *__domainname, + __const char *__msgid, int __category) __THROW; +extern char *__dcgettext (__const char *__domainname, + __const char *__msgid, int __category) + __THROW __attribute_format_arg__ (2); + + +/* Similar to `gettext' but select the plural form corresponding to the + number N. */ +extern char *ngettext (__const char *__msgid1, __const char *__msgid2, + unsigned long int __n) + __THROW __attribute_format_arg__ (1) __attribute_format_arg__ (2); + +/* Similar to `dgettext' but select the plural form corresponding to the + number N. */ +extern char *dngettext (__const char *__domainname, __const char *__msgid1, + __const char *__msgid2, unsigned long int __n) + __THROW __attribute_format_arg__ (2) __attribute_format_arg__ (3); + +/* Similar to `dcgettext' but select the plural form corresponding to the + number N. */ +extern char *dcngettext (__const char *__domainname, __const char *__msgid1, + __const char *__msgid2, unsigned long int __n, + int __category) + __THROW __attribute_format_arg__ (2) __attribute_format_arg__ (3); + + +/* Set the current default message catalog to DOMAINNAME. + If DOMAINNAME is null, return the current default. + If DOMAINNAME is "", reset to the default of "messages". */ +extern char *textdomain (__const char *__domainname) __THROW; + +/* Specify that the DOMAINNAME message catalog will be found + in DIRNAME rather than in the system locale data base. */ +extern char *bindtextdomain (__const char *__domainname, + __const char *__dirname) __THROW; + +/* Specify the character encoding in which the messages from the + DOMAINNAME message catalog will be returned. */ +extern char *bind_textdomain_codeset (__const char *__domainname, + __const char *__codeset) __THROW; + + +/* Optimized version of the function above. */ +#if defined __OPTIMIZE__ + +/* We need NULL for `gettext'. */ +# define __need_NULL +# include <stddef.h> + +/* We need LC_MESSAGES for `dgettext'. */ +# include <locale.h> + +/* These must be macros. Inlined functions are useless because the + `__builtin_constant_p' predicate in dcgettext would always return + false. */ + +# define gettext(msgid) dgettext (NULL, msgid) + +# define dgettext(domainname, msgid) \ + dcgettext (domainname, msgid, LC_MESSAGES) + +# define ngettext(msgid1, msgid2, n) dngettext (NULL, msgid1, msgid2, n) + +# define dngettext(domainname, msgid1, msgid2, n) \ + dcngettext (domainname, msgid1, msgid2, n, LC_MESSAGES) +#endif /* Optimizing. */ -#endif /* _LIBINTL_H */ +__END_DECLS +#endif /* libintl.h */ diff --git a/include/locale.h b/include/locale.h index 1101bb15a..02d33a0d4 100644 --- a/include/locale.h +++ b/include/locale.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991,92,1995-1999,2000,2001 Free Software Foundation, Inc. +/* Copyright (C) 1991,92,95-99,2000,01,02 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 @@ -39,13 +39,15 @@ __BEGIN_DECLS #define LC_COLLATE __LC_COLLATE #define LC_MONETARY __LC_MONETARY #define LC_MESSAGES __LC_MESSAGES -/* #define LC_PAPER __LC_PAPER */ -/* #define LC_NAME __LC_NAME */ -/* #define LC_ADDRESS __LC_ADDRESS */ -/* #define LC_TELEPHONE __LC_TELEPHONE */ -/* #define LC_MEASUREMENT __LC_MEASUREMENT */ -/* #define LC_IDENTIFICATION __LC_IDENTIFICATION */ -#define LC_ALL __LC_ALL +#if 0 +#define LC_PAPER __LC_PAPER +#define LC_NAME __LC_NAME +#define LC_ADDRESS __LC_ADDRESS +#define LC_TELEPHONE __LC_TELEPHONE +#define LC_MEASUREMENT __LC_MEASUREMENT +#define LC_IDENTIFICATION __LC_IDENTIFICATION +#endif +#define LC_ALL __LC_ALL /* Structure giving information about numeric and monetary notation. */ @@ -119,14 +121,18 @@ struct lconv }; +__BEGIN_NAMESPACE_STD + /* Set and/or return the current locale. */ extern char *setlocale (int __category, __const char *__locale) __THROW; /* Return the numeric/monetary information for the current locale. */ extern struct lconv *localeconv (void) __THROW; -#if 0 -/* #ifdef __USE_GNU */ +__END_NAMESPACE_STD + + +#if defined(__USE_GNU) && defined(__UCLIBC_HAS_XLOCALE__) /* The concept of one static locale per category is not very well thought out. Many applications will need to process its data using information from several different locales. Another application is @@ -141,22 +147,77 @@ extern struct lconv *localeconv (void) __THROW; /* Get locale datatype definition. */ # include <xlocale.h> +typedef __locale_t locale_t; + /* Return a reference to a data structure representing a set of locale datasets. Unlike for the CATEGORY parameter for `setlocale' the - CATEGORY_MASK parameter here uses a single bit for each category. - I.e., 1 << LC_CTYPE means to load data for this category. If - BASE is non-null the appropriate category information in the BASE - record is replaced. */ -extern __locale_t __newlocale (int __category_mask, __const char *__locale, - __locale_t __base) __THROW; + CATEGORY_MASK parameter here uses a single bit for each category, + made by OR'ing together LC_*_MASK bits above. */ +extern __locale_t newlocale (int __category_mask, __const char *__locale, + __locale_t __base) __THROW; + +/* These are the bits that can be set in the CATEGORY_MASK argument to + `newlocale'. In the GNU implementation, LC_FOO_MASK has the value + of (1 << LC_FOO), but this is not a part of the interface that + callers can assume will be true. */ +# define LC_CTYPE_MASK (1 << __LC_CTYPE) +# define LC_NUMERIC_MASK (1 << __LC_NUMERIC) +# define LC_TIME_MASK (1 << __LC_TIME) +# define LC_COLLATE_MASK (1 << __LC_COLLATE) +# define LC_MONETARY_MASK (1 << __LC_MONETARY) +# define LC_MESSAGES_MASK (1 << __LC_MESSAGES) +#ifdef L_newlocale +#warning mask defines for extra locale categories +#endif /* L_newlocale - uClibc note */ +#ifdef LC_PAPER +# define LC_PAPER_MASK (1 << __LC_PAPER) +# define LC_NAME_MASK (1 << __LC_NAME) +# define LC_ADDRESS_MASK (1 << __LC_ADDRESS) +# define LC_TELEPHONE_MASK (1 << __LC_TELEPHONE) +# define LC_MEASUREMENT_MASK (1 << __LC_MEASUREMENT) +# define LC_IDENTIFICATION_MASK (1 << __LC_IDENTIFICATION) +# define LC_ALL_MASK (LC_CTYPE_MASK \ + | LC_NUMERIC_MASK \ + | LC_TIME_MASK \ + | LC_COLLATE_MASK \ + | LC_MONETARY_MASK \ + | LC_MESSAGES_MASK \ + | LC_PAPER_MASK \ + | LC_NAME_MASK \ + | LC_ADDRESS_MASK \ + | LC_TELEPHONE_MASK \ + | LC_MEASUREMENT_MASK \ + | LC_IDENTIFICATION_MASK \ + ) +#else /* LC_PAPER */ +# define LC_ALL_MASK (LC_CTYPE_MASK \ + | LC_NUMERIC_MASK \ + | LC_TIME_MASK \ + | LC_COLLATE_MASK \ + | LC_MONETARY_MASK \ + | LC_MESSAGES_MASK \ + ) +#endif /* LC_PAPER */ /* Return a duplicate of the set of locale in DATASET. All usage counters are increased if necessary. */ -extern __locale_t __duplocale (__locale_t __dataset) __THROW; +extern __locale_t duplocale (__locale_t __dataset) __THROW; /* Free the data associated with a locale dataset previously returned by a call to `setlocale_r'. */ -extern void __freelocale (__locale_t __dataset) __THROW; +extern void freelocale (__locale_t __dataset) __THROW; + +/* Switch the current thread's locale to DATASET. + If DATASET is null, instead just return the current setting. + The special value LC_GLOBAL_LOCALE is the initial setting + for all threads and can also be installed any time, meaning + the thread uses the global settings controlled by `setlocale'. */ +extern __locale_t uselocale (__locale_t __dataset) __THROW; + +/* This value can be passed to `uselocale' and may be returned by it. + Passing this value to any other function has undefined behavior. */ +# define LC_GLOBAL_LOCALE ((__locale_t) -1L) + #endif __END_DECLS diff --git a/include/signal.h b/include/signal.h index f0a24dbcf..7793cdbe1 100644 --- a/include/signal.h +++ b/include/signal.h @@ -273,10 +273,12 @@ extern int sigqueue (__pid_t __pid, int __sig, __const union sigval __val) #ifdef __USE_BSD +#ifdef __UCLIBC_HAS_SYS_SIGLIST__ /* Names of the signals. This variable exists only for compatibility. Use `strsignal' instead (see <string.h>). */ extern __const char *__const _sys_siglist[_NSIG]; extern __const char *__const sys_siglist[_NSIG]; +#endif /* __UCLIBC_HAS_SYS_SIGLIST__ */ /* Structure passed to `sigvec'. */ struct sigvec diff --git a/include/stdio.h b/include/stdio.h index 3e27707ae..b11394da7 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -355,12 +355,19 @@ extern int getchar (void) __THROW; /* The C standard explicitly says this is a macro, so we always do the optimization for it. */ +#ifdef __UCLIBC_HAS_THREADS__ +#define getc(_fp) (getc)(_fp) /* SUSv3 says getc must be threadsafe. */ +#else /* __UCLIBC_HAS_THREADS__ */ #define getc(_fp) __GETC(_fp) +#endif /* __UCLIBC_HAS_THREADS__ */ #if defined __USE_POSIX || defined __USE_MISC /* These are defined in POSIX.1:1996. */ extern int getc_unlocked (FILE *__stream) __THROW; extern int getchar_unlocked (void) __THROW; + +/* SUSv3 allows getc_unlocked to be a macro */ +#define getc_unlocked(_fp) __GETC(_fp) #endif /* Use POSIX or MISC. */ #ifdef __USE_MISC @@ -378,7 +385,11 @@ extern int putchar (int __c) __THROW; /* The C standard explicitly says this can be a macro, so we always do the optimization for it. */ +#ifdef __UCLIBC_HAS_THREADS__ +#define putc(_ch, _fp) (putc)(_ch, _fp) /* SUSv3 says putc must be threadsafe. */ +#else /* __UCLIBC_HAS_THREADS__ */ #define putc(_ch, _fp) __PUTC(_ch, _fp) +#endif /* __UCLIBC_HAS_THREADS__ */ #ifdef __USE_MISC /* Faster version when locking is not necessary. */ @@ -389,6 +400,9 @@ extern int fputc_unlocked (int __c, FILE *__stream) __THROW; /* These are defined in POSIX.1:1996. */ extern int putc_unlocked (int __c, FILE *__stream) __THROW; extern int putchar_unlocked (int __c) __THROW; + +/* SUSv3 allows putc_unlocked to be a macro */ +#define putc_unlocked(_ch, _fp) __PUTC(_ch, _fp) #endif /* Use POSIX or MISC. */ @@ -544,6 +558,7 @@ extern int ferror_unlocked (FILE *__stream) __THROW; /* Print a message describing the meaning of the value of errno. */ extern void perror (__const char *__s) __THROW; +#ifdef __UCLIBC_HAS_SYS_ERRLIST__ /* These variables normally should not be used directly. The `strerror' function provides all the needed functionality. */ #ifdef __USE_BSD @@ -555,6 +570,7 @@ extern __const char *__const sys_errlist[]; extern int _sys_nerr; extern __const char *__const _sys_errlist[]; #endif +#endif /* __UCLIBC_HAS_SYS_ERRLIST__ */ #ifdef __USE_POSIX diff --git a/include/stdlib.h b/include/stdlib.h index ac73fc143..f7589d7ea 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-1999, 2000, 2001 Free Software Foundation, Inc. +/* Copyright (C) 1991-2002, 2003 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 @@ -92,6 +92,7 @@ typedef union # define WIFSTOPPED(status) __WIFSTOPPED(__WAIT_INT(status)) #endif /* X/Open and <sys/wait.h> not included. */ +__BEGIN_NAMESPACE_STD /* Returned by `div'. */ typedef struct { @@ -108,8 +109,10 @@ typedef struct } ldiv_t; # define __ldiv_t_defined 1 #endif +__END_NAMESPACE_STD #if defined __USE_ISOC99 && !defined __lldiv_t_defined +__BEGIN_NAMESPACE_C99 /* Returned by `lldiv'. */ __extension__ typedef struct { @@ -117,6 +120,7 @@ __extension__ typedef struct long long int rem; /* Remainder. */ } lldiv_t; # define __lldiv_t_defined 1 +__END_NAMESPACE_C99 #endif @@ -130,12 +134,17 @@ __extension__ typedef struct #define EXIT_SUCCESS 0 /* Successful exit status. */ +/* Maximum length of a multibyte character in the current locale. */ +/* #define MB_CUR_MAX (__ctype_get_mb_cur_max ()) */ +/* extern size_t __ctype_get_mb_cur_max (void) __THROW; */ #ifdef __UCLIBC_HAS_WCHAR__ /* Maximum length of a multibyte character in the current locale. */ #define MB_CUR_MAX (_stdlib_mb_cur_max ()) extern size_t _stdlib_mb_cur_max (void) __THROW; #endif + +__BEGIN_NAMESPACE_STD #ifdef __UCLIBC_HAS_FLOATS__ /* Convert a string to a floating-point number. */ extern double atof (__const char *__nptr) __THROW __attribute_pure__; @@ -144,28 +153,36 @@ extern double atof (__const char *__nptr) __THROW __attribute_pure__; extern int atoi (__const char *__nptr) __THROW __attribute_pure__; /* Convert a string to a long integer. */ extern long int atol (__const char *__nptr) __THROW __attribute_pure__; +__END_NAMESPACE_STD -#if defined __USE_ISOC99 || (defined __GNUC__ && defined __USE_MISC) +#if defined __USE_ISOC99 || (defined __GLIBC_HAVE_LONG_LONG && defined __USE_MISC) +__BEGIN_NAMESPACE_C99 /* Convert a string to a long long integer. */ __extension__ extern long long int atoll (__const char *__nptr) __THROW __attribute_pure__; +__END_NAMESPACE_C99 #endif +#endif /* __UCLIBC_HAS_FLOATS__ */ #ifdef __UCLIBC_HAS_FLOATS__ +__BEGIN_NAMESPACE_STD /* Convert a string to a floating-point number. */ extern double strtod (__const char *__restrict __nptr, char **__restrict __endptr) __THROW; +__END_NAMESPACE_STD #ifdef __USE_ISOC99 +__BEGIN_NAMESPACE_C99 /* Likewise for `float' and `long double' sizes of floating-point numbers. */ extern float strtof (__const char *__restrict __nptr, char **__restrict __endptr) __THROW; extern long double strtold (__const char *__restrict __nptr, char **__restrict __endptr) __THROW; +__END_NAMESPACE_C99 #endif -#endif /* __UCLIBC_HAS_FLOATS__ */ +__BEGIN_NAMESPACE_STD /* Convert a string to a long integer. */ extern long int strtol (__const char *__restrict __nptr, char **__restrict __endptr, int __base) __THROW; @@ -173,8 +190,9 @@ extern long int strtol (__const char *__restrict __nptr, extern unsigned long int strtoul (__const char *__restrict __nptr, char **__restrict __endptr, int __base) __THROW; +__END_NAMESPACE_C99 -#if defined __GNUC__ && defined __USE_BSD +#if defined __GLIBC_HAVE_LONG_LONG && defined __USE_BSD /* Convert a string to a quadword integer. */ __extension__ extern long long int strtoq (__const char *__restrict __nptr, @@ -186,9 +204,8 @@ extern unsigned long long int strtouq (__const char *__restrict __nptr, __THROW; #endif /* GCC and use BSD. */ -#if defined __USE_ISOC99 || (defined __GNUC__ && defined __USE_MISC) -/* These functions will part of the standard C library in ISO C99. */ - +#if defined __USE_ISOC99 || (defined __GLIBC_HAVE_LONG_LONG && defined __USE_MISC) +__BEGIN_NAMESPACE_C99 /* Convert a string to a quadword integer. */ __extension__ extern long long int strtoll (__const char *__restrict __nptr, @@ -198,10 +215,11 @@ __extension__ extern unsigned long long int strtoull (__const char *__restrict __nptr, char **__restrict __endptr, int __base) __THROW; +__END_NAMESPACE_C99 #endif /* ISO C99 or GCC and use MISC. */ -#if 0 +#ifdef __UCLIBC_HAS_XLOCALE__ #ifdef __USE_GNU /* The concept of one static locale per category is not very well thought out. Many applications will need to process its data using @@ -220,44 +238,43 @@ extern unsigned long long int strtoull (__const char *__restrict __nptr, /* Special versions of the functions above which take the locale to use as an additional parameter. */ -extern long int __strtol_l (__const char *__restrict __nptr, - char **__restrict __endptr, int __base, - __locale_t __loc) __THROW; +extern long int strtol_l (__const char *__restrict __nptr, + char **__restrict __endptr, int __base, + __locale_t __loc) __THROW; -extern unsigned long int __strtoul_l (__const char *__restrict __nptr, - char **__restrict __endptr, - int __base, __locale_t __loc) __THROW; +extern unsigned long int strtoul_l (__const char *__restrict __nptr, + char **__restrict __endptr, + int __base, __locale_t __loc) __THROW; __extension__ -extern long long int __strtoll_l (__const char *__restrict __nptr, - char **__restrict __endptr, int __base, - __locale_t __loc) __THROW; +extern long long int strtoll_l (__const char *__restrict __nptr, + char **__restrict __endptr, int __base, + __locale_t __loc) __THROW; __extension__ -extern unsigned long long int __strtoull_l (__const char *__restrict __nptr, - char **__restrict __endptr, - int __base, __locale_t __loc) +extern unsigned long long int strtoull_l (__const char *__restrict __nptr, + char **__restrict __endptr, + int __base, __locale_t __loc) __THROW; -extern double __strtod_l (__const char *__restrict __nptr, - char **__restrict __endptr, __locale_t __loc) +extern double strtod_l (__const char *__restrict __nptr, + char **__restrict __endptr, __locale_t __loc) __THROW; -extern float __strtof_l (__const char *__restrict __nptr, - char **__restrict __endptr, __locale_t __loc) __THROW; +extern float strtof_l (__const char *__restrict __nptr, + char **__restrict __endptr, __locale_t __loc) __THROW; -extern long double __strtold_l (__const char *__restrict __nptr, - char **__restrict __endptr, - __locale_t __loc) __THROW; +extern long double strtold_l (__const char *__restrict __nptr, + char **__restrict __endptr, + __locale_t __loc) __THROW; #endif /* GNU */ -#endif /* 0 */ +#endif /* __UCLIBC_HAS_XLOCALE__ */ #if 0 /* The internal entry points for `strtoX' take an extra flag argument saying whether or not to parse locale-dependent number grouping. */ -#ifdef __UCLIBC_HAS_FLOATS__ extern double __strtod_internal (__const char *__restrict __nptr, char **__restrict __endptr, int __group) __THROW; @@ -267,7 +284,6 @@ extern float __strtof_internal (__const char *__restrict __nptr, extern long double __strtold_internal (__const char *__restrict __nptr, char **__restrict __endptr, int __group) __THROW; -#endif /* __UCLIBC_HAS_FLOATS__ */ #ifndef __strtol_internal_defined extern long int __strtol_internal (__const char *__restrict __nptr, char **__restrict __endptr, @@ -300,72 +316,78 @@ extern unsigned long long int __strtoull_internal (__const char * #endif /* GCC */ #endif /* 0 */ -#ifdef __USE_EXTERN_INLINES -#if 0 +#if defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__ \ + && defined __USE_EXTERN_INLINES /* Define inline functions which call the internal entry points. */ -extern __inline double -strtod (__const char *__restrict __nptr, char **__restrict __endptr) __THROW -{ - return __strtod_internal (__nptr, __endptr, 0); -} -extern __inline long int -strtol (__const char *__restrict __nptr, char **__restrict __endptr, - int __base) __THROW -{ - return __strtol_internal (__nptr, __endptr, __base, 0); -} -extern __inline unsigned long int -strtoul (__const char *__restrict __nptr, char **__restrict __endptr, - int __base) __THROW -{ - return __strtoul_internal (__nptr, __endptr, __base, 0); -} - -# ifdef __USE_ISOC99 -extern __inline float -strtof (__const char *__restrict __nptr, char **__restrict __endptr) __THROW -{ - return __strtof_internal (__nptr, __endptr, 0); -} -extern __inline long double -strtold (__const char *__restrict __nptr, char **__restrict __endptr) __THROW -{ - return __strtold_internal (__nptr, __endptr, 0); -} -# endif - -# ifdef __USE_BSD -__extension__ extern __inline long long int -strtoq (__const char *__restrict __nptr, char **__restrict __endptr, - int __base) __THROW -{ - return __strtoll_internal (__nptr, __endptr, __base, 0); -} -__extension__ extern __inline unsigned long long int -strtouq (__const char *__restrict __nptr, char **__restrict __endptr, - int __base) __THROW -{ - return __strtoull_internal (__nptr, __endptr, __base, 0); -} -# endif - -# if defined __USE_MISC || defined __USE_ISOC99 -__extension__ extern __inline long long int -strtoll (__const char *__restrict __nptr, char **__restrict __endptr, - int __base) __THROW -{ - return __strtoll_internal (__nptr, __endptr, __base, 0); -} -__extension__ extern __inline unsigned long long int -strtoull (__const char * __restrict __nptr, char **__restrict __endptr, - int __base) __THROW -{ - return __strtoull_internal (__nptr, __endptr, __base, 0); -} -# endif -#endif /* 0 */ - +/* __BEGIN_NAMESPACE_STD */ +/* extern __inline double */ +/* strtod (__const char *__restrict __nptr, char **__restrict __endptr) __THROW */ +/* { */ +/* return __strtod_internal (__nptr, __endptr, 0); */ +/* } */ +/* extern __inline long int */ +/* strtol (__const char *__restrict __nptr, char **__restrict __endptr, */ +/* int __base) __THROW */ +/* { */ +/* return __strtol_internal (__nptr, __endptr, __base, 0); */ +/* } */ +/* extern __inline unsigned long int */ +/* strtoul (__const char *__restrict __nptr, char **__restrict __endptr, */ +/* int __base) __THROW */ +/* { */ +/* return __strtoul_internal (__nptr, __endptr, __base, 0); */ +/* } */ +/* __END_NAMESPACE_STD */ + +/* # ifdef __USE_ISOC99 */ +/* __BEGIN_NAMESPACE_C99 */ +/* extern __inline float */ +/* strtof (__const char *__restrict __nptr, char **__restrict __endptr) __THROW */ +/* { */ +/* return __strtof_internal (__nptr, __endptr, 0); */ +/* } */ +/* extern __inline long double */ +/* strtold (__const char *__restrict __nptr, char **__restrict __endptr) __THROW */ +/* { */ +/* return __strtold_internal (__nptr, __endptr, 0); */ +/* } */ +/* __END_NAMESPACE_C99 */ +/* # endif */ + +/* # ifdef __USE_BSD */ +/* __extension__ extern __inline long long int */ +/* strtoq (__const char *__restrict __nptr, char **__restrict __endptr, */ +/* int __base) __THROW */ +/* { */ +/* return __strtoll_internal (__nptr, __endptr, __base, 0); */ +/* } */ +/* __extension__ extern __inline unsigned long long int */ +/* strtouq (__const char *__restrict __nptr, char **__restrict __endptr, */ +/* int __base) __THROW */ +/* { */ +/* return __strtoull_internal (__nptr, __endptr, __base, 0); */ +/* } */ +/* # endif */ + +/* # if defined __USE_MISC || defined __USE_ISOC99 */ +/* __BEGIN_NAMESPACE_C99 */ +/* __extension__ extern __inline long long int */ +/* strtoll (__const char *__restrict __nptr, char **__restrict __endptr, */ +/* int __base) __THROW */ +/* { */ +/* return __strtoll_internal (__nptr, __endptr, __base, 0); */ +/* } */ +/* __extension__ extern __inline unsigned long long int */ +/* strtoull (__const char * __restrict __nptr, char **__restrict __endptr, */ +/* int __base) __THROW */ +/* { */ +/* return __strtoull_internal (__nptr, __endptr, __base, 0); */ +/* } */ +/* __END_NAMESPACE_C99 */ +/* # endif */ + +__BEGIN_NAMESPACE_STD extern __inline double atof (__const char *__nptr) __THROW { @@ -381,13 +403,16 @@ atol (__const char *__nptr) __THROW { return strtol (__nptr, (char **) NULL, 10); } +__END_NAMESPACE_STD # if defined __USE_MISC || defined __USE_ISOC99 +__BEGIN_NAMESPACE_C99 __extension__ extern __inline long long int atoll (__const char *__nptr) __THROW { return strtoll (__nptr, (char **) NULL, 10); } +__END_NAMESPACE_C99 # endif #endif /* Optimizing and Inlining. */ @@ -401,7 +426,9 @@ extern char *l64a (long int __n) __THROW; /* Read a number from a string S in base 64 as above. */ extern long int a64l (__const char *__s) __THROW __attribute_pure__; +#endif /* Use SVID || extended X/Open. */ +#if defined __USE_SVID || defined __USE_XOPEN_EXTENDED || defined __USE_BSD # include <sys/types.h> /* we need int32_t... */ /* These are the functions that actually do things. The `random', `srandom', @@ -454,13 +481,15 @@ extern int initstate_r (unsigned int __seed, char *__restrict __statebuf, extern int setstate_r (char *__restrict __statebuf, struct random_data *__restrict __buf) __THROW; # endif /* Use misc. */ -#endif /* Use SVID || extended X/Open. */ +#endif /* Use SVID || extended X/Open || BSD. */ +__BEGIN_NAMESPACE_STD /* Return a random integer between 0 and RAND_MAX inclusive. */ extern int rand (void) __THROW; /* Seed the random number generator with the given number. */ extern void srand (unsigned int __seed) __THROW; +__END_NAMESPACE_STD #ifdef __USE_POSIX /* Reentrant interface according to POSIX.1. */ @@ -541,34 +570,24 @@ extern int lcong48_r (unsigned short int __param[7], #endif /* don't just need malloc and calloc */ #ifndef __malloc_and_calloc_defined -#define __malloc_and_calloc_defined +# define __malloc_and_calloc_defined +__BEGIN_NAMESPACE_STD /* Allocate SIZE bytes of memory. */ extern void *malloc (size_t __size) __THROW __attribute_malloc__; /* Allocate NMEMB elements of SIZE bytes each, all initialized to 0. */ extern void *calloc (size_t __nmemb, size_t __size) __THROW __attribute_malloc__; -#if 0 -/* Cope with autoconf's broken AC_FUNC_MALLOC macro, which - * redefines malloc to rpl_malloc if it does not detect glibc - * style returning-a-valid-pointer-for-malloc(0) behavior. This - * calls malloc() as usual, but if __size is zero, we allocate and - * return a 1-byte block instead.... sigh... */ -static __inline void *rpl_malloc (size_t __size) -{ - if (__size == 0) { - __size++; - } - return malloc(__size); -} -#endif +__END_NAMESPACE_STD #endif #ifndef __need_malloc_and_calloc +__BEGIN_NAMESPACE_STD /* Re-allocate the previously allocated block in PTR, making the new block SIZE bytes long. */ extern void *realloc (void *__ptr, size_t __size) __THROW __attribute_malloc__; /* Free a block allocated by `malloc', `realloc' or `calloc'. */ extern void free (void *__ptr) __THROW; +__END_NAMESPACE_STD #ifdef __USE_MISC /* Free a block. An alias for `free'. (Sun Unices). */ @@ -588,23 +607,30 @@ extern void *valloc (size_t __size) __THROW __attribute_malloc__; /* Allocate memory of SIZE bytes with an alignment of ALIGNMENT. */ extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size) __THROW __attribute_malloc__; +#if 0 +/* Cope with autoconf's broken AC_FUNC_MALLOC macro, which + * redefines malloc to rpl_malloc if it does not detect glibc + * style returning-a-valid-pointer-for-malloc(0) behavior. This + * calls malloc() as usual, but if __size is zero, we allocate and + * return a 1-byte block instead.... sigh... */ +static __inline void *rpl_malloc (size_t __size) +{ + if (__size == 0) { + __size++; + } + return malloc(__size); +} +#endif #endif +__BEGIN_NAMESPACE_STD /* Abort execution and generate a core-dump. */ extern void abort (void) __THROW __attribute__ ((__noreturn__)); /* Register a function to be called when `exit' is called. */ extern int atexit (void (*__func) (void)) __THROW; - -/* The following is used by uClibc in atexit.c and sysconf.c */ -/* We have no limit when __UCLIBC_DYNAMIC_ATEXIT__ is enabled. */ -#ifdef __UCLIBC_DYNAMIC_ATEXIT__ -# define __UCLIBC_MAX_ATEXIT INT_MAX -#else -# define __UCLIBC_MAX_ATEXIT 20 -#endif - +__END_NAMESPACE_STD #ifdef __USE_MISC /* Register a function to be called with the status @@ -613,20 +639,26 @@ extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg) __THROW; #endif +__BEGIN_NAMESPACE_STD /* Call all functions registered with `atexit' and `on_exit', in the reverse of the order in which they were registered perform stdio cleanup, and terminate program execution with STATUS. */ extern void exit (int __status) __THROW __attribute__ ((__noreturn__)); +__END_NAMESPACE_STD #ifdef __USE_ISOC99 +__BEGIN_NAMESPACE_C99 /* Terminate the program with STATUS without calling any of the functions registered with `atexit' or `on_exit'. */ extern void _Exit (int __status) __THROW __attribute__ ((__noreturn__)); +__END_NAMESPACE_C99 #endif +__BEGIN_NAMESPACE_STD /* Return the value of envariable NAME, or NULL if it doesn't exist. */ extern char *getenv (__const char *__name) __THROW; +__END_NAMESPACE_STD /* This function is similar to the above but returns NULL if the programs is running with SUID or SGID enabled. */ @@ -649,6 +681,15 @@ extern int setenv (__const char *__name, __const char *__value, int __replace) extern int unsetenv (__const char *__name) __THROW; #endif +/* The following is used by uClibc in atexit.c and sysconf.c */ +/* We have no limit when __UCLIBC_DYNAMIC_ATEXIT__ is enabled. */ +#ifdef __UCLIBC_DYNAMIC_ATEXIT__ +# define __UCLIBC_MAX_ATEXIT INT_MAX +#else +# define __UCLIBC_MAX_ATEXIT 20 +#endif + + #ifdef __USE_MISC /* The `clearenv' was planned to be added to POSIX.1 but probably never made it. Nevertheless the POSIX.9 standard (POSIX bindings @@ -668,18 +709,21 @@ extern char *mktemp (char *__template) __THROW; The last six characters of TEMPLATE must be "XXXXXX"; they are replaced with a string that makes the filename unique. Returns a file descriptor open on the file for reading and writing, - or -1 if it cannot create a uniquely-named file. */ + or -1 if it cannot create a uniquely-named file. + + This function is a possible cancellation points and therefore not + marked with __THROW. */ # ifndef __USE_FILE_OFFSET64 -extern int mkstemp (char *__template) __THROW; +extern int mkstemp (char *__template); # else # ifdef __REDIRECT -extern int __REDIRECT (mkstemp, (char *__template) __THROW, mkstemp64); +extern int __REDIRECT (mkstemp, (char *__template), mkstemp64); # else # define mkstemp mkstemp64 # endif # endif # ifdef __USE_LARGEFILE64 -extern int mkstemp64 (char *__template) __THROW; +extern int mkstemp64 (char *__template); # endif #endif @@ -693,8 +737,13 @@ extern char *mkdtemp (char *__template) __THROW; #endif -/* Execute the given line as a shell command. */ -extern int system (__const char *__command) __THROW; +__BEGIN_NAMESPACE_STD +/* Execute the given line as a shell command. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int system (__const char *__command); +__END_NAMESPACE_STD #if 0 @@ -727,6 +776,7 @@ typedef __compar_fn_t comparison_fn_t; # endif #endif +__BEGIN_NAMESPACE_STD /* Do a binary search for KEY in BASE, which consists of NMEMB elements of SIZE bytes each, using COMPAR to perform the comparisons. */ extern void *bsearch (__const void *__key, __const void *__base, @@ -741,12 +791,15 @@ extern void qsort (void *__base, size_t __nmemb, size_t __size, /* Return the absolute value of X. */ extern int abs (int __x) __THROW __attribute__ ((__const__)); extern long int labs (long int __x) __THROW __attribute__ ((__const__)); +__END_NAMESPACE_STD + #ifdef __USE_ISOC99 __extension__ extern long long int llabs (long long int __x) __THROW __attribute__ ((__const__)); #endif +__BEGIN_NAMESPACE_STD /* Return the `div_t', `ldiv_t' or `lldiv_t' representation of the value of NUMER over DENOM. */ /* GCC may have built-ins for these someday. */ @@ -754,10 +807,14 @@ extern div_t div (int __numer, int __denom) __THROW __attribute__ ((__const__)); extern ldiv_t ldiv (long int __numer, long int __denom) __THROW __attribute__ ((__const__)); +__END_NAMESPACE_STD + #ifdef __USE_ISOC99 +__BEGIN_NAMESPACE_C99 __extension__ extern lldiv_t lldiv (long long int __numer, long long int __denom) __THROW __attribute__ ((__const__)); +__END_NAMESPACE_C99 #endif @@ -814,7 +871,9 @@ extern int qfcvt_r (long double __value, int __ndigit, #endif /* __UCLIBC_HAS_FLOATS__ */ #endif + #ifdef __UCLIBC_HAS_WCHAR__ +__BEGIN_NAMESPACE_STD /* Return the length of the multibyte character in S, which is no longer than N. */ extern int mblen (__const char *__s, size_t __n) __THROW; @@ -834,7 +893,9 @@ extern size_t mbstowcs (wchar_t *__restrict __pwcs, extern size_t wcstombs (char *__restrict __s, __const wchar_t *__restrict __pwcs, size_t __n) __THROW; -#endif /* def __UCLIBC_HAS_WCHAR__ */ +__END_NAMESPACE_STD +#endif /* __UCLIBC_HAS_WCHAR__ */ + #ifdef __USE_SVID /* Determine whether the string value of RESPONSE matches the affirmation diff --git a/include/string.h b/include/string.h index 8aa40f262..f3ef812bf 100644 --- a/include/string.h +++ b/include/string.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991,92,93,95,96,97,98,99,2000,2001 Free Software Foundation, Inc. +/* Copyright (C) 1991-1993, 1995-2002, 2003 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 @@ -33,6 +33,7 @@ __BEGIN_DECLS #include <stddef.h> +__BEGIN_NAMESPACE_STD /* Copy N bytes of SRC to DEST. */ extern void *memcpy (void *__restrict __dest, __const void *__restrict __src, size_t __n) __THROW; @@ -40,6 +41,7 @@ extern void *memcpy (void *__restrict __dest, correct behavior for overlapping strings. */ extern void *memmove (void *__dest, __const void *__src, size_t __n) __THROW; +__END_NAMESPACE_STD /* Copy no more than N bytes of SRC to DEST, stopping when C is found. Return the position in DEST one byte past where C was copied, @@ -51,6 +53,7 @@ extern void *memccpy (void *__restrict __dest, __const void *__restrict __src, #endif /* SVID. */ +__BEGIN_NAMESPACE_STD /* Set N bytes of S to C. */ extern void *memset (void *__s, int __c, size_t __n) __THROW; @@ -61,18 +64,20 @@ extern int memcmp (__const void *__s1, __const void *__s2, size_t __n) /* Search N bytes of S for C. */ extern void *memchr (__const void *__s, int __c, size_t __n) __THROW __attribute_pure__; +__END_NAMESPACE_STD #ifdef __USE_GNU /* Search in S for C. This is similar to `memchr' but there is no length limit. */ extern void *rawmemchr (__const void *__s, int __c) __THROW __attribute_pure__; -#endif /* Search N bytes of S for the final occurrence of C. */ extern void *memrchr (__const void *__s, int __c, size_t __n) __THROW __attribute_pure__; +#endif +__BEGIN_NAMESPACE_STD /* Copy SRC to DEST. */ extern char *strcpy (char *__restrict __dest, __const char *__restrict __src) __THROW; @@ -100,20 +105,22 @@ extern int strcoll (__const char *__s1, __const char *__s2) /* Put a transformation of SRC into no more than N bytes of DEST. */ extern size_t strxfrm (char *__restrict __dest, __const char *__restrict __src, size_t __n) __THROW; +__END_NAMESPACE_STD -#if 0 -/*#ifdef __USE_GNU*/ +#ifdef __UCLIBC_HAS_XLOCALE__ +#ifdef __USE_GNU /* The following functions are equivalent to the both above but they take the locale they use for the collation as an extra argument. This is not standardsized but something like will come. */ # include <xlocale.h> /* Compare the collated forms of S1 and S2 using rules from L. */ -extern int __strcoll_l (__const char *__s1, __const char *__s2, __locale_t __l) +extern int strcoll_l (__const char *__s1, __const char *__s2, __locale_t __l) __THROW __attribute_pure__; /* Put a transformation of SRC into no more than N bytes of DEST. */ -extern size_t __strxfrm_l (char *__dest, __const char *__src, size_t __n, - __locale_t __l) __THROW; +extern size_t strxfrm_l (char *__dest, __const char *__src, size_t __n, + __locale_t __l) __THROW; +#endif #endif #if defined __USE_SVID || defined __USE_BSD || defined __USE_XOPEN_EXTENDED @@ -152,17 +159,20 @@ extern char *strndup (__const char *__string, size_t __n) })) #endif +__BEGIN_NAMESPACE_STD /* Find the first occurrence of C in S. */ extern char *strchr (__const char *__s, int __c) __THROW __attribute_pure__; /* Find the last occurrence of C in S. */ extern char *strrchr (__const char *__s, int __c) __THROW __attribute_pure__; +__END_NAMESPACE_STD #ifdef __USE_GNU -/* This funciton is similar to `strchr'. But it returns a pointer to +/* This function is similar to `strchr'. But it returns a pointer to the closing NUL byte in case C is not found in S. */ extern char *strchrnul (__const char *__s, int __c) __THROW __attribute_pure__; #endif +__BEGIN_NAMESPACE_STD /* Return the length of the initial segment of S which consists entirely of characters not in REJECT. */ extern size_t strcspn (__const char *__s, __const char *__reject) @@ -178,15 +188,11 @@ extern char *strpbrk (__const char *__s, __const char *__accept) extern char *strstr (__const char *__haystack, __const char *__needle) __THROW __attribute_pure__; -#ifdef __USE_GNU -/* Similar to `strstr' but this function ignores the case of both strings. */ -extern char *strcasestr (__const char *__haystack, __const char *__needle) - __THROW __attribute_pure__; -#endif /* Divide S into tokens separated by characters in DELIM. */ extern char *strtok (char *__restrict __s, __const char *__restrict __delim) __THROW; +__END_NAMESPACE_STD /* Divide S into tokens separated by characters in DELIM. Information passed between calls are stored in SAVE_PTR. */ @@ -199,6 +205,12 @@ extern char *strtok_r (char *__restrict __s, __const char *__restrict __delim, #endif #ifdef __USE_GNU +/* Similar to `strstr' but this function ignores the case of both strings. */ +extern char *strcasestr (__const char *__haystack, __const char *__needle) + __THROW __attribute_pure__; +#endif + +#ifdef __USE_GNU /* Find the first occurrence of NEEDLE in HAYSTACK. NEEDLE is NEEDLELEN bytes long; HAYSTACK is HAYSTACKLEN bytes long. */ @@ -215,8 +227,10 @@ extern void *mempcpy (void *__restrict __dest, #endif +__BEGIN_NAMESPACE_STD /* Return the length of S. */ extern size_t strlen (__const char *__s) __THROW __attribute_pure__; +__END_NAMESPACE_STD #ifdef __USE_GNU /* Find the length of STRING, but scan at most MAXLEN characters. @@ -226,12 +240,17 @@ extern size_t strnlen (__const char *__string, size_t __maxlen) #endif +__BEGIN_NAMESPACE_STD /* Return a string describing the meaning of the `errno' code in ERRNUM. */ extern char *strerror (int __errnum) __THROW; - -/* Reentrant versions of `strerror'. If a temporary buffer is required, - at most BUFLEN bytes of BUF will be used. These symbols are _NOT_ intended - to be applications, and can change at any time. */ +__END_NAMESPACE_STD +#if defined __USE_XOPEN2K || defined __USE_MISC +/* Reentrant version of `strerror'. If a temporary buffer is required, at + most BUFLEN bytes of BUF will be used. */ +/* extern char *strerror_r (int __errnum, char *__buf, size_t __buflen) __THROW; */ + +/* uClibc Note: glibc's strerror_r is different from that specified in SUSv3. + * So we try to compensate based on feature macros. */ extern char *_glibc_strerror_r (int __errnum, char *__buf, size_t __buflen) __THROW; extern int _susv3_strerror_r (int __errnum, char *__buf, size_t buflen) __THROW; @@ -243,7 +262,7 @@ extern int __REDIRECT (strerror_r, # else # define strerror_r _susv3_strerror_r # endif -#elif defined(__USE_MISC) +#else /* defined(__USE_XOPEN2K) && !defined(__USE_GNU) */ # ifdef __REDIRECT extern char *__REDIRECT (strerror_r, (int __errnum, char *__buf, size_t buflen) __THROW, @@ -251,13 +270,14 @@ extern char *__REDIRECT (strerror_r, # else # define strerror_r _glibc_strerror_r # endif +#endif /* defined(__USE_XOPEN2K) && !defined(__USE_GNU) */ #endif /* We define this function always since `bzero' is sometimes needed when the namespace rules does not allow this. */ extern void __bzero (void *__s, size_t __n) __THROW; -#if defined __USE_BSD +#ifdef __USE_BSD /* Copy N bytes of SRC to DEST (like memmove, but args reversed). */ extern void bcopy (__const void *__src, void *__dest, size_t __n) __THROW; @@ -280,8 +300,7 @@ extern int ffs (int __i) __THROW __attribute__ ((__const__)); /* The following two functions are non-standard but necessary for non-32 bit platforms. */ -# if 0 -/*# ifdef __USE_GNU*/ +# ifdef __USE_GNU extern int ffsl (long int __l) __THROW __attribute__ ((__const__)); # ifdef __GNUC__ __extension__ extern int ffsll (long long int __ll) @@ -298,17 +317,18 @@ extern int strncasecmp (__const char *__s1, __const char *__s2, size_t __n) __THROW __attribute_pure__; #endif /* Use BSD. */ -#if 0 -/*#ifdef __USE_GNU*/ +#ifdef __UCLIBC_HAS_XLOCALE__ +#ifdef __USE_GNU /* Again versions of a few functions which use the given locale instead of the global one. */ -extern int __strcasecmp_l (__const char *__s1, __const char *__s2, - __locale_t __loc) __THROW __attribute_pure__; +extern int strcasecmp_l (__const char *__s1, __const char *__s2, + __locale_t __loc) __THROW __attribute_pure__; -extern int __strncasecmp_l (__const char *__s1, __const char *__s2, - size_t __n, __locale_t __loc) +extern int strncasecmp_l (__const char *__s1, __const char *__s2, + size_t __n, __locale_t __loc) __THROW __attribute_pure__; #endif +#endif #ifdef __USE_BSD /* Return the next DELIM-delimited token from *STRINGP, @@ -357,6 +377,7 @@ extern char *basename (__const char *__filename) __THROW; # endif #endif + #if 0 #if defined __GNUC__ && __GNUC__ >= 2 # if defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__ \ diff --git a/include/sys/cdefs.h b/include/sys/cdefs.h index 3ae52c7a8..18143058f 100644 --- a/include/sys/cdefs.h +++ b/include/sys/cdefs.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992,93,94,95,96,97,98,99,2000,2001,2002 Free Software Foundation, Inc. +/* Copyright (C) 1992-2001, 2002 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 @@ -85,6 +85,31 @@ #endif +/* The standard library needs the functions from the ISO C90 standard + in the std namespace. At the same time we want to be safe for + future changes and we include the ISO C99 code in the non-standard + namespace __c99. The C++ wrapper header take case of adding the + definitions to the global namespace. */ +#if defined __cplusplus && defined _GLIBCPP_USE_NAMESPACES +# define __BEGIN_NAMESPACE_STD namespace std { +# define __END_NAMESPACE_STD } +# define __USING_NAMESPACE_STD(name) using std::name; +# define __BEGIN_NAMESPACE_C99 namespace __c99 { +# define __END_NAMESPACE_C99 } +# define __USING_NAMESPACE_C99(name) using __c99::name; +#else +/* For compatibility we do not add the declarations into any + namespace. They will end up in the global namespace which is what + old code expects. */ +# define __BEGIN_NAMESPACE_STD +# define __END_NAMESPACE_STD +# define __USING_NAMESPACE_STD(name) +# define __BEGIN_NAMESPACE_C99 +# define __END_NAMESPACE_C99 +# define __USING_NAMESPACE_C99(name) +#endif + + /* Support for bounded pointers. */ #ifndef __BOUNDED_POINTERS__ # define __bounded /* nothing */ @@ -124,7 +149,8 @@ #if defined __GNUC__ && __GNUC__ >= 2 # define __REDIRECT(name, proto, alias) name proto __asm__ (__ASMNAME (#alias)) -# define __ASMNAME(cname) __C_SYMBOL_PREFIX__ cname +# define __ASMNAME(cname) __ASMNAME2 (__USER_LABEL_PREFIX__, cname) +# define __ASMNAME2(prefix, cname) __STRING (prefix) cname /* #elif __SOME_OTHER_COMPILER__ @@ -159,6 +185,24 @@ # define __attribute_pure__ /* Ignore */ #endif +/* At some point during the gcc 3.1 development the `used' attribute + for functions was introduced. We don't want to use it unconditionally + (although this would be possible) since it generates warnings. */ +#if __GNUC_PREREQ (3,1) +# define __attribute_used__ __attribute__ ((__used__)) +# define __attribute_noinline__ __attribute__ ((__noinline__)) +#else +# define __attribute_used__ __attribute__ ((__unused__)) +# define __attribute_noinline__ /* Ignore */ +#endif + +/* gcc allows marking deprecated functions. */ +#if __GNUC_PREREQ (3,2) +# define __attribute_deprecated__ __attribute__ ((__deprecated__)) +#else +# define __attribute_deprecated__ /* Ignore */ +#endif + /* At some point during the gcc 2.8 development the `format_arg' attribute for functions was introduced. We don't want to use it unconditionally (although this would be possible) since it generates warnings. diff --git a/include/time.h b/include/time.h index 5611defbb..8dc787917 100644 --- a/include/time.h +++ b/include/time.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-1999, 2000, 2001 Free Software Foundation, Inc. +/* Copyright (C) 1991-1999,2000,2001,2002,2003 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 @@ -55,8 +55,13 @@ __BEGIN_DECLS # include <bits/types.h> +__BEGIN_NAMESPACE_STD /* Returned by `clock'. */ typedef __clock_t clock_t; +__END_NAMESPACE_STD +#if defined __USE_XOPEN || defined __USE_POSIX || defined __USE_MISC +__USING_NAMESPACE_STD(clock_t) +#endif #endif /* clock_t not defined and <time.h> or need clock_t. */ #undef __need_clock_t @@ -66,8 +71,13 @@ typedef __clock_t clock_t; # include <bits/types.h> +__BEGIN_NAMESPACE_STD /* Returned by `time'. */ typedef __time_t time_t; +__END_NAMESPACE_STD +#if defined __USE_POSIX || defined __USE_MISC || defined __USE_SVID +__USING_NAMESPACE_STD(time_t) +#endif #endif /* time_t not defined and <time.h> or need time_t. */ #undef __need_time_t @@ -97,15 +107,17 @@ typedef __timer_t timer_t; #undef __need_timer_t -#if !defined __timespec_defined && \ - ((defined _TIME_H && defined __USE_POSIX199309) || defined __need_timespec) +#if !defined __timespec_defined && \ + ((defined _TIME_H && \ + (defined __USE_POSIX199309 || defined __USE_MISC)) || \ + defined __need_timespec) # define __timespec_defined 1 /* POSIX.1b structure for a time value. This is like a `struct timeval' but has nanoseconds instead of microseconds. */ struct timespec { - long int tv_sec; /* Seconds. */ + __time_t tv_sec; /* Seconds. */ long int tv_nsec; /* Nanoseconds. */ }; @@ -114,6 +126,7 @@ struct timespec #ifdef _TIME_H +__BEGIN_NAMESPACE_STD /* Used by other time functions. */ struct tm { @@ -128,15 +141,20 @@ struct tm int tm_isdst; /* DST. [-1/0/1]*/ #ifdef __UCLIBC_HAS_TM_EXTENSIONS__ -# ifdef __USE_BSD +#ifdef __USE_BSD long int tm_gmtoff; /* Seconds east of UTC. */ - __const char tm_zone[8]; /* Timezone abbreviation. */ -# else + __const char *tm_zone; /* Timezone abbreviation. */ +#else long int __tm_gmtoff; /* Seconds east of UTC. */ - __const char __tm_zone[8];/* Timezone abbreviation. */ -# endif + __const char *__tm_zone; /* Timezone abbreviation. */ +#endif + char __tm_tzname[8]; /* In uClibc, tm_zone points to __tm_tzname. */ #endif /* __UCLIBC_HAS_TM_EXTENSIONS__ */ }; +__END_NAMESPACE_STD +#if defined __USE_XOPEN || defined __USE_POSIX || defined __USE_MISC +__USING_NAMESPACE_STD(tm) +#endif #ifdef __USE_POSIX199309 @@ -160,6 +178,7 @@ typedef __pid_t pid_t; #endif +__BEGIN_NAMESPACE_STD /* Time used by the program so far (user time + system time). The result / CLOCKS_PER_SECOND is program time in seconds. */ extern clock_t clock (void) __THROW; @@ -181,6 +200,7 @@ extern time_t mktime (struct tm *__tp) __THROW; extern size_t strftime (char *__restrict __s, size_t __maxsize, __const char *__restrict __format, __const struct tm *__restrict __tp) __THROW; +__END_NAMESPACE_STD # ifdef __USE_XOPEN /* Parse S according to FORMAT and store binary time information in TP. @@ -190,7 +210,25 @@ extern char *strptime (__const char *__restrict __s, __THROW; # endif +#ifdef __UCLIBC_HAS_XLOCALE__ +# ifdef __USE_GNU +/* Similar to the two functions above but take the information from + the provided locale and not the global locale. */ +# include <xlocale.h> + +extern size_t strftime_l (char *__restrict __s, size_t __maxsize, + __const char *__restrict __format, + __const struct tm *__restrict __tp, + __locale_t __loc) __THROW; + +extern char *strptime_l (__const char *__restrict __s, + __const char *__restrict __fmt, struct tm *__tp, + __locale_t __loc) __THROW; +# endif +#endif + +__BEGIN_NAMESPACE_STD /* Return the `struct tm' representation of *TIMER in Universal Coordinated Time (aka Greenwich Mean Time). */ extern struct tm *gmtime (__const time_t *__timer) __THROW; @@ -198,6 +236,7 @@ extern struct tm *gmtime (__const time_t *__timer) __THROW; /* Return the `struct tm' representation of *TIMER in the local timezone. */ extern struct tm *localtime (__const time_t *__timer) __THROW; +__END_NAMESPACE_STD # if defined __USE_POSIX || defined __USE_MISC /* Return the `struct tm' representation of *TIMER in UTC, @@ -211,12 +250,14 @@ extern struct tm *localtime_r (__const time_t *__restrict __timer, struct tm *__restrict __tp) __THROW; # endif /* POSIX or misc */ +__BEGIN_NAMESPACE_STD /* Return a string of the form "Day Mon dd hh:mm:ss yyyy\n" that is the representation of TP in this format. */ extern char *asctime (__const struct tm *__tp) __THROW; /* Equivalent to `asctime (localtime (timer))'. */ extern char *ctime (__const time_t *__timer) __THROW; +__END_NAMESPACE_STD # if defined __USE_POSIX || defined __USE_MISC /* Reentrant versions of the above functions. */ @@ -281,9 +322,12 @@ extern int dysize (int __year) __THROW __attribute__ ((__const__)); # ifdef __USE_POSIX199309 -/* Pause execution for a number of nanoseconds. */ +/* Pause execution for a number of nanoseconds. + + This function is a cancellation point and therefore not marked with + __THROW. */ extern int nanosleep (__const struct timespec *__requested_time, - struct timespec *__remaining) __THROW; + struct timespec *__remaining); /* Get resolution of clock CLOCK_ID. */ @@ -297,10 +341,13 @@ extern int clock_settime (clockid_t __clock_id, __const struct timespec *__tp) __THROW; # ifdef __USE_XOPEN2K -/* High-resolution sleep with the specified clock. */ +/* High-resolution sleep with the specified clock. + + This function is a cancellation point and therefore not marked with + __THROW. */ extern int clock_nanosleep (clockid_t __clock_id, int __flags, __const struct timespec *__req, - struct timespec *__rem) __THROW; + struct timespec *__rem); /* Return clock ID for CPU-time clock. */ extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __THROW; @@ -346,8 +393,11 @@ extern int getdate_err; /* Parse the given string as a date specification and return a value representing the value. The templates from the file identified by the environment variable DATEMSK are used. In case of an error - `getdate_err' is set. */ -extern struct tm *getdate (__const char *__string) __THROW; + `getdate_err' is set. + + This function is a possible cancellation points and therefore not + marked with __THROW. */ +extern struct tm *getdate (__const char *__string); # endif # ifdef __USE_GNU @@ -355,12 +405,16 @@ extern struct tm *getdate (__const char *__string) __THROW; and the static buffer to return the result in, we provide a thread-safe variant. The functionality is the same. The result is returned in the buffer pointed to by RESBUFP and in case of an error the return - value is != 0 with the same values as given above for `getdate_err'. */ + value is != 0 with the same values as given above for `getdate_err'. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ extern int getdate_r (__const char *__restrict __string, - struct tm *__restrict __resbufp) __THROW; + struct tm *__restrict __resbufp); # endif - __END_DECLS #endif /* <time.h> included. */ diff --git a/include/wchar.h b/include/wchar.h index 67a3664bf..5fb44f418 100644 --- a/include/wchar.h +++ b/include/wchar.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc. +/* Copyright (C) 1995-2002, 2003 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 @@ -62,6 +62,15 @@ member of the extended character set. */ # define _WINT_T typedef unsigned int wint_t; +#else +/* Work around problems with the <stddef.h> file which doesn't put + wint_t in the std namespace. */ +# if defined __cplusplus && defined _GLIBCPP_USE_NAMESPACES \ + && defined __WINT_TYPE__ +__BEGIN_NAMESPACE_STD +typedef __WINT_TYPE__ wint_t; +__END_NAMESPACE_STD +# endif #endif @@ -93,8 +102,13 @@ typedef struct defined. */ #ifdef _WCHAR_H +__BEGIN_NAMESPACE_C99 /* Public type. */ typedef __mbstate_t mbstate_t; +__END_NAMESPACE_C99 +#ifdef __USE_GNU +__USING_NAMESPACE_C99(mbstate_t) +#endif #ifndef WCHAR_MIN /* These constants might also be defined in <inttypes.h>. */ @@ -112,13 +126,21 @@ typedef __mbstate_t mbstate_t; # include <wctype.h> #endif + +__BEGIN_DECLS + +__BEGIN_NAMESPACE_STD /* This incomplete type is defined in <time.h> but needed here because of `wcsftime'. */ struct tm; +/* XXX We have to clean this up at some point. Since tm is in the std + namespace but wcsftime is in __c99 the type wouldn't be found + without inserting it in the global namespace. */ +__USING_NAMESPACE_STD(tm) +__END_NAMESPACE_STD -__BEGIN_DECLS - +__BEGIN_NAMESPACE_C99 /* Copy SRC to DEST. */ extern wchar_t *wcscpy (wchar_t *__restrict __dest, __const wchar_t *__restrict __src) __THROW; @@ -141,6 +163,7 @@ extern int wcscmp (__const wchar_t *__s1, __const wchar_t *__s2) /* Compare N wide-characters of S1 and S2. */ extern int wcsncmp (__const wchar_t *__s1, __const wchar_t *__s2, size_t __n) __THROW __attribute_pure__; +__END_NAMESPACE_C99 #ifdef __USE_GNU /* Compare S1 and S2, ignoring case. */ @@ -150,19 +173,20 @@ extern int wcscasecmp (__const wchar_t *__s1, __const wchar_t *__s2) __THROW; extern int wcsncasecmp (__const wchar_t *__s1, __const wchar_t *__s2, size_t __n) __THROW; +#ifdef __UCLIBC_HAS_XLOCALE__ /* Similar to the two functions above but take the information from the provided locale and not the global locale. */ -#if 0 # include <xlocale.h> -extern int __wcscasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2, - __locale_t __loc) __THROW; +extern int wcscasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2, + __locale_t __loc) __THROW; -extern int __wcsncasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2, - size_t __n, __locale_t __loc) __THROW; -#endif +extern int wcsncasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2, + size_t __n, __locale_t __loc) __THROW; +#endif /* __UCLIBC_HAS_XLOCALE__ */ #endif +__BEGIN_NAMESPACE_C99 /* Compare S1 and S2, both interpreted as appropriate to the LC_COLLATE category of the current locale. */ extern int wcscoll (__const wchar_t *__s1, __const wchar_t *__s2) __THROW; @@ -171,33 +195,37 @@ extern int wcscoll (__const wchar_t *__s1, __const wchar_t *__s2) __THROW; `wcscoll' to the original strings. */ extern size_t wcsxfrm (wchar_t *__restrict __s1, __const wchar_t *__restrict __s2, size_t __n) __THROW; +__END_NAMESPACE_C99 #ifdef __USE_GNU -#if 0 +#ifdef __UCLIBC_HAS_XLOCALE__ /* Similar to the two functions above but take the information from the provided locale and not the global locale. */ /* Compare S1 and S2, both interpreted as appropriate to the LC_COLLATE category of the given locale. */ -extern int __wcscoll_l (__const wchar_t *__s1, __const wchar_t *__s2, - __locale_t __loc) __THROW; +extern int wcscoll_l (__const wchar_t *__s1, __const wchar_t *__s2, + __locale_t __loc) __THROW; + /* Transform S2 into array pointed to by S1 such that if wcscmp is applied to two transformed strings the result is the as applying `wcscoll' to the original strings. */ -extern size_t __wcsxfrm_l (wchar_t *__s1, __const wchar_t *__s2, - size_t __n, __locale_t __loc) __THROW; -#endif +extern size_t wcsxfrm_l (wchar_t *__s1, __const wchar_t *__s2, + size_t __n, __locale_t __loc) __THROW; +#endif /* __UCLIBC_HAS_XLOCALE__ */ /* Duplicate S, returning an identical malloc'd string. */ extern wchar_t *wcsdup (__const wchar_t *__s) __THROW __attribute_malloc__; #endif +__BEGIN_NAMESPACE_C99 /* Find the first occurrence of WC in WCS. */ extern wchar_t *wcschr (__const wchar_t *__wcs, wchar_t __wc) __THROW __attribute_pure__; /* Find the last occurrence of WC in WCS. */ extern wchar_t *wcsrchr (__const wchar_t *__wcs, wchar_t __wc) __THROW __attribute_pure__; +__END_NAMESPACE_C99 #ifdef __USE_GNU /* This function is similar to `wcschr'. But it returns a pointer to @@ -206,6 +234,7 @@ extern wchar_t *wcschrnul (__const wchar_t *__s, wchar_t __wc) __THROW __attribute_pure__; #endif +__BEGIN_NAMESPACE_C99 /* Return the length of the initial segmet of WCS which consists entirely of wide characters not in REJECT. */ extern size_t wcscspn (__const wchar_t *__wcs, __const wchar_t *__reject) @@ -221,12 +250,6 @@ extern wchar_t *wcspbrk (__const wchar_t *__wcs, __const wchar_t *__accept) extern wchar_t *wcsstr (__const wchar_t *__haystack, __const wchar_t *__needle) __THROW __attribute_pure__; -#ifdef __USE_XOPEN -/* Another name for `wcsstr' from XPG4. */ -extern wchar_t *wcswcs (__const wchar_t *__haystack, __const wchar_t *__needle) - __THROW __attribute_pure__; -#endif - /* Divide WCS into tokens separated by characters in DELIM. */ extern wchar_t *wcstok (wchar_t *__restrict __s, __const wchar_t *__restrict __delim, @@ -234,6 +257,13 @@ extern wchar_t *wcstok (wchar_t *__restrict __s, /* Return the number of wide characters in S. */ extern size_t wcslen (__const wchar_t *__s) __THROW __attribute_pure__; +__END_NAMESPACE_C99 + +#ifdef __USE_XOPEN +/* Another name for `wcsstr' from XPG4. */ +extern wchar_t *wcswcs (__const wchar_t *__haystack, __const wchar_t *__needle) + __THROW __attribute_pure__; +#endif #ifdef __USE_GNU /* Return the number of wide characters in S, but at most MAXLEN. */ @@ -242,6 +272,7 @@ extern size_t wcsnlen (__const wchar_t *__s, size_t __maxlen) #endif +__BEGIN_NAMESPACE_C99 /* Search N wide characters of S for C. */ extern wchar_t *wmemchr (__const wchar_t *__s, wchar_t __c, size_t __n) __THROW __attribute_pure__; @@ -262,6 +293,7 @@ extern wchar_t *wmemmove (wchar_t *__s1, __const wchar_t *__s2, size_t __n) /* Set N wide characters of S to C. */ extern wchar_t *wmemset (wchar_t *__s, wchar_t __c, size_t __n) __THROW; +__END_NAMESPACE_C99 #ifdef __USE_GNU /* Copy N wide characters of SRC to DEST and return pointer to following @@ -272,6 +304,7 @@ extern wchar_t *wmempcpy (wchar_t *__restrict __s1, #endif +__BEGIN_NAMESPACE_C99 /* Determine whether C constitutes a valid (one-byte) multibyte character. */ extern wint_t btowc (int __c) __THROW; @@ -299,9 +332,9 @@ extern size_t __mbrlen (__const char *__restrict __s, size_t __n, mbstate_t *__restrict __ps) __THROW; extern size_t mbrlen (__const char *__restrict __s, size_t __n, mbstate_t *__restrict __ps) __THROW; +__END_NAMESPACE_C99 -#if 0 -/* #ifdef __USE_EXTERN_INLINES */ +#ifdef __USE_EXTERN_INLINES /* Define inline function as optimization. */ extern __inline size_t mbrlen (__const char *__restrict __s, size_t __n, mbstate_t *__restrict __ps) __THROW @@ -309,6 +342,7 @@ extern __inline size_t mbrlen (__const char *__restrict __s, size_t __n, ? mbrtowc (NULL, __s, __n, __ps) : __mbrlen (__s, __n, NULL)); } #endif +__BEGIN_NAMESPACE_C99 /* Write wide character representation of multibyte character string SRC to DST. */ extern size_t mbsrtowcs (wchar_t *__restrict __dst, @@ -320,6 +354,7 @@ extern size_t mbsrtowcs (wchar_t *__restrict __dst, extern size_t wcsrtombs (char *__restrict __dst, __const wchar_t **__restrict __src, size_t __len, mbstate_t *__restrict __ps) __THROW; +__END_NAMESPACE_C99 #ifdef __USE_GNU @@ -349,6 +384,7 @@ extern int wcswidth (__const wchar_t *__s, size_t __n) __THROW; #endif /* Use X/Open. */ +__BEGIN_NAMESPACE_C99 /* Convert initial portion of the wide string NPTR to `double' representation. */ extern double wcstod (__const wchar_t *__restrict __nptr, @@ -374,40 +410,41 @@ extern unsigned long int wcstoul (__const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr, int __base) __THROW; -#if defined __GNUC__ && defined __USE_GNU +#if defined __USE_ISOC99 || (defined __GNUC__ && defined __USE_GNU) /* Convert initial portion of wide string NPTR to `long int' representation. */ __extension__ -extern long long int wcstoq (__const wchar_t *__restrict __nptr, - wchar_t **__restrict __endptr, int __base) +extern long long int wcstoll (__const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, int __base) __THROW; /* Convert initial portion of wide string NPTR to `unsigned long long int' representation. */ __extension__ -extern unsigned long long int wcstouq (__const wchar_t *__restrict __nptr, - wchar_t **__restrict __endptr, - int __base) __THROW; -#endif /* GCC and use GNU. */ +extern unsigned long long int wcstoull (__const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, + int __base) __THROW; +#endif /* ISO C99 or GCC and GNU. */ +__END_NAMESPACE_C99 -#if defined __USE_ISOC99 || (defined __GNUC__ && defined __USE_GNU) +#if defined __GNUC__ && defined __USE_GNU /* Convert initial portion of wide string NPTR to `long int' representation. */ __extension__ -extern long long int wcstoll (__const wchar_t *__restrict __nptr, - wchar_t **__restrict __endptr, int __base) +extern long long int wcstoq (__const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, int __base) __THROW; /* Convert initial portion of wide string NPTR to `unsigned long long int' representation. */ __extension__ -extern unsigned long long int wcstoull (__const wchar_t *__restrict __nptr, - wchar_t **__restrict __endptr, - int __base) __THROW; -#endif /* ISO C99 or GCC and GNU. */ +extern unsigned long long int wcstouq (__const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, + int __base) __THROW; +#endif /* GCC and use GNU. */ -#if 0 -/* #ifdef __USE_GNU */ +#ifdef __USE_GNU +#ifdef __UCLIBC_HAS_XLOCALE__ /* The concept of one static locale per category is not very well thought out. Many applications will need to process its data using information from several different locales. Another application is @@ -425,36 +462,37 @@ extern unsigned long long int wcstoull (__const wchar_t *__restrict __nptr, /* Special versions of the functions above which take the locale to use as an additional parameter. */ -extern long int __wcstol_l (__const wchar_t *__restrict __nptr, - wchar_t **__restrict __endptr, int __base, - __locale_t __loc) __THROW; +extern long int wcstol_l (__const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, int __base, + __locale_t __loc) __THROW; -extern unsigned long int __wcstoul_l (__const wchar_t *__restrict __nptr, - wchar_t **__restrict __endptr, - int __base, __locale_t __loc) __THROW; +extern unsigned long int wcstoul_l (__const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, + int __base, __locale_t __loc) __THROW; __extension__ -extern long long int __wcstoll_l (__const wchar_t *__restrict __nptr, - wchar_t **__restrict __endptr, - int __base, __locale_t __loc) __THROW; +extern long long int wcstoll_l (__const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, + int __base, __locale_t __loc) __THROW; __extension__ -extern unsigned long long int __wcstoull_l (__const wchar_t *__restrict __nptr, - wchar_t **__restrict __endptr, - int __base, __locale_t __loc) +extern unsigned long long int wcstoull_l (__const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, + int __base, __locale_t __loc) __THROW; -extern double __wcstod_l (__const wchar_t *__restrict __nptr, - wchar_t **__restrict __endptr, __locale_t __loc) +extern double wcstod_l (__const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, __locale_t __loc) __THROW; -extern float __wcstof_l (__const wchar_t *__restrict __nptr, - wchar_t **__restrict __endptr, __locale_t __loc) +extern float wcstof_l (__const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, __locale_t __loc) __THROW; -extern long double __wcstold_l (__const wchar_t *__restrict __nptr, - wchar_t **__restrict __endptr, - __locale_t __loc) __THROW; +extern long double wcstold_l (__const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, + __locale_t __loc) __THROW; +#endif /* __UCLIBC_HAS_XLOCALE__ */ #endif /* GNU */ @@ -504,42 +542,44 @@ extern unsigned long long int __wcstoull_internal (__const wchar_t * #if defined __OPTIMIZE__ && __GNUC__ >= 2 /* Define inline functions which call the internal entry points. */ - -extern __inline double wcstod (__const wchar_t *__restrict __nptr, - wchar_t **__restrict __endptr) __THROW -{ return __wcstod_internal (__nptr, __endptr, 0); } -extern __inline long int wcstol (__const wchar_t *__restrict __nptr, - wchar_t **__restrict __endptr, - int __base) __THROW -{ return __wcstol_internal (__nptr, __endptr, __base, 0); } -extern __inline unsigned long int wcstoul (__const wchar_t *__restrict __nptr, - wchar_t **__restrict __endptr, - int __base) __THROW -{ return __wcstoul_internal (__nptr, __endptr, __base, 0); } +/* __BEGIN_NAMESPACE_C99 */ + +/* extern __inline double wcstod (__const wchar_t *__restrict __nptr, */ +/* wchar_t **__restrict __endptr) __THROW */ +/* { return __wcstod_internal (__nptr, __endptr, 0); } */ +/* extern __inline long int wcstol (__const wchar_t *__restrict __nptr, */ +/* wchar_t **__restrict __endptr, */ +/* int __base) __THROW */ +/* { return __wcstol_internal (__nptr, __endptr, __base, 0); } */ +/* extern __inline unsigned long int wcstoul (__const wchar_t *__restrict __nptr, */ +/* wchar_t **__restrict __endptr, */ +/* int __base) __THROW */ +/* { return __wcstoul_internal (__nptr, __endptr, __base, 0); } */ +/* __END_NAMESPACE_C99 */ # ifdef __USE_GNU -extern __inline float wcstof (__const wchar_t *__restrict __nptr, - wchar_t **__restrict __endptr) __THROW -{ return __wcstof_internal (__nptr, __endptr, 0); } -extern __inline long double wcstold (__const wchar_t *__restrict __nptr, - wchar_t **__restrict __endptr) __THROW -{ return __wcstold_internal (__nptr, __endptr, 0); } - - -__extension__ -extern __inline long long int wcstoq (__const wchar_t *__restrict __nptr, - wchar_t **__restrict __endptr, - int __base) __THROW -{ return __wcstoll_internal (__nptr, __endptr, __base, 0); } -__extension__ -extern __inline unsigned long long int wcstouq (__const wchar_t * - __restrict __nptr, - wchar_t **__restrict __endptr, - int __base) __THROW -{ return __wcstoull_internal (__nptr, __endptr, __base, 0); } +/* extern __inline float wcstof (__const wchar_t *__restrict __nptr, */ +/* wchar_t **__restrict __endptr) __THROW */ +/* { return __wcstof_internal (__nptr, __endptr, 0); } */ +/* extern __inline long double wcstold (__const wchar_t *__restrict __nptr, */ +/* wchar_t **__restrict __endptr) __THROW */ +/* { return __wcstold_internal (__nptr, __endptr, 0); } */ + + +/* __extension__ */ +/* extern __inline long long int wcstoq (__const wchar_t *__restrict __nptr, */ +/* wchar_t **__restrict __endptr, */ +/* int __base) __THROW */ +/* { return __wcstoll_internal (__nptr, __endptr, __base, 0); } */ +/* __extension__ */ +/* extern __inline unsigned long long int wcstouq (__const wchar_t * */ +/* __restrict __nptr, */ +/* wchar_t **__restrict __endptr, */ +/* int __base) __THROW */ +/* { return __wcstoull_internal (__nptr, __endptr, __base, 0); } */ # endif /* Use GNU. */ #endif /* Optimizing GCC >=2. */ -#endif +#endif /* 0 */ #ifdef __USE_GNU @@ -556,32 +596,45 @@ extern wchar_t *wcpncpy (wchar_t *__dest, __const wchar_t *__src, size_t __n) /* Wide character I/O functions. */ #if defined __USE_ISOC99 || defined __USE_UNIX98 +__BEGIN_NAMESPACE_C99 /* Select orientation for stream. */ extern int fwide (__FILE *__fp, int __mode) __THROW; -/* Write formatted output to STREAM. */ +/* Write formatted output to STREAM. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ extern int fwprintf (__FILE *__restrict __stream, __const wchar_t *__restrict __format, ...) - __THROW /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */; -/* Write formatted output to stdout. */ + /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */; +/* Write formatted output to stdout. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ extern int wprintf (__const wchar_t *__restrict __format, ...) - __THROW /* __attribute__ ((__format__ (__wprintf__, 1, 2))) */; + /* __attribute__ ((__format__ (__wprintf__, 1, 2))) */; /* Write formatted output of at most N characters to S. */ extern int swprintf (wchar_t *__restrict __s, size_t __n, __const wchar_t *__restrict __format, ...) __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */; -/* Write formatted output to S from argument list ARG. */ +/* Write formatted output to S from argument list ARG. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ extern int vfwprintf (__FILE *__restrict __s, __const wchar_t *__restrict __format, __gnuc_va_list __arg) - __THROW /* __attribute__ ((__format__ (__wprintf__, 2, 0))) */; -/* Write formatted output to stdout from argument list ARG. */ + /* __attribute__ ((__format__ (__wprintf__, 2, 0))) */; +/* Write formatted output to stdout from argument list ARG. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ extern int vwprintf (__const wchar_t *__restrict __format, __gnuc_va_list __arg) - __THROW /* __attribute__ ((__format__ (__wprintf__, 1, 0))) */; + /* __attribute__ ((__format__ (__wprintf__, 1, 0))) */; /* Write formatted output of at most N character to S from argument list ARG. */ extern int vswprintf (wchar_t *__restrict __s, size_t __n, @@ -590,101 +643,187 @@ extern int vswprintf (wchar_t *__restrict __s, size_t __n, __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */; -/* Read formatted input from STREAM. */ +/* Read formatted input from STREAM. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ extern int fwscanf (__FILE *__restrict __stream, __const wchar_t *__restrict __format, ...) - __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */; -/* Read formatted input from stdin. */ + /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */; +/* Read formatted input from stdin. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ extern int wscanf (__const wchar_t *__restrict __format, ...) - __THROW /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */; + /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */; /* Read formatted input from S. */ extern int swscanf (__const wchar_t *__restrict __s, __const wchar_t *__restrict __format, ...) __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */; + +__END_NAMESPACE_C99 #endif /* Use ISO C99 and Unix98. */ #ifdef __USE_ISOC99 -/* Read formatted input from S into argument list ARG. */ +__BEGIN_NAMESPACE_C99 + +/* Read formatted input from S into argument list ARG. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ extern int vfwscanf (__FILE *__restrict __s, __const wchar_t *__restrict __format, __gnuc_va_list __arg) - __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */; -/* Read formatted input from stdin into argument list ARG. */ + /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */; +/* Read formatted input from stdin into argument list ARG. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ extern int vwscanf (__const wchar_t *__restrict __format, __gnuc_va_list __arg) - __THROW /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */; + /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */; /* Read formatted input from S into argument list ARG. */ extern int vswscanf (__const wchar_t *__restrict __s, __const wchar_t *__restrict __format, __gnuc_va_list __arg) __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */; + +__END_NAMESPACE_C99 #endif /* Use ISO C99. */ -/* Read a character from STREAM. */ -extern wint_t fgetwc (__FILE *__stream) __THROW; -extern wint_t getwc (__FILE *__stream) __THROW; +__BEGIN_NAMESPACE_C99 +/* Read a character from STREAM. + + These functions are possible cancellation points and therefore not + marked with __THROW. */ +extern wint_t fgetwc (__FILE *__stream); +extern wint_t getwc (__FILE *__stream); -/* Read a character from stdin. */ -extern wint_t getwchar (void) __THROW; +/* Read a character from stdin. + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern wint_t getwchar (void); -/* Write a character to STREAM. */ -extern wint_t fputwc (wchar_t __wc, __FILE *__stream) __THROW; -extern wint_t putwc (wchar_t __wc, __FILE *__stream) __THROW; -/* Write a character to stdout. */ -extern wint_t putwchar (wchar_t __wc) __THROW; +/* Write a character to STREAM. + + These functions are possible cancellation points and therefore not + marked with __THROW. */ +extern wint_t fputwc (wchar_t __wc, __FILE *__stream); +extern wint_t putwc (wchar_t __wc, __FILE *__stream); + +/* Write a character to stdout. + + This function is a possible cancellation points and therefore not + marked with __THROW. */ +extern wint_t putwchar (wchar_t __wc); /* Get a newline-terminated wide character string of finite length - from STREAM. */ + from STREAM. + + This function is a possible cancellation points and therefore not + marked with __THROW. */ extern wchar_t *fgetws (wchar_t *__restrict __ws, int __n, - __FILE *__restrict __stream) __THROW; + __FILE *__restrict __stream); + +/* Write a string to STREAM. -/* Write a string to STREAM. */ + This function is a possible cancellation points and therefore not + marked with __THROW. */ extern int fputws (__const wchar_t *__restrict __ws, - __FILE *__restrict __stream) __THROW; + __FILE *__restrict __stream); + +/* Push a character back onto the input buffer of STREAM. -/* Push a character back onto the input buffer of STREAM. */ -extern wint_t ungetwc (wint_t __wc, __FILE *__stream) __THROW; + This function is a possible cancellation points and therefore not + marked with __THROW. */ +extern wint_t ungetwc (wint_t __wc, __FILE *__stream); +__END_NAMESPACE_C99 #ifdef __USE_GNU /* These are defined to be equivalent to the `char' functions defined - in POSIX.1:1996. */ -extern wint_t getwc_unlocked (__FILE *__stream) __THROW; -extern wint_t getwchar_unlocked (void) __THROW; + in POSIX.1:1996. -/* This is the wide character version of a GNU extension. */ -extern wint_t fgetwc_unlocked (__FILE *__stream) __THROW; + These functions are not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation they are cancellation points and + therefore not marked with __THROW. */ +extern wint_t getwc_unlocked (__FILE *__stream); +extern wint_t getwchar_unlocked (void); -/* Faster version when locking is not necessary. */ -extern wint_t fputwc_unlocked (wchar_t __wc, __FILE *__stream) __THROW; +/* This is the wide character version of a GNU extension. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern wint_t fgetwc_unlocked (__FILE *__stream); + +/* Faster version when locking is not necessary. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern wint_t fputwc_unlocked (wchar_t __wc, __FILE *__stream); /* These are defined to be equivalent to the `char' functions defined - in POSIX.1:1996. */ -extern wint_t putwc_unlocked (wchar_t __wc, __FILE *__stream) __THROW; -extern wint_t putwchar_unlocked (wchar_t __wc) __THROW; + in POSIX.1:1996. + These functions are not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation they are cancellation points and + therefore not marked with __THROW. */ +extern wint_t putwc_unlocked (wchar_t __wc, __FILE *__stream); +extern wint_t putwchar_unlocked (wchar_t __wc); -/* This function does the same as `fgetws' but does not lock the stream. */ + +/* This function does the same as `fgetws' but does not lock the stream. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ extern wchar_t *fgetws_unlocked (wchar_t *__restrict __ws, int __n, - __FILE *__restrict __stream) __THROW; + __FILE *__restrict __stream); + +/* This function does the same as `fputws' but does not lock the stream. -/* This function does the same as `fputws' but does not lock the stream. */ + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ extern int fputws_unlocked (__const wchar_t *__restrict __ws, - __FILE *__restrict __stream) __THROW; + __FILE *__restrict __stream); #endif +__BEGIN_NAMESPACE_C99 /* Format TP into S according to FORMAT. Write no more than MAXSIZE wide characters and return the number of wide characters written, or 0 if it would exceed MAXSIZE. */ extern size_t wcsftime (wchar_t *__restrict __s, size_t __maxsize, __const wchar_t *__restrict __format, __const struct tm *__restrict __tp) __THROW; +__END_NAMESPACE_C99 + +# ifdef __USE_GNU +#ifdef __UCLIBC_HAS_XLOCALE__ +# include <xlocale.h> + +/* Similar to `wcsftime' but takes the information from + the provided locale and not the global locale. */ +extern size_t wcsftime_l (wchar_t *__restrict __s, size_t __maxsize, + __const wchar_t *__restrict __format, + __const struct tm *__restrict __tp, + __locale_t __loc) __THROW; +#endif /* __UCLIBC_HAS_XLOCALE__ */ +# endif /* The X/Open standard demands that most of the functions defined in the <wctype.h> header must also appear here. This is probably diff --git a/include/wctype.h b/include/wctype.h index 515f36ff6..86b5db44c 100644 --- a/include/wctype.h +++ b/include/wctype.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc. +/* Copyright (C) 1996,97,98,99,2000,01,02 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 @@ -33,8 +33,6 @@ #ifndef __need_iswxxx # define _WCTYPE_H 1 -#include <bits/uClibc_ctype.h> - /* We try to get wint_t from <stddef.h>, but not all GCC versions define it there. So define it ourselves if it remains undefined. */ # define __need_wint_t @@ -46,6 +44,11 @@ member of the extended character set. */ # define _WINT_T typedef unsigned int wint_t; +# else +# ifdef __USE_ISOC99 +__USING_NAMESPACE_C99(wint_t) +# endif +__END_NAMESPACE_C99 # endif /* Constant expression of type `wint_t' whose value does not correspond @@ -62,14 +65,55 @@ typedef unsigned int wint_t; #ifndef __iswxxx_defined # define __iswxxx_defined 1 +__BEGIN_NAMESPACE_C99 /* Scalar type that can hold values which represent locale-specific character classifications. */ -/* uClibc note: glibc uses an unsigned long int. */ +/* uClibc note: glibc uses - typedef unsigned long int wctype_t; */ typedef unsigned int wctype_t; +__END_NAMESPACE_C99 + +# ifndef _ISwbit +# define _ISwbit(bit) (1 << (bit)) + +enum +{ + __ISwupper = 0, /* UPPERCASE. */ + __ISwlower = 1, /* lowercase. */ + __ISwalpha = 2, /* Alphabetic. */ + __ISwdigit = 3, /* Numeric. */ + __ISwxdigit = 4, /* Hexadecimal numeric. */ + __ISwspace = 5, /* Whitespace. */ + __ISwprint = 6, /* Printing. */ + __ISwgraph = 7, /* Graphical. */ + __ISwblank = 8, /* Blank (usually SPC and TAB). */ + __ISwcntrl = 9, /* Control character. */ + __ISwpunct = 10, /* Punctuation. */ + __ISwalnum = 11, /* Alphanumeric. */ + + _ISwupper = _ISwbit (__ISwupper), /* UPPERCASE. */ + _ISwlower = _ISwbit (__ISwlower), /* lowercase. */ + _ISwalpha = _ISwbit (__ISwalpha), /* Alphabetic. */ + _ISwdigit = _ISwbit (__ISwdigit), /* Numeric. */ + _ISwxdigit = _ISwbit (__ISwxdigit), /* Hexadecimal numeric. */ + _ISwspace = _ISwbit (__ISwspace), /* Whitespace. */ + _ISwprint = _ISwbit (__ISwprint), /* Printing. */ + _ISwgraph = _ISwbit (__ISwgraph), /* Graphical. */ + _ISwblank = _ISwbit (__ISwblank), /* Blank (usually SPC and TAB). */ + _ISwcntrl = _ISwbit (__ISwcntrl), /* Control character. */ + _ISwpunct = _ISwbit (__ISwpunct), /* Punctuation. */ + _ISwalnum = _ISwbit (__ISwalnum) /* Alphanumeric. */ +}; +# else +# if defined(__UCLIBC_MJN3_ONLY__) && defined(L_iswctype) +#warning remove _ISwbit already defined check? +#error _ISwbit already defined! +# endif +# endif /* Not _ISwbit */ __BEGIN_DECLS +__BEGIN_NAMESPACE_C99 /* * Wide-character classification functions: 7.15.2.1. */ @@ -141,21 +185,30 @@ extern wctype_t wctype (__const char *__property) __THROW; /* Determine whether the wide-character WC has the property described by DESC. */ extern int iswctype (wint_t __wc, wctype_t __desc) __THROW; +__END_NAMESPACE_C99 + /* * Wide-character case-mapping functions: 7.15.3.1. */ +__BEGIN_NAMESPACE_C99 /* Scalar type that can hold values which represent locale-specific character mappings. */ -/* typedef __const __int32_t *wctrans_t; */ -typedef unsigned int wctrans_t; /* TODO: fix this */ +/* uClibc note: glibc uses - typedef __const __int32_t *wctrans_t; */ +typedef unsigned int wctrans_t; +__END_NAMESPACE_C99 +#ifdef __USE_GNU +__USING_NAMESPACE_C99(wctrans_t) +#endif +__BEGIN_NAMESPACE_C99 /* Converts an uppercase letter to the corresponding lowercase letter. */ extern wint_t towlower (wint_t __wc) __THROW; /* Converts an lowercase letter to the corresponding uppercase letter. */ extern wint_t towupper (wint_t __wc) __THROW; +__END_NAMESPACE_C99 __END_DECLS @@ -172,80 +225,81 @@ __END_DECLS __BEGIN_DECLS +__BEGIN_NAMESPACE_C99 /* Construct value that describes a mapping between wide characters identified by the string argument PROPERTY. */ extern wctrans_t wctrans (__const char *__property) __THROW; /* Map the wide character WC using the mapping described by DESC. */ extern wint_t towctrans (wint_t __wc, wctrans_t __desc) __THROW; +__END_NAMESPACE_C99 -#if 0 -/* # ifdef __USE_GNU */ +#if defined(__USE_GNU) && defined(__UCLIBC_HAS_XLOCALE__) /* Declare the interface to extended locale model. */ # include <xlocale.h> /* Test for any wide character for which `iswalpha' or `iswdigit' is true. */ -extern int __iswalnum_l (wint_t __wc, __locale_t __locale) __THROW; +extern int iswalnum_l (wint_t __wc, __locale_t __locale) __THROW; /* Test for any wide character for which `iswupper' or 'iswlower' is true, or any wide character that is one of a locale-specific set of wide-characters for which none of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */ -extern int __iswalpha_l (wint_t __wc, __locale_t __locale) __THROW; +extern int iswalpha_l (wint_t __wc, __locale_t __locale) __THROW; /* Test for any control wide character. */ -extern int __iswcntrl_l (wint_t __wc, __locale_t __locale) __THROW; +extern int iswcntrl_l (wint_t __wc, __locale_t __locale) __THROW; /* Test for any wide character that corresponds to a decimal-digit character. */ -extern int __iswdigit_l (wint_t __wc, __locale_t __locale) __THROW; +extern int iswdigit_l (wint_t __wc, __locale_t __locale) __THROW; /* Test for any wide character for which `iswprint' is true and `iswspace' is false. */ -extern int __iswgraph_l (wint_t __wc, __locale_t __locale) __THROW; +extern int iswgraph_l (wint_t __wc, __locale_t __locale) __THROW; /* Test for any wide character that corresponds to a lowercase letter or is one of a locale-specific set of wide characters for which none of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */ -extern int __iswlower_l (wint_t __wc, __locale_t __locale) __THROW; +extern int iswlower_l (wint_t __wc, __locale_t __locale) __THROW; /* Test for any printing wide character. */ -extern int __iswprint_l (wint_t __wc, __locale_t __locale) __THROW; +extern int iswprint_l (wint_t __wc, __locale_t __locale) __THROW; /* Test for any printing wide character that is one of a locale-specific et of wide characters for which neither `iswspace' nor `iswalnum' is true. */ -extern int __iswpunct_l (wint_t __wc, __locale_t __locale) __THROW; +extern int iswpunct_l (wint_t __wc, __locale_t __locale) __THROW; /* Test for any wide character that corresponds to a locale-specific set of wide characters for which none of `iswalnum', `iswgraph', or `iswpunct' is true. */ -extern int __iswspace_l (wint_t __wc, __locale_t __locale) __THROW; +extern int iswspace_l (wint_t __wc, __locale_t __locale) __THROW; /* Test for any wide character that corresponds to an uppercase letter or is one of a locale-specific set of wide character for which none of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */ -extern int __iswupper_l (wint_t __wc, __locale_t __locale) __THROW; +extern int iswupper_l (wint_t __wc, __locale_t __locale) __THROW; /* Test for any wide character that corresponds to a hexadecimal-digit character equivalent to that performed be the functions described in the previous subclause. */ -extern int __iswxdigit_l (wint_t __wc, __locale_t __locale) __THROW; +extern int iswxdigit_l (wint_t __wc, __locale_t __locale) __THROW; /* Test for any wide character that corresponds to a standard blank wide character or a locale-specific set of wide characters for which `iswalnum' is false. */ -extern int __iswblank_l (wint_t __wc, __locale_t __locale) __THROW; +extern int iswblank_l (wint_t __wc, __locale_t __locale) __THROW; /* Construct value that describes a class of wide characters identified by the string argument PROPERTY. */ -extern wctype_t __wctype_l (__const char *__property, __locale_t __locale) +extern wctype_t wctype_l (__const char *__property, __locale_t __locale) __THROW; /* Determine whether the wide-character WC has the property described by DESC. */ -extern int __iswctype_l (wint_t __wc, wctype_t __desc, __locale_t __locale) +extern int iswctype_l (wint_t __wc, wctype_t __desc, __locale_t __locale) __THROW; @@ -254,19 +308,19 @@ extern int __iswctype_l (wint_t __wc, wctype_t __desc, __locale_t __locale) */ /* Converts an uppercase letter to the corresponding lowercase letter. */ -extern wint_t __towlower_l (wint_t __wc, __locale_t __locale) __THROW; +extern wint_t towlower_l (wint_t __wc, __locale_t __locale) __THROW; /* Converts an lowercase letter to the corresponding uppercase letter. */ -extern wint_t __towupper_l (wint_t __wc, __locale_t __locale) __THROW; +extern wint_t towupper_l (wint_t __wc, __locale_t __locale) __THROW; /* Construct value that describes a mapping between wide characters identified by the string argument PROPERTY. */ -extern wctrans_t __wctrans_l (__const char *__property, __locale_t __locale) +extern wctrans_t wctrans_l (__const char *__property, __locale_t __locale) __THROW; /* Map the wide character WC using the mapping described by DESC. */ -extern wint_t __towctrans_l (wint_t __wc, wctrans_t __desc, - __locale_t __locale) __THROW; +extern wint_t towctrans_l (wint_t __wc, wctrans_t __desc, + __locale_t __locale) __THROW; # endif /* Use GNU. */ diff --git a/include/xlocale.h b/include/xlocale.h new file mode 100644 index 000000000..6f726fef9 --- /dev/null +++ b/include/xlocale.h @@ -0,0 +1,62 @@ +/* Definition of locale datatype. + Copyright (C) 1997,2000,02 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _XLOCALE_H +#define _XLOCALE_H 1 + +#include <features.h> + +#ifndef __UCLIBC_HAS_XLOCALE__ +#error Attempted to include xlocale.h when uClibc built without extended locale support. +#endif /* __UCLIBC_HAS_XLOCALE__ */ + +#include <bits/uClibc_locale.h> +/* #include <bits/uClibc_touplow.h> */ + +#if 0 +/* Structure for reentrant locale using functions. This is an + (almost) opaque type for the user level programs. The file and + this data structure is not standardized. Don't rely on it. It can + go away without warning. */ +typedef struct __locale_struct +{ +#if 0 + /* Note: LC_ALL is not a valid index into this array. */ + struct locale_data *__locales[13]; /* 13 = __LC_LAST. */ +#endif + + /* To increase the speed of this solution we add some special members. */ +/* const unsigned short int *__ctype_b; */ +/* const int *__ctype_tolower; */ +/* const int *__ctype_toupper; */ + const __uint16_t *__ctype_b; + const __ctype_touplow_t *__ctype_tolower; + const __ctype_touplow_t *__ctype_toupper; + + __uclibc_locale_t *__locale_ptr; + +#if 0 + /* Note: LC_ALL is not a valid index into this array. */ + const char *__names[13]; +#endif +} *__locale_t; +#endif + +#endif /* xlocale.h */ |