xref: /haiku/headers/posix/locale.h (revision 97f11716bfaa0f385eb0e28a52bf56a5023b9e99)
10fae8733SScott McCreary /*
2173f54f1SMatt Madia  * Copyright 2002-2012 Haiku, Inc. All Rights Reserved.
30fae8733SScott McCreary  * Distributed under the terms of the MIT License.
40fae8733SScott McCreary  */
5a3b20c0fSAxel Dörfler #ifndef _LOCALE_H_
6a3b20c0fSAxel Dörfler #define _LOCALE_H_
70fae8733SScott McCreary 
8a3b20c0fSAxel Dörfler 
9*d338200eSTrung Nguyen #include <locale_t.h>
10a3b20c0fSAxel Dörfler #include <null.h>
11a3b20c0fSAxel Dörfler 
12a3b20c0fSAxel Dörfler struct lconv {
13a3b20c0fSAxel Dörfler 	char *decimal_point;
14a3b20c0fSAxel Dörfler 	char *thousands_sep;
15a3b20c0fSAxel Dörfler 	char *grouping;
16a3b20c0fSAxel Dörfler 	char *int_curr_symbol;
17a3b20c0fSAxel Dörfler 	char *currency_symbol;
18a3b20c0fSAxel Dörfler 	char *mon_decimal_point;
19a3b20c0fSAxel Dörfler 	char *mon_thousands_sep;
20a3b20c0fSAxel Dörfler 	char *mon_grouping;
21a3b20c0fSAxel Dörfler 	char *positive_sign;
22a3b20c0fSAxel Dörfler 	char *negative_sign;
23a3b20c0fSAxel Dörfler 	char int_frac_digits;
24a3b20c0fSAxel Dörfler 	char frac_digits;
25a3b20c0fSAxel Dörfler 	char p_cs_precedes;
26a3b20c0fSAxel Dörfler 	char p_sep_by_space;
27a3b20c0fSAxel Dörfler 	char n_cs_precedes;
28a3b20c0fSAxel Dörfler 	char n_sep_by_space;
29a3b20c0fSAxel Dörfler 	char p_sign_posn;
30a3b20c0fSAxel Dörfler 	char n_sign_posn;
31a3f66598SOliver Tappe 	char int_p_cs_precedes;
32a3f66598SOliver Tappe 	char int_p_sep_by_space;
33a3f66598SOliver Tappe 	char int_n_cs_precedes;
34a3f66598SOliver Tappe 	char int_n_sep_by_space;
35a3f66598SOliver Tappe 	char int_p_sign_posn;
36a3f66598SOliver Tappe 	char int_n_sign_posn;
37a3b20c0fSAxel Dörfler };
38a3b20c0fSAxel Dörfler 
39a3b20c0fSAxel Dörfler #define	LC_ALL		0
40a3b20c0fSAxel Dörfler #define	LC_COLLATE	1
41a3b20c0fSAxel Dörfler #define	LC_CTYPE	2
42a3b20c0fSAxel Dörfler #define	LC_MONETARY	3
43a3b20c0fSAxel Dörfler #define	LC_NUMERIC	4
44a3b20c0fSAxel Dörfler #define	LC_TIME		5
45a3b20c0fSAxel Dörfler #define	LC_MESSAGES	6
46a3f66598SOliver Tappe /*
47a3f66598SOliver Tappe  * the values above must be kept in loopable order (i.e. strictly increasing
48a3f66598SOliver Tappe  * with no holes) and in sync with the value below
49a3f66598SOliver Tappe  */
50a3f66598SOliver Tappe #define	LC_LAST		LC_MESSAGES
51a3b20c0fSAxel Dörfler 
52*d338200eSTrung Nguyen #define LC_COLLATE_MASK		(1 << (LC_COLLATE - 1))
53*d338200eSTrung Nguyen #define LC_CTYPE_MASK		(1 << (LC_CTYPE - 1))
54*d338200eSTrung Nguyen #define LC_MONETARY_MASK	(1 << (LC_MONETARY - 1))
55*d338200eSTrung Nguyen #define LC_NUMERIC_MASK 	(1 << (LC_NUMERIC - 1))
56*d338200eSTrung Nguyen #define LC_TIME_MASK		(1 << (LC_TIME - 1))
57*d338200eSTrung Nguyen #define LC_MESSAGES_MASK	(1 << (LC_MESSAGES - 1))
58*d338200eSTrung Nguyen 
59*d338200eSTrung Nguyen #define LC_ALL_MASK			(LC_COLLATE_MASK | LC_CTYPE_MASK | \
60*d338200eSTrung Nguyen 							LC_MONETARY_MASK | LC_NUMERIC_MASK | \
61*d338200eSTrung Nguyen 							LC_TIME_MASK | LC_MESSAGES_MASK)
62*d338200eSTrung Nguyen 
63*d338200eSTrung Nguyen #define LC_GLOBAL_LOCALE ((locale_t)-1)
64*d338200eSTrung Nguyen 
65a3b20c0fSAxel Dörfler #ifdef __cplusplus
66a3b20c0fSAxel Dörfler extern "C" {
67a3b20c0fSAxel Dörfler #endif
68a3b20c0fSAxel Dörfler 
69a3b20c0fSAxel Dörfler extern struct lconv *localeconv(void);
70a3b20c0fSAxel Dörfler extern char *setlocale(int category, const char *locale);
71a3b20c0fSAxel Dörfler 
72*d338200eSTrung Nguyen extern locale_t duplocale(locale_t);
73*d338200eSTrung Nguyen extern void freelocale(locale_t);
74*d338200eSTrung Nguyen extern locale_t newlocale(int, const char *, locale_t);
75*d338200eSTrung Nguyen extern locale_t uselocale(locale_t);
76*d338200eSTrung Nguyen 
77a3b20c0fSAxel Dörfler #ifdef __cplusplus
78a3b20c0fSAxel Dörfler }
79a3b20c0fSAxel Dörfler #endif
80a3b20c0fSAxel Dörfler 
81a3b20c0fSAxel Dörfler #endif /* _LOCALE_H_ */
82