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