1
0

locale_impl.h 734 B

12345678910111213141516171819202122232425262728
  1. #include <locale.h>
  2. #include <stdlib.h>
  3. #include "libc.h"
  4. #include "pthread_impl.h"
  5. #define LOCALE_NAME_MAX 15
  6. struct __locale_map {
  7. const void *map;
  8. size_t map_size;
  9. char name[LOCALE_NAME_MAX+1];
  10. struct __locale_map *next;
  11. };
  12. int __setlocalecat(locale_t, int, const char *);
  13. const char *__mo_lookup(const void *, size_t, const char *);
  14. const char *__lctrans(const char *, const struct __locale_map *);
  15. const char *__lctrans_cur(const char *);
  16. #define LCTRANS(msg, lc, loc) __lctrans(msg, (loc)->cat[(lc)-2])
  17. #define LCTRANS_CUR(msg) __lctrans_cur(msg)
  18. #define CURRENT_LOCALE (__pthread_self()->locale)
  19. #define CURRENT_UTF8 (__pthread_self()->locale->ctype_utf8)
  20. #undef MB_CUR_MAX
  21. #define MB_CUR_MAX (CURRENT_UTF8 ? 4 : 1)