1 /* Access to locale-dependent parameters.
2 Copyright (C) 1995-2002,2003,2004,2005,2009 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 Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the 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 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
23 /* Get the type definition. */
26 #include <bits/uClibc_locale.h> /* Define the __LC_* category names. */
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
36 #define _NL_ITEM(category, index) (((category) << 16) | (index))
38 /* Extract the category and item index from a constructed `nl_item' value. */
39 #define _NL_ITEM_CATEGORY(item) ((int) (item) >> 16)
40 #define _NL_ITEM_INDEX(item) ((int) (item) & 0xffff)
42 #define _NL_ITEM(category, index) \
43 (((category) << __NL_ITEM_CATEGORY_SHIFT) | (index))
45 /* Extract the category and item index from a constructed `nl_item' value. */
46 #define _NL_ITEM_CATEGORY(item) ((int) (item) >> __NL_ITEM_CATEGORY_SHIFT)
47 #define _NL_ITEM_INDEX(item) ((int) (item) & __NL_ITEM_INDEX_MASK)
50 /* Enumeration of locale items that can be queried with `nl_langinfo'. */
53 /* LC_TIME category: date and time formatting. */
55 /* Abbreviated days of the week. */
56 ABDAY_1
= _NL_ITEM (__LC_TIME
, 0), /* Sun */
57 #define ABDAY_1 ABDAY_1
59 #define ABDAY_2 ABDAY_2
61 #define ABDAY_3 ABDAY_3
63 #define ABDAY_4 ABDAY_4
65 #define ABDAY_5 ABDAY_5
67 #define ABDAY_6 ABDAY_6
69 #define ABDAY_7 ABDAY_7
71 /* Long-named days of the week. */
78 DAY_4
, /* Wednesday */
87 /* Abbreviated month names. */
89 #define ABMON_1 ABMON_1
91 #define ABMON_2 ABMON_2
93 #define ABMON_3 ABMON_3
95 #define ABMON_4 ABMON_4
97 #define ABMON_5 ABMON_5
99 #define ABMON_6 ABMON_6
101 #define ABMON_7 ABMON_7
103 #define ABMON_8 ABMON_8
105 #define ABMON_9 ABMON_9
107 #define ABMON_10 ABMON_10
109 #define ABMON_11 ABMON_11
111 #define ABMON_12 ABMON_12
113 /* Long month names. */
133 #define MON_10 MON_10
135 #define MON_11 MON_11
137 #define MON_12 MON_12
139 AM_STR
, /* Ante meridian string. */
140 #define AM_STR AM_STR
141 PM_STR
, /* Post meridian string. */
142 #define PM_STR PM_STR
144 D_T_FMT
, /* Date and time format for strftime. */
145 #define D_T_FMT D_T_FMT
146 D_FMT
, /* Date format for strftime. */
148 T_FMT
, /* Time format for strftime. */
150 T_FMT_AMPM
, /* 12-hour time format for strftime. */
151 #define T_FMT_AMPM T_FMT_AMPM
153 ERA
, /* Alternate era. */
155 __ERA_YEAR
, /* Year in alternate era format. */
157 # define ERA_YEAR __ERA_YEAR
159 ERA_D_FMT
, /* Date in alternate era format. */
160 #define ERA_D_FMT ERA_D_FMT
161 ALT_DIGITS
, /* Alternate symbols for digits. */
162 #define ALT_DIGITS ALT_DIGITS
163 ERA_D_T_FMT
, /* Date and time in alternate era format. */
164 #define ERA_D_T_FMT ERA_D_T_FMT
165 ERA_T_FMT
, /* Time in alternate era format. */
166 #define ERA_T_FMT ERA_T_FMT
169 _NL_TIME_ERA_NUM_ENTRIES
, /* Number entries in the era arrays. */
170 _NL_TIME_ERA_ENTRIES
, /* Structure with era entries in usable form.*/
172 _NL_WABDAY_1
, /* Sun */
180 /* Long-named days of the week. */
181 _NL_WDAY_1
, /* Sunday */
182 _NL_WDAY_2
, /* Monday */
183 _NL_WDAY_3
, /* Tuesday */
184 _NL_WDAY_4
, /* Wednesday */
185 _NL_WDAY_5
, /* Thursday */
186 _NL_WDAY_6
, /* Friday */
187 _NL_WDAY_7
, /* Saturday */
189 /* Abbreviated month names. */
190 _NL_WABMON_1
, /* Jan */
203 /* Long month names. */
204 _NL_WMON_1
, /* January */
217 _NL_WAM_STR
, /* Ante meridian string. */
218 _NL_WPM_STR
, /* Post meridian string. */
220 _NL_WD_T_FMT
, /* Date and time format for strftime. */
221 _NL_WD_FMT
, /* Date format for strftime. */
222 _NL_WT_FMT
, /* Time format for strftime. */
223 _NL_WT_FMT_AMPM
, /* 12-hour time format for strftime. */
225 _NL_WERA_YEAR
, /* Year in alternate era format. */
226 _NL_WERA_D_FMT
, /* Date in alternate era format. */
227 _NL_WALT_DIGITS
, /* Alternate symbols for digits. */
228 _NL_WERA_D_T_FMT
, /* Date and time in alternate era format. */
229 _NL_WERA_T_FMT
, /* Time in alternate era format. */
232 _NL_TIME_WEEK_1STDAY
,
233 _NL_TIME_WEEK_1STWEEK
,
234 _NL_TIME_FIRST_WEEKDAY
,
235 _NL_TIME_FIRST_WORKDAY
,
236 _NL_TIME_CAL_DIRECTION
,
239 _DATE_FMT
, /* strftime format for date. */
240 #define _DATE_FMT _DATE_FMT
246 _NL_NUM_LC_TIME
, /* Number of indices in LC_TIME category. */
248 /* LC_COLLATE category: text sorting.
249 This information is accessed by the strcoll and strxfrm functions.
250 These `nl_langinfo' names are used only internally. */
252 _NL_COLLATE_NRULES
= _NL_ITEM (__LC_COLLATE
, 0),
253 _NL_COLLATE_RULESETS
,
255 _NL_COLLATE_WEIGHTMB
,
257 _NL_COLLATE_INDIRECTMB
,
262 _NL_COLLATE_WEIGHTWC
,
264 _NL_COLLATE_INDIRECTWC
,
265 _NL_COLLATE_SYMB_HASH_SIZEMB
,
266 _NL_COLLATE_SYMB_TABLEMB
,
267 _NL_COLLATE_SYMB_EXTRAMB
,
268 _NL_COLLATE_COLLSEQMB
,
269 _NL_COLLATE_COLLSEQWC
,
274 /* LC_CTYPE category: character classification.
275 This information is accessed by the functions in <ctype.h>.
276 These `nl_langinfo' names are used only internally. */
278 _NL_CTYPE_CLASS
= _NL_ITEM (__LC_CTYPE
, 0),
288 _NL_CTYPE_CLASS_NAMES
,
291 _NL_CTYPE_MB_CUR_MAX
,
292 _NL_CTYPE_CODESET_NAME
,
293 CODESET
= _NL_CTYPE_CODESET_NAME
,
294 #define CODESET CODESET
297 _NL_CTYPE_CLASS_OFFSET
,
298 _NL_CTYPE_MAP_OFFSET
,
299 _NL_CTYPE_INDIGITS_MB_LEN
,
300 _NL_CTYPE_INDIGITS0_MB
,
301 _NL_CTYPE_INDIGITS1_MB
,
302 _NL_CTYPE_INDIGITS2_MB
,
303 _NL_CTYPE_INDIGITS3_MB
,
304 _NL_CTYPE_INDIGITS4_MB
,
305 _NL_CTYPE_INDIGITS5_MB
,
306 _NL_CTYPE_INDIGITS6_MB
,
307 _NL_CTYPE_INDIGITS7_MB
,
308 _NL_CTYPE_INDIGITS8_MB
,
309 _NL_CTYPE_INDIGITS9_MB
,
310 _NL_CTYPE_INDIGITS_WC_LEN
,
311 _NL_CTYPE_INDIGITS0_WC
,
312 _NL_CTYPE_INDIGITS1_WC
,
313 _NL_CTYPE_INDIGITS2_WC
,
314 _NL_CTYPE_INDIGITS3_WC
,
315 _NL_CTYPE_INDIGITS4_WC
,
316 _NL_CTYPE_INDIGITS5_WC
,
317 _NL_CTYPE_INDIGITS6_WC
,
318 _NL_CTYPE_INDIGITS7_WC
,
319 _NL_CTYPE_INDIGITS8_WC
,
320 _NL_CTYPE_INDIGITS9_WC
,
321 _NL_CTYPE_OUTDIGIT0_MB
,
323 _NL_CTYPE_OUTDIGIT0_MB
= _NL_ITEM (__LC_CTYPE
, 0),
325 _NL_CTYPE_OUTDIGIT1_MB
,
326 _NL_CTYPE_OUTDIGIT2_MB
,
327 _NL_CTYPE_OUTDIGIT3_MB
,
328 _NL_CTYPE_OUTDIGIT4_MB
,
329 _NL_CTYPE_OUTDIGIT5_MB
,
330 _NL_CTYPE_OUTDIGIT6_MB
,
331 _NL_CTYPE_OUTDIGIT7_MB
,
332 _NL_CTYPE_OUTDIGIT8_MB
,
333 _NL_CTYPE_OUTDIGIT9_MB
,
335 _NL_CTYPE_OUTDIGIT0_WC
,
336 _NL_CTYPE_OUTDIGIT1_WC
,
337 _NL_CTYPE_OUTDIGIT2_WC
,
338 _NL_CTYPE_OUTDIGIT3_WC
,
339 _NL_CTYPE_OUTDIGIT4_WC
,
340 _NL_CTYPE_OUTDIGIT5_WC
,
341 _NL_CTYPE_OUTDIGIT6_WC
,
342 _NL_CTYPE_OUTDIGIT7_WC
,
343 _NL_CTYPE_OUTDIGIT8_WC
,
344 _NL_CTYPE_OUTDIGIT9_WC
,
345 _NL_CTYPE_TRANSLIT_TAB_SIZE
,
346 _NL_CTYPE_TRANSLIT_FROM_IDX
,
347 _NL_CTYPE_TRANSLIT_FROM_TBL
,
348 _NL_CTYPE_TRANSLIT_TO_IDX
,
349 _NL_CTYPE_TRANSLIT_TO_TBL
,
350 _NL_CTYPE_TRANSLIT_DEFAULT_MISSING_LEN
,
351 _NL_CTYPE_TRANSLIT_DEFAULT_MISSING
,
352 _NL_CTYPE_TRANSLIT_IGNORE_LEN
,
353 _NL_CTYPE_TRANSLIT_IGNORE
,
354 _NL_CTYPE_MAP_TO_NONASCII
,
355 _NL_CTYPE_NONASCII_CASE
,
356 _NL_CTYPE_EXTRA_MAP_1
,
357 _NL_CTYPE_EXTRA_MAP_2
,
358 _NL_CTYPE_EXTRA_MAP_3
,
359 _NL_CTYPE_EXTRA_MAP_4
,
360 _NL_CTYPE_EXTRA_MAP_5
,
361 _NL_CTYPE_EXTRA_MAP_6
,
362 _NL_CTYPE_EXTRA_MAP_7
,
363 _NL_CTYPE_EXTRA_MAP_8
,
364 _NL_CTYPE_EXTRA_MAP_9
,
365 _NL_CTYPE_EXTRA_MAP_10
,
366 _NL_CTYPE_EXTRA_MAP_11
,
367 _NL_CTYPE_EXTRA_MAP_12
,
368 _NL_CTYPE_EXTRA_MAP_13
,
369 _NL_CTYPE_EXTRA_MAP_14
,
371 _NL_CTYPE_CODESET_NAME
, /* uClibc note: MUST BE LAST ENTRY!!! */
372 CODESET
= _NL_CTYPE_CODESET_NAME
,
373 #define CODESET CODESET
377 /* LC_MONETARY category: formatting of monetary quantities.
378 These items each correspond to a member of `struct lconv',
379 defined in <locale.h>. */
380 __INT_CURR_SYMBOL
= _NL_ITEM (__LC_MONETARY
, 0),
382 # define INT_CURR_SYMBOL __INT_CURR_SYMBOL
386 # define CURRENCY_SYMBOL __CURRENCY_SYMBOL
390 # define MON_DECIMAL_POINT __MON_DECIMAL_POINT
394 # define MON_THOUSANDS_SEP __MON_THOUSANDS_SEP
398 # define MON_GROUPING __MON_GROUPING
402 # define POSITIVE_SIGN __POSITIVE_SIGN
406 # define NEGATIVE_SIGN __NEGATIVE_SIGN
410 # define INT_FRAC_DIGITS __INT_FRAC_DIGITS
414 # define FRAC_DIGITS __FRAC_DIGITS
418 # define P_CS_PRECEDES __P_CS_PRECEDES
422 # define P_SEP_BY_SPACE __P_SEP_BY_SPACE
426 # define N_CS_PRECEDES __N_CS_PRECEDES
430 # define N_SEP_BY_SPACE __N_SEP_BY_SPACE
434 # define P_SIGN_POSN __P_SIGN_POSN
438 # define N_SIGN_POSN __N_SIGN_POSN
440 #if 0 /* moved below for some reason on uClibc */
441 _NL_MONETARY_CRNCYSTR
,
442 #define CRNCYSTR _NL_MONETARY_CRNCYSTR
446 # define INT_P_CS_PRECEDES __INT_P_CS_PRECEDES
448 __INT_P_SEP_BY_SPACE
,
450 # define INT_P_SEP_BY_SPACE __INT_P_SEP_BY_SPACE
454 # define INT_N_CS_PRECEDES __INT_N_CS_PRECEDES
456 __INT_N_SEP_BY_SPACE
,
458 # define INT_N_SEP_BY_SPACE __INT_N_SEP_BY_SPACE
462 # define INT_P_SIGN_POSN __INT_P_SIGN_POSN
466 # define INT_N_SIGN_POSN __INT_N_SIGN_POSN
468 #if 1 /* moved here from above */
469 _NL_MONETARY_CRNCYSTR
,
470 #define CRNCYSTR _NL_MONETARY_CRNCYSTR
473 _NL_MONETARY_DUO_INT_CURR_SYMBOL
,
474 _NL_MONETARY_DUO_CURRENCY_SYMBOL
,
475 _NL_MONETARY_DUO_INT_FRAC_DIGITS
,
476 _NL_MONETARY_DUO_FRAC_DIGITS
,
477 _NL_MONETARY_DUO_P_CS_PRECEDES
,
478 _NL_MONETARY_DUO_P_SEP_BY_SPACE
,
479 _NL_MONETARY_DUO_N_CS_PRECEDES
,
480 _NL_MONETARY_DUO_N_SEP_BY_SPACE
,
481 _NL_MONETARY_DUO_INT_P_CS_PRECEDES
,
482 _NL_MONETARY_DUO_INT_P_SEP_BY_SPACE
,
483 _NL_MONETARY_DUO_INT_N_CS_PRECEDES
,
484 _NL_MONETARY_DUO_INT_N_SEP_BY_SPACE
,
485 _NL_MONETARY_DUO_P_SIGN_POSN
,
486 _NL_MONETARY_DUO_N_SIGN_POSN
,
487 _NL_MONETARY_DUO_INT_P_SIGN_POSN
,
488 _NL_MONETARY_DUO_INT_N_SIGN_POSN
,
489 _NL_MONETARY_UNO_VALID_FROM
,
490 _NL_MONETARY_UNO_VALID_TO
,
491 _NL_MONETARY_DUO_VALID_FROM
,
492 _NL_MONETARY_DUO_VALID_TO
,
493 _NL_MONETARY_CONVERSION_RATE
,
494 _NL_MONETARY_DECIMAL_POINT_WC
,
495 _NL_MONETARY_THOUSANDS_SEP_WC
,
496 _NL_MONETARY_CODESET
,
500 /* LC_NUMERIC category: formatting of numbers.
501 These also correspond to members of `struct lconv'; see <locale.h>. */
502 __DECIMAL_POINT
= _NL_ITEM (__LC_NUMERIC
, 0),
504 # define DECIMAL_POINT __DECIMAL_POINT
506 RADIXCHAR
= __DECIMAL_POINT
,
507 #define RADIXCHAR RADIXCHAR
510 # define THOUSANDS_SEP __THOUSANDS_SEP
512 THOUSEP
= __THOUSANDS_SEP
,
513 #define THOUSEP THOUSEP
516 # define GROUPING __GROUPING
519 _NL_NUMERIC_DECIMAL_POINT_WC
,
520 _NL_NUMERIC_THOUSANDS_SEP_WC
,
525 __YESEXPR
= _NL_ITEM (__LC_MESSAGES
, 0), /* Regex matching ``yes'' input. */
526 #define YESEXPR __YESEXPR
527 __NOEXPR
, /* Regex matching ``no'' input. */
528 #define NOEXPR __NOEXPR
529 __YESSTR
, /* Output string for ``yes''. */
530 #if defined __USE_GNU || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
531 # define YESSTR __YESSTR
533 __NOSTR
, /* Output string for ``no''. */
534 #if defined __USE_GNU || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
535 # define NOSTR __NOSTR
538 _NL_MESSAGES_CODESET
,
543 _NL_PAPER_HEIGHT
= _NL_ITEM (__LC_PAPER
, 0),
548 _NL_NAME_NAME_FMT
= _NL_ITEM (__LC_NAME
, 0),
557 _NL_ADDRESS_POSTAL_FMT
= _NL_ITEM (__LC_ADDRESS
, 0),
558 _NL_ADDRESS_COUNTRY_NAME
,
559 _NL_ADDRESS_COUNTRY_POST
,
560 _NL_ADDRESS_COUNTRY_AB2
,
561 _NL_ADDRESS_COUNTRY_AB3
,
562 _NL_ADDRESS_COUNTRY_CAR
,
563 _NL_ADDRESS_COUNTRY_NUM
,
564 _NL_ADDRESS_COUNTRY_ISBN
,
565 _NL_ADDRESS_LANG_NAME
,
567 _NL_ADDRESS_LANG_TERM
,
568 _NL_ADDRESS_LANG_LIB
,
572 _NL_TELEPHONE_TEL_INT_FMT
= _NL_ITEM (__LC_TELEPHONE
, 0),
573 _NL_TELEPHONE_TEL_DOM_FMT
,
574 _NL_TELEPHONE_INT_SELECT
,
575 _NL_TELEPHONE_INT_PREFIX
,
576 _NL_TELEPHONE_CODESET
,
577 _NL_NUM_LC_TELEPHONE
,
579 _NL_MEASUREMENT_MEASUREMENT
= _NL_ITEM (__LC_MEASUREMENT
, 0),
580 _NL_MEASUREMENT_CODESET
,
581 _NL_NUM_LC_MEASUREMENT
,
583 _NL_IDENTIFICATION_TITLE
= _NL_ITEM (__LC_IDENTIFICATION
, 0),
584 _NL_IDENTIFICATION_SOURCE
,
585 _NL_IDENTIFICATION_ADDRESS
,
586 _NL_IDENTIFICATION_CONTACT
,
587 _NL_IDENTIFICATION_EMAIL
,
588 _NL_IDENTIFICATION_TEL
,
589 _NL_IDENTIFICATION_FAX
,
590 _NL_IDENTIFICATION_LANGUAGE
,
591 _NL_IDENTIFICATION_TERRITORY
,
592 _NL_IDENTIFICATION_AUDIENCE
,
593 _NL_IDENTIFICATION_APPLICATION
,
594 _NL_IDENTIFICATION_ABBREVIATION
,
595 _NL_IDENTIFICATION_REVISION
,
596 _NL_IDENTIFICATION_DATE
,
597 _NL_IDENTIFICATION_CATEGORY
,
598 _NL_IDENTIFICATION_CODESET
,
599 _NL_NUM_LC_IDENTIFICATION
,
602 /* This marks the highest value used. */
606 /* This macro produces an item you can pass to `nl_langinfo' or
607 `nl_langinfo_l' to get the name of the locale in use for CATEGORY. */
608 #define _NL_LOCALE_NAME(category) _NL_ITEM ((category), -1)
610 # define NL_LOCALE_NAME(category) _NL_LOCALE_NAME (category)
614 /* Return the current locale's value for ITEM.
615 If ITEM is invalid, an empty string is returned.
617 The string returned will not change until `setlocale' is called;
618 it is usually in read-only memory and cannot be modified. */
620 extern char *nl_langinfo (nl_item __item
) __THROW
;
621 libc_hidden_proto(nl_langinfo
)
624 #if defined __USE_XOPEN2K && defined __UCLIBC_HAS_XLOCALE__
625 /* This interface is for the extended locale model. See <locale.h> for
628 /* Get locale datatype definition. */
629 # include <xlocale.h>
631 /* Just like nl_langinfo but get the information from the locale object L. */
632 extern char *nl_langinfo_l (nl_item __item
, __locale_t __l
);
633 libc_hidden_proto(nl_langinfo_l
)
638 #endif /* langinfo.h */