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 /extra/locale/locale_mmap.h | |
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 'extra/locale/locale_mmap.h')
-rw-r--r-- | extra/locale/locale_mmap.h | 79 |
1 files changed, 42 insertions, 37 deletions
diff --git a/extra/locale/locale_mmap.h b/extra/locale/locale_mmap.h index 12c4025e1..1b748239b 100644 --- a/extra/locale/locale_mmap.h +++ b/extra/locale/locale_mmap.h @@ -1,13 +1,16 @@ -/* #include "lt_defines.h" */ - -/* TODO - fix */ -#define MAGIC_SIZE 64 +/* #define __LOCALE_DATA_MAGIC_SIZE 64 */ +#ifndef __WCHAR_ENABLED +#if 0 +#warning WHOA!!! __WCHAR_ENABLED is not defined! defining it now... +#endif +#define __WCHAR_ENABLED +#endif /* TODO - fix */ #ifdef __WCHAR_ENABLED -#define WCctype_TBL_LEN (WCctype_II_LEN + WCctype_TI_LEN + WCctype_UT_LEN) -#define WCuplow_TBL_LEN (WCuplow_II_LEN + WCuplow_TI_LEN + WCuplow_UT_LEN) -#define WCuplow_diff_TBL_LEN (2 * WCuplow_diffs) +#define __LOCALE_DATA_WCctype_TBL_LEN (__LOCALE_DATA_WCctype_II_LEN + __LOCALE_DATA_WCctype_TI_LEN + __LOCALE_DATA_WCctype_UT_LEN) +#define __LOCALE_DATA_WCuplow_TBL_LEN (__LOCALE_DATA_WCuplow_II_LEN + __LOCALE_DATA_WCuplow_TI_LEN + __LOCALE_DATA_WCuplow_UT_LEN) +#define __LOCALE_DATA_WCuplow_diff_TBL_LEN (2 * __LOCALE_DATA_WCuplow_diffs) /* #define WCcomb_TBL_LEN (WCcomb_II_LEN + WCcomb_TI_LEN + WCcomb_UT_LEN) */ #endif @@ -16,70 +19,72 @@ #undef __PASTE3 #define __PASTE3(A,B,C) A ## B ## C -#define COMMON_MMAP(X) \ +#define __LOCALE_DATA_COMMON_MMAP(X) \ unsigned char __PASTE3(lc_,X,_data)[__PASTE3(__lc_,X,_data_LEN)]; -#define COMMON_MMIDX(X) \ +#define __LOCALE_DATA_COMMON_MMIDX(X) \ unsigned char __PASTE3(lc_,X,_rows)[__PASTE3(__lc_,X,_rows_LEN)]; \ uint16_t __PASTE3(lc_,X,_item_offsets)[__PASTE3(__lc_,X,_item_offsets_LEN)]; \ uint16_t __PASTE3(lc_,X,_item_idx)[__PASTE3(__lc_,X,_item_idx_LEN)]; \ typedef struct { - unsigned char magic[MAGIC_SIZE]; +#ifdef __LOCALE_DATA_MAGIC_SIZE + unsigned char magic[__LOCALE_DATA_MAGIC_SIZE]; +#endif /* __LOCALE_DATA_MAGIC_SIZE */ #ifdef __CTYPE_HAS_8_BIT_LOCALES - const unsigned char tbl8ctype[Cctype_TBL_LEN]; - const unsigned char tbl8uplow[Cuplow_TBL_LEN]; + const unsigned char tbl8ctype[__LOCALE_DATA_Cctype_TBL_LEN]; + const unsigned char tbl8uplow[__LOCALE_DATA_Cuplow_TBL_LEN]; #ifdef __WCHAR_ENABLED - const uint16_t tbl8c2wc[Cc2wc_TBL_LEN]; /* char > 0x7f to wide char */ - const unsigned char tbl8wc2c[Cwc2c_TBL_LEN]; + const uint16_t tbl8c2wc[__LOCALE_DATA_Cc2wc_TBL_LEN]; /* char > 0x7f to wide char */ + const unsigned char tbl8wc2c[__LOCALE_DATA_Cwc2c_TBL_LEN]; /* translit */ #endif /* __WCHAR_ENABLED */ #endif /* __CTYPE_HAS_8_BIT_LOCALES */ #ifdef __WCHAR_ENABLED - const unsigned char tblwctype[WCctype_TBL_LEN]; - const unsigned char tblwuplow[WCuplow_TBL_LEN]; - const int16_t tblwuplow_diff[WCuplow_diff_TBL_LEN]; + const unsigned char tblwctype[__LOCALE_DATA_WCctype_TBL_LEN]; + const unsigned char tblwuplow[__LOCALE_DATA_WCuplow_TBL_LEN]; + const int16_t tblwuplow_diff[__LOCALE_DATA_WCuplow_diff_TBL_LEN]; /* const unsigned char tblwcomb[WCcomb_TBL_LEN]; */ /* width?? */ #endif /* __WCHAR_ENABLED */ - COMMON_MMAP(ctype); - COMMON_MMAP(numeric); - COMMON_MMAP(monetary); - COMMON_MMAP(time); + __LOCALE_DATA_COMMON_MMAP(ctype); + __LOCALE_DATA_COMMON_MMAP(numeric); + __LOCALE_DATA_COMMON_MMAP(monetary); + __LOCALE_DATA_COMMON_MMAP(time); /* collate is different */ - COMMON_MMAP(messages); + __LOCALE_DATA_COMMON_MMAP(messages); #ifdef __CTYPE_HAS_8_BIT_LOCALES - const codeset_8_bit_t codeset_8_bit[NUM_CODESETS]; + const __codeset_8_bit_t codeset_8_bit[__LOCALE_DATA_NUM_CODESETS]; #endif /* __CTYPE_HAS_8_BIT_LOCALES */ - COMMON_MMIDX(ctype); - COMMON_MMIDX(numeric); - COMMON_MMIDX(monetary); - COMMON_MMIDX(time); + __LOCALE_DATA_COMMON_MMIDX(ctype); + __LOCALE_DATA_COMMON_MMIDX(numeric); + __LOCALE_DATA_COMMON_MMIDX(monetary); + __LOCALE_DATA_COMMON_MMIDX(time); /* collate is different */ - COMMON_MMIDX(messages); + __LOCALE_DATA_COMMON_MMIDX(messages); const uint16_t collate_data[__lc_collate_data_LEN]; - unsigned char lc_common_item_offsets_LEN[CATEGORIES]; - size_t lc_common_tbl_offsets[CATEGORIES * 4]; + unsigned char lc_common_item_offsets_LEN[__LOCALE_DATA_CATEGORIES]; + size_t lc_common_tbl_offsets[__LOCALE_DATA_CATEGORIES * 4]; /* offsets from start of locale_mmap_t */ /* rows, item_offsets, item_idx, data */ -#ifdef NUM_LOCALES - unsigned char locales[NUM_LOCALES * WIDTH_LOCALES]; - unsigned char locale_names5[5*NUM_LOCALE_NAMES]; - unsigned char locale_at_modifiers[LOCALE_AT_MODIFIERS_LENGTH]; -#endif /* NUM_LOCALES */ +#ifdef __LOCALE_DATA_NUM_LOCALES + unsigned char locales[__LOCALE_DATA_NUM_LOCALES * __LOCALE_DATA_WIDTH_LOCALES]; + unsigned char locale_names5[5*__LOCALE_DATA_NUM_LOCALE_NAMES]; + unsigned char locale_at_modifiers[__LOCALE_DATA_AT_MODIFIERS_LENGTH]; +#endif /* __LOCALE_DATA_NUM_LOCALES */ - unsigned char lc_names[lc_names_LEN]; + unsigned char lc_names[__lc_names_LEN]; #ifdef __CTYPE_HAS_8_BIT_LOCALES - unsigned char codeset_list[sizeof(CODESET_LIST)]; /* TODO - fix */ + unsigned char codeset_list[sizeof(__LOCALE_DATA_CODESET_LIST)]; /* TODO - fix */ #endif /* __CTYPE_HAS_8_BIT_LOCALES */ |