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