1 /**
2  * D header file for C99.
3  *
4  * $(C_HEADER_DESCRIPTION pubs.opengroup.org/onlinepubs/009695399/basedefs/_locale.h.html, _locale.h)
5  *
6  * Copyright: Copyright Sean Kelly 2005 - 2009.
7  * License: Distributed under the
8  *      $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0).
9  *    (See accompanying file LICENSE)
10  * Authors:   Sean Kelly
11  * Source:    $(DRUNTIMESRC core/stdc/_locale.d)
12  * Standards: ISO/IEC 9899:1999 (E)
13  */
14 
15 module core.stdc.locale;
16 
17 version (OSX)
18     version = Darwin;
19 else version (iOS)
20     version = Darwin;
21 else version (TVOS)
22     version = Darwin;
23 else version (WatchOS)
24     version = Darwin;
25 
26 extern (C):
27 @trusted: // Only setlocale operates on C strings.
28 nothrow:
29 @nogc:
30 
31 ///
32 struct lconv
33 {
34     char* decimal_point;
35     char* thousands_sep;
36     char* grouping;
37     char* int_curr_symbol;
38     char* currency_symbol;
39     char* mon_decimal_point;
40     char* mon_thousands_sep;
41     char* mon_grouping;
42     char* positive_sign;
43     char* negative_sign;
44     byte  int_frac_digits;
45     byte  frac_digits;
46     byte  p_cs_precedes;
47     byte  p_sep_by_space;
48     byte  n_cs_precedes;
49     byte  n_sep_by_space;
50     byte  p_sign_posn;
51     byte  n_sign_posn;
52     byte  int_p_cs_precedes;
53     byte  int_p_sep_by_space;
54     byte  int_n_cs_precedes;
55     byte  int_n_sep_by_space;
56     byte  int_p_sign_posn;
57     byte  int_n_sign_posn;
58 }
59 
60 version (CRuntime_Glibc)
61 {
62     ///
63     enum LC_CTYPE          = 0;
64     ///
65     enum LC_NUMERIC        = 1;
66     ///
67     enum LC_TIME           = 2;
68     ///
69     enum LC_COLLATE        = 3;
70     ///
71     enum LC_MONETARY       = 4;
72     ///
73     enum LC_MESSAGES       = 5;
74     ///
75     enum LC_ALL            = 6;
76     ///
77     enum LC_PAPER          = 7;  // non-standard
78     ///
79     enum LC_NAME           = 8;  // non-standard
80     ///
81     enum LC_ADDRESS        = 9;  // non-standard
82     ///
83     enum LC_TELEPHONE      = 10; // non-standard
84     ///
85     enum LC_MEASUREMENT    = 11; // non-standard
86     ///
87     enum LC_IDENTIFICATION = 12; // non-standard
88 }
89 else version (Windows)
90 {
91     ///
92     enum LC_ALL            = 0;
93     ///
94     enum LC_COLLATE        = 1;
95     ///
96     enum LC_CTYPE          = 2;
97     ///
98     enum LC_MONETARY       = 3;
99     ///
100     enum LC_NUMERIC        = 4;
101     ///
102     enum LC_TIME           = 5;
103 }
104 else version (Darwin)
105 {
106     ///
107     enum LC_ALL            = 0;
108     ///
109     enum LC_COLLATE        = 1;
110     ///
111     enum LC_CTYPE          = 2;
112     ///
113     enum LC_MONETARY       = 3;
114     ///
115     enum LC_NUMERIC        = 4;
116     ///
117     enum LC_TIME           = 5;
118     ///
119     enum LC_MESSAGES       = 6;
120 }
121 else version (FreeBSD)
122 {
123     ///
124     enum LC_ALL            = 0;
125     ///
126     enum LC_COLLATE        = 1;
127     ///
128     enum LC_CTYPE          = 2;
129     ///
130     enum LC_MONETARY       = 3;
131     ///
132     enum LC_NUMERIC        = 4;
133     ///
134     enum LC_TIME           = 5;
135     ///
136     enum LC_MESSAGES       = 6;
137 }
138 else version (NetBSD)
139 {
140     ///
141     enum LC_ALL            = 0;
142     ///
143     enum LC_COLLATE        = 1;
144     ///
145     enum LC_CTYPE          = 2;
146     ///
147     enum LC_MONETARY       = 3;
148     ///
149     enum LC_NUMERIC        = 4;
150     ///
151     enum LC_TIME           = 5;
152     ///
153     enum LC_MESSAGES       = 6;
154 }
155 else version (OpenBSD)
156 {
157     ///
158     enum LC_ALL            = 0;
159     ///
160     enum LC_COLLATE        = 1;
161     ///
162     enum LC_CTYPE          = 2;
163     ///
164     enum LC_MONETARY       = 3;
165     ///
166     enum LC_NUMERIC        = 4;
167     ///
168     enum LC_TIME           = 5;
169     ///
170     enum LC_MESSAGES       = 6;
171 }
172 else version (DragonFlyBSD)
173 {
174     ///
175     enum LC_ALL            = 0;
176     ///
177     enum LC_COLLATE        = 1;
178     ///
179     enum LC_CTYPE          = 2;
180     ///
181     enum LC_MONETARY       = 3;
182     ///
183     enum LC_NUMERIC        = 4;
184     ///
185     enum LC_TIME           = 5;
186     ///
187     enum LC_MESSAGES       = 6;
188 }
189 else version (CRuntime_Bionic)
190 {
191     enum
192     {
193         ///
194         LC_CTYPE          = 0,
195         ///
196         LC_NUMERIC        = 1,
197         ///
198         LC_TIME           = 2,
199         ///
200         LC_COLLATE        = 3,
201         ///
202         LC_MONETARY       = 4,
203         ///
204         LC_MESSAGES       = 5,
205         ///
206         LC_ALL            = 6,
207         ///
208         LC_PAPER          = 7,
209         ///
210         LC_NAME           = 8,
211         ///
212         LC_ADDRESS        = 9,
213         ///
214         LC_TELEPHONE      = 10,
215         ///
216         LC_MEASUREMENT    = 11,
217         ///
218         LC_IDENTIFICATION = 12,
219     }
220 }
221 else version (Solaris)
222 {
223     ///
224     enum LC_CTYPE       = 0;
225     ///
226     enum LC_NUMERIC     = 1;
227     ///
228     enum LC_TIME        = 2;
229     ///
230     enum LC_COLLATE     = 3;
231     ///
232     enum LC_MONETARY    = 4;
233     ///
234     enum LC_MESSAGES    = 5;
235     ///
236     enum LC_ALL         = 6;
237 }
238 else version (CRuntime_Musl)
239 {
240     ///
241     enum LC_CTYPE          = 0;
242     ///
243     enum LC_NUMERIC        = 1;
244     ///
245     enum LC_TIME           = 2;
246     ///
247     enum LC_COLLATE        = 3;
248     ///
249     enum LC_MONETARY       = 4;
250     ///
251     enum LC_MESSAGES       = 5;
252     ///
253     enum LC_ALL            = 6;
254 }
255 else version (CRuntime_UClibc)
256 {
257     ///
258     enum LC_CTYPE          = 0;
259     ///
260     enum LC_NUMERIC        = 1;
261     ///
262     enum LC_TIME           = 2;
263     ///
264     enum LC_COLLATE        = 3;
265     ///
266     enum LC_MONETARY       = 4;
267     ///
268     enum LC_MESSAGES       = 5;
269     ///
270     enum LC_ALL            = 6;
271     ///
272     enum LC_PAPER          = 7;
273     ///
274     enum LC_NAME           = 8;
275     ///
276     enum LC_ADDRESS        = 9;
277     ///
278     enum LC_TELEPHONE      = 10;
279     ///
280     enum LC_MEASUREMENT    = 11;
281     ///
282     enum LC_IDENTIFICATION = 12;
283 }
284 else
285 {
286     static assert(false, "Unsupported platform");
287 }
288 
289 ///
290 @system char*  setlocale(int category, const scope char* locale);
291 ///
292 lconv* localeconv();