April 2024 | ||||||
Mo | Tu | We | Th | Fr | Sa | Su |
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 1 | 2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 |
001: /* Copyright (C) 1991,1992,1995-2002,2007,2009 Free Software Foundation, Inc. 002: This file is part of the GNU C Library. 003: 004: The GNU C Library is free software; you can redistribute it and/or 005: modify it under the terms of the GNU Lesser General Public 006: License as published by the Free Software Foundation; either 007: version 2.1 of the License, or (at your option) any later version. 008: 009: The GNU C Library is distributed in the hope that it will be useful, 010: but WITHOUT ANY WARRANTY; without even the implied warranty of 011: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 012: Lesser General Public License for more details. 013: 014: You should have received a copy of the GNU Lesser General Public 015: License along with the GNU C Library; if not, write to the Free 016: Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 017: 02111-1307 USA. */ 018: 019: /* 020: * ISO C99 Standard: 7.11 Localization <locale.h> 021: */ 022: 023: #ifndef _LOCALE_H 024: #define _LOCALE_H 1 025: 026: #include <features.h> 027: 028: #define __need_NULL 029: #include <stddef.h> 030: #include <bits/locale.h> 031: 032: __BEGIN_DECLS 033: 034: /* These are the possibilities for the first argument to setlocale. 035: The code assumes that the lowest LC_* symbol has the value zero. */ 036: #define LC_CTYPE __LC_CTYPE 037: #define LC_NUMERIC __LC_NUMERIC 038: #define LC_TIME __LC_TIME 039: #define LC_COLLATE __LC_COLLATE 040: #define LC_MONETARY __LC_MONETARY 041: #define LC_MESSAGES __LC_MESSAGES 042: #define LC_ALL __LC_ALL 043: #define LC_PAPER __LC_PAPER 044: #define LC_NAME __LC_NAME 045: #define LC_ADDRESS __LC_ADDRESS 046: #define LC_TELEPHONE __LC_TELEPHONE 047: #define LC_MEASUREMENT __LC_MEASUREMENT 048: #define LC_IDENTIFICATION __LC_IDENTIFICATION 049: 050: 051: __BEGIN_NAMESPACE_STD 052: 053: /* Structure giving information about numeric and monetary notation. */ 054: struct lconv 055: { 056: /* Numeric (non-monetary) information. */ 057: 058: char *decimal_point; /* Decimal point character. */ 059: char *thousands_sep; /* Thousands separator. */ 060: /* Each element is the number of digits in each group; 061: elements with higher indices are farther left. 062: An element with value CHAR_MAX means that no further grouping is done. 063: An element with value 0 means that the previous element is used 064: for all groups farther left. */ 065: char *grouping; 066: 067: /* Monetary information. */ 068: 069: /* First three chars are a currency symbol from ISO 4217. 070: Fourth char is the separator. Fifth char is '\0'. */ 071: char *int_curr_symbol; 072: char *currency_symbol; /* Local currency symbol. */ 073: char *mon_decimal_point; /* Decimal point character. */ 074: char *mon_thousands_sep; /* Thousands separator. */ 075: char *mon_grouping; /* Like `grouping' element (above). */ 076: char *positive_sign; /* Sign for positive values. */ 077: char *negative_sign; /* Sign for negative values. */ 078: char int_frac_digits; /* Int'l fractional digits. */ 079: char frac_digits; /* Local fractional digits. */ 080: /* 1 if currency_symbol precedes a positive value, 0 if succeeds. */ 081: char p_cs_precedes; 082: /* 1 iff a space separates currency_symbol from a positive value. */ 083: char p_sep_by_space; 084: /* 1 if currency_symbol precedes a negative value, 0 if succeeds. */ 085: char n_cs_precedes; 086: /* 1 iff a space separates currency_symbol from a negative value. */ 087: char n_sep_by_space; 088: /* Positive and negative sign positions: 089: 0 Parentheses surround the quantity and currency_symbol. 090: 1 The sign string precedes the quantity and currency_symbol. 091: 2 The sign string follows the quantity and currency_symbol. 092: 3 The sign string immediately precedes the currency_symbol. 093: 4 The sign string immediately follows the currency_symbol. */ 094: char p_sign_posn; 095: char n_sign_posn; 096: #ifdef __USE_ISOC99 097: /* 1 if int_curr_symbol precedes a positive value, 0 if succeeds. */ 098: char int_p_cs_precedes; 099: /* 1 iff a space separates int_curr_symbol from a positive value. */ 100: char int_p_sep_by_space; 101: /* 1 if int_curr_symbol precedes a negative value, 0 if succeeds. */ 102: char int_n_cs_precedes; 103: /* 1 iff a space separates int_curr_symbol from a negative value. */ 104: char int_n_sep_by_space; 105: /* Positive and negative sign positions: 106: 0 Parentheses surround the quantity and int_curr_symbol. 107: 1 The sign string precedes the quantity and int_curr_symbol. 108: 2 The sign string follows the quantity and int_curr_symbol. 109: 3 The sign string immediately precedes the int_curr_symbol. 110: 4 The sign string immediately follows the int_curr_symbol. */ 111: char int_p_sign_posn; 112: char int_n_sign_posn; 113: #else 114: char __int_p_cs_precedes; 115: char __int_p_sep_by_space; 116: char __int_n_cs_precedes; 117: char __int_n_sep_by_space; 118: char __int_p_sign_posn; 119: char __int_n_sign_posn; 120: #endif 121: }; 122: 123: 124: /* Set and/or return the current locale. */ 125: extern char *setlocale (int __category, __const char *__locale) __THROW; 126: 127: /* Return the numeric/monetary information for the current locale. */ 128: extern struct lconv *localeconv (void) __THROW; 129: 130: __END_NAMESPACE_STD 131: 132: 133: #ifdef __USE_XOPEN2K8 134: /* The concept of one static locale per category is not very well 135: thought out. Many applications will need to process its data using 136: information from several different locales. Another application is 137: the implementation of the internationalization handling in the 138: upcoming ISO C++ standard library. To support this another set of 139: the functions using locale data exist which have an additional 140: argument. 141: 142: Attention: all these functions are *not* standardized in any form. 143: This is a proof-of-concept implementation. */ 144: 145: /* Get locale datatype definition. */ 146: # include <xlocale.h> 147: 148: /* Return a reference to a data structure representing a set of locale 149: datasets. Unlike for the CATEGORY parameter for `setlocale' the 150: CATEGORY_MASK parameter here uses a single bit for each category, 151: made by OR'ing together LC_*_MASK bits above. */ 152: extern __locale_t newlocale (int __category_mask, __const char *__locale, 153: __locale_t __base) __THROW; 154: 155: /* These are the bits that can be set in the CATEGORY_MASK argument to 156: `newlocale'. In the GNU implementation, LC_FOO_MASK has the value 157: of (1 << LC_FOO), but this is not a part of the interface that 158: callers can assume will be true. */ 159: # define LC_CTYPE_MASK (1 << __LC_CTYPE) 160: # define LC_NUMERIC_MASK (1 << __LC_NUMERIC) 161: # define LC_TIME_MASK (1 << __LC_TIME) 162: # define LC_COLLATE_MASK (1 << __LC_COLLATE) 163: # define LC_MONETARY_MASK (1 << __LC_MONETARY) 164: # define LC_MESSAGES_MASK (1 << __LC_MESSAGES) 165: # define LC_PAPER_MASK (1 << __LC_PAPER) 166: # define LC_NAME_MASK (1 << __LC_NAME) 167: # define LC_ADDRESS_MASK (1 << __LC_ADDRESS) 168: # define LC_TELEPHONE_MASK (1 << __LC_TELEPHONE) 169: # define LC_MEASUREMENT_MASK (1 << __LC_MEASUREMENT) 170: # define LC_IDENTIFICATION_MASK (1 << __LC_IDENTIFICATION) 171: # define LC_ALL_MASK (LC_CTYPE_MASK \ 172: | LC_NUMERIC_MASK \ 173: | LC_TIME_MASK \ 174: | LC_COLLATE_MASK \ 175: | LC_MONETARY_MASK \ 176: | LC_MESSAGES_MASK \ 177: | LC_PAPER_MASK \ 178: | LC_NAME_MASK \ 179: | LC_ADDRESS_MASK \ 180: | LC_TELEPHONE_MASK \ 181: | LC_MEASUREMENT_MASK \ 182: | LC_IDENTIFICATION_MASK \ 183: ) 184: 185: /* Return a duplicate of the set of locale in DATASET. All usage 186: counters are increased if necessary. */ 187: extern __locale_t duplocale (__locale_t __dataset) __THROW; 188: 189: /* Free the data associated with a locale dataset previously returned 190: by a call to `setlocale_r'. */ 191: extern void freelocale (__locale_t __dataset) __THROW; 192: 193: /* Switch the current thread's locale to DATASET. 194: If DATASET is null, instead just return the current setting. 195: The special value LC_GLOBAL_LOCALE is the initial setting 196: for all threads and can also be installed any time, meaning 197: the thread uses the global settings controlled by `setlocale'. */ 198: extern __locale_t uselocale (__locale_t __dataset) __THROW; 199: 200: /* This value can be passed to `uselocale' and may be returned by it. 201: Passing this value to any other function has undefined behavior. */ 202: # define LC_GLOBAL_LOCALE ((__locale_t) -1L) 203: 204: #endif 205: 206: __END_DECLS 207: 208: #endif /* locale.h */ 209: