1 /* 2 * Copyright (C) 2013 The Android Open Source Project 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * * Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * * Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in 12 * the documentation and/or other materials provided with the 13 * distribution. 14 * 15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 18 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 19 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 22 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 */ 28 #ifndef NDK_ANDROID_SUPPORT_LOCALE_H 29 #define NDK_ANDROID_SUPPORT_LOCALE_H 30 31 #define lconv __libc_lconv 32 #define localeconv __libc_localeconv 33 #include_next <locale.h> 34 #undef lconv 35 #undef localeconv 36 #include <xlocale.h> 37 38 #ifdef __cplusplus 39 extern "C" { 40 #endif 41 42 #define LC_CTYPE_MASK (1 << LC_CTYPE) 43 #define LC_NUMERIC_MASK (1 << LC_NUMERIC) 44 #define LC_TIME_MASK (1 << LC_TIME) 45 #define LC_COLLATE_MASK (1 << LC_COLLATE) 46 #define LC_MONETARY_MASK (1 << LC_MONETARY) 47 #define LC_MESSAGES_MASK (1 << LC_MESSAGES) 48 #define LC_PAPER_MASK (1 << LC_PAPER) 49 #define LC_NAME_MASK (1 << LC_NAME) 50 #define LC_ADDRESS_MASK (1 << LC_ADDRESS) 51 #define LC_TELEPHONE_MASK (1 << LC_TELEPHONE) 52 #define LC_MEASUREMENT_MASK (1 << LC_MEASUREMENT) 53 #define LC_IDENTIFICATION_MASK (1 << LC_IDENTIFICATION) 54 55 #define LC_ALL_MASK (LC_CTYPE_MASK \ 56 | LC_NUMERIC_MASK \ 57 | LC_TIME_MASK \ 58 | LC_COLLATE_MASK \ 59 | LC_MONETARY_MASK \ 60 | LC_MESSAGES_MASK \ 61 | LC_PAPER_MASK \ 62 | LC_NAME_MASK \ 63 | LC_ADDRESS_MASK \ 64 | LC_TELEPHONE_MASK \ 65 | LC_MEASUREMENT_MASK \ 66 | LC_IDENTIFICATION_MASK \ 67 ) 68 69 extern locale_t newlocale(int, const char*, locale_t); 70 extern locale_t uselocale(locale_t); 71 extern void freelocale(locale_t); 72 73 #define LC_GLOBAL_LOCALE ((locale_t) -1L) 74 75 struct lconv { 76 char* decimal_point; /* Decimal point character */ 77 char* thousands_sep; /* Thousands separator */ 78 char* grouping; /* Grouping */ 79 char* int_curr_symbol; 80 char* currency_symbol; 81 char* mon_decimal_point; 82 char* mon_thousands_sep; 83 char* mon_grouping; 84 char* positive_sign; 85 char* negative_sign; 86 char int_frac_digits; 87 char frac_digits; 88 char p_cs_precedes; 89 char p_sep_by_space; 90 char n_cs_precedes; 91 char n_sep_by_space; 92 char p_sign_posn; 93 char n_sign_posn; 94 /* ISO-C99 */ 95 char int_p_cs_precedes; 96 char int_p_sep_by_space; 97 char int_n_cs_precedes; 98 char int_n_sep_by_space; 99 char int_p_sign_posn; 100 char int_n_sign_posn; 101 }; 102 103 struct lconv* localeconv(void); 104 105 #if 0 106 // Used to implement the std::ctype<char> specialization. 107 extern const char * const __ctype_c_mask_table; 108 // TODO(ajwong): Make this based on some exported bionic constant. 109 const int __ctype_c_mask_table_size = 256; 110 #endif 111 112 #ifdef __cplusplus 113 } // extern "C" 114 #endif 115 116 #endif // NDK_ANDROID_SUPPORT_LOCALE_H 117