]> pd.if.org Git - pdclib/blob - includes/locale.h
Re-import from Subversion.
[pdclib] / includes / locale.h
1 /* ----------------------------------------------------------------------------
2  * $Id$
3  * ----------------------------------------------------------------------------
4  * Public Domain C Library - http://pdclib.sourceforge.net
5  * This code is Public Domain. Use, modify, and redistribute at will.
6  * ----------------------------------------------------------------------------
7  * Localization
8  * --------------------------------------------------------------------------*/
9
10 #ifndef _LOCALE_H
11 #define _LOCALE_H _LOCALE_H
12
13 #ifndef _NULL
14 #include "__intern.h"
15 #endif /* _NULL */
16
17 /* ----------------------------------------------------------------------------
18  * DEFINES
19  * --------------------------------------------------------------------------*/
20
21 #define NULL _NULL
22
23 /* Locale categories */
24 #define LC_COLLATE   1 /* affects strcoll() and strxfrm() */
25 #define LC_CTYPE     2 /* affects ctype.h */
26 #define LC_MONETARY  4 /* affects monetary aspect of localeconv() */
27 #define LC_NUMERIC   8 /* affects numeric aspect of localeconv() */
28 #define LC_TIME     16 /* affects strftime() */
29 #define LC_ALL      31 /* affects all of the above */
30
31 /* ----------------------------------------------------------------------------
32  * TYPEDEFS
33  * --------------------------------------------------------------------------*/
34
35 /* TODO: Detailed documentation of grouping formats and field values */
36
37 struct lconv
38 {
39     /* LC_NUMERIC */
40     char * decimal_point;      /* decimal point */
41     char * grouping;           /* grouping */
42     char * thousands_sep;      /* grouping string */
43
44     /* LC_MONETARY */
45     char * mon_decimal_point;  /* decimal point */
46     char * mon_grouping;       /* grouping */
47     char * mon_thousands_sep;  /* grouping string */
48     char * negative_sign;      /* negative sign */
49     char * positive_sign;      /* positive sign */
50     char * currency_symbol;    /* currency symbol */
51     char frac_digits;          /* after-point digits */
52     /* negative values */
53     char n_cs_precedes;        /* currency symbol preceding value? */
54     char n_sep_by_space;       /* currency symbol seperated by space? */
55     char n_sign_posn;          /* sign position */
56     /* positive values */
57     char p_cs_precedes;        /* currency symbol preceding value? */
58     char p_sep_by_space;       /* currency symbol seperated by space? */
59     char p_sign_posn;          /* sign position? */
60
61     /* for international monetary values */
62     char * int_curr_symbol;    /* international currency symbol (ISO 4217) */
63     char int_frac_digits;      /* after-point digits */
64     /* negative values */
65     char int_n_cs_precedes;    /* currency symbol preceding value? */
66     char int_n_sep_by_space;   /* currency symbol seperated by space? */
67     char int_n_sign_posn;      /* sign position? */
68     /* positive values */
69     char int_p_cs_precedes;    /* currency symbol preceding value? */
70     char int_p_sep_by_space;   /* currency symbol seperated by space? */
71     char int_p_sign_posn;      /* sign position? */
72 };
73
74 /* ----------------------------------------------------------------------------
75  * FUNCTIONS
76  * --------------------------------------------------------------------------*/
77
78 /** Returns a (pointer to a) lconv structure holding the values for the current
79  * locale. The structure must not be changed; values might become outdated with
80  * later calls to setlocale() changing LC_NUMERIC, LC_MONETARY or LC_ALL.
81  */
82 struct lconv * localeconv( void );
83
84 /** Categories are selected by OR'ing the LC_* defines from this header. The
85  * function sets the current locale to that defined by locale_name, and returns
86  * the name of the new locale (if it was set successfully) or a null pointer
87  * (if unsuccessful). At startup, the current locale is "C" by default. A null
88  * pointer as locale_name leaves the locale unchanged, an empty string sets it
89  * to the "native" locale.
90  */
91 char * setlocale( int categories, const char * locale_name );
92
93 #endif /* _LOCALE_H */