Update.
[glibc.git] / locale / locale.h
blob5afa10c4dc64437929a8dce63eda8e86b904c3d1
1 /* Copyright (C) 1991,92,95,96,97,98,99,2000 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>
31 __BEGIN_DECLS
33 /* These are the possibilities for the first argument to setlocale.
34 The code assumes that the lowest LC_* symbol has the value zero. */
35 #define LC_CTYPE 0
36 #define LC_NUMERIC 1
37 #define LC_TIME 2
38 #define LC_COLLATE 3
39 #define LC_MONETARY 4
40 #define LC_MESSAGES 5
41 #define LC_ALL 6
42 #define LC_PAPER 7
43 #define LC_NAME 8
44 #define LC_ADDRESS 9
45 #define LC_TELEPHONE 10
46 #define LC_MEASUREMENT 11
47 #define LC_IDENTIFICATION 12
50 /* Structure giving information about numeric and monetary notation. */
51 struct lconv
53 /* Numeric (non-monetary) information. */
55 char *decimal_point; /* Decimal point character. */
56 char *thousands_sep; /* Thousands separator. */
57 /* Each element is the number of digits in each group;
58 elements with higher indices are farther left.
59 An element with value CHAR_MAX means that no further grouping is done.
60 An element with value 0 means that the previous element is used
61 for all groups farther left. */
62 char *grouping;
64 /* Monetary information. */
66 /* First three chars are a currency symbol from ISO 4217.
67 Fourth char is the separator. Fifth char is '\0'. */
68 char *int_curr_symbol;
69 char *currency_symbol; /* Local currency symbol. */
70 char *mon_decimal_point; /* Decimal point character. */
71 char *mon_thousands_sep; /* Thousands separator. */
72 char *mon_grouping; /* Like `grouping' element (above). */
73 char *positive_sign; /* Sign for positive values. */
74 char *negative_sign; /* Sign for negative values. */
75 char int_frac_digits; /* Int'l fractional digits. */
76 char frac_digits; /* Local fractional digits. */
77 /* 1 if currency_symbol precedes a positive value, 0 if succeeds. */
78 char p_cs_precedes;
79 /* 1 iff a space separates currency_symbol from a positive value. */
80 char p_sep_by_space;
81 /* 1 if currency_symbol precedes a negative value, 0 if succeeds. */
82 char n_cs_precedes;
83 /* 1 iff a space separates currency_symbol from a negative value. */
84 char n_sep_by_space;
85 /* Positive and negative sign positions:
86 0 Parentheses surround the quantity and currency_symbol.
87 1 The sign string precedes the quantity and currency_symbol.
88 2 The sign string follows the quantity and currency_symbol.
89 3 The sign string immediately precedes the currency_symbol.
90 4 The sign string immediately follows the currency_symbol. */
91 char p_sign_posn;
92 char n_sign_posn;
93 #ifdef __USE_ISOC99
94 /* 1 if int_curr_symbol precedes a positive value, 0 if succeeds. */
95 char int_p_cs_precedes;
96 /* 1 iff a space separates int_curr_symbol from a positive value. */
97 char int_p_sep_by_space;
98 /* 1 if int_curr_symbol precedes a negative value, 0 if succeeds. */
99 char int_n_cs_precedes;
100 /* 1 iff a space separates int_curr_symbol from a negative value. */
101 char int_n_sep_by_space;
102 /* Positive and negative sign positions:
103 0 Parentheses surround the quantity and int_curr_symbol.
104 1 The sign string precedes the quantity and int_curr_symbol.
105 2 The sign string follows the quantity and int_curr_symbol.
106 3 The sign string immediately precedes the int_curr_symbol.
107 4 The sign string immediately follows the int_curr_symbol. */
108 char int_p_sign_posn;
109 char int_n_sign_posn;
110 #else
111 char __int_p_cs_precedes;
112 char __int_p_sep_by_space;
113 char __int_n_cs_precedes;
114 char __int_n_sep_by_space;
115 char __int_p_sign_posn;
116 char __int_n_sign_posn;
117 #endif
121 /* Set and/or return the current locale. */
122 extern char *setlocale (int __category, __const char *__locale) __THROW;
124 /* Return the numeric/monetary information for the current locale. */
125 extern struct lconv *localeconv (void) __THROW;
127 #ifdef __USE_GNU
128 /* The concept of one static locale per category is not very well
129 thought out. Many applications will need to process its data using
130 information from several different locales. Another application is
131 the implementation of the internationalization handling in the
132 upcoming ISO C++ standard library. To support this another set of
133 the functions using locale data exist which have an additional
134 argument.
136 Attention: all these functions are *not* standardized in any form.
137 This is a proof-of-concept implementation. */
139 /* Get locale datatype definition. */
140 # include <xlocale.h>
142 /* Return a reference to a data structure representing a set of locale
143 datasets. Unlike for the CATEGORY parameter for `setlocale' the
144 CATEGORY_MASK parameter here uses a single bit for each category.
145 I.e., 1 << LC_CTYPE means to load data for this category. If
146 BASE is non-null the appropriate category information in the BASE
147 record is replaced. */
148 extern __locale_t __newlocale (int __category_mask, __const char *__locale,
149 __locale_t __base) __THROW;
151 /* Return a duplicate of the set of locale in DATASET. All usage
152 counters are increased if necessary. */
153 extern __locale_t __duplocale (__locale_t __dataset) __THROW;
155 /* Free the data associated with a locale dataset previously returned
156 by a call to `setlocale_r'. */
157 extern void __freelocale (__locale_t __dataset) __THROW;
158 #endif
160 __END_DECLS
162 #endif /* locale.h */