1/* Copyright (C) 1991,92,1995-1999,2000,2001 Free Software Foundation, Inc.
2   This file is part of the GNU C Library.
3
4   The GNU C Library is free software; you can redistribute it and/or
5   modify it under the terms of the GNU Lesser General Public
6   License as published by the Free Software Foundation; either
7   version 2.1 of the License, or (at your option) any later version.
8
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   Lesser General Public License for more details.
13
14   You should have received a copy of the GNU Lesser General Public
15   License along with the GNU C Library; if not, write to the Free
16   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17   02111-1307 USA.  */
18
19/*
20 *	ISO C99 Standard: 7.11 Localization	<locale.h>
21 */
22
23#ifndef	_LOCALE_H
24#define	_LOCALE_H	1
25
26#include <features.h>
27
28#define __need_NULL
29#include <stddef.h>
30#include <bits/locale.h>
31
32__BEGIN_DECLS
33
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
44
45/* Structure giving information about numeric and monetary notation.  */
46struct lconv
47{
48  /* Numeric (non-monetary) information.  */
49
50  char *decimal_point;		/* Decimal point character.  */
51  char *thousands_sep;		/* Thousands separator.  */
52  /* Each element is the number of digits in each group;
53     elements with higher indices are farther left.
54     An element with value CHAR_MAX means that no further grouping is done.
55     An element with value 0 means that the previous element is used
56     for all groups farther left.  */
57  char *grouping;
58
59  /* Monetary information.  */
60
61  /* First three chars are a currency symbol from ISO 4217.
62     Fourth char is the separator.  Fifth char is '\0'.  */
63  char *int_curr_symbol;
64  char *currency_symbol;	/* Local currency symbol.  */
65  char *mon_decimal_point;	/* Decimal point character.  */
66  char *mon_thousands_sep;	/* Thousands separator.  */
67  char *mon_grouping;		/* Like `grouping' element (above).  */
68  char *positive_sign;		/* Sign for positive values.  */
69  char *negative_sign;		/* Sign for negative values.  */
70  char int_frac_digits;		/* Int'l fractional digits.  */
71  char frac_digits;		/* Local fractional digits.  */
72  /* 1 if currency_symbol precedes a positive value, 0 if succeeds.  */
73  char p_cs_precedes;
74  /* 1 iff a space separates currency_symbol from a positive value.  */
75  char p_sep_by_space;
76  /* 1 if currency_symbol precedes a negative value, 0 if succeeds.  */
77  char n_cs_precedes;
78  /* 1 iff a space separates currency_symbol from a negative value.  */
79  char n_sep_by_space;
80  /* Positive and negative sign positions:
81     0 Parentheses surround the quantity and currency_symbol.
82     1 The sign string precedes the quantity and currency_symbol.
83     2 The sign string follows the quantity and currency_symbol.
84     3 The sign string immediately precedes the currency_symbol.
85     4 The sign string immediately follows the currency_symbol.  */
86  char p_sign_posn;
87  char n_sign_posn;
88#ifdef __USE_ISOC99
89  /* 1 if int_curr_symbol precedes a positive value, 0 if succeeds.  */
90  char int_p_cs_precedes;
91  /* 1 iff a space separates int_curr_symbol from a positive value.  */
92  char int_p_sep_by_space;
93  /* 1 if int_curr_symbol precedes a negative value, 0 if succeeds.  */
94  char int_n_cs_precedes;
95  /* 1 iff a space separates int_curr_symbol from a negative value.  */
96  char int_n_sep_by_space;
97  /* Positive and negative sign positions:
98     0 Parentheses surround the quantity and int_curr_symbol.
99     1 The sign string precedes the quantity and int_curr_symbol.
100     2 The sign string follows the quantity and int_curr_symbol.
101     3 The sign string immediately precedes the int_curr_symbol.
102     4 The sign string immediately follows the int_curr_symbol.  */
103  char int_p_sign_posn;
104  char int_n_sign_posn;
105#else
106  char __int_p_cs_precedes;
107  char __int_p_sep_by_space;
108  char __int_n_cs_precedes;
109  char __int_n_sep_by_space;
110  char __int_p_sign_posn;
111  char __int_n_sign_posn;
112#endif
113};
114
115
116/* Set and/or return the current locale.  */
117extern char *setlocale (int __category, __const char *__locale) __THROW;
118
119/* Return the numeric/monetary information for the current locale.  */
120extern struct lconv *localeconv (void) __THROW;
121
122#ifdef	__USE_GNU
123/* The concept of one static locale per category is not very well
124   thought out.  Many applications will need to process its data using
125   information from several different locales.  Another application is
126   the implementation of the internationalization handling in the
127   upcoming ISO C++ standard library.  To support this another set of
128   the functions using locale data exist which have an additional
129   argument.
130
131   Attention: all these functions are *not* standardized in any form.
132   This is a proof-of-concept implementation.  */
133
134/* Get locale datatype definition.  */
135# include <xlocale.h>
136
137/* Return a reference to a data structure representing a set of locale
138   datasets.  Unlike for the CATEGORY parameter for `setlocale' the
139   CATEGORY_MASK parameter here uses a single bit for each category.
140   I.e., 1 << LC_CTYPE means to load data for this category.  If
141   BASE is non-null the appropriate category information in the BASE
142   record is replaced.  */
143extern __locale_t __newlocale (int __category_mask, __const char *__locale,
144			       __locale_t __base) __THROW;
145
146/* Return a duplicate of the set of locale in DATASET.  All usage
147   counters are increased if necessary.  */
148extern __locale_t __duplocale (__locale_t __dataset) __THROW;
149
150/* Free the data associated with a locale dataset previously returned
151   by a call to `setlocale_r'.  */
152extern void __freelocale (__locale_t __dataset) __THROW;
153#endif
154
155__END_DECLS
156
157#endif /* locale.h  */
158