xlocale.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. //===----------------------------------------------------------------------===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is dual licensed under the MIT and the University of Illinois Open
  6. // Source Licenses. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. #ifdef __sun__
  10. #include "support/solaris/xlocale.h"
  11. #include <stdarg.h>
  12. #include <stdio.h>
  13. #include <sys/localedef.h>
  14. int isxdigit_l(int __c, locale_t __l) {
  15. return isxdigit(__c);
  16. }
  17. int iswxdigit_l(wchar_t __c, locale_t __l) {
  18. return isxdigit(__c);
  19. }
  20. // FIXME: This disregards the locale, which is Very Wrong
  21. #define vsnprintf_l(__s, __n, __l, __format, __va) \
  22. vsnprintf(__s, __n, __format, __va)
  23. int snprintf_l(char *__s, size_t __n, locale_t __l, const char *__format, ...)
  24. {
  25. va_list __va;
  26. va_start(__va, __format);
  27. int __res = vsnprintf_l(__s, __n , __l, __format, __va);
  28. va_end(__va);
  29. return __res;
  30. }
  31. int asprintf_l(char **__s, locale_t __l, const char *__format, ...) {
  32. va_list __va;
  33. va_start(__va, __format);
  34. // FIXME:
  35. int __res = vasprintf(__s, __format, __va);
  36. va_end(__va);
  37. return __res;
  38. }
  39. int sscanf_l(const char *__s, locale_t __l, const char *__format, ...) {
  40. va_list __va;
  41. va_start(__va, __format);
  42. // FIXME:
  43. int __res = vsscanf(__s, __format, __va);
  44. va_end(__va);
  45. return __res;
  46. }
  47. size_t mbrtowc_l(wchar_t *__pwc, const char *__pmb,
  48. size_t __max, mbstate_t *__ps, locale_t __loc) {
  49. return mbrtowc(__pwc, __pmb, __max, __ps);
  50. }
  51. struct lconv *localeconv_l(locale_t __l) {
  52. return localeconv();
  53. }
  54. #endif // __sun__