comparison lphobos/std/c/locale.d @ 1:c53b6e3fe49a trunk

[svn r5] Initial commit. Most things are very rough.
author lindquist
date Sat, 01 Sep 2007 21:43:27 +0200
parents
children
comparison
equal deleted inserted replaced
0:a9e71648e74d 1:c53b6e3fe49a
1 /**
2 * C's <locale.h>
3 * License: Public Domain
4 * Standards:
5 * ISO/IEC 9899:1999 7.11
6 * Macros:
7 * WIKI=Phobos/StdCLocale
8 */
9 module std.c.locale;
10
11 extern(C):
12
13 /// Structure giving information about numeric and monetary notation.
14 struct lconv{
15 /// The decimal-point character used to format nonmonetary quantities.
16 char* decimal_point;
17
18 /** The character used to separate groups of digits before the
19 * decimal-point character in formatted nonmonetary quantities.
20 **/
21 char* thousands_sep;
22
23 /** A string whose elements indicate the size of each group of digits
24 * in formatted nonmonetary quantities.
25 **/
26 char* grouping;
27
28 /** The international currency symbol applicable to the current locale.
29 * The first three characters contain the alphabetic international
30 * currency symbol in accordance with those specified in ISO 4217.
31 * The fourth character (immediately preceding the null character)
32 * is the character used to separate the international currency symbol
33 * from the monetary quantity.
34 **/
35 char* int_curr_symbol;
36
37 /// The local currency symbol applicable to the current locale.
38 char* currency_symbol;
39
40 /// The decimal-point used to format monetary quantities.
41 char* mon_decimal_point;
42
43 /** The separator for groups of digits before the decimal-point in
44 * formatted monetary quantities.
45 **/
46 char* mon_thousands_sep;
47
48 /** A string whose elements indicate the size of each group of digits
49 * in formatted monetary quantities.
50 **/
51 char* mon_grouping;
52
53 /** The string used to indicate a nonnegative-valued formatted
54 * monetary quantity.
55 **/
56 char* positive_sign;
57
58 /** The string used to indicate a negative-valued formatted monetary
59 * quantity.
60 **/
61 char* negative_sign;
62
63 /** The number of fractional digits (those after the decimal-point) to
64 * be displayed in an internationally formatted monetary quantity.
65 **/
66 char int_frac_digits;
67
68 /** The number of fractional digits (those after the decimal-point) to
69 * be displayed in a locally formatted monetary quantity.
70 **/
71 char frac_digits;
72
73 /// 1 if currency_symbol precedes a positive value, 0 if succeeds.
74 char p_cs_precedes;
75
76 /// 1 if a space separates currency_symbol from a positive value.
77 char p_sep_by_space;
78
79 /// 1 if currency_symbol precedes a negative value, 0 if succeeds.
80 char n_cs_precedes;
81
82 /// 1 if a space separates currency_symbol from a negative value.
83 char n_sep_by_space;
84
85 /* Positive and negative sign positions:
86 0 Parentheses surround the quantity and currency_symbol.
87 1 The sign string precedes the quantity and currency_symbol.
88 2 The sign string follows the quantity and currency_symbol.
89 3 The sign string immediately precedes the currency_symbol.
90 4 The sign string immediately follows the currency_symbol. */
91 char p_sign_posn;
92 char n_sign_posn;
93
94 /// 1 if int_curr_symbol precedes a positive value, 0 if succeeds.
95 char int_p_cs_precedes;
96
97 /// 1 iff a space separates int_curr_symbol from a positive value.
98 char int_p_sep_by_space;
99
100 /// 1 if int_curr_symbol precedes a negative value, 0 if succeeds.
101 char int_n_cs_precedes;
102
103 /// 1 iff a space separates int_curr_symbol from a negative value.
104 char int_n_sep_by_space;
105
106 /* Positive and negative sign positions:
107 0 Parentheses surround the quantity and int_curr_symbol.
108 1 The sign string precedes the quantity and int_curr_symbol.
109 2 The sign string follows the quantity and int_curr_symbol.
110 3 The sign string immediately precedes the int_curr_symbol.
111 4 The sign string immediately follows the int_curr_symbol. */
112 char int_p_sign_posn;
113 char int_n_sign_posn;
114 }
115
116 /** Affects the behavior of C's character handling functions and C's multibyte
117 * and wide character functions.
118 **/
119 const LC_CTYPE = 0;
120
121 /** Affects the decimal-point character for C's formatted input/output functions
122 * and C's string conversion functions, as well as C's nonmonetary formatting
123 * information returned by the localeconv function.
124 **/
125 const LC_NUMERIC = 1;
126
127 /// Affects the behavior of the strftime and wcsftime functions.
128 const LC_TIME = 2;
129
130 /// Affects the behavior of the strcoll and strxfrm functions.
131 const LC_COLLATE = 3;
132
133 /** Affects the monetary formatting information returned by the localeconv
134 * function.
135 **/
136 const LC_MONETARY = 4;
137
138 /// The program's entire locale.
139 const LC_ALL = 6;
140
141 /** The setlocale function selects the appropriate portion of the program's
142 * locale as specified by the category and locale arguments.
143 **/
144 char* setlocale(int category, char* locale);
145
146 /** The localeconv function sets the components of an object with type
147 * lconv with values appropriate for the formatting of numeric quantities
148 * (monetary and otherwise) according to the rules of the current locale.
149 **/
150 lconv* localeconv();
151