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