1 /* Access to locale-dependent parameters.
2 Copyright (C) 1995-2002,2003,2004,2005 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/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
35 #define _NL_ITEM(category, index) (((category) << 16) | (index))
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)
41 /* Enumeration of locale items that can be queried with `nl_langinfo'. */
44 /* LC_TIME category: date and time formatting. */
46 /* Abbreviated days of the week. */
47 ABDAY_1
= _NL_ITEM (__LC_TIME
, 0), /* Sun */
48 #define ABDAY_1 ABDAY_1
50 #define ABDAY_2 ABDAY_2
52 #define ABDAY_3 ABDAY_3
54 #define ABDAY_4 ABDAY_4
56 #define ABDAY_5 ABDAY_5
58 #define ABDAY_6 ABDAY_6
60 #define ABDAY_7 ABDAY_7
62 /* Long-named days of the week. */
69 DAY_4
, /* Wednesday */
78 /* Abbreviated month names. */
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. */
124 #define MON_10 MON_10
126 #define MON_11 MON_11
128 #define MON_12 MON_12
130 AM_STR
, /* Ante meridiem string. */
131 #define AM_STR AM_STR
132 PM_STR
, /* Post meridiem string. */
133 #define PM_STR PM_STR
135 D_T_FMT
, /* Date and time format for strftime. */
136 #define D_T_FMT D_T_FMT
137 D_FMT
, /* Date format for strftime. */
139 T_FMT
, /* Time format for strftime. */
141 T_FMT_AMPM
, /* 12-hour time format for strftime. */
142 #define T_FMT_AMPM T_FMT_AMPM
144 ERA
, /* Alternate era. */
146 __ERA_YEAR
, /* Year in alternate era format. */
148 # define ERA_YEAR __ERA_YEAR
150 ERA_D_FMT
, /* Date in alternate era format. */
151 #define ERA_D_FMT ERA_D_FMT
152 ALT_DIGITS
, /* Alternate symbols for digits. */
153 #define ALT_DIGITS ALT_DIGITS
154 ERA_D_T_FMT
, /* Date and time in alternate era format. */
155 #define ERA_D_T_FMT ERA_D_T_FMT
156 ERA_T_FMT
, /* Time in alternate era format. */
157 #define ERA_T_FMT ERA_T_FMT
159 _NL_TIME_ERA_NUM_ENTRIES
, /* Number entries in the era arrays. */
160 _NL_TIME_ERA_ENTRIES
, /* Structure with era entries in usable form.*/
162 _NL_WABDAY_1
, /* Sun */
170 /* Long-named days of the week. */
171 _NL_WDAY_1
, /* Sunday */
172 _NL_WDAY_2
, /* Monday */
173 _NL_WDAY_3
, /* Tuesday */
174 _NL_WDAY_4
, /* Wednesday */
175 _NL_WDAY_5
, /* Thursday */
176 _NL_WDAY_6
, /* Friday */
177 _NL_WDAY_7
, /* Saturday */
179 /* Abbreviated month names. */
180 _NL_WABMON_1
, /* Jan */
193 /* Long month names. */
194 _NL_WMON_1
, /* January */
207 _NL_WAM_STR
, /* Ante meridiem string. */
208 _NL_WPM_STR
, /* Post meridiem string. */
210 _NL_WD_T_FMT
, /* Date and time format for strftime. */
211 _NL_WD_FMT
, /* Date format for strftime. */
212 _NL_WT_FMT
, /* Time format for strftime. */
213 _NL_WT_FMT_AMPM
, /* 12-hour time format for strftime. */
215 _NL_WERA_YEAR
, /* Year in alternate era format. */
216 _NL_WERA_D_FMT
, /* Date in alternate era format. */
217 _NL_WALT_DIGITS
, /* Alternate symbols for digits. */
218 _NL_WERA_D_T_FMT
, /* Date and time in alternate era format. */
219 _NL_WERA_T_FMT
, /* Time in alternate era format. */
222 _NL_TIME_WEEK_1STDAY
,
223 _NL_TIME_WEEK_1STWEEK
,
224 _NL_TIME_FIRST_WEEKDAY
,
225 _NL_TIME_FIRST_WORKDAY
,
226 _NL_TIME_CAL_DIRECTION
,
229 _DATE_FMT
, /* strftime format for date. */
230 #define _DATE_FMT _DATE_FMT
235 _NL_NUM_LC_TIME
, /* Number of indices in LC_TIME category. */
237 /* LC_COLLATE category: text sorting.
238 This information is accessed by the strcoll and strxfrm functions.
239 These `nl_langinfo' names are used only internally. */
240 _NL_COLLATE_NRULES
= _NL_ITEM (__LC_COLLATE
, 0),
241 _NL_COLLATE_RULESETS
,
243 _NL_COLLATE_WEIGHTMB
,
245 _NL_COLLATE_INDIRECTMB
,
250 _NL_COLLATE_WEIGHTWC
,
252 _NL_COLLATE_INDIRECTWC
,
253 _NL_COLLATE_SYMB_HASH_SIZEMB
,
254 _NL_COLLATE_SYMB_TABLEMB
,
255 _NL_COLLATE_SYMB_EXTRAMB
,
256 _NL_COLLATE_COLLSEQMB
,
257 _NL_COLLATE_COLLSEQWC
,
261 /* LC_CTYPE category: character classification.
262 This information is accessed by the functions in <ctype.h>.
263 These `nl_langinfo' names are used only internally. */
264 _NL_CTYPE_CLASS
= _NL_ITEM (__LC_CTYPE
, 0),
274 _NL_CTYPE_CLASS_NAMES
,
277 _NL_CTYPE_MB_CUR_MAX
,
278 _NL_CTYPE_CODESET_NAME
,
279 CODESET
= _NL_CTYPE_CODESET_NAME
,
280 #define CODESET CODESET
283 _NL_CTYPE_CLASS_OFFSET
,
284 _NL_CTYPE_MAP_OFFSET
,
285 _NL_CTYPE_INDIGITS_MB_LEN
,
286 _NL_CTYPE_INDIGITS0_MB
,
287 _NL_CTYPE_INDIGITS1_MB
,
288 _NL_CTYPE_INDIGITS2_MB
,
289 _NL_CTYPE_INDIGITS3_MB
,
290 _NL_CTYPE_INDIGITS4_MB
,
291 _NL_CTYPE_INDIGITS5_MB
,
292 _NL_CTYPE_INDIGITS6_MB
,
293 _NL_CTYPE_INDIGITS7_MB
,
294 _NL_CTYPE_INDIGITS8_MB
,
295 _NL_CTYPE_INDIGITS9_MB
,
296 _NL_CTYPE_INDIGITS_WC_LEN
,
297 _NL_CTYPE_INDIGITS0_WC
,
298 _NL_CTYPE_INDIGITS1_WC
,
299 _NL_CTYPE_INDIGITS2_WC
,
300 _NL_CTYPE_INDIGITS3_WC
,
301 _NL_CTYPE_INDIGITS4_WC
,
302 _NL_CTYPE_INDIGITS5_WC
,
303 _NL_CTYPE_INDIGITS6_WC
,
304 _NL_CTYPE_INDIGITS7_WC
,
305 _NL_CTYPE_INDIGITS8_WC
,
306 _NL_CTYPE_INDIGITS9_WC
,
307 _NL_CTYPE_OUTDIGIT0_MB
,
308 _NL_CTYPE_OUTDIGIT1_MB
,
309 _NL_CTYPE_OUTDIGIT2_MB
,
310 _NL_CTYPE_OUTDIGIT3_MB
,
311 _NL_CTYPE_OUTDIGIT4_MB
,
312 _NL_CTYPE_OUTDIGIT5_MB
,
313 _NL_CTYPE_OUTDIGIT6_MB
,
314 _NL_CTYPE_OUTDIGIT7_MB
,
315 _NL_CTYPE_OUTDIGIT8_MB
,
316 _NL_CTYPE_OUTDIGIT9_MB
,
317 _NL_CTYPE_OUTDIGIT0_WC
,
318 _NL_CTYPE_OUTDIGIT1_WC
,
319 _NL_CTYPE_OUTDIGIT2_WC
,
320 _NL_CTYPE_OUTDIGIT3_WC
,
321 _NL_CTYPE_OUTDIGIT4_WC
,
322 _NL_CTYPE_OUTDIGIT5_WC
,
323 _NL_CTYPE_OUTDIGIT6_WC
,
324 _NL_CTYPE_OUTDIGIT7_WC
,
325 _NL_CTYPE_OUTDIGIT8_WC
,
326 _NL_CTYPE_OUTDIGIT9_WC
,
327 _NL_CTYPE_TRANSLIT_TAB_SIZE
,
328 _NL_CTYPE_TRANSLIT_FROM_IDX
,
329 _NL_CTYPE_TRANSLIT_FROM_TBL
,
330 _NL_CTYPE_TRANSLIT_TO_IDX
,
331 _NL_CTYPE_TRANSLIT_TO_TBL
,
332 _NL_CTYPE_TRANSLIT_DEFAULT_MISSING_LEN
,
333 _NL_CTYPE_TRANSLIT_DEFAULT_MISSING
,
334 _NL_CTYPE_TRANSLIT_IGNORE_LEN
,
335 _NL_CTYPE_TRANSLIT_IGNORE
,
336 _NL_CTYPE_MAP_TO_NONASCII
,
337 _NL_CTYPE_EXTRA_MAP_1
,
338 _NL_CTYPE_EXTRA_MAP_2
,
339 _NL_CTYPE_EXTRA_MAP_3
,
340 _NL_CTYPE_EXTRA_MAP_4
,
341 _NL_CTYPE_EXTRA_MAP_5
,
342 _NL_CTYPE_EXTRA_MAP_6
,
343 _NL_CTYPE_EXTRA_MAP_7
,
344 _NL_CTYPE_EXTRA_MAP_8
,
345 _NL_CTYPE_EXTRA_MAP_9
,
346 _NL_CTYPE_EXTRA_MAP_10
,
347 _NL_CTYPE_EXTRA_MAP_11
,
348 _NL_CTYPE_EXTRA_MAP_12
,
349 _NL_CTYPE_EXTRA_MAP_13
,
350 _NL_CTYPE_EXTRA_MAP_14
,
353 /* LC_MONETARY category: formatting of monetary quantities.
354 These items each correspond to a member of `struct lconv',
355 defined in <locale.h>. */
356 __INT_CURR_SYMBOL
= _NL_ITEM (__LC_MONETARY
, 0),
358 # define INT_CURR_SYMBOL __INT_CURR_SYMBOL
362 # define CURRENCY_SYMBOL __CURRENCY_SYMBOL
366 # define MON_DECIMAL_POINT __MON_DECIMAL_POINT
370 # define MON_THOUSANDS_SEP __MON_THOUSANDS_SEP
374 # define MON_GROUPING __MON_GROUPING
378 # define POSITIVE_SIGN __POSITIVE_SIGN
382 # define NEGATIVE_SIGN __NEGATIVE_SIGN
386 # define INT_FRAC_DIGITS __INT_FRAC_DIGITS
390 # define FRAC_DIGITS __FRAC_DIGITS
394 # define P_CS_PRECEDES __P_CS_PRECEDES
398 # define P_SEP_BY_SPACE __P_SEP_BY_SPACE
402 # define N_CS_PRECEDES __N_CS_PRECEDES
406 # define N_SEP_BY_SPACE __N_SEP_BY_SPACE
410 # define P_SIGN_POSN __P_SIGN_POSN
414 # define N_SIGN_POSN __N_SIGN_POSN
416 _NL_MONETARY_CRNCYSTR
,
417 #define CRNCYSTR _NL_MONETARY_CRNCYSTR
420 # define INT_P_CS_PRECEDES __INT_P_CS_PRECEDES
422 __INT_P_SEP_BY_SPACE
,
424 # define INT_P_SEP_BY_SPACE __INT_P_SEP_BY_SPACE
428 # define INT_N_CS_PRECEDES __INT_N_CS_PRECEDES
430 __INT_N_SEP_BY_SPACE
,
432 # define INT_N_SEP_BY_SPACE __INT_N_SEP_BY_SPACE
436 # define INT_P_SIGN_POSN __INT_P_SIGN_POSN
440 # define INT_N_SIGN_POSN __INT_N_SIGN_POSN
442 _NL_MONETARY_DUO_INT_CURR_SYMBOL
,
443 _NL_MONETARY_DUO_CURRENCY_SYMBOL
,
444 _NL_MONETARY_DUO_INT_FRAC_DIGITS
,
445 _NL_MONETARY_DUO_FRAC_DIGITS
,
446 _NL_MONETARY_DUO_P_CS_PRECEDES
,
447 _NL_MONETARY_DUO_P_SEP_BY_SPACE
,
448 _NL_MONETARY_DUO_N_CS_PRECEDES
,
449 _NL_MONETARY_DUO_N_SEP_BY_SPACE
,
450 _NL_MONETARY_DUO_INT_P_CS_PRECEDES
,
451 _NL_MONETARY_DUO_INT_P_SEP_BY_SPACE
,
452 _NL_MONETARY_DUO_INT_N_CS_PRECEDES
,
453 _NL_MONETARY_DUO_INT_N_SEP_BY_SPACE
,
454 _NL_MONETARY_DUO_P_SIGN_POSN
,
455 _NL_MONETARY_DUO_N_SIGN_POSN
,
456 _NL_MONETARY_DUO_INT_P_SIGN_POSN
,
457 _NL_MONETARY_DUO_INT_N_SIGN_POSN
,
458 _NL_MONETARY_UNO_VALID_FROM
,
459 _NL_MONETARY_UNO_VALID_TO
,
460 _NL_MONETARY_DUO_VALID_FROM
,
461 _NL_MONETARY_DUO_VALID_TO
,
462 _NL_MONETARY_CONVERSION_RATE
,
463 _NL_MONETARY_DECIMAL_POINT_WC
,
464 _NL_MONETARY_THOUSANDS_SEP_WC
,
465 _NL_MONETARY_CODESET
,
468 /* LC_NUMERIC category: formatting of numbers.
469 These also correspond to members of `struct lconv'; see <locale.h>. */
470 __DECIMAL_POINT
= _NL_ITEM (__LC_NUMERIC
, 0),
472 # define DECIMAL_POINT __DECIMAL_POINT
474 RADIXCHAR
= __DECIMAL_POINT
,
475 #define RADIXCHAR RADIXCHAR
478 # define THOUSANDS_SEP __THOUSANDS_SEP
480 THOUSEP
= __THOUSANDS_SEP
,
481 #define THOUSEP THOUSEP
484 # define GROUPING __GROUPING
486 _NL_NUMERIC_DECIMAL_POINT_WC
,
487 _NL_NUMERIC_THOUSANDS_SEP_WC
,
491 __YESEXPR
= _NL_ITEM (__LC_MESSAGES
, 0), /* Regex matching ``yes'' input. */
492 #define YESEXPR __YESEXPR
493 __NOEXPR
, /* Regex matching ``no'' input. */
494 #define NOEXPR __NOEXPR
495 __YESSTR
, /* Output string for ``yes''. */
496 #if defined __USE_GNU || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
497 # define YESSTR __YESSTR
499 __NOSTR
, /* Output string for ``no''. */
500 #if defined __USE_GNU || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
501 # define NOSTR __NOSTR
503 _NL_MESSAGES_CODESET
,
506 _NL_PAPER_HEIGHT
= _NL_ITEM (__LC_PAPER
, 0),
511 _NL_NAME_NAME_FMT
= _NL_ITEM (__LC_NAME
, 0),
520 _NL_ADDRESS_POSTAL_FMT
= _NL_ITEM (__LC_ADDRESS
, 0),
521 _NL_ADDRESS_COUNTRY_NAME
,
522 _NL_ADDRESS_COUNTRY_POST
,
523 _NL_ADDRESS_COUNTRY_AB2
,
524 _NL_ADDRESS_COUNTRY_AB3
,
525 _NL_ADDRESS_COUNTRY_CAR
,
526 _NL_ADDRESS_COUNTRY_NUM
,
527 _NL_ADDRESS_COUNTRY_ISBN
,
528 _NL_ADDRESS_LANG_NAME
,
530 _NL_ADDRESS_LANG_TERM
,
531 _NL_ADDRESS_LANG_LIB
,
535 _NL_TELEPHONE_TEL_INT_FMT
= _NL_ITEM (__LC_TELEPHONE
, 0),
536 _NL_TELEPHONE_TEL_DOM_FMT
,
537 _NL_TELEPHONE_INT_SELECT
,
538 _NL_TELEPHONE_INT_PREFIX
,
539 _NL_TELEPHONE_CODESET
,
540 _NL_NUM_LC_TELEPHONE
,
542 _NL_MEASUREMENT_MEASUREMENT
= _NL_ITEM (__LC_MEASUREMENT
, 0),
543 _NL_MEASUREMENT_CODESET
,
544 _NL_NUM_LC_MEASUREMENT
,
546 _NL_IDENTIFICATION_TITLE
= _NL_ITEM (__LC_IDENTIFICATION
, 0),
547 _NL_IDENTIFICATION_SOURCE
,
548 _NL_IDENTIFICATION_ADDRESS
,
549 _NL_IDENTIFICATION_CONTACT
,
550 _NL_IDENTIFICATION_EMAIL
,
551 _NL_IDENTIFICATION_TEL
,
552 _NL_IDENTIFICATION_FAX
,
553 _NL_IDENTIFICATION_LANGUAGE
,
554 _NL_IDENTIFICATION_TERRITORY
,
555 _NL_IDENTIFICATION_AUDIENCE
,
556 _NL_IDENTIFICATION_APPLICATION
,
557 _NL_IDENTIFICATION_ABBREVIATION
,
558 _NL_IDENTIFICATION_REVISION
,
559 _NL_IDENTIFICATION_DATE
,
560 _NL_IDENTIFICATION_CATEGORY
,
561 _NL_IDENTIFICATION_CODESET
,
562 _NL_NUM_LC_IDENTIFICATION
,
564 /* This marks the highest value used. */
568 /* This macro produces an item you can pass to `nl_langinfo' or
569 `nl_langinfo_l' to get the name of the locale in use for CATEGORY. */
570 #define _NL_LOCALE_NAME(category) _NL_ITEM ((category), -1)
572 # define NL_LOCALE_NAME(category) _NL_LOCALE_NAME (category)
576 /* Return the current locale's value for ITEM.
577 If ITEM is invalid, an empty string is returned.
579 The string returned will not change until `setlocale' is called;
580 it is usually in read-only memory and cannot be modified. */
582 extern char *nl_langinfo (nl_item __item
) __THROW
;
586 /* This interface is for the extended locale model. See <locale.h> for
589 /* Get locale datatype definition. */
590 # include <xlocale.h>
592 /* Just like nl_langinfo but get the information from the locale object L. */
593 extern char *nl_langinfo_l (nl_item __item
, __locale_t l
);
598 #endif /* langinfo.h */