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