locale_mmap.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /* #include "lt_defines.h" */
  2. /* TODO - fix */
  3. #define MAGIC_SIZE 64
  4. /* TODO - fix */
  5. #ifdef __WCHAR_ENABLED
  6. #define WCctype_TBL_LEN (WCctype_II_LEN + WCctype_TI_LEN + WCctype_UT_LEN)
  7. #define WCuplow_TBL_LEN (WCuplow_II_LEN + WCuplow_TI_LEN + WCuplow_UT_LEN)
  8. #define WCuplow_diff_TBL_LEN (2 * WCuplow_diffs)
  9. /* #define WCcomb_TBL_LEN (WCcomb_II_LEN + WCcomb_TI_LEN + WCcomb_UT_LEN) */
  10. #endif
  11. #undef __PASTE2
  12. #define __PASTE2(A,B) A ## B
  13. #undef __PASTE3
  14. #define __PASTE3(A,B,C) A ## B ## C
  15. #define COMMON_MMAP(X) \
  16. unsigned char __PASTE3(lc_,X,_data)[__PASTE3(__lc_,X,_data_LEN)];
  17. #define COMMON_MMIDX(X) \
  18. unsigned char __PASTE3(lc_,X,_rows)[__PASTE3(__lc_,X,_rows_LEN)]; \
  19. uint16_t __PASTE3(lc_,X,_item_offsets)[__PASTE3(__lc_,X,_item_offsets_LEN)]; \
  20. uint16_t __PASTE3(lc_,X,_item_idx)[__PASTE3(__lc_,X,_item_idx_LEN)]; \
  21. typedef struct {
  22. unsigned char magic[MAGIC_SIZE];
  23. #ifdef __CTYPE_HAS_8_BIT_LOCALES
  24. const unsigned char tbl8ctype[Cctype_TBL_LEN];
  25. const unsigned char tbl8uplow[Cuplow_TBL_LEN];
  26. #ifdef __WCHAR_ENABLED
  27. const uint16_t tbl8c2wc[Cc2wc_TBL_LEN]; /* char > 0x7f to wide char */
  28. const unsigned char tbl8wc2c[Cwc2c_TBL_LEN];
  29. /* translit */
  30. #endif /* __WCHAR_ENABLED */
  31. #endif /* __CTYPE_HAS_8_BIT_LOCALES */
  32. #ifdef __WCHAR_ENABLED
  33. const unsigned char tblwctype[WCctype_TBL_LEN];
  34. const unsigned char tblwuplow[WCuplow_TBL_LEN];
  35. const int16_t tblwuplow_diff[WCuplow_diff_TBL_LEN];
  36. /* const unsigned char tblwcomb[WCcomb_TBL_LEN]; */
  37. /* width?? */
  38. #endif /* __WCHAR_ENABLED */
  39. COMMON_MMAP(ctype);
  40. COMMON_MMAP(numeric);
  41. COMMON_MMAP(monetary);
  42. COMMON_MMAP(time);
  43. /* collate is different */
  44. COMMON_MMAP(messages);
  45. #ifdef __CTYPE_HAS_8_BIT_LOCALES
  46. const codeset_8_bit_t codeset_8_bit[NUM_CODESETS];
  47. #endif /* __CTYPE_HAS_8_BIT_LOCALES */
  48. COMMON_MMIDX(ctype);
  49. COMMON_MMIDX(numeric);
  50. COMMON_MMIDX(monetary);
  51. COMMON_MMIDX(time);
  52. /* collate is different */
  53. COMMON_MMIDX(messages);
  54. const uint16_t collate_data[__lc_collate_data_LEN];
  55. unsigned char lc_common_item_offsets_LEN[CATEGORIES];
  56. size_t lc_common_tbl_offsets[CATEGORIES * 4];
  57. /* offsets from start of locale_mmap_t */
  58. /* rows, item_offsets, item_idx, data */
  59. #ifdef NUM_LOCALES
  60. unsigned char locales[NUM_LOCALES * WIDTH_LOCALES];
  61. unsigned char locale_names5[5*NUM_LOCALE_NAMES];
  62. unsigned char locale_at_modifiers[LOCALE_AT_MODIFIERS_LENGTH];
  63. #endif /* NUM_LOCALES */
  64. unsigned char lc_names[lc_names_LEN];
  65. #ifdef __CTYPE_HAS_8_BIT_LOCALES
  66. unsigned char codeset_list[sizeof(CODESET_LIST)]; /* TODO - fix */
  67. #endif /* __CTYPE_HAS_8_BIT_LOCALES */
  68. } __locale_mmap_t;
  69. extern const __locale_mmap_t *__locale_mmap;