1 // ----------------------------------------------------------------------------
3 // ----------------------------------------------------------------------------
4 // Public Domain C Library - http://pdclib.sourceforge.net
5 // This code is Public Domain. Use, modify, and redistribute at will.
6 // ----------------------------------------------------------------------------
8 // ----------------------------------------------------------------------------
11 #define __LOCALE_H __LOCALE_H
13 // ----------------------------------------------------------------------------
19 #define LC_COLLATE 1 // affects strcoll() and strxfrm()
20 #define LC_CTYPE 2 // affects ctype.h
21 #define LC_MONETARY 4 // affects monetary aspect of localeconv()
22 #define LC_NUMERIC 8 // affects numeric aspect of localeconv()
23 #define LC_TIME 16 // affects strftime()
24 #define LC_ALL 31 // affects all of the above
26 // ----------------------------------------------------------------------------
29 // TODO: Detailed documentation of grouping formats and field values
34 char * decimal_point; // decimal point
35 char * grouping; // grouping
36 char * thousands_sep; // grouping string
39 char * mon_decimal_point; // decimal point
40 char * mon_grouping; // grouping
41 char * mon_thousands_sep; // grouping string
42 char * negative_sign; // negative sign
43 char * positive_sign; // positive sign
44 char * currency_symbol; // currency symbol
45 char frac_digits; // after-point digits
47 char n_cs_precedes; // currency symbol preceding value?
48 char n_sep_by_space; // currency symbol seperated by space?
49 char n_sign_posn; // sign position
51 char p_cs_precedes; // currency symbol preceding value?
52 char p_sep_by_space; // currency symbol seperated by space?
53 char p_sign_posn; // sign position?
55 // for international monetary values
56 char * int_curr_symbol; // international currency symbol (ISO 4217)
57 char int_frac_digits; // after-point digits
59 char int_n_cs_precedes; // currency symbol preceding value?
60 char int_n_sep_by_space; // currency symbol seperated by space?
61 char int_n_sign_posn; // sign position?
63 char int_p_cs_precedes; // currency symbol preceding value?
64 char int_p_sep_by_space; // currency symbol seperated by space?
65 char int_p_sign_posn; // sign position?
68 // ----------------------------------------------------------------------------
71 // Returns a (pointer to a) lconv structure holding the values for the current
72 // locale. The structure must not be changed; values might become outdated with
73 // later calls to setlocale() changing LC_NUMERIC, LC_MONETARY or LC_ALL.
74 struct lconv * localeconv( void );
76 // Categories are selected by OR'ing the LC_* defines from this header. The
77 // function sets the current locale to that defined by locale_name, and returns
78 // the name of the new locale (if it was set successfully) or a null pointer
79 // (if unsuccessful). At startup, the current locale is "C" by default. A null
80 // pointer as locale_name leaves the locale unchanged, an empty string sets it
81 // to the "native" locale.
82 char * setlocale( int categories, const char * locale_name );