Update.
[platform/upstream/glibc.git] / locale / langinfo.h
1 /* Access to locale-dependent parameters.
2    Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
3    This file is part of the GNU C Library.
4
5    The GNU C Library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Library General Public License as
7    published by the Free Software Foundation; either version 2 of the
8    License, or (at your option) any later version.
9
10    The GNU C Library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Library General Public License for more details.
14
15    You should have received a copy of the GNU Library General Public
16    License along with the GNU C Library; see the file COPYING.LIB.  If not,
17    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18    Boston, MA 02111-1307, USA.  */
19
20 #ifndef _LANGINFO_H
21 #define _LANGINFO_H 1
22
23 #include <locale.h>             /* Define the LC_* category names.  */
24
25 /* Get the type definition.  */
26 #include <nl_types.h>
27
28
29 __BEGIN_DECLS
30
31 /* Construct an `nl_item' value for `nl_langinfo' from a locale category
32    (LC_*) and an item index within the category.  Some code may depend on
33    the item values within a category increasing monotonically with the
34    indices.  */
35 #define _NL_ITEM(category, index)       (((category) << 16) | (index))
36
37 /* Extract the category and item index from a constructed `nl_item' value.  */
38 #define _NL_ITEM_CATEGORY(item)         ((int) (item) >> 16)
39 #define _NL_ITEM_INDEX(item)            ((int) (item) & 0xffff)
40
41
42 /* Enumeration of locale items that can be queried with `nl_langinfo'.  */
43 enum
44 {
45   /* LC_TIME category: date and time formatting.  */
46
47   /* Abbreviated days of the week. */
48   ABDAY_1 = _NL_ITEM (LC_TIME, 0), /* Sun */
49   ABDAY_2,
50   ABDAY_3,
51   ABDAY_4,
52   ABDAY_5,
53   ABDAY_6,
54   ABDAY_7,
55
56   /* Long-named days of the week. */
57   DAY_1,                        /* Sunday */
58   DAY_2,                        /* Monday */
59   DAY_3,                        /* Tuesday */
60   DAY_4,                        /* Wednesday */
61   DAY_5,                        /* Thursday */
62   DAY_6,                        /* Friday */
63   DAY_7,                        /* Saturday */
64
65   /* Abbreviated month names.  */
66   ABMON_1,                      /* Jan */
67   ABMON_2,
68   ABMON_3,
69   ABMON_4,
70   ABMON_5,
71   ABMON_6,
72   ABMON_7,
73   ABMON_8,
74   ABMON_9,
75   ABMON_10,
76   ABMON_11,
77   ABMON_12,
78
79   /* Long month names.  */
80   MON_1,                        /* January */
81   MON_2,
82   MON_3,
83   MON_4,
84   MON_5,
85   MON_6,
86   MON_7,
87   MON_8,
88   MON_9,
89   MON_10,
90   MON_11,
91   MON_12,
92
93   AM_STR,                       /* Ante meridian string.  */
94   PM_STR,                       /* Post meridian string.  */
95
96   D_T_FMT,                      /* Date and time format for strftime.  */
97   D_FMT,                        /* Date format for strftime.  */
98   T_FMT,                        /* Time format for strftime.  */
99   T_FMT_AMPM,                   /* 12-hour time format for strftime.  */
100
101   ERA,                          /* Alternate era.  */
102   ERA_YEAR,                     /* Year in alternate era format.  */
103   ERA_D_FMT,                    /* Date in alternate era format.  */
104   ALT_DIGITS,                   /* Alternate symbols for digits.  */
105   ERA_D_T_FMT,                  /* Date and time in alternate era format.  */
106   ERA_T_FMT,                    /* Time in alternate era format.  */
107
108   _NL_TIME_NUM_ALT_DIGITS,      /* Number entries in the alt_digits arrays.  */
109
110   _NL_TIME_ERA_NUM_ENTRIES,     /* Number entries in the era arrays.  */
111   _NL_TIME_ERA_ENTRIES_EB,      /* Structure with era entries in usable form.*/
112   _NL_TIME_ERA_ENTRIES_EL,
113
114   _NL_NUM_LC_TIME,              /* Number of indices in LC_TIME category.  */
115
116   /* LC_COLLATE category: text sorting.
117      This information is accessed by the strcoll and strxfrm functions.
118      These `nl_langinfo' names are used only internally.  */
119   _NL_COLLATE_NRULES = _NL_ITEM (LC_COLLATE, 0),
120   _NL_COLLATE_RULES,
121   _NL_COLLATE_HASH_SIZE,
122   _NL_COLLATE_HASH_LAYERS,
123   _NL_COLLATE_TABLE_EB,
124   _NL_COLLATE_TABLE_EL,
125   _NL_COLLATE_UNDEFINED,
126   _NL_COLLATE_EXTRA_EB,
127   _NL_COLLATE_EXTRA_EL,
128   _NL_COLLATE_ELEM_HASH_SIZE,
129   _NL_COLLATE_ELEM_HASH_EB,
130   _NL_COLLATE_ELEM_HASH_EL,
131   _NL_COLLATE_ELEM_STR_POOL,
132   _NL_COLLATE_ELEM_VAL_EB,
133   _NL_COLLATE_ELEM_VAL_EL,
134   _NL_COLLATE_SYMB_HASH_SIZE,
135   _NL_COLLATE_SYMB_HASH_EB,
136   _NL_COLLATE_SYMB_HASH_EL,
137   _NL_COLLATE_SYMB_STR_POOL,
138   _NL_COLLATE_SYMB_CLASS_EB,
139   _NL_COLLATE_SYMB_CLASS_EL,
140   _NL_NUM_LC_COLLATE,
141
142   /* LC_CTYPE category: character classification.
143      This information is accessed by the functions in <ctype.h>.
144      These `nl_langinfo' names are used only internally.  */
145   _NL_CTYPE_CLASS = _NL_ITEM (LC_CTYPE, 0),
146   _NL_CTYPE_TOUPPER_EB,
147   _NL_CTYPE_TOLOWER_EB,
148   _NL_CTYPE_TOUPPER_EL,
149   _NL_CTYPE_TOLOWER_EL,
150   _NL_CTYPE_CLASS32,
151   _NL_CTYPE_NAMES_EB,
152   _NL_CTYPE_NAMES_EL,
153   _NL_CTYPE_HASH_SIZE,
154   _NL_CTYPE_HASH_LAYERS,
155   _NL_CTYPE_CLASS_NAMES,
156   _NL_CTYPE_MAP_NAMES,
157   _NL_CTYPE_WIDTH,
158   _NL_CTYPE_MB_CUR_MAX,
159   _NL_CTYPE_CODESET_NAME,
160 #ifdef __USE_UNIX98
161   CODESET = _NL_CTYPE_CODESET_NAME,
162 #endif
163   _NL_NUM_LC_CTYPE,
164
165   /* LC_MONETARY category: formatting of monetary quantities.
166      These items each correspond to a member of `struct lconv',
167      defined in <locale.h>.  */
168   INT_CURR_SYMBOL = _NL_ITEM (LC_MONETARY, 0),
169   CURRENCY_SYMBOL,
170 #ifdef __USE_UNIX98
171   CRNCYSTR = CURRENCY_SYMBOL,
172 #endif
173   MON_DECIMAL_POINT,
174   MON_THOUSANDS_SEP,
175   MON_GROUPING,
176   POSITIVE_SIGN,
177   NEGATIVE_SIGN,
178   INT_FRAC_DIGITS,
179   FRAC_DIGITS,
180   P_CS_PRECEDES,
181   P_SEP_BY_SPACE,
182   N_CS_PRECEDES,
183   N_SEP_BY_SPACE,
184   P_SIGN_POSN,
185   N_SIGN_POSN,
186   _NL_NUM_LC_MONETARY,
187
188   /* LC_NUMERIC category: formatting of numbers.
189      These also correspond to members of `struct lconv'; see <locale.h>.  */
190   DECIMAL_POINT = _NL_ITEM (LC_NUMERIC, 0),
191 #ifdef __USE_UNIX98
192   RADIXCHAR = DECIMAL_POINT,
193 #endif
194   THOUSANDS_SEP,
195 #ifdef __USE_UNIX98
196   THOUSEP = THOUSANDS_SEP,
197 #endif
198   GROUPING,
199   _NL_NUM_LC_NUMERIC,
200
201   YESEXPR = _NL_ITEM (LC_MESSAGES, 0), /* Regex matching ``yes'' input.  */
202   NOEXPR,                       /* Regex matching ``no'' input.  */
203   YESSTR,                       /* Output string for ``yes''.  */
204   NOSTR,                        /* Output string for ``no''.  */
205   _NL_NUM_LC_MESSAGES,
206
207   /* This marks the highest value used.  */
208   _NL_NUM
209 };
210
211
212 /* Return the current locale's value for ITEM.
213    If ITEM is invalid, an empty string is returned.
214
215    The string returned will not change until `setlocale' is called;
216    it is usually in read-only memory and cannot be modified.  */
217
218 extern char *nl_langinfo __P ((nl_item __item));
219
220
221 __END_DECLS
222
223 #endif  /* langinfo.h */