diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2009-01-21 02:52:59 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2009-01-21 02:52:59 +0000 |
commit | 3f1adc3da04a7809171c3990770d72f28c5d80e4 (patch) | |
tree | 0953b7f1ad2a4a72a3843ab34cc6b292e6d74ea5 /libc/sysdeps/linux/common/bits | |
parent | 71486075e0ab506b80609416a3126a666b88e415 (diff) |
*: remove __UCLIBC_CURLOCALE_DATA, __UCLIBC_CURLOCALE_DATA.x
is always equivalent to __UCLIBC_CURLOCALE->x.
remove typedef __uclibc_locale_t, it used only in a few places,
it is lees confusing to use struct __uclibc_locale_struct
everywhere.
xlocale.h: hide __global_locale back under _LIBC,
bug 53 is wrong in claiming it should be exported.
Also hide under _LIBC:
extern __locale_t __curlocale_var;
extern __locale_t __curlocale(void);
extern __locale_t __curlocale_set(__locale_t newloc);
# define __UCLIBC_CURLOCALE
# define __XL_NPP(N)
# define __LOCALE_PARAM
# define __LOCALE_ARG
# define __LOCALE_PTR
Diffstat (limited to 'libc/sysdeps/linux/common/bits')
-rw-r--r-- | libc/sysdeps/linux/common/bits/uClibc_locale.h | 103 |
1 files changed, 48 insertions, 55 deletions
diff --git a/libc/sysdeps/linux/common/bits/uClibc_locale.h b/libc/sysdeps/linux/common/bits/uClibc_locale.h index 39ed97959..9790da29d 100644 --- a/libc/sysdeps/linux/common/bits/uClibc_locale.h +++ b/libc/sysdeps/linux/common/bits/uClibc_locale.h @@ -35,49 +35,38 @@ #ifdef __UCLIBC_HAS_LOCALE__ -#undef __LOCALE_C_ONLY +# undef __LOCALE_C_ONLY -#else /* __UCLIBC_HAS_LOCALE__ */ +#else -#define __LOCALE_C_ONLY +# define __LOCALE_C_ONLY -#define __XL_NPP(N) N -#define __LOCALE_PARAM -#define __LOCALE_ARG +# ifdef _LIBC +# define __XL_NPP(N) N +# define __LOCALE_PARAM +# define __LOCALE_ARG +# endif -#endif /* __UCLIBC_HAS_LOCALE__ */ +#endif /**********************************************************************/ -#define __NL_ITEM_CATEGORY_SHIFT (8) -#define __NL_ITEM_INDEX_MASK (0xff) +#define __NL_ITEM_CATEGORY_SHIFT 8 +#define __NL_ITEM_INDEX_MASK 0xff /* TODO: Make sure these agree with the locale mmap file gererator! */ -#define __LC_CTYPE 0 -#define __LC_NUMERIC 1 -#define __LC_MONETARY 2 -#define __LC_TIME 3 -#define __LC_COLLATE 4 -#define __LC_MESSAGES 5 -#define __LC_ALL 6 +#define __LC_CTYPE 0 +#define __LC_NUMERIC 1 +#define __LC_MONETARY 2 +#define __LC_TIME 3 +#define __LC_COLLATE 4 +#define __LC_MESSAGES 5 +#define __LC_ALL 6 /**********************************************************************/ #ifndef __LOCALE_C_ONLY -#if defined _LIBC /* && (defined IS_IN_libc || defined NOT_IN_libc) */ -#include <stddef.h> -#include <stdint.h> -#include <bits/uClibc_touplow.h> - -#ifndef __UCLIBC_GEN_LOCALE -#include <bits/uClibc_locale_data.h> -#endif -#endif - -/* extern void _locale_set(const unsigned char *p); */ -/* extern void _locale_init(void); */ - enum { __ctype_encoding_7_bit, /* C/POSIX */ __ctype_encoding_utf8, /* UTF-8 */ @@ -98,7 +87,21 @@ enum { * In particular, C/POSIX locale is '#' + "\x80\x01"}*LC_ALL + nul. */ +struct __uclibc_locale_struct; +typedef struct __uclibc_locale_struct *__locale_t; + #ifdef _LIBC + +/* extern void _locale_set(const unsigned char *p); */ +/* extern void _locale_init(void); */ + +#include <stddef.h> +#include <stdint.h> +#include <bits/uClibc_touplow.h> +#ifndef __UCLIBC_GEN_LOCALE +# include <bits/uClibc_locale_data.h> +#endif + #ifndef __UCLIBC_GEN_LOCALE /* && (defined IS_IN_libc || defined NOT_IN_libc) */ typedef struct { uint16_t num_weights; @@ -140,10 +143,9 @@ typedef struct { uint16_t MAX_WEIGHTS; } __collate_t; - /* static unsigned char cur_locale[LOCALE_STRING_SIZE]; */ -typedef struct __uclibc_locale_struct { +struct __uclibc_locale_struct { #ifdef __UCLIBC_HAS_XLOCALE__ const __ctype_mask_t *__ctype_b; const __ctype_touplow_t *__ctype_tolower; @@ -176,13 +178,13 @@ typedef struct __uclibc_locale_struct { const unsigned char *tbl8ctype; const unsigned char *idx8uplow; const unsigned char *tbl8uplow; -#ifdef __UCLIBC_HAS_WCHAR__ +# ifdef __UCLIBC_HAS_WCHAR__ const unsigned char *idx8c2wc; const uint16_t *tbl8c2wc; /* char > 0x7f to wide char */ const unsigned char *idx8wc2c; const unsigned char *tbl8wc2c; /* translit */ -#endif /* __UCLIBC_HAS_WCHAR__ */ +# endif #endif /* __CTYPE_HAS_8_BIT_LOCALES */ #ifdef __UCLIBC_HAS_WCHAR__ @@ -310,19 +312,16 @@ typedef struct __uclibc_locale_struct { /* collate is at the end */ __collate_t collate; +}; -} __uclibc_locale_t; - -extern __uclibc_locale_t __global_locale_data; +extern struct __uclibc_locale_struct __global_locale_data; +extern struct __uclibc_locale_struct *__global_locale; #endif /* !__UCLIBC_GEN_LOCALE */ -#endif /* _LIBC */ - -extern struct __uclibc_locale_struct * __global_locale; -typedef struct __uclibc_locale_struct *__locale_t; - -/* if we need to leave only _LIBC, then attribute_hidden is not usable */ -#if defined _LIBC && (defined IS_IN_libc || defined NOT_IN_libc) +#if defined IS_IN_libc || defined NOT_IN_libc +/* If you plan to remove xxx_IN_libc guards, + * remove attribute_hidden, it won't work. + */ extern int __locale_mbrtowc_l(wchar_t *__restrict dst, const char *__restrict src, __locale_t loc) attribute_hidden; @@ -332,29 +331,22 @@ extern int __locale_mbrtowc_l(wchar_t *__restrict dst, /* so we only get the warning once... */ #warning need thread version of CUR_LOCALE! #endif + /**********************************************************************/ #ifdef __UCLIBC_HAS_XLOCALE__ extern __locale_t __curlocale_var; - # ifdef __UCLIBC_HAS_THREADS__ - extern __locale_t __curlocale(void) __THROW __attribute__ ((__const__)); extern __locale_t __curlocale_set(__locale_t newloc); -# define __UCLIBC_CURLOCALE (__curlocale()) -# define __UCLIBC_CURLOCALE_DATA (*__curlocale()) - +# define __UCLIBC_CURLOCALE (__curlocale()) # else - -# define __UCLIBC_CURLOCALE (__curlocale_var) -# define __UCLIBC_CURLOCALE_DATA (*__curlocale_var) - +# define __UCLIBC_CURLOCALE (__curlocale_var) # endif #elif defined(__UCLIBC_HAS_LOCALE__) -# define __UCLIBC_CURLOCALE (__global_locale) -# define __UCLIBC_CURLOCALE_DATA (*__global_locale) +# define __UCLIBC_CURLOCALE (__global_locale) #endif /**********************************************************************/ @@ -375,7 +367,8 @@ extern __locale_t __curlocale_set(__locale_t newloc); #endif /**********************************************************************/ +#endif /* _LIBC */ + #endif /* !defined(__LOCALE_C_ONLY) */ -/**********************************************************************/ #endif /* _UCLIBC_LOCALE_H */ |