]> pd.if.org Git - pdclib/blob - includes/locale.h
Started out on v0.6.
[pdclib] / includes / locale.h
1 /* $Id$ */
2
3 /* 7.11 Localization <locale.h>
4
5    This file is part of the Public Domain C Library (PDCLib).
6    Permission is granted to use, modify, and / or redistribute at will.
7 */
8
9 #ifndef _PDCLIB_LOCALE_H
10 #define _PDCLIB_LOCALE_H _PDCLIB_LOCALE_H
11
12 /* The structure returned by localeconv().
13
14    The values for *_sep_by_space:
15    0 - no space
16    1 - if symbol and sign are adjacent, a space seperates them from the value;
17        otherwise a space seperates the symbol from the value
18    2 - if symbol and sign are adjacent, a space seperates them; otherwise a
19        space seperates the sign from the value
20
21    The values for *_sign_posn:
22    0 - Parentheses surround value and symbol
23    1 - sign precedes value and symbol
24    2 - sign succeeds value and symbol
25    3 - sign immediately precedes symbol
26    4 - sign immediately succeeds symbol
27 */
28 struct lconv
29 {
30     char * decimal_point;      /* decimal point character                     */
31     char * thousands_sep;      /* character for seperating groups of digits   */
32     char * grouping;           /* string indicating the size of digit groups  */
33     char * mon_decimal_point;  /* decimal point for monetary quantities       */
34     char * mon_thousands_sep;  /* thousands_sep for monetary quantities       */
35     char * mon_grouping;       /* grouping for monetary quantities            */
36     char * positive_sign;      /* string indicating nonnegative mty. qty.     */
37     char * negative_sign;      /* string indicating negative mty. qty.        */
38     char * currency_symbol;    /* local currency symbol (e.g. '$')            */
39     char * int_curr_symbol;    /* international currency symbol (e.g. "USD"   */
40     char frac_digits;          /* fractional digits in local monetary qty.    */
41     char p_cs_precedes;        /* if currency_symbol precedes positive qty.   */
42     char n_cs_precedes;        /* if currency_symbol precedes negative qty.   */
43     char p_sep_by_space;       /* if it is seperated by space from pos. qty.  */
44     char n_sep_by_space;       /* if it is seperated by space from neg. qty.  */
45     char p_sign_posn;          /* positioning of positive_sign for mon. qty.  */
46     char n_sign_posn;          /* positioning of negative_sign for mon. qty.  */
47     char int_frac_digits;      /* Same as above, for international format     */
48     char int_p_cs_precedes;    /* Same as above, for international format     */
49     char int_n_cs_precedes;    /* Same as above, for international format     */
50     char int_p_sep_by_space;   /* Same as above, for international format     */
51     char int_n_sep_by_space;   /* Same as above, for international format     */
52     char int_p_sign_posn;      /* Same as above, for international format     */
53     char int_n_sign_posn;      /* Same as above, for international format     */
54 }
55
56 #ifndef _PDCLIB_NULL_DEFINED
57 #define _PDCLIB_NULL_DEFINED _PDCLIB_NULL_DEFINED
58 #define NULL _PDCLIB_NULL
59 #endif
60
61 /* LC_ALL
62    - entire locale
63    LC_COLLATE
64    - strcoll(), strxfrm()
65    LC_CTYPE
66    - <ctype.h>
67    LC_MONETARY
68    - monetary formatting as returned by localeconv
69    LC_NUMERIC
70    - decimal-point character for printf() / scanf() functions, string
71      conversions, and nonmonetary formattign as returned by localeconv
72    LC_TIME
73    - strftime(), wcsftime()
74
75    First arguments to setlocale().
76 */
77
78 /* The category parameter can be any of the LC_* macros to specify if the call
79    to setlocale() shall affect the entire locale or only a portion thereof.
80    The category locale specifies which locale should be switched to, with "C"
81    being the minimal default locale, and "" being the locale-specific native
82    environment. A NULL pointer makes setlocale() return the *current* setting.
83    Otherwise, returns a pointer to a string associated with the specified
84    category for the new locale.
85 */
86 char * setlocale( int category, const char * locale );
87
88 /* Returns a struct lconv initialized to the values appropriate for the current
89    locale setting.
90 */
91 struct lconv * localeconv( void );
92
93 #endif
94