1 /* Access to locale-dependent parameters.
2 Copyright (C) 1995-2023 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, see
17 <https://www.gnu.org/licenses/>. */
22 /* Get the type definition. */
25 #include <bits/locale.h> /* Define the __LC_* category names. */
30 /* Construct an `nl_item' value for `nl_langinfo' from a locale category
31 (LC_*) and an item index within the category. Some code may depend on
32 the item values within a category increasing monotonically with the
34 #define _NL_ITEM(category, index) (((category) << 16) | (index))
36 /* Extract the category and item index from a constructed `nl_item' value. */
37 #define _NL_ITEM_CATEGORY(item) ((int) (item) >> 16)
38 #define _NL_ITEM_INDEX(item) ((int) (item) & 0xffff)
40 /* Enumeration of locale items that can be queried with `nl_langinfo'. */
43 /* LC_TIME category: date and time formatting. */
45 /* Abbreviated days of the week. */
46 ABDAY_1
= _NL_ITEM (__LC_TIME
, 0), /* Sun */
47 #define ABDAY_1 ABDAY_1
49 #define ABDAY_2 ABDAY_2
51 #define ABDAY_3 ABDAY_3
53 #define ABDAY_4 ABDAY_4
55 #define ABDAY_5 ABDAY_5
57 #define ABDAY_6 ABDAY_6
59 #define ABDAY_7 ABDAY_7
61 /* Long-named days of the week. */
68 DAY_4
, /* Wednesday */
77 /* Abbreviated month names, in the grammatical form used when the month
78 is a part of a complete date. */
80 #define ABMON_1 ABMON_1
82 #define ABMON_2 ABMON_2
84 #define ABMON_3 ABMON_3
86 #define ABMON_4 ABMON_4
88 #define ABMON_5 ABMON_5
90 #define ABMON_6 ABMON_6
92 #define ABMON_7 ABMON_7
94 #define ABMON_8 ABMON_8
96 #define ABMON_9 ABMON_9
98 #define ABMON_10 ABMON_10
100 #define ABMON_11 ABMON_11
102 #define ABMON_12 ABMON_12
104 /* Long month names, in the grammatical form used when the month
105 is a part of a complete date. */
125 #define MON_10 MON_10
127 #define MON_11 MON_11
129 #define MON_12 MON_12
131 AM_STR
, /* Ante meridiem string. */
132 #define AM_STR AM_STR
133 PM_STR
, /* Post meridiem string. */
134 #define PM_STR PM_STR
136 D_T_FMT
, /* Date and time format for strftime. */
137 #define D_T_FMT D_T_FMT
138 D_FMT
, /* Date format for strftime. */
140 T_FMT
, /* Time format for strftime. */
142 T_FMT_AMPM
, /* 12-hour time format for strftime. */
143 #define T_FMT_AMPM T_FMT_AMPM
145 ERA
, /* Alternate era. */
147 __ERA_YEAR
, /* Year in alternate era format. */
149 # define ERA_YEAR __ERA_YEAR
151 ERA_D_FMT
, /* Date in alternate era format. */
152 #define ERA_D_FMT ERA_D_FMT
153 ALT_DIGITS
, /* Alternate symbols for digits. */
154 #define ALT_DIGITS ALT_DIGITS
155 ERA_D_T_FMT
, /* Date and time in alternate era format. */
156 #define ERA_D_T_FMT ERA_D_T_FMT
157 ERA_T_FMT
, /* Time in alternate era format. */
158 #define ERA_T_FMT ERA_T_FMT
160 _NL_TIME_ERA_NUM_ENTRIES
, /* Number entries in the era arrays. */
161 _NL_TIME_ERA_ENTRIES
, /* Structure with era entries in usable form.*/
163 _NL_WABDAY_1
, /* Sun */
171 /* Long-named days of the week. */
172 _NL_WDAY_1
, /* Sunday */
173 _NL_WDAY_2
, /* Monday */
174 _NL_WDAY_3
, /* Tuesday */
175 _NL_WDAY_4
, /* Wednesday */
176 _NL_WDAY_5
, /* Thursday */
177 _NL_WDAY_6
, /* Friday */
178 _NL_WDAY_7
, /* Saturday */
180 /* Abbreviated month names, in the grammatical form used when the month
181 is a part of a complete date. */
182 _NL_WABMON_1
, /* Jan */
195 /* Long month names, in the grammatical form used when the month
196 is a part of a complete date. */
197 _NL_WMON_1
, /* January */
210 _NL_WAM_STR
, /* Ante meridiem string. */
211 _NL_WPM_STR
, /* Post meridiem string. */
213 _NL_WD_T_FMT
, /* Date and time format for strftime. */
214 _NL_WD_FMT
, /* Date format for strftime. */
215 _NL_WT_FMT
, /* Time format for strftime. */
216 _NL_WT_FMT_AMPM
, /* 12-hour time format for strftime. */
218 _NL_WERA_YEAR
, /* Year in alternate era format. */
219 _NL_WERA_D_FMT
, /* Date in alternate era format. */
220 _NL_WALT_DIGITS
, /* Alternate symbols for digits. */
221 _NL_WERA_D_T_FMT
, /* Date and time in alternate era format. */
222 _NL_WERA_T_FMT
, /* Time in alternate era format. */
225 _NL_TIME_WEEK_1STDAY
,
226 _NL_TIME_WEEK_1STWEEK
,
227 _NL_TIME_FIRST_WEEKDAY
,
228 _NL_TIME_FIRST_WORKDAY
,
229 _NL_TIME_CAL_DIRECTION
,
232 _DATE_FMT
, /* strftime format for date. */
233 #define _DATE_FMT _DATE_FMT
238 /* Long month names, in the grammatical form used when the month
239 is named by itself. */
240 __ALTMON_1
, /* January */
253 # define ALTMON_1 __ALTMON_1
254 # define ALTMON_2 __ALTMON_2
255 # define ALTMON_3 __ALTMON_3
256 # define ALTMON_4 __ALTMON_4
257 # define ALTMON_5 __ALTMON_5
258 # define ALTMON_6 __ALTMON_6
259 # define ALTMON_7 __ALTMON_7
260 # define ALTMON_8 __ALTMON_8
261 # define ALTMON_9 __ALTMON_9
262 # define ALTMON_10 __ALTMON_10
263 # define ALTMON_11 __ALTMON_11
264 # define ALTMON_12 __ALTMON_12
267 /* Long month names, in the grammatical form used when the month
268 is named by itself. */
269 _NL_WALTMON_1
, /* January */
282 /* Abbreviated month names, in the grammatical form used when the month
283 is named by itself. */
284 _NL_ABALTMON_1
, /* Jan */
297 /* Abbreviated month names, in the grammatical form used when the month
298 is named by itself. */
299 _NL_WABALTMON_1
, /* Jan */
312 _NL_NUM_LC_TIME
, /* Number of indices in LC_TIME category. */
314 /* LC_COLLATE category: text sorting.
315 This information is accessed by the strcoll and strxfrm functions.
316 These `nl_langinfo' names are used only internally. */
317 _NL_COLLATE_NRULES
= _NL_ITEM (__LC_COLLATE
, 0),
318 _NL_COLLATE_RULESETS
,
320 _NL_COLLATE_WEIGHTMB
,
322 _NL_COLLATE_INDIRECTMB
,
327 _NL_COLLATE_WEIGHTWC
,
329 _NL_COLLATE_INDIRECTWC
,
330 _NL_COLLATE_SYMB_HASH_SIZEMB
,
331 _NL_COLLATE_SYMB_TABLEMB
,
332 _NL_COLLATE_SYMB_EXTRAMB
,
333 _NL_COLLATE_COLLSEQMB
,
334 _NL_COLLATE_COLLSEQWC
,
338 /* LC_CTYPE category: character classification.
339 This information is accessed by the functions in <ctype.h>.
340 These `nl_langinfo' names are used only internally. */
341 _NL_CTYPE_CLASS
= _NL_ITEM (__LC_CTYPE
, 0),
351 _NL_CTYPE_CLASS_NAMES
,
354 _NL_CTYPE_MB_CUR_MAX
,
355 _NL_CTYPE_CODESET_NAME
,
356 CODESET
= _NL_CTYPE_CODESET_NAME
,
357 #define CODESET CODESET
360 _NL_CTYPE_CLASS_OFFSET
,
361 _NL_CTYPE_MAP_OFFSET
,
362 _NL_CTYPE_INDIGITS_MB_LEN
,
363 _NL_CTYPE_INDIGITS0_MB
,
364 _NL_CTYPE_INDIGITS1_MB
,
365 _NL_CTYPE_INDIGITS2_MB
,
366 _NL_CTYPE_INDIGITS3_MB
,
367 _NL_CTYPE_INDIGITS4_MB
,
368 _NL_CTYPE_INDIGITS5_MB
,
369 _NL_CTYPE_INDIGITS6_MB
,
370 _NL_CTYPE_INDIGITS7_MB
,
371 _NL_CTYPE_INDIGITS8_MB
,
372 _NL_CTYPE_INDIGITS9_MB
,
373 _NL_CTYPE_INDIGITS_WC_LEN
,
374 _NL_CTYPE_INDIGITS0_WC
,
375 _NL_CTYPE_INDIGITS1_WC
,
376 _NL_CTYPE_INDIGITS2_WC
,
377 _NL_CTYPE_INDIGITS3_WC
,
378 _NL_CTYPE_INDIGITS4_WC
,
379 _NL_CTYPE_INDIGITS5_WC
,
380 _NL_CTYPE_INDIGITS6_WC
,
381 _NL_CTYPE_INDIGITS7_WC
,
382 _NL_CTYPE_INDIGITS8_WC
,
383 _NL_CTYPE_INDIGITS9_WC
,
384 _NL_CTYPE_OUTDIGIT0_MB
,
385 _NL_CTYPE_OUTDIGIT1_MB
,
386 _NL_CTYPE_OUTDIGIT2_MB
,
387 _NL_CTYPE_OUTDIGIT3_MB
,
388 _NL_CTYPE_OUTDIGIT4_MB
,
389 _NL_CTYPE_OUTDIGIT5_MB
,
390 _NL_CTYPE_OUTDIGIT6_MB
,
391 _NL_CTYPE_OUTDIGIT7_MB
,
392 _NL_CTYPE_OUTDIGIT8_MB
,
393 _NL_CTYPE_OUTDIGIT9_MB
,
394 _NL_CTYPE_OUTDIGIT0_WC
,
395 _NL_CTYPE_OUTDIGIT1_WC
,
396 _NL_CTYPE_OUTDIGIT2_WC
,
397 _NL_CTYPE_OUTDIGIT3_WC
,
398 _NL_CTYPE_OUTDIGIT4_WC
,
399 _NL_CTYPE_OUTDIGIT5_WC
,
400 _NL_CTYPE_OUTDIGIT6_WC
,
401 _NL_CTYPE_OUTDIGIT7_WC
,
402 _NL_CTYPE_OUTDIGIT8_WC
,
403 _NL_CTYPE_OUTDIGIT9_WC
,
404 _NL_CTYPE_TRANSLIT_TAB_SIZE
,
405 _NL_CTYPE_TRANSLIT_FROM_IDX
,
406 _NL_CTYPE_TRANSLIT_FROM_TBL
,
407 _NL_CTYPE_TRANSLIT_TO_IDX
,
408 _NL_CTYPE_TRANSLIT_TO_TBL
,
409 _NL_CTYPE_TRANSLIT_DEFAULT_MISSING_LEN
,
410 _NL_CTYPE_TRANSLIT_DEFAULT_MISSING
,
411 _NL_CTYPE_TRANSLIT_IGNORE_LEN
,
412 _NL_CTYPE_TRANSLIT_IGNORE
,
413 _NL_CTYPE_MAP_TO_NONASCII
,
414 _NL_CTYPE_NONASCII_CASE
,
415 _NL_CTYPE_EXTRA_MAP_1
,
416 _NL_CTYPE_EXTRA_MAP_2
,
417 _NL_CTYPE_EXTRA_MAP_3
,
418 _NL_CTYPE_EXTRA_MAP_4
,
419 _NL_CTYPE_EXTRA_MAP_5
,
420 _NL_CTYPE_EXTRA_MAP_6
,
421 _NL_CTYPE_EXTRA_MAP_7
,
422 _NL_CTYPE_EXTRA_MAP_8
,
423 _NL_CTYPE_EXTRA_MAP_9
,
424 _NL_CTYPE_EXTRA_MAP_10
,
425 _NL_CTYPE_EXTRA_MAP_11
,
426 _NL_CTYPE_EXTRA_MAP_12
,
427 _NL_CTYPE_EXTRA_MAP_13
,
428 _NL_CTYPE_EXTRA_MAP_14
,
431 /* LC_MONETARY category: formatting of monetary quantities.
432 These items each correspond to a member of `struct lconv',
433 defined in <locale.h>. */
434 __INT_CURR_SYMBOL
= _NL_ITEM (__LC_MONETARY
, 0),
436 # define INT_CURR_SYMBOL __INT_CURR_SYMBOL
440 # define CURRENCY_SYMBOL __CURRENCY_SYMBOL
444 # define MON_DECIMAL_POINT __MON_DECIMAL_POINT
448 # define MON_THOUSANDS_SEP __MON_THOUSANDS_SEP
452 # define MON_GROUPING __MON_GROUPING
456 # define POSITIVE_SIGN __POSITIVE_SIGN
460 # define NEGATIVE_SIGN __NEGATIVE_SIGN
464 # define INT_FRAC_DIGITS __INT_FRAC_DIGITS
468 # define FRAC_DIGITS __FRAC_DIGITS
472 # define P_CS_PRECEDES __P_CS_PRECEDES
476 # define P_SEP_BY_SPACE __P_SEP_BY_SPACE
480 # define N_CS_PRECEDES __N_CS_PRECEDES
484 # define N_SEP_BY_SPACE __N_SEP_BY_SPACE
488 # define P_SIGN_POSN __P_SIGN_POSN
492 # define N_SIGN_POSN __N_SIGN_POSN
494 _NL_MONETARY_CRNCYSTR
,
495 #define CRNCYSTR _NL_MONETARY_CRNCYSTR
498 # define INT_P_CS_PRECEDES __INT_P_CS_PRECEDES
500 __INT_P_SEP_BY_SPACE
,
502 # define INT_P_SEP_BY_SPACE __INT_P_SEP_BY_SPACE
506 # define INT_N_CS_PRECEDES __INT_N_CS_PRECEDES
508 __INT_N_SEP_BY_SPACE
,
510 # define INT_N_SEP_BY_SPACE __INT_N_SEP_BY_SPACE
514 # define INT_P_SIGN_POSN __INT_P_SIGN_POSN
518 # define INT_N_SIGN_POSN __INT_N_SIGN_POSN
520 _NL_MONETARY_DUO_INT_CURR_SYMBOL
,
521 _NL_MONETARY_DUO_CURRENCY_SYMBOL
,
522 _NL_MONETARY_DUO_INT_FRAC_DIGITS
,
523 _NL_MONETARY_DUO_FRAC_DIGITS
,
524 _NL_MONETARY_DUO_P_CS_PRECEDES
,
525 _NL_MONETARY_DUO_P_SEP_BY_SPACE
,
526 _NL_MONETARY_DUO_N_CS_PRECEDES
,
527 _NL_MONETARY_DUO_N_SEP_BY_SPACE
,
528 _NL_MONETARY_DUO_INT_P_CS_PRECEDES
,
529 _NL_MONETARY_DUO_INT_P_SEP_BY_SPACE
,
530 _NL_MONETARY_DUO_INT_N_CS_PRECEDES
,
531 _NL_MONETARY_DUO_INT_N_SEP_BY_SPACE
,
532 _NL_MONETARY_DUO_P_SIGN_POSN
,
533 _NL_MONETARY_DUO_N_SIGN_POSN
,
534 _NL_MONETARY_DUO_INT_P_SIGN_POSN
,
535 _NL_MONETARY_DUO_INT_N_SIGN_POSN
,
536 _NL_MONETARY_UNO_VALID_FROM
,
537 _NL_MONETARY_UNO_VALID_TO
,
538 _NL_MONETARY_DUO_VALID_FROM
,
539 _NL_MONETARY_DUO_VALID_TO
,
540 _NL_MONETARY_CONVERSION_RATE
,
541 _NL_MONETARY_DECIMAL_POINT_WC
,
542 _NL_MONETARY_THOUSANDS_SEP_WC
,
543 _NL_MONETARY_CODESET
,
546 /* LC_NUMERIC category: formatting of numbers.
547 These also correspond to members of `struct lconv'; see <locale.h>. */
548 __DECIMAL_POINT
= _NL_ITEM (__LC_NUMERIC
, 0),
550 # define DECIMAL_POINT __DECIMAL_POINT
552 RADIXCHAR
= __DECIMAL_POINT
,
553 #define RADIXCHAR RADIXCHAR
556 # define THOUSANDS_SEP __THOUSANDS_SEP
558 THOUSEP
= __THOUSANDS_SEP
,
559 #define THOUSEP THOUSEP
562 # define GROUPING __GROUPING
564 _NL_NUMERIC_DECIMAL_POINT_WC
,
565 _NL_NUMERIC_THOUSANDS_SEP_WC
,
569 __YESEXPR
= _NL_ITEM (__LC_MESSAGES
, 0), /* Regex matching ``yes'' input. */
570 #define YESEXPR __YESEXPR
571 __NOEXPR
, /* Regex matching ``no'' input. */
572 #define NOEXPR __NOEXPR
573 __YESSTR
, /* Output string for ``yes''. */
574 #if defined __USE_GNU || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
575 # define YESSTR __YESSTR
577 __NOSTR
, /* Output string for ``no''. */
578 #if defined __USE_GNU || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
579 # define NOSTR __NOSTR
581 _NL_MESSAGES_CODESET
,
584 _NL_PAPER_HEIGHT
= _NL_ITEM (__LC_PAPER
, 0),
589 _NL_NAME_NAME_FMT
= _NL_ITEM (__LC_NAME
, 0),
598 _NL_ADDRESS_POSTAL_FMT
= _NL_ITEM (__LC_ADDRESS
, 0),
599 _NL_ADDRESS_COUNTRY_NAME
,
600 _NL_ADDRESS_COUNTRY_POST
,
601 _NL_ADDRESS_COUNTRY_AB2
,
602 _NL_ADDRESS_COUNTRY_AB3
,
603 _NL_ADDRESS_COUNTRY_CAR
,
604 _NL_ADDRESS_COUNTRY_NUM
,
605 _NL_ADDRESS_COUNTRY_ISBN
,
606 _NL_ADDRESS_LANG_NAME
,
608 _NL_ADDRESS_LANG_TERM
,
609 _NL_ADDRESS_LANG_LIB
,
613 _NL_TELEPHONE_TEL_INT_FMT
= _NL_ITEM (__LC_TELEPHONE
, 0),
614 _NL_TELEPHONE_TEL_DOM_FMT
,
615 _NL_TELEPHONE_INT_SELECT
,
616 _NL_TELEPHONE_INT_PREFIX
,
617 _NL_TELEPHONE_CODESET
,
618 _NL_NUM_LC_TELEPHONE
,
620 _NL_MEASUREMENT_MEASUREMENT
= _NL_ITEM (__LC_MEASUREMENT
, 0),
621 _NL_MEASUREMENT_CODESET
,
622 _NL_NUM_LC_MEASUREMENT
,
624 _NL_IDENTIFICATION_TITLE
= _NL_ITEM (__LC_IDENTIFICATION
, 0),
625 _NL_IDENTIFICATION_SOURCE
,
626 _NL_IDENTIFICATION_ADDRESS
,
627 _NL_IDENTIFICATION_CONTACT
,
628 _NL_IDENTIFICATION_EMAIL
,
629 _NL_IDENTIFICATION_TEL
,
630 _NL_IDENTIFICATION_FAX
,
631 _NL_IDENTIFICATION_LANGUAGE
,
632 _NL_IDENTIFICATION_TERRITORY
,
633 _NL_IDENTIFICATION_AUDIENCE
,
634 _NL_IDENTIFICATION_APPLICATION
,
635 _NL_IDENTIFICATION_ABBREVIATION
,
636 _NL_IDENTIFICATION_REVISION
,
637 _NL_IDENTIFICATION_DATE
,
638 _NL_IDENTIFICATION_CATEGORY
,
639 _NL_IDENTIFICATION_CODESET
,
640 _NL_NUM_LC_IDENTIFICATION
,
642 /* This marks the highest value used. */
646 /* This macro produces an item you can pass to `nl_langinfo' or
647 `nl_langinfo_l' to get the name of the locale in use for CATEGORY. */
648 #define _NL_LOCALE_NAME(category) _NL_ITEM ((category), \
651 # define NL_LOCALE_NAME(category) _NL_LOCALE_NAME (category)
655 /* Return the current locale's value for ITEM.
656 If ITEM is invalid, an empty string is returned.
658 The string returned will not change until `setlocale' is called;
659 it is usually in read-only memory and cannot be modified. */
661 extern char *nl_langinfo (nl_item __item
) __THROW
;
664 #ifdef __USE_XOPEN2K8
665 /* POSIX.1-2008 extended locale interface (see locale.h). */
666 # include <bits/types/locale_t.h>
668 /* Just like nl_langinfo but get the information from the locale object L. */
669 extern char *nl_langinfo_l (nl_item __item
, locale_t __l
);
674 #endif /* langinfo.h */