Update.
[glibc.git] / locale / locale.h
blobc17babc33e722d119b012337027d9f8d303a1971
1 /* Copyright (C) 1991,92,1995-1999,2000,2001 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU C Library; see the file COPYING.LIB. If not,
16 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. */
20 * ISO C99 Standard: 7.11 Localization <locale.h>
23 #ifndef _LOCALE_H
24 #define _LOCALE_H 1
26 #include <features.h>
28 #define __need_NULL
29 #include <stddef.h>
30 #include <bits/locale.h>
32 __BEGIN_DECLS
34 /* These are the possibilities for the first argument to setlocale.
35 The code assumes that the lowest LC_* symbol has the value zero. */
36 #define LC_CTYPE __LC_CTYPE
37 #define LC_NUMERIC __LC_NUMERIC
38 #define LC_TIME __LC_TIME
39 #define LC_COLLATE __LC_COLLATE
40 #define LC_MONETARY __LC_MONETARY
41 #define LC_MESSAGES __LC_MESSAGES
42 #define LC_ALL __LC_ALL
43 #define LC_PAPER __LC_PAPER
44 #define LC_NAME __LC_NAME
45 #define LC_ADDRESS __LC_ADDRESS
46 #define LC_TELEPHONE __LC_TELEPHONE
47 #define LC_MEASUREMENT __LC_MEASUREMENT
48 #define LC_IDENTIFICATION __LC_IDENTIFICATION
51 /* Structure giving information about numeric and monetary notation. */
52 struct lconv
54 /* Numeric (non-monetary) information. */
56 char *decimal_point; /* Decimal point character. */
57 char *thousands_sep; /* Thousands separator. */
58 /* Each element is the number of digits in each group;
59 elements with higher indices are farther left.
60 An element with value CHAR_MAX means that no further grouping is done.
61 An element with value 0 means that the previous element is used
62 for all groups farther left. */
63 char *grouping;
65 /* Monetary information. */
67 /* First three chars are a currency symbol from ISO 4217.
68 Fourth char is the separator. Fifth char is '\0'. */
69 char *int_curr_symbol;
70 char *currency_symbol; /* Local currency symbol. */
71 char *mon_decimal_point; /* Decimal point character. */
72 char *mon_thousands_sep; /* Thousands separator. */
73 char *mon_grouping; /* Like `grouping' element (above). */
74 char *positive_sign; /* Sign for positive values. */
75 char *negative_sign; /* Sign for negative values. */
76 char int_frac_digits; /* Int'l fractional digits. */
77 char frac_digits; /* Local fractional digits. */
78 /* 1 if currency_symbol precedes a positive value, 0 if succeeds. */
79 char p_cs_precedes;
80 /* 1 iff a space separates currency_symbol from a positive value. */
81 char p_sep_by_space;
82 /* 1 if currency_symbol precedes a negative value, 0 if succeeds. */
83 char n_cs_precedes;
84 /* 1 iff a space separates currency_symbol from a negative value. */
85 char n_sep_by_space;
86 /* Positive and negative sign positions:
87 0 Parentheses surround the quantity and currency_symbol.
88 1 The sign string precedes the quantity and currency_symbol.
89 2 The sign string follows the quantity and currency_symbol.
90 3 The sign string immediately precedes the currency_symbol.
91 4 The sign string immediately follows the currency_symbol. */
92 char p_sign_posn;
93 char n_sign_posn;
94 #ifdef __USE_ISOC99
95 /* 1 if int_curr_symbol precedes a positive value, 0 if succeeds. */
96 char int_p_cs_precedes;
97 /* 1 iff a space separates int_curr_symbol from a positive value. */
98 char int_p_sep_by_space;
99 /* 1 if int_curr_symbol precedes a negative value, 0 if succeeds. */
100 char int_n_cs_precedes;
101 /* 1 iff a space separates int_curr_symbol from a negative value. */
102 char int_n_sep_by_space;
103 /* Positive and negative sign positions:
104 0 Parentheses surround the quantity and int_curr_symbol.
105 1 The sign string precedes the quantity and int_curr_symbol.
106 2 The sign string follows the quantity and int_curr_symbol.
107 3 The sign string immediately precedes the int_curr_symbol.
108 4 The sign string immediately follows the int_curr_symbol. */
109 char int_p_sign_posn;
110 char int_n_sign_posn;
111 #else
112 char __int_p_cs_precedes;
113 char __int_p_sep_by_space;
114 char __int_n_cs_precedes;
115 char __int_n_sep_by_space;
116 char __int_p_sign_posn;
117 char __int_n_sign_posn;
118 #endif
122 /* Set and/or return the current locale. */
123 extern char *setlocale (int __category, __const char *__locale) __THROW;
125 /* Return the numeric/monetary information for the current locale. */
126 extern struct lconv *localeconv (void) __THROW;
128 #ifdef __USE_GNU
129 /* The concept of one static locale per category is not very well
130 thought out. Many applications will need to process its data using
131 information from several different locales. Another application is
132 the implementation of the internationalization handling in the
133 upcoming ISO C++ standard library. To support this another set of
134 the functions using locale data exist which have an additional
135 argument.
137 Attention: all these functions are *not* standardized in any form.
138 This is a proof-of-concept implementation. */
140 /* Get locale datatype definition. */
141 # include <xlocale.h>
143 /* Return a reference to a data structure representing a set of locale
144 datasets. Unlike for the CATEGORY parameter for `setlocale' the
145 CATEGORY_MASK parameter here uses a single bit for each category.
146 I.e., 1 << LC_CTYPE means to load data for this category. If
147 BASE is non-null the appropriate category information in the BASE
148 record is replaced. */
149 extern __locale_t __newlocale (int __category_mask, __const char *__locale,
150 __locale_t __base) __THROW;
152 /* Return a duplicate of the set of locale in DATASET. All usage
153 counters are increased if necessary. */
154 extern __locale_t __duplocale (__locale_t __dataset) __THROW;
156 /* Free the data associated with a locale dataset previously returned
157 by a call to `setlocale_r'. */
158 extern void __freelocale (__locale_t __dataset) __THROW;
159 #endif
161 __END_DECLS
163 #endif /* locale.h */