summaryrefslogtreecommitdiff
path: root/extra/locale/locale_mmap.h
diff options
context:
space:
mode:
authorManuel Novoa III <mjn3@codepoet.org>2002-05-06 07:37:32 +0000
committerManuel Novoa III <mjn3@codepoet.org>2002-05-06 07:37:32 +0000
commitd07fdf8b9ece2c4339b325921add50792077bf97 (patch)
treeb0886656bdd854728f2d1c05597368c4739ecc1b /extra/locale/locale_mmap.h
parent7f09a14cabbec158d683542e53f53ccfe75031fa (diff)
New locale support (in development). Supports LC_CTYPE, LC_NUMERIC,
LC_TIME, LC_MONETARY, and LC_MESSAGES for the SUSv3 items. Also, nl_langinfo() when real locale support is enabled. New implementation of ctype.h. New implementation of wctype.h. New implementation of most of the string functions (smaller). New implementation of the wcs/wmem functions. These are untested, but they're also just preprocessor-modified versions ot the corresponding str/mem functions. Tweaked qsort and new bsearch. Stuff still pending: stdlib.h and wchar.h mb<->wc functions. I actually have working versions of the stdlib ones, but the reentrant versions from wchar.h require some reworking. Basic replacement and translit support for wc->mb conversions. (groundwork laid). Simple-minded collate support such as was provided by the previous locale implementation. (mostly done -- 8-bit codesets only) Shared mmaping of the locale data and strerror message text.
Diffstat (limited to 'extra/locale/locale_mmap.h')
-rw-r--r--extra/locale/locale_mmap.h89
1 files changed, 89 insertions, 0 deletions
diff --git a/extra/locale/locale_mmap.h b/extra/locale/locale_mmap.h
new file mode 100644
index 000000000..1ed7a2094
--- /dev/null
+++ b/extra/locale/locale_mmap.h
@@ -0,0 +1,89 @@
+/* #include "lt_defines.h" */
+
+/* TODO - fix */
+#define MAGIC_SIZE 64
+
+/* 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 WCcomb_TBL_LEN (WCcomb_II_LEN + WCcomb_TI_LEN + WCcomb_UT_LEN)
+#endif
+
+#undef __PASTE2
+#define __PASTE2(A,B) A ## B
+#undef __PASTE3
+#define __PASTE3(A,B,C) A ## B ## C
+
+#define COMMON_MMAP(X) \
+ unsigned char __PASTE3(lc_,X,_data)[__PASTE3(__lc_,X,_data_LEN)];
+
+#define 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 __CTYPE_HAS_8_BIT_LOCALES
+ const unsigned char tbl8ctype[Cctype_TBL_LEN];
+ const unsigned char tbl8uplow[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];
+ /* 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 tblwcomb[WCcomb_TBL_LEN];
+ /* width?? */
+#endif /* __WCHAR_ENABLED */
+
+ COMMON_MMAP(numeric);
+ COMMON_MMAP(monetary);
+ COMMON_MMAP(time);
+
+ /* TODO -- collate*/
+
+ COMMON_MMAP(messages);
+
+
+#ifdef __CTYPE_HAS_8_BIT_LOCALES
+ const codeset_8_bit_t codeset_8_bit[NUM_CODESETS];
+#endif /* __CTYPE_HAS_8_BIT_LOCALES */
+
+ COMMON_MMIDX(numeric);
+ COMMON_MMIDX(monetary);
+ COMMON_MMIDX(time);
+
+ /* TODO -- collate*/
+
+ COMMON_MMIDX(messages);
+
+
+ unsigned char lc_common_item_offsets_LEN[CATEGORIES];
+ size_t lc_common_tbl_offsets[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 */
+
+ unsigned char lc_names[lc_names_LEN];
+#ifdef __CTYPE_HAS_8_BIT_LOCALES
+ unsigned char codeset_list[sizeof(CODESET_LIST)]; /* TODO - fix */
+#endif /* __CTYPE_HAS_8_BIT_LOCALES */
+
+
+} __locale_mmap_t;
+
+extern const __locale_mmap_t *__locale_mmap;