1 /** 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef _LOCALE_H 17 #define _LOCALE_H 18 19 #ifdef __cplusplus 20 extern "C" { 21 #endif 22 23 #include <features.h> 24 25 #if __cplusplus >= 201103L 26 #define NULL nullptr 27 #elif defined(__cplusplus) 28 #define NULL 0L 29 #else 30 #define NULL ((void*)0) 31 #endif 32 33 #define LC_CTYPE 0 34 #define LC_NUMERIC 1 35 #define LC_TIME 2 36 #define LC_COLLATE 3 37 #define LC_MONETARY 4 38 #define LC_MESSAGES 5 39 #define LC_PAPER 6 40 #define LC_NAME 7 41 #define LC_ADDRESS 8 42 #define LC_TELEPHONE 9 43 #define LC_MEASUREMENT 10 44 #define LC_IDENTIFICATION 11 45 #define LC_ALL 12 46 47 struct lconv { 48 char *decimal_point; 49 char *thousands_sep; 50 char *grouping; 51 52 char *int_curr_symbol; 53 char *currency_symbol; 54 char *mon_decimal_point; 55 char *mon_thousands_sep; 56 char *mon_grouping; 57 char *positive_sign; 58 char *negative_sign; 59 char int_frac_digits; 60 char frac_digits; 61 char p_cs_precedes; 62 char p_sep_by_space; 63 char n_cs_precedes; 64 char n_sep_by_space; 65 char p_sign_posn; 66 char n_sign_posn; 67 char int_p_cs_precedes; 68 char int_p_sep_by_space; 69 char int_n_cs_precedes; 70 char int_n_sep_by_space; 71 char int_p_sign_posn; 72 char int_n_sign_posn; 73 }; 74 75 char *setlocale (int, const char *); 76 struct lconv *localeconv(void); 77 78 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ 79 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) 80 81 #define __NEED_locale_t 82 83 #include <bits/alltypes.h> 84 85 #define LC_GLOBAL_LOCALE ((locale_t)-1) 86 87 #define LC_CTYPE_MASK (1<<LC_CTYPE) 88 #define LC_NUMERIC_MASK (1<<LC_NUMERIC) 89 #define LC_TIME_MASK (1<<LC_TIME) 90 #define LC_COLLATE_MASK (1<<LC_COLLATE) 91 #define LC_MONETARY_MASK (1<<LC_MONETARY) 92 #define LC_MESSAGES_MASK (1<<LC_MESSAGES) 93 #define LC_PAPER_MASK (1<<LC_PAPER) 94 #define LC_NAME_MASK (1<<LC_NAME) 95 #define LC_ADDRESS_MASK (1<<LC_ADDRESS) 96 #define LC_TELEPHONE_MASK (1<<LC_TELEPHONE) 97 #define LC_MEASUREMENT_MASK (1<<LC_MEASUREMENT) 98 #define LC_IDENTIFICATION_MASK (1<<LC_IDENTIFICATION) 99 #define LC_ALL_MASK 0x7fffffff 100 101 locale_t duplocale(locale_t); 102 void freelocale(locale_t); 103 locale_t newlocale(int, const char *, locale_t); 104 locale_t uselocale(locale_t); 105 106 #endif 107 #ifdef __cplusplus 108 } 109 #endif 110 #endif 111