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 16 #ifndef _LIBCPP_SUPPORT_XLOCALE_POSIX_L_FALLBACK_H 17 #define _LIBCPP_SUPPORT_XLOCALE_POSIX_L_FALLBACK_H 18 19 #ifdef __cplusplus 20 extern "C" { 21 #endif 22 23 inline _LIBCPP_INLINE_VISIBILITY int isalnum_l(int c, locale_t) { 24 return ::isalnum(c); 25 } 26 27 inline _LIBCPP_INLINE_VISIBILITY int isalpha_l(int c, locale_t) { 28 return ::isalpha(c); 29 } 30 31 inline _LIBCPP_INLINE_VISIBILITY int isblank_l(int c, locale_t) { 32 return ::isblank(c); 33 } 34 35 inline _LIBCPP_INLINE_VISIBILITY int iscntrl_l(int c, locale_t) { 36 return ::iscntrl(c); 37 } 38 39 inline _LIBCPP_INLINE_VISIBILITY int isdigit_l(int c, locale_t) { 40 return ::isdigit(c); 41 } 42 43 inline _LIBCPP_INLINE_VISIBILITY int isgraph_l(int c, locale_t) { 44 return ::isgraph(c); 45 } 46 47 inline _LIBCPP_INLINE_VISIBILITY int islower_l(int c, locale_t) { 48 return ::islower(c); 49 } 50 51 inline _LIBCPP_INLINE_VISIBILITY int isprint_l(int c, locale_t) { 52 return ::isprint(c); 53 } 54 55 inline _LIBCPP_INLINE_VISIBILITY int ispunct_l(int c, locale_t) { 56 return ::ispunct(c); 57 } 58 59 inline _LIBCPP_INLINE_VISIBILITY int isspace_l(int c, locale_t) { 60 return ::isspace(c); 61 } 62 63 inline _LIBCPP_INLINE_VISIBILITY int isupper_l(int c, locale_t) { 64 return ::isupper(c); 65 } 66 67 inline _LIBCPP_INLINE_VISIBILITY int isxdigit_l(int c, locale_t) { 68 return ::isxdigit(c); 69 } 70 71 inline _LIBCPP_INLINE_VISIBILITY int iswalnum_l(wint_t c, locale_t) { 72 return ::iswalnum(c); 73 } 74 75 inline _LIBCPP_INLINE_VISIBILITY int iswalpha_l(wint_t c, locale_t) { 76 return ::iswalpha(c); 77 } 78 79 inline _LIBCPP_INLINE_VISIBILITY int iswblank_l(wint_t c, locale_t) { 80 return ::iswblank(c); 81 } 82 83 inline _LIBCPP_INLINE_VISIBILITY int iswcntrl_l(wint_t c, locale_t) { 84 return ::iswcntrl(c); 85 } 86 87 inline _LIBCPP_INLINE_VISIBILITY int iswdigit_l(wint_t c, locale_t) { 88 return ::iswdigit(c); 89 } 90 91 inline _LIBCPP_INLINE_VISIBILITY int iswgraph_l(wint_t c, locale_t) { 92 return ::iswgraph(c); 93 } 94 95 inline _LIBCPP_INLINE_VISIBILITY int iswlower_l(wint_t c, locale_t) { 96 return ::iswlower(c); 97 } 98 99 inline _LIBCPP_INLINE_VISIBILITY int iswprint_l(wint_t c, locale_t) { 100 return ::iswprint(c); 101 } 102 103 inline _LIBCPP_INLINE_VISIBILITY int iswpunct_l(wint_t c, locale_t) { 104 return ::iswpunct(c); 105 } 106 107 inline _LIBCPP_INLINE_VISIBILITY int iswspace_l(wint_t c, locale_t) { 108 return ::iswspace(c); 109 } 110 111 inline _LIBCPP_INLINE_VISIBILITY int iswupper_l(wint_t c, locale_t) { 112 return ::iswupper(c); 113 } 114 115 inline _LIBCPP_INLINE_VISIBILITY int iswxdigit_l(wint_t c, locale_t) { 116 return ::iswxdigit(c); 117 } 118 119 inline _LIBCPP_INLINE_VISIBILITY int toupper_l(int c, locale_t) { 120 return ::toupper(c); 121 } 122 123 inline _LIBCPP_INLINE_VISIBILITY int tolower_l(int c, locale_t) { 124 return ::tolower(c); 125 } 126 127 inline _LIBCPP_INLINE_VISIBILITY wint_t towupper_l(wint_t c, locale_t) { 128 return ::towupper(c); 129 } 130 131 inline _LIBCPP_INLINE_VISIBILITY wint_t towlower_l(wint_t c, locale_t) { 132 return ::towlower(c); 133 } 134 135 inline _LIBCPP_INLINE_VISIBILITY int strcoll_l(const char *s1, const char *s2, 136 locale_t) { 137 return ::strcoll(s1, s2); 138 } 139 140 inline _LIBCPP_INLINE_VISIBILITY size_t strxfrm_l(char *dest, const char *src, 141 size_t n, locale_t) { 142 return ::strxfrm(dest, src, n); 143 } 144 145 inline _LIBCPP_INLINE_VISIBILITY size_t strftime_l(char *s, size_t max, 146 const char *format, 147 const struct tm *tm, locale_t) { 148 return ::strftime(s, max, format, tm); 149 } 150 151 inline _LIBCPP_INLINE_VISIBILITY int wcscoll_l(const wchar_t *ws1, 152 const wchar_t *ws2, locale_t) { 153 return ::wcscoll(ws1, ws2); 154 } 155 156 inline _LIBCPP_INLINE_VISIBILITY size_t wcsxfrm_l(wchar_t *dest, const wchar_t *src, 157 size_t n, locale_t) { 158 return ::wcsxfrm(dest, src, n); 159 } 160 161 #ifdef __cplusplus 162 } 163 #endif 164 165 #endif // _LIBCPP_SUPPORT_XLOCALE_POSIX_L_FALLBACK_H 166