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