__posix_l_fallback.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. // -*- C++ -*-
  2. //===--------------- support/xlocale/__posix_l_fallback.h -----------------===//
  3. //
  4. // The LLVM Compiler Infrastructure
  5. //
  6. // This file is dual licensed under the MIT and the University of Illinois Open
  7. // Source Licenses. See LICENSE.TXT for details.
  8. //
  9. //===----------------------------------------------------------------------===//
  10. // These are reimplementations of some extended locale functions ( *_l ) that
  11. // are normally part of POSIX. This shared implementation provides parts of the
  12. // extended locale support for libc's that normally don't have any (like
  13. // Android's bionic and Newlib).
  14. //===----------------------------------------------------------------------===//
  15. #ifndef _LIBCPP_SUPPORT_XLOCALE_POSIX_L_FALLBACK_H
  16. #define _LIBCPP_SUPPORT_XLOCALE_POSIX_L_FALLBACK_H
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. inline _LIBCPP_ALWAYS_INLINE int isalnum_l(int c, locale_t) {
  21. return ::isalnum(c);
  22. }
  23. inline _LIBCPP_ALWAYS_INLINE int isalpha_l(int c, locale_t) {
  24. return ::isalpha(c);
  25. }
  26. inline _LIBCPP_ALWAYS_INLINE int isblank_l(int c, locale_t) {
  27. return ::isblank(c);
  28. }
  29. inline _LIBCPP_ALWAYS_INLINE int iscntrl_l(int c, locale_t) {
  30. return ::iscntrl(c);
  31. }
  32. inline _LIBCPP_ALWAYS_INLINE int isdigit_l(int c, locale_t) {
  33. return ::isdigit(c);
  34. }
  35. inline _LIBCPP_ALWAYS_INLINE int isgraph_l(int c, locale_t) {
  36. return ::isgraph(c);
  37. }
  38. inline _LIBCPP_ALWAYS_INLINE int islower_l(int c, locale_t) {
  39. return ::islower(c);
  40. }
  41. inline _LIBCPP_ALWAYS_INLINE int isprint_l(int c, locale_t) {
  42. return ::isprint(c);
  43. }
  44. inline _LIBCPP_ALWAYS_INLINE int ispunct_l(int c, locale_t) {
  45. return ::ispunct(c);
  46. }
  47. inline _LIBCPP_ALWAYS_INLINE int isspace_l(int c, locale_t) {
  48. return ::isspace(c);
  49. }
  50. inline _LIBCPP_ALWAYS_INLINE int isupper_l(int c, locale_t) {
  51. return ::isupper(c);
  52. }
  53. inline _LIBCPP_ALWAYS_INLINE int isxdigit_l(int c, locale_t) {
  54. return ::isxdigit(c);
  55. }
  56. inline _LIBCPP_ALWAYS_INLINE int iswalnum_l(wint_t c, locale_t) {
  57. return ::iswalnum(c);
  58. }
  59. inline _LIBCPP_ALWAYS_INLINE int iswalpha_l(wint_t c, locale_t) {
  60. return ::iswalpha(c);
  61. }
  62. inline _LIBCPP_ALWAYS_INLINE int iswblank_l(wint_t c, locale_t) {
  63. return ::iswblank(c);
  64. }
  65. inline _LIBCPP_ALWAYS_INLINE int iswcntrl_l(wint_t c, locale_t) {
  66. return ::iswcntrl(c);
  67. }
  68. inline _LIBCPP_ALWAYS_INLINE int iswdigit_l(wint_t c, locale_t) {
  69. return ::iswdigit(c);
  70. }
  71. inline _LIBCPP_ALWAYS_INLINE int iswgraph_l(wint_t c, locale_t) {
  72. return ::iswgraph(c);
  73. }
  74. inline _LIBCPP_ALWAYS_INLINE int iswlower_l(wint_t c, locale_t) {
  75. return ::iswlower(c);
  76. }
  77. inline _LIBCPP_ALWAYS_INLINE int iswprint_l(wint_t c, locale_t) {
  78. return ::iswprint(c);
  79. }
  80. inline _LIBCPP_ALWAYS_INLINE int iswpunct_l(wint_t c, locale_t) {
  81. return ::iswpunct(c);
  82. }
  83. inline _LIBCPP_ALWAYS_INLINE int iswspace_l(wint_t c, locale_t) {
  84. return ::iswspace(c);
  85. }
  86. inline _LIBCPP_ALWAYS_INLINE int iswupper_l(wint_t c, locale_t) {
  87. return ::iswupper(c);
  88. }
  89. inline _LIBCPP_ALWAYS_INLINE int iswxdigit_l(wint_t c, locale_t) {
  90. return ::iswxdigit(c);
  91. }
  92. inline _LIBCPP_ALWAYS_INLINE int toupper_l(int c, locale_t) {
  93. return ::toupper(c);
  94. }
  95. inline _LIBCPP_ALWAYS_INLINE int tolower_l(int c, locale_t) {
  96. return ::tolower(c);
  97. }
  98. inline _LIBCPP_ALWAYS_INLINE int towupper_l(int c, locale_t) {
  99. return ::towupper(c);
  100. }
  101. inline _LIBCPP_ALWAYS_INLINE int towlower_l(int c, locale_t) {
  102. return ::towlower(c);
  103. }
  104. inline _LIBCPP_ALWAYS_INLINE int strcoll_l(const char *s1, const char *s2,
  105. locale_t) {
  106. return ::strcoll(s1, s2);
  107. }
  108. inline _LIBCPP_ALWAYS_INLINE size_t strxfrm_l(char *dest, const char *src,
  109. size_t n, locale_t) {
  110. return ::strxfrm(dest, src, n);
  111. }
  112. inline _LIBCPP_ALWAYS_INLINE size_t strftime_l(char *s, size_t max,
  113. const char *format,
  114. const struct tm *tm, locale_t) {
  115. return ::strftime(s, max, format, tm);
  116. }
  117. inline _LIBCPP_ALWAYS_INLINE int wcscoll_l(const wchar_t *ws1,
  118. const wchar_t *ws2, locale_t) {
  119. return ::wcscoll(ws1, ws2);
  120. }
  121. inline _LIBCPP_ALWAYS_INLINE size_t wcsxfrm_l(wchar_t *dest, const wchar_t *src,
  122. size_t n, locale_t) {
  123. return ::wcsxfrm(dest, src, n);
  124. }
  125. #ifdef __cplusplus
  126. }
  127. #endif
  128. #endif // _LIBCPP_SUPPORT_XLOCALE_POSIX_L_FALLBACK_H