locale_mmap.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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(numeric);
  40. COMMON_MMAP(monetary);
  41. COMMON_MMAP(time);
  42. /* TODO -- collate*/
  43. COMMON_MMAP(messages);
  44. #ifdef __CTYPE_HAS_8_BIT_LOCALES
  45. const codeset_8_bit_t codeset_8_bit[NUM_CODESETS];
  46. #endif /* __CTYPE_HAS_8_BIT_LOCALES */
  47. COMMON_MMIDX(numeric);
  48. COMMON_MMIDX(monetary);
  49. COMMON_MMIDX(time);
  50. /* TODO -- collate*/
  51. COMMON_MMIDX(messages);
  52. unsigned char lc_common_item_offsets_LEN[CATEGORIES];
  53. size_t lc_common_tbl_offsets[CATEGORIES * 4];
  54. /* offsets from start of locale_mmap_t */
  55. /* rows, item_offsets, item_idx, data */
  56. #ifdef NUM_LOCALES
  57. unsigned char locales[NUM_LOCALES * WIDTH_LOCALES];
  58. unsigned char locale_names5[5*NUM_LOCALE_NAMES];
  59. unsigned char locale_at_modifiers[LOCALE_AT_MODIFIERS_LENGTH];
  60. #endif /* NUM_LOCALES */
  61. unsigned char lc_names[lc_names_LEN];
  62. #ifdef __CTYPE_HAS_8_BIT_LOCALES
  63. unsigned char codeset_list[sizeof(CODESET_LIST)]; /* TODO - fix */
  64. #endif /* __CTYPE_HAS_8_BIT_LOCALES */
  65. } __locale_mmap_t;
  66. extern const __locale_mmap_t *__locale_mmap;