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