1 /* nl_langinfo -- Access to locale-dependent parameters.
2 Copyright (C) 1995, 1996 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
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.
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.
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. */
23 #include <locale.h> /* Define the LC_* category names. */
27 /* Construct an `nl_item' value for `nl_langinfo' from a locale category
28 (LC_*) and an item index within the category. Some code may depend on
29 the item values within a category increasing monotonically with the
31 #define _NL_ITEM(category, index) (((category) << 16) | (index))
33 /* Extract the category and item index from a constructed `nl_item' value. */
34 #define _NL_ITEM_CATEGORY(item) ((int) (item) >> 16)
35 #define _NL_ITEM_INDEX(item) ((int) (item) & 0xffff)
38 /* Enumeration of locale items that can be queried with `nl_langinfo'. */
41 /* LC_TIME category: date and time formatting. */
43 /* Abbreviated days of the week. */
44 ABDAY_1
= _NL_ITEM (LC_TIME
, 0), /* Sun */
52 /* Long-named days of the week. */
56 DAY_4
, /* Wednesday */
61 /* Abbreviated month names. */
75 /* Long month names. */
89 AM_STR
, /* Ante meridian string. */
90 PM_STR
, /* Post meridian string. */
92 D_T_FMT
, /* Date and time format for strftime. */
93 D_FMT
, /* Date format for strftime. */
94 T_FMT
, /* Time format for strftime. */
95 T_FMT_AMPM
, /* 12-hour time format for strftime. */
97 ERA
, /* Alternate era. */
98 ERA_YEAR
, /* Year in alternate era format. */
99 ERA_D_FMT
, /* Date in alternate era format. */
100 ALT_DIGITS
, /* Alternate symbols for digits. */
101 ERA_D_T_FMT
, /* Date and time in alternate era format. */
102 ERA_T_FMT
, /* Time in alternate era format. */
104 _NL_TIME_NUM_ALT_DIGITS
, /* Number entries in the alt_digits arrays. */
106 _NL_TIME_ERA_NUM_ENTRIES
, /* Number entries in the era arrays. */
107 _NL_TIME_ERA_ENTRIES_EB
, /* Structure with era entries in usable form.*/
108 _NL_TIME_ERA_ENTRIES_EL
,
110 _NL_NUM_LC_TIME
, /* Number of indices in LC_TIME category. */
112 /* LC_COLLATE category: text sorting.
113 This information is accessed by the strcoll and strxfrm functions.
114 These `nl_langinfo' names are used only internally. */
115 _NL_COLLATE_NRULES
= _NL_ITEM (LC_COLLATE
, 0),
117 _NL_COLLATE_HASH_SIZE
,
118 _NL_COLLATE_HASH_LAYERS
,
119 _NL_COLLATE_TABLE_EB
,
120 _NL_COLLATE_TABLE_EL
,
121 _NL_COLLATE_UNDEFINED
,
122 _NL_COLLATE_EXTRA_EB
,
123 _NL_COLLATE_EXTRA_EL
,
124 _NL_COLLATE_ELEM_HASH_SIZE
,
125 _NL_COLLATE_ELEM_HASH_EB
,
126 _NL_COLLATE_ELEM_HASH_EL
,
127 _NL_COLLATE_ELEM_STR_POOL
,
128 _NL_COLLATE_ELEM_VAL_EB
,
129 _NL_COLLATE_ELEM_VAL_EL
,
130 _NL_COLLATE_SYMB_HASH_SIZE
,
131 _NL_COLLATE_SYMB_HASH_EB
,
132 _NL_COLLATE_SYMB_HASH_EL
,
133 _NL_COLLATE_SYMB_STR_POOL
,
134 _NL_COLLATE_SYMB_CLASS_EB
,
135 _NL_COLLATE_SYMB_CLASS_EL
,
138 /* LC_CTYPE category: character classification.
139 This information is accessed by the functions in <ctype.h>.
140 These `nl_langinfo' names are used only internally. */
141 _NL_CTYPE_CLASS
= _NL_ITEM (LC_CTYPE
, 0),
142 _NL_CTYPE_TOUPPER_EB
,
143 _NL_CTYPE_TOLOWER_EB
,
144 _NL_CTYPE_TOUPPER_EL
,
145 _NL_CTYPE_TOLOWER_EL
,
150 _NL_CTYPE_HASH_LAYERS
,
151 _NL_CTYPE_CLASS_NAMES
,
154 _NL_CTYPE_MB_CUR_MAX
,
155 _NL_CTYPE_CODESET_NAME
,
158 /* LC_MONETARY category: formatting of monetary quantities.
159 These items each correspond to a member of `struct lconv',
160 defined in <locale.h>. */
161 INT_CURR_SYMBOL
= _NL_ITEM (LC_MONETARY
, 0),
178 /* LC_NUMERIC category: formatting of numbers.
179 These also correspond to members of `struct lconv'; see <locale.h>. */
180 DECIMAL_POINT
= _NL_ITEM (LC_NUMERIC
, 0),
185 YESEXPR
= _NL_ITEM (LC_MESSAGES
, 0), /* Regex matching ``yes'' input. */
186 NOEXPR
, /* Regex matching ``no'' input. */
187 YESSTR
, /* Output string for ``yes''. */
188 NOSTR
, /* Output string for ``no''. */
191 /* This marks the highest value used. */
196 /* Return the current locale's value for ITEM.
197 If ITEM is invalid, an empty string is returned.
199 The string returned will not change until `setlocale' is called;
200 it is usually in read-only memory and cannot be modified. */
202 extern char *nl_langinfo
__P ((nl_item __item
));
207 #endif /* langinfo.h */