• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifdef __cplusplus
26 #define NULL 0L
27 #else
28 #define NULL ((void*)0)
29 #endif
30 
31 #define LC_CTYPE    0
32 #define LC_NUMERIC  1
33 #define LC_TIME     2
34 #define LC_COLLATE  3
35 #define LC_MONETARY 4
36 #define LC_MESSAGES 5
37 #define LC_PAPER    6
38 #define LC_NAME     7
39 #define LC_ADDRESS  8
40 #define LC_TELEPHONE 9
41 #define LC_MEASUREMENT 10
42 #define LC_IDENTIFICATION 11
43 #define LC_ALL      12
44 
45 struct lconv {
46     char *decimal_point;
47     char *thousands_sep;
48     char *grouping;
49 
50     char *int_curr_symbol;
51     char *currency_symbol;
52     char *mon_decimal_point;
53     char *mon_thousands_sep;
54     char *mon_grouping;
55     char *positive_sign;
56     char *negative_sign;
57     char int_frac_digits;
58     char frac_digits;
59     char p_cs_precedes;
60     char p_sep_by_space;
61     char n_cs_precedes;
62     char n_sep_by_space;
63     char p_sign_posn;
64     char n_sign_posn;
65     char int_p_cs_precedes;
66     char int_p_sep_by_space;
67     char int_n_cs_precedes;
68     char int_n_sep_by_space;
69     char int_p_sign_posn;
70     char int_n_sign_posn;
71 };
72 
73 char *setlocale (int, const char *);
74 struct lconv *localeconv(void);
75 
76 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
77  || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
78 
79 #define __NEED_locale_t
80 
81 #include <bits/alltypes.h>
82 
83 #define LC_GLOBAL_LOCALE ((locale_t)-1)
84 
85 #define LC_CTYPE_MASK    (1<<LC_CTYPE)
86 #define LC_NUMERIC_MASK  (1<<LC_NUMERIC)
87 #define LC_TIME_MASK     (1<<LC_TIME)
88 #define LC_COLLATE_MASK  (1<<LC_COLLATE)
89 #define LC_MONETARY_MASK (1<<LC_MONETARY)
90 #define LC_MESSAGES_MASK (1<<LC_MESSAGES)
91 #define LC_PAPER_MASK    (1<<LC_PAPER)
92 #define LC_NAME_MASK     (1<<LC_NAME)
93 #define LC_ADDRESS_MASK  (1<<LC_ADDRESS)
94 #define LC_TELEPHONE_MASK (1<<LC_TELEPHONE)
95 #define LC_MEASUREMENT_MASK (1<<LC_MEASUREMENT)
96 #define LC_IDENTIFICATION_MASK (1<<LC_IDENTIFICATION)
97 #define LC_ALL_MASK      0x7fffffff
98 
99 locale_t duplocale(locale_t);
100 void freelocale(locale_t);
101 locale_t newlocale(int, const char *, locale_t);
102 locale_t uselocale(locale_t);
103 
104 #endif
105 #ifdef __cplusplus
106 }
107 #endif
108 #endif
109