xref: /netbsd-src/include/locale.h (revision 5d4506330815e0994570364945f6a4d6c1ce93de)
1*5d450633Sjoerg /*	$NetBSD: locale.h,v 1.28 2016/04/29 16:26:48 joerg Exp $	*/
24d2cbfceScgd 
361f28255Scgd /*
4b7b7322cSperry  * Copyright (c) 1991, 1993
5b7b7322cSperry  *	The Regents of the University of California.  All rights reserved.
661f28255Scgd  *
761f28255Scgd  * Redistribution and use in source and binary forms, with or without
861f28255Scgd  * modification, are permitted provided that the following conditions
961f28255Scgd  * are met:
1061f28255Scgd  * 1. Redistributions of source code must retain the above copyright
1161f28255Scgd  *    notice, this list of conditions and the following disclaimer.
1261f28255Scgd  * 2. Redistributions in binary form must reproduce the above copyright
1361f28255Scgd  *    notice, this list of conditions and the following disclaimer in the
1461f28255Scgd  *    documentation and/or other materials provided with the distribution.
15039cc956Sagc  * 3. Neither the name of the University nor the names of its contributors
1661f28255Scgd  *    may be used to endorse or promote products derived from this software
1761f28255Scgd  *    without specific prior written permission.
1861f28255Scgd  *
1961f28255Scgd  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2061f28255Scgd  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2161f28255Scgd  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2261f28255Scgd  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2361f28255Scgd  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2461f28255Scgd  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2561f28255Scgd  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2661f28255Scgd  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2761f28255Scgd  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2861f28255Scgd  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2961f28255Scgd  * SUCH DAMAGE.
3061f28255Scgd  *
31b7b7322cSperry  *	@(#)locale.h	8.1 (Berkeley) 6/2/93
3261f28255Scgd  */
3361f28255Scgd 
3461f28255Scgd #ifndef _LOCALE_H_
3561f28255Scgd #define _LOCALE_H_
3661f28255Scgd 
37e8c1e0eeSjoerg #include <sys/featuretest.h>
38e8c1e0eeSjoerg 
3961f28255Scgd struct lconv {
4061f28255Scgd 	char	*decimal_point;
4161f28255Scgd 	char	*thousands_sep;
4261f28255Scgd 	char	*grouping;
4361f28255Scgd 	char	*int_curr_symbol;
4461f28255Scgd 	char	*currency_symbol;
4561f28255Scgd 	char	*mon_decimal_point;
4661f28255Scgd 	char	*mon_thousands_sep;
4761f28255Scgd 	char	*mon_grouping;
4861f28255Scgd 	char	*positive_sign;
4961f28255Scgd 	char	*negative_sign;
5061f28255Scgd 	char	int_frac_digits;
5161f28255Scgd 	char	frac_digits;
5261f28255Scgd 	char	p_cs_precedes;
5361f28255Scgd 	char	p_sep_by_space;
5461f28255Scgd 	char	n_cs_precedes;
5561f28255Scgd 	char	n_sep_by_space;
5661f28255Scgd 	char	p_sign_posn;
5761f28255Scgd 	char	n_sign_posn;
5820a43da1Skleink 	char	int_p_cs_precedes;
5920a43da1Skleink 	char	int_n_cs_precedes;
6020a43da1Skleink 	char	int_p_sep_by_space;
6120a43da1Skleink 	char	int_n_sep_by_space;
6220a43da1Skleink 	char	int_p_sign_posn;
6320a43da1Skleink 	char	int_n_sign_posn;
6461f28255Scgd };
6561f28255Scgd 
666f29805eSkleink #include <sys/null.h>
6761f28255Scgd 
6861f28255Scgd #define	LC_ALL		0
6961f28255Scgd #define	LC_COLLATE	1
7061f28255Scgd #define	LC_CTYPE	2
7161f28255Scgd #define	LC_MONETARY	3
7261f28255Scgd #define	LC_NUMERIC	4
7361f28255Scgd #define	LC_TIME		5
7487edfb66Sjtc #define LC_MESSAGES	6
7561f28255Scgd 
7687edfb66Sjtc #define	_LC_LAST	7		/* marks end */
7761f28255Scgd 
7861f28255Scgd #include <sys/cdefs.h>
7961f28255Scgd 
806ffcdd8dSjoerg #if (_POSIX_C_SOURCE - 0) >= 200809L || defined(_NETBSD_SOURCE) || \
816ffcdd8dSjoerg     defined(__SETLOCALE_SOURCE__)
826ffcdd8dSjoerg #  ifndef __LOCALE_T_DECLARED
836ffcdd8dSjoerg typedef struct _locale		*locale_t;
846ffcdd8dSjoerg #  define __LOCALE_T_DECLARED
856ffcdd8dSjoerg #  endif
866ffcdd8dSjoerg #endif
876ffcdd8dSjoerg 
8861f28255Scgd __BEGIN_DECLS
8919b7469aSperry struct lconv *localeconv(void);
909efec5bcStnozaki char *setlocale(int, const char *) __RENAME(__setlocale50);
916ffcdd8dSjoerg 
926ffcdd8dSjoerg #if (_POSIX_C_SOURCE - 0) >= 200809L || defined(_NETBSD_SOURCE)
936ffcdd8dSjoerg #  ifndef __LOCALE_T_DECLARED
946ffcdd8dSjoerg typedef struct _locale		*locale_t;
956ffcdd8dSjoerg #  define __LOCALE_T_DECLARED
966ffcdd8dSjoerg #  endif
9781d0329eSjoerg #define	LC_ALL_MASK		((int)~0)
9881d0329eSjoerg #define	LC_COLLATE_MASK		((int)(1 << LC_COLLATE))
9981d0329eSjoerg #define	LC_CTYPE_MASK		((int)(1 << LC_CTYPE))
10081d0329eSjoerg #define	LC_MONETARY_MASK	((int)(1 << LC_MONETARY))
10181d0329eSjoerg #define	LC_NUMERIC_MASK		((int)(1 << LC_NUMERIC))
10281d0329eSjoerg #define	LC_TIME_MASK		((int)(1 << LC_TIME))
10381d0329eSjoerg #define	LC_MESSAGES_MASK	((int)(1 << LC_MESSAGES))
10481d0329eSjoerg locale_t	duplocale(locale_t);
10581d0329eSjoerg void		freelocale(locale_t);
1066ffcdd8dSjoerg struct lconv	*localeconv_l(locale_t);
10781d0329eSjoerg locale_t	newlocale(int, const char *, locale_t);
108e0ac190eSjoerg 
109143f5307Schristos extern		       struct _locale	_lc_global_locale;
110e0ac190eSjoerg #define LC_GLOBAL_LOCALE	(&_lc_global_locale)
1112aac8b87Sjoerg #endif /* _POSIX_SOURCE >= 200809 || _NETBSD_SOURCE */
1122aac8b87Sjoerg 
1132aac8b87Sjoerg #if defined(_NETBSD_SOURCE)
114143f5307Schristos extern		       const struct _locale _lc_C_locale;
115e0ac190eSjoerg #define LC_C_LOCALE		((locale_t)__UNCONST(&_lc_C_locale))
1166ffcdd8dSjoerg #endif
11761f28255Scgd __END_DECLS
11861f28255Scgd 
11961f28255Scgd #endif /* _LOCALE_H_ */
120