Subversion Repositories DevTools

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2875 dpurdie 1
#pragma force_top_level
2
#pragma include_only_once
3
 
4
/* locale.h: ANSI 'C' (X3J11 Oct 88) library header, section 4.3 */
5
/* Copyright (C) Codemist Ltd., 1988                            */
6
/* Copyright (C) Advanced Risc Machines Ltd., 1991              */
7
/* version 0.03 */
8
 
9
#ifndef __locale_h
10
#define __locale_h
11
 
12
#ifdef __cplusplus
13
extern "C" {
14
#endif
15
 
16
/* Handles national characteristics eg. USA month day year UK day month year */
17
 
18
#define LC_COLLATE  1
19
    /* affects the behaviour of the strcoll function */
20
#define LC_CTYPE    2
21
    /* affects the behaviour of the character handling functions */
22
    /* (isdigit, isspace and isxdigit are not affected) */
23
#define LC_MONETARY 4
24
    /* affects the monetary formatting information returned by the */
25
    /* localeconv function. */
26
#define LC_NUMERIC  8
27
    /* affects the decimal-point character for the formatted input/output */
28
    /* functions and the string conversion functions */
29
#define LC_TIME    16
30
    /* affects the behaviour of the strftime function */
31
#define LC_ALL     31
32
    /* program's entire locale */
33
 
34
extern char *setlocale(int /*category*/, const char * /*locale*/);
35
  /*
36
   * Selects the appropriate piece of the program's locale as specified by the
37
   * category and locale arguments. The setlocale function may be used to
38
   * change or query the program's entire current locale or portions thereof.
39
   * The effect of the category argument for each value is described above.
40
   * A value of "C" for locale specifies the minimal environment for C
41
   * translation; a value of "" for locale specifies the implementation-defined
42
   * native environment. At program startup the equivalent of
43
   * setlocale(LC_ALL, "C") is executed.
44
   *
45
   * Return value:
46
   * If a pointer to string is given for locale and the selection can be
47
   * honoured, the string associated with the specified category for the new
48
   * locale is returned. If the selction can not be honoured, a null pointer
49
   * is returned and the program's locale is not changed.
50
   * A null pointer for locale causes the string associated with the category
51
   * for the program's current locale to be returned and the program's locale
52
   * is not changed. This enquiry can fail by returning a null pointer only if
53
   * the category is LC_ALL and the most recent successful locale-setting call
54
   * used a category other than LC_ALL.
55
   * The string returned is such that a subsequent call with that string and
56
   * its associated category will restore that part of the program's locale.
57
   * The string returned shall not be modified by the program, but may be
58
   * overwritten by a subsequent call to setlocale.
59
   */
60
 
61
struct lconv {
62
  char *decimal_point;
63
       /* The decimal point character used to format non-monetary quantities */
64
  char *thousands_sep;
65
       /* The character used to separate groups of digits to the left of the */
66
       /* decimal point character in formatted non-monetary quantities.      */
67
  char *grouping;
68
       /* A string whose elements indicate the size of each group of digits  */
69
       /* in formatted non-monetary quantities. See below for more details.  */
70
  char *int_curr_symbol;
71
       /* The international currency symbol applicable to the current locale.*/
72
       /* The first three characters contain the alphabetic international    */
73
       /* currency symbol in accordance with those specified in ISO 4217     */
74
       /* Codes for the representation of Currency and Funds. The fourth     */
75
       /* character (immediately preceding the null character) is the        */
76
       /* character used to separate the international currency symbol from  */
77
       /* the monetary quantity.                                             */
78
  char *currency_symbol;
79
       /* The local currency symbol applicable to the current locale.        */
80
  char *mon_decimal_point;
81
       /* The decimal-point used to format monetary quantities.              */
82
  char *mon_thousands_sep;
83
       /* The separator for groups of digits to the left of the decimal-point*/
84
       /* in formatted monetary quantities.                                  */
85
  char *mon_grouping;
86
       /* A string whose elements indicate the size of each group of digits  */
87
       /* in formatted monetary quantities. See below for more details.      */
88
  char *positive_sign;
89
       /* The string used to indicate a nonnegative-valued formatted         */
90
       /* monetary quantity.                                                 */
91
  char *negative_sign;
92
       /* The string used to indicate a negative-valued formatted monetary   */
93
       /* quantity.                                                          */
94
  char int_frac_digits;
95
       /* The number of fractional digits (those to the right of the         */
96
       /* decimal-point) to be displayed in an internationally formatted     */
97
       /* monetary quantities.                                               */
98
  char frac_digits;
99
       /* The number of fractional digits (those to the right of the         */
100
       /* decimal-point) to be displayed in a formatted monetary quantity.   */
101
  char p_cs_precedes;
102
       /* Set to 1 or 0 if the currency_symbol respectively precedes or      */
103
       /* succeeds the value for a nonnegative formatted monetary quantity.  */
104
  char p_sep_by_space;
105
       /* Set to 1 or 0 if the currency_symbol respectively is or is not     */
106
       /* separated by a space from the value for a nonnegative formatted    */
107
       /* monetary quantity.                                                 */
108
  char n_cs_precedes;
109
       /* Set to 1 or 0 if the currency_symbol respectively precedes or      */
110
       /* succeeds the value for a negative formatted monetary quantity.     */
111
  char n_sep_by_space;
112
       /* Set to 1 or 0 if the currency_symbol respectively is or is not     */
113
       /* separated by a space from the value for a negative formatted       */
114
       /* monetary quantity.                                                 */
115
  char p_sign_posn;
116
       /* Set to a value indicating the position of the positive_sign for a  */
117
       /* nonnegative formatted monetary quantity. See below for more details*/
118
  char n_sign_posn;
119
       /* Set to a value indicating the position of the negative_sign for a  */
120
       /* negative formatted monetary quantity. See below for more details.  */
121
 
122
  /*
123
   * The elements of grouping amd mon_grouping are interpreted according to
124
   * the following:
125
   * CHAR_MAX   No further grouping is to be performed.
126
   * 0          The previous element is to be repeatedly used for the
127
   *            remainder of the digits.
128
   * other      The value is the number of digits that compromise the current
129
   *            group. The next element is examined to determine the size of
130
   *            the next group of digits to the left of the current group.
131
   *
132
   * The value of p_sign_posn and n_sign_posn is interpreted according to
133
   * the following:
134
   * 0          Parentheses surround the quantity and currency_symbol.
135
   * 1          The sign string preceeds the quantity and currency_symbol.
136
   * 2          The sign string succeeds the quantity and currency_symbol.
137
   * 3          The sign string immediately preceeds the currency_symbol.
138
   * 4          The sign string immediately succeeds the currency_symbol.
139
   */
140
};
141
 
142
extern struct lconv *localeconv(void);
143
  /*
144
   * Sets the components of an object with type struct lconv with values
145
   * appropriate for the formatting of numeric quantities (monetary and
146
   * otherwise) according to the rules of the current locale.
147
   * The members of the structure with type char * are strings, any of which
148
   * (except decimal_point) can point to "", to indicate that the value is not
149
   * available in the current locale or is of zero length. The members with
150
   * type char are nonnegative numbers, any of which can be CHAR_MAX to
151
   * indicate that the value is not available in the current locale.
152
   * The members included are described above.
153
   *
154
   * Return value:
155
   * A pointer to the filled in object. The structure pointed to by the return
156
   * value shall not be modified by the program, but may be overwritten by a
157
   * subsequent call to the localeconv function. In addition, calls to the
158
   * setlocale function with categories LC_ALL, LC_MONETARY, or LC_NUMERIC may
159
   * overwrite the contents of the structure.
160
   */
161
 
162
#ifndef NULL
163
#  define NULL 0
164
#endif
165
 
166
#ifdef __cplusplus
167
}
168
#endif
169
 
170
#endif
171
 
172
/* end of locale.h */