2 //===-----------------------------------------------------------------------===//
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8 //===----------------------------------------------------------------------===//
9 // These are reimplementations of some extended locale functions ( *_l ) that
10 // are normally part of POSIX. This shared implementation provides parts of the
11 // extended locale support for libc's that normally don't have any (like
12 // Android's bionic and Newlib).
13 //===----------------------------------------------------------------------===//
15 #ifndef _LIBCPP___SUPPORT_XLOCALE_POSIX_L_FALLBACK_H
16 #define _LIBCPP___SUPPORT_XLOCALE_POSIX_L_FALLBACK_H
22 #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
30 inline _LIBCPP_HIDE_FROM_ABI_C
int isalnum_l(int __c
, locale_t
) { return ::isalnum(__c
); }
32 inline _LIBCPP_HIDE_FROM_ABI_C
int isalpha_l(int __c
, locale_t
) { return ::isalpha(__c
); }
34 inline _LIBCPP_HIDE_FROM_ABI_C
int isblank_l(int __c
, locale_t
) { return ::isblank(__c
); }
36 inline _LIBCPP_HIDE_FROM_ABI_C
int iscntrl_l(int __c
, locale_t
) { return ::iscntrl(__c
); }
38 inline _LIBCPP_HIDE_FROM_ABI_C
int isdigit_l(int __c
, locale_t
) { return ::isdigit(__c
); }
40 inline _LIBCPP_HIDE_FROM_ABI_C
int isgraph_l(int __c
, locale_t
) { return ::isgraph(__c
); }
42 inline _LIBCPP_HIDE_FROM_ABI_C
int islower_l(int __c
, locale_t
) { return ::islower(__c
); }
44 inline _LIBCPP_HIDE_FROM_ABI_C
int isprint_l(int __c
, locale_t
) { return ::isprint(__c
); }
46 inline _LIBCPP_HIDE_FROM_ABI_C
int ispunct_l(int __c
, locale_t
) { return ::ispunct(__c
); }
48 inline _LIBCPP_HIDE_FROM_ABI_C
int isspace_l(int __c
, locale_t
) { return ::isspace(__c
); }
50 inline _LIBCPP_HIDE_FROM_ABI_C
int isupper_l(int __c
, locale_t
) { return ::isupper(__c
); }
52 inline _LIBCPP_HIDE_FROM_ABI_C
int isxdigit_l(int __c
, locale_t
) { return ::isxdigit(__c
); }
54 inline _LIBCPP_HIDE_FROM_ABI_C
int toupper_l(int __c
, locale_t
) { return ::toupper(__c
); }
56 inline _LIBCPP_HIDE_FROM_ABI_C
int tolower_l(int __c
, locale_t
) { return ::tolower(__c
); }
58 #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
59 inline _LIBCPP_HIDE_FROM_ABI_C
int iswalnum_l(wint_t __c
, locale_t
) { return ::iswalnum(__c
); }
61 inline _LIBCPP_HIDE_FROM_ABI_C
int iswalpha_l(wint_t __c
, locale_t
) { return ::iswalpha(__c
); }
63 inline _LIBCPP_HIDE_FROM_ABI_C
int iswblank_l(wint_t __c
, locale_t
) { return ::iswblank(__c
); }
65 inline _LIBCPP_HIDE_FROM_ABI_C
int iswcntrl_l(wint_t __c
, locale_t
) { return ::iswcntrl(__c
); }
67 inline _LIBCPP_HIDE_FROM_ABI_C
int iswdigit_l(wint_t __c
, locale_t
) { return ::iswdigit(__c
); }
69 inline _LIBCPP_HIDE_FROM_ABI_C
int iswgraph_l(wint_t __c
, locale_t
) { return ::iswgraph(__c
); }
71 inline _LIBCPP_HIDE_FROM_ABI_C
int iswlower_l(wint_t __c
, locale_t
) { return ::iswlower(__c
); }
73 inline _LIBCPP_HIDE_FROM_ABI_C
int iswprint_l(wint_t __c
, locale_t
) { return ::iswprint(__c
); }
75 inline _LIBCPP_HIDE_FROM_ABI_C
int iswpunct_l(wint_t __c
, locale_t
) { return ::iswpunct(__c
); }
77 inline _LIBCPP_HIDE_FROM_ABI_C
int iswspace_l(wint_t __c
, locale_t
) { return ::iswspace(__c
); }
79 inline _LIBCPP_HIDE_FROM_ABI_C
int iswupper_l(wint_t __c
, locale_t
) { return ::iswupper(__c
); }
81 inline _LIBCPP_HIDE_FROM_ABI_C
int iswxdigit_l(wint_t __c
, locale_t
) { return ::iswxdigit(__c
); }
83 inline _LIBCPP_HIDE_FROM_ABI_C
wint_t towupper_l(wint_t __c
, locale_t
) { return ::towupper(__c
); }
85 inline _LIBCPP_HIDE_FROM_ABI_C
wint_t towlower_l(wint_t __c
, locale_t
) { return ::towlower(__c
); }
86 #endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
88 inline _LIBCPP_HIDE_FROM_ABI_C
int strcoll_l(const char* __s1
, const char* __s2
, locale_t
) {
89 return ::strcoll(__s1
, __s2
);
92 inline _LIBCPP_HIDE_FROM_ABI_C
size_t strxfrm_l(char* __dest
, const char* __src
, size_t __n
, locale_t
) {
93 return ::strxfrm(__dest
, __src
, __n
);
96 inline _LIBCPP_HIDE_FROM_ABI_C
size_t
97 strftime_l(char* __s
, size_t __max
, const char* __format
, const struct tm
* __tm
, locale_t
) {
98 return ::strftime(__s
, __max
, __format
, __tm
);
101 #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
102 inline _LIBCPP_HIDE_FROM_ABI_C
int wcscoll_l(const wchar_t* __ws1
, const wchar_t* __ws2
, locale_t
) {
103 return ::wcscoll(__ws1
, __ws2
);
106 inline _LIBCPP_HIDE_FROM_ABI_C
size_t wcsxfrm_l(wchar_t* __dest
, const wchar_t* __src
, size_t __n
, locale_t
) {
107 return ::wcsxfrm(__dest
, __src
, __n
);
109 #endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
115 #endif // _LIBCPP___SUPPORT_XLOCALE_POSIX_L_FALLBACK_H