xref: /minix3/include/locale.h (revision 84d9c625bfea59e274550651111ae9edfdc40fbd)
1*84d9c625SLionel Sambuc /*	$NetBSD: locale.h,v 1.24 2013/05/17 14:11:55 joerg Exp $	*/
22fe8fb19SBen Gras 
32fe8fb19SBen Gras /*
42fe8fb19SBen Gras  * Copyright (c) 1991, 1993
52fe8fb19SBen Gras  *	The Regents of the University of California.  All rights reserved.
62fe8fb19SBen Gras  *
72fe8fb19SBen Gras  * Redistribution and use in source and binary forms, with or without
82fe8fb19SBen Gras  * modification, are permitted provided that the following conditions
92fe8fb19SBen Gras  * are met:
102fe8fb19SBen Gras  * 1. Redistributions of source code must retain the above copyright
112fe8fb19SBen Gras  *    notice, this list of conditions and the following disclaimer.
122fe8fb19SBen Gras  * 2. Redistributions in binary form must reproduce the above copyright
132fe8fb19SBen Gras  *    notice, this list of conditions and the following disclaimer in the
142fe8fb19SBen Gras  *    documentation and/or other materials provided with the distribution.
152fe8fb19SBen Gras  * 3. Neither the name of the University nor the names of its contributors
162fe8fb19SBen Gras  *    may be used to endorse or promote products derived from this software
172fe8fb19SBen Gras  *    without specific prior written permission.
182fe8fb19SBen Gras  *
192fe8fb19SBen Gras  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
202fe8fb19SBen Gras  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
212fe8fb19SBen Gras  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
222fe8fb19SBen Gras  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
232fe8fb19SBen Gras  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
242fe8fb19SBen Gras  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
252fe8fb19SBen Gras  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
262fe8fb19SBen Gras  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
272fe8fb19SBen Gras  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
282fe8fb19SBen Gras  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
292fe8fb19SBen Gras  * SUCH DAMAGE.
302fe8fb19SBen Gras  *
312fe8fb19SBen Gras  *	@(#)locale.h	8.1 (Berkeley) 6/2/93
329865aeaaSBen Gras  */
339865aeaaSBen Gras 
342fe8fb19SBen Gras #ifndef _LOCALE_H_
352fe8fb19SBen Gras #define _LOCALE_H_
369865aeaaSBen Gras 
37*84d9c625SLionel Sambuc #include <sys/featuretest.h>
38*84d9c625SLionel Sambuc 
399865aeaaSBen Gras struct lconv {
402fe8fb19SBen Gras 	char	*decimal_point;
412fe8fb19SBen Gras 	char	*thousands_sep;
422fe8fb19SBen Gras 	char	*grouping;
432fe8fb19SBen Gras 	char	*int_curr_symbol;
442fe8fb19SBen Gras 	char	*currency_symbol;
452fe8fb19SBen Gras 	char	*mon_decimal_point;
462fe8fb19SBen Gras 	char	*mon_thousands_sep;
472fe8fb19SBen Gras 	char	*mon_grouping;
482fe8fb19SBen Gras 	char	*positive_sign;
492fe8fb19SBen Gras 	char	*negative_sign;
502fe8fb19SBen Gras 	char	int_frac_digits;
512fe8fb19SBen Gras 	char	frac_digits;
522fe8fb19SBen Gras 	char	p_cs_precedes;
532fe8fb19SBen Gras 	char	p_sep_by_space;
542fe8fb19SBen Gras 	char	n_cs_precedes;
552fe8fb19SBen Gras 	char	n_sep_by_space;
562fe8fb19SBen Gras 	char	p_sign_posn;
572fe8fb19SBen Gras 	char	n_sign_posn;
582fe8fb19SBen Gras 	char	int_p_cs_precedes;
592fe8fb19SBen Gras 	char	int_n_cs_precedes;
602fe8fb19SBen Gras 	char	int_p_sep_by_space;
612fe8fb19SBen Gras 	char	int_n_sep_by_space;
622fe8fb19SBen Gras 	char	int_p_sign_posn;
632fe8fb19SBen Gras 	char	int_n_sign_posn;
649865aeaaSBen Gras };
659865aeaaSBen Gras 
66dbde088dSArun Thomas #include <sys/null.h>
679865aeaaSBen Gras 
682fe8fb19SBen Gras #define	LC_ALL		0
692fe8fb19SBen Gras #define	LC_COLLATE	1
702fe8fb19SBen Gras #define	LC_CTYPE	2
712fe8fb19SBen Gras #define	LC_MONETARY	3
722fe8fb19SBen Gras #define	LC_NUMERIC	4
732fe8fb19SBen Gras #define	LC_TIME		5
742fe8fb19SBen Gras #define LC_MESSAGES	6
759865aeaaSBen Gras 
762fe8fb19SBen Gras #define	_LC_LAST	7		/* marks end */
779865aeaaSBen Gras 
782fe8fb19SBen Gras #include <sys/cdefs.h>
792fe8fb19SBen Gras 
80*84d9c625SLionel Sambuc #if (_POSIX_C_SOURCE - 0) >= 200809L || defined(_NETBSD_SOURCE) || \
81*84d9c625SLionel Sambuc     defined(__SETLOCALE_SOURCE__)
82*84d9c625SLionel Sambuc #  ifndef __LOCALE_T_DECLARED
83*84d9c625SLionel Sambuc typedef struct _locale		*locale_t;
84*84d9c625SLionel Sambuc #  define __LOCALE_T_DECLARED
85*84d9c625SLionel Sambuc #  endif
862fe8fb19SBen Gras #endif
872fe8fb19SBen Gras 
882fe8fb19SBen Gras __BEGIN_DECLS
892fe8fb19SBen Gras struct lconv *localeconv(void);
902fe8fb19SBen Gras char *setlocale(int, const char *) __RENAME(__setlocale50);
91*84d9c625SLionel Sambuc 
92*84d9c625SLionel Sambuc #if (_POSIX_C_SOURCE - 0) >= 200809L || defined(_NETBSD_SOURCE)
93*84d9c625SLionel Sambuc #  ifndef __LOCALE_T_DECLARED
94*84d9c625SLionel Sambuc typedef struct _locale		*locale_t;
95*84d9c625SLionel Sambuc #  define __LOCALE_T_DECLARED
96*84d9c625SLionel Sambuc #  endif
97*84d9c625SLionel Sambuc #define	LC_ALL_MASK		((int)~0)
98*84d9c625SLionel Sambuc #define	LC_COLLATE_MASK		((int)(1 << LC_COLLATE))
99*84d9c625SLionel Sambuc #define	LC_CTYPE_MASK		((int)(1 << LC_CTYPE))
100*84d9c625SLionel Sambuc #define	LC_MONETARY_MASK	((int)(1 << LC_MONETARY))
101*84d9c625SLionel Sambuc #define	LC_NUMERIC_MASK		((int)(1 << LC_NUMERIC))
102*84d9c625SLionel Sambuc #define	LC_TIME_MASK		((int)(1 << LC_TIME))
103*84d9c625SLionel Sambuc #define	LC_MESSAGES_MASK	((int)(1 << LC_MESSAGES))
104*84d9c625SLionel Sambuc locale_t	duplocale(locale_t);
105*84d9c625SLionel Sambuc void		freelocale(locale_t);
106*84d9c625SLionel Sambuc struct lconv	*localeconv_l(locale_t);
107*84d9c625SLionel Sambuc locale_t	newlocale(int, const char *, locale_t);
108*84d9c625SLionel Sambuc 
109*84d9c625SLionel Sambuc #ifndef _LIBC
110*84d9c625SLionel Sambuc extern struct _locale	_lc_global_locale;
111*84d9c625SLionel Sambuc #else
112*84d9c625SLionel Sambuc extern __dso_protected struct _locale	_lc_global_locale;
113*84d9c625SLionel Sambuc #endif
114*84d9c625SLionel Sambuc #define LC_GLOBAL_LOCALE	(&_lc_global_locale)
115*84d9c625SLionel Sambuc #endif /* _POSIX_SOURCE >= 200809 || _NETBSD_SOURCE */
116*84d9c625SLionel Sambuc 
117*84d9c625SLionel Sambuc #if defined(_NETBSD_SOURCE)
118*84d9c625SLionel Sambuc #  ifndef _LIBC
119*84d9c625SLionel Sambuc extern const struct _locale _lc_C_locale;
120*84d9c625SLionel Sambuc #  else
121*84d9c625SLionel Sambuc extern __dso_protected const struct _locale _lc_C_locale;
122*84d9c625SLionel Sambuc #  endif
123*84d9c625SLionel Sambuc #define LC_C_LOCALE		((locale_t)__UNCONST(&_lc_C_locale))
124*84d9c625SLionel Sambuc #endif
1252fe8fb19SBen Gras __END_DECLS
1262fe8fb19SBen Gras 
1272fe8fb19SBen Gras #endif /* _LOCALE_H_ */
128