locale_mmap.h 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /* #define __LOCALE_DATA_MAGIC_SIZE 64 */
  2. #ifndef __WCHAR_ENABLED
  3. #if 0
  4. #warning WHOA!!! __WCHAR_ENABLED is not defined! defining it now...
  5. #endif
  6. #define __WCHAR_ENABLED
  7. #endif
  8. /* TODO - fix */
  9. #ifdef __WCHAR_ENABLED
  10. #define __LOCALE_DATA_WCctype_TBL_LEN (__LOCALE_DATA_WCctype_II_LEN + __LOCALE_DATA_WCctype_TI_LEN + __LOCALE_DATA_WCctype_UT_LEN)
  11. #define __LOCALE_DATA_WCuplow_TBL_LEN (__LOCALE_DATA_WCuplow_II_LEN + __LOCALE_DATA_WCuplow_TI_LEN + __LOCALE_DATA_WCuplow_UT_LEN)
  12. #define __LOCALE_DATA_WCuplow_diff_TBL_LEN (2 * __LOCALE_DATA_WCuplow_diffs)
  13. /* #define WCcomb_TBL_LEN (WCcomb_II_LEN + WCcomb_TI_LEN + WCcomb_UT_LEN) */
  14. #endif
  15. #undef __PASTE2
  16. #define __PASTE2(A,B) A ## B
  17. #undef __PASTE3
  18. #define __PASTE3(A,B,C) A ## B ## C
  19. #define __LOCALE_DATA_COMMON_MMAP(X) \
  20. unsigned char __PASTE3(lc_,X,_data)[__PASTE3(__lc_,X,_data_LEN)];
  21. #define __LOCALE_DATA_COMMON_MMIDX(X) \
  22. unsigned char __PASTE3(lc_,X,_rows)[__PASTE3(__lc_,X,_rows_LEN)]; \
  23. uint16_t __PASTE3(lc_,X,_item_offsets)[__PASTE3(__lc_,X,_item_offsets_LEN)]; \
  24. uint16_t __PASTE3(lc_,X,_item_idx)[__PASTE3(__lc_,X,_item_idx_LEN)]; \
  25. typedef struct {
  26. #ifdef __LOCALE_DATA_MAGIC_SIZE
  27. unsigned char magic[__LOCALE_DATA_MAGIC_SIZE];
  28. #endif
  29. #ifdef __CTYPE_HAS_8_BIT_LOCALES
  30. const unsigned char tbl8ctype[__LOCALE_DATA_Cctype_TBL_LEN];
  31. const unsigned char tbl8uplow[__LOCALE_DATA_Cuplow_TBL_LEN];
  32. #ifdef __WCHAR_ENABLED
  33. const uint16_t tbl8c2wc[__LOCALE_DATA_Cc2wc_TBL_LEN]; /* char > 0x7f to wide char */
  34. const unsigned char tbl8wc2c[__LOCALE_DATA_Cwc2c_TBL_LEN];
  35. /* translit */
  36. #endif /* __WCHAR_ENABLED */
  37. #endif /* __CTYPE_HAS_8_BIT_LOCALES */
  38. #ifdef __WCHAR_ENABLED
  39. const unsigned char tblwctype[__LOCALE_DATA_WCctype_TBL_LEN];
  40. const unsigned char tblwuplow[__LOCALE_DATA_WCuplow_TBL_LEN];
  41. const int16_t tblwuplow_diff[__LOCALE_DATA_WCuplow_diff_TBL_LEN];
  42. /* const unsigned char tblwcomb[WCcomb_TBL_LEN]; */
  43. /* width?? */
  44. #endif
  45. __LOCALE_DATA_COMMON_MMAP(ctype)
  46. __LOCALE_DATA_COMMON_MMAP(numeric)
  47. __LOCALE_DATA_COMMON_MMAP(monetary)
  48. __LOCALE_DATA_COMMON_MMAP(time)
  49. /* collate is different */
  50. __LOCALE_DATA_COMMON_MMAP(messages)
  51. #ifdef __CTYPE_HAS_8_BIT_LOCALES
  52. const __codeset_8_bit_t codeset_8_bit[__LOCALE_DATA_NUM_CODESETS];
  53. #endif
  54. __LOCALE_DATA_COMMON_MMIDX(ctype)
  55. __LOCALE_DATA_COMMON_MMIDX(numeric)
  56. __LOCALE_DATA_COMMON_MMIDX(monetary)
  57. __LOCALE_DATA_COMMON_MMIDX(time)
  58. /* collate is different */
  59. __LOCALE_DATA_COMMON_MMIDX(messages)
  60. const uint16_t collate_data[__lc_collate_data_LEN];
  61. unsigned char lc_common_item_offsets_LEN[__LOCALE_DATA_CATEGORIES];
  62. size_t lc_common_tbl_offsets[__LOCALE_DATA_CATEGORIES * 4];
  63. /* offsets from start of locale_mmap_t */
  64. /* rows, item_offsets, item_idx, data */
  65. #ifdef __LOCALE_DATA_NUM_LOCALES
  66. unsigned char locales[__LOCALE_DATA_NUM_LOCALES * __LOCALE_DATA_WIDTH_LOCALES];
  67. unsigned char locale_names5[5*__LOCALE_DATA_NUM_LOCALE_NAMES];
  68. unsigned char locale_at_modifiers[__LOCALE_DATA_AT_MODIFIERS_LENGTH];
  69. #endif
  70. unsigned char lc_names[__lc_names_LEN];
  71. #ifdef __CTYPE_HAS_8_BIT_LOCALES
  72. unsigned char codeset_list[sizeof(__LOCALE_DATA_CODESET_LIST)]; /* TODO - fix */
  73. #endif
  74. } __locale_mmap_t;
  75. extern const __locale_mmap_t *__locale_mmap;