1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef _LIBCPP_SUPPORT_NEWLIB_XLOCALE_H
11 #define _LIBCPP_SUPPORT_NEWLIB_XLOCALE_H
12 
13 #if defined(_NEWLIB_VERSION)
14 
15 #include <cstdlib>
16 #include <clocale>
17 #include <cwctype>
18 #include <ctype.h>
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 // Patch over newlib's lack of extended locale support
25 typedef void *locale_t;
duplocale(locale_t)26 static inline locale_t duplocale(locale_t) {
27   return NULL;
28 }
29 
freelocale(locale_t)30 static inline void freelocale(locale_t) {
31 }
32 
newlocale(int,const char *,locale_t)33 static inline locale_t newlocale(int, const char *, locale_t) {
34   return NULL;
35 }
36 
uselocale(locale_t)37 static inline locale_t uselocale(locale_t) {
38   return NULL;
39 }
40 
41 #define LC_COLLATE_MASK  (1 << LC_COLLATE)
42 #define LC_CTYPE_MASK    (1 << LC_CTYPE)
43 #define LC_MESSAGES_MASK (1 << LC_MESSAGES)
44 #define LC_MONETARY_MASK (1 << LC_MONETARY)
45 #define LC_NUMERIC_MASK  (1 << LC_NUMERIC)
46 #define LC_TIME_MASK     (1 << LC_TIME)
47 #define LC_ALL_MASK (LC_COLLATE_MASK|\
48                      LC_CTYPE_MASK|\
49                      LC_MONETARY_MASK|\
50                      LC_NUMERIC_MASK|\
51                      LC_TIME_MASK|\
52                      LC_MESSAGES_MASK)
53 
54 // Share implementation with Android's Bionic
55 #include <support/xlocale/xlocale.h>
56 
57 #ifdef __cplusplus
58 } // extern "C"
59 #endif
60 
61 #endif // _NEWLIB_VERSION
62 
63 #endif
64