aboutsummaryrefslogtreecommitdiff
path: root/include/support/xlocale/xlocale.h
blob: 99f710e8f44ea38471ae144962cc9a9e634fb40e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
// -*- C++ -*-
//===------------------- support/xlocale/xlocale.h ------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// This is a shared implementation of a shim to provide extended locale support
// on top of libc's that don't support it (like Android's bionic, and Newlib).
//
// The 'illusion' only works when the specified locale is "C" or "POSIX", but
// that's about as good as we can do without implementing full xlocale support
// in the underlying libc.
//===----------------------------------------------------------------------===//

#ifndef _LIBCPP_SUPPORT_XLOCALE_XLOCALE_H
#define _LIBCPP_SUPPORT_XLOCALE_XLOCALE_H

#ifdef __cplusplus
extern "C" {
#endif

static inline int isalnum_l(int c, locale_t) {
  return isalnum(c);
}

static inline int isalpha_l(int c, locale_t) {
  return isalpha(c);
}

static inline int isblank_l(int c, locale_t) {
  return isblank(c);
}

static inline int iscntrl_l(int c, locale_t) {
  return iscntrl(c);
}

static inline int isdigit_l(int c, locale_t) {
  return isdigit(c);
}

static inline int isgraph_l(int c, locale_t) {
  return isgraph(c);
}

static inline int islower_l(int c, locale_t) {
  return islower(c);
}

static inline int isprint_l(int c, locale_t) {
  return isprint(c);
}

static inline int ispunct_l(int c, locale_t) {
  return ispunct(c);
}

static inline int isspace_l(int c, locale_t) {
  return isspace(c);
}

static inline int isupper_l(int c, locale_t) {
  return isupper(c);
}

static inline int isxdigit_l(int c, locale_t) {
  return isxdigit(c);
}

static inline int iswalnum_l(wint_t c, locale_t) {
  return iswalnum(c);
}

static inline int iswalpha_l(wint_t c, locale_t) {
  return iswalpha(c);
}

static inline int iswblank_l(wint_t c, locale_t) {
  return iswblank(c);
}

static inline int iswcntrl_l(wint_t c, locale_t) {
  return iswcntrl(c);
}

static inline int iswdigit_l(wint_t c, locale_t) {
  return iswdigit(c);
}

static inline int iswgraph_l(wint_t c, locale_t) {
  return iswgraph(c);
}

static inline int iswlower_l(wint_t c, locale_t) {
  return iswlower(c);
}

static inline int iswprint_l(wint_t c, locale_t) {
  return iswprint(c);
}

static inline int iswpunct_l(wint_t c, locale_t) {
  return iswpunct(c);
}

static inline int iswspace_l(wint_t c, locale_t) {
  return iswspace(c);
}

static inline int iswupper_l(wint_t c, locale_t) {
  return iswupper(c);
}

static inline int iswxdigit_l(wint_t c, locale_t) {
  return iswxdigit(c);
}

static inline int toupper_l(int c, locale_t) {
  return toupper(c);
}

static inline int tolower_l(int c, locale_t) {
  return tolower(c);
}

static inline int towupper_l(int c, locale_t) {
  return towupper(c);
}

static inline int towlower_l(int c, locale_t) {
  return towlower(c);
}

static inline int strcoll_l(const char *s1, const char *s2, locale_t) {
  return strcoll(s1, s2);
}

static inline size_t strxfrm_l(char *dest, const char *src, size_t n,
                               locale_t) {
  return strxfrm(dest, src, n);
}

static inline size_t strftime_l(char *s, size_t max, const char *format,
                                const struct tm *tm, locale_t) {
  return strftime(s, max, format, tm);
}

static inline int wcscoll_l(const wchar_t *ws1, const wchar_t *ws2, locale_t) {
  return wcscoll(ws1, ws2);
}

static inline size_t wcsxfrm_l(wchar_t *dest, const wchar_t *src, size_t n,
                               locale_t) {
  return wcsxfrm(dest, src, n);
}

static inline long double strtold_l(const char *nptr, char **endptr, locale_t) {
  return strtold(nptr, endptr);
}

static inline long long strtoll_l(const char *nptr, char **endptr, int base,
                                  locale_t) {
  return strtoll(nptr, endptr, base);
}

static inline unsigned long long strtoull_l(const char *nptr, char **endptr,
                                            int base, locale_t) {
  return strtoull(nptr, endptr, base);
}

static inline long long wcstoll_l(const wchar_t *nptr, wchar_t **endptr,
                                  int base, locale_t) {
  return wcstoll(nptr, endptr, base);
}

static inline unsigned long long wcstoull_l(const wchar_t *nptr,
                                            wchar_t **endptr, int base,
                                            locale_t) {
  return wcstoull(nptr, endptr, base);
}

static inline long double wcstold_l(const wchar_t *nptr, wchar_t **endptr,
                                    locale_t) {
  return wcstold(nptr, endptr);
}

#ifdef __cplusplus
}
#endif

#endif // _LIBCPP_SUPPORT_XLOCALE_XLOCALE_H