xref: /titanic_50/usr/src/head/locale.h (revision ba3594ba9b5dd4c846c472a8d657edcb7c8109ac)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
217c478bd9Sstevel@tonic-gate  */
227c478bd9Sstevel@tonic-gate /*
237c478bd9Sstevel@tonic-gate  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
272d08521bSGarrett D'Amore /*
28*ba3594baSGarrett D'Amore  * Copyright 2014 Garrett D'Amore <garrett@damore.org>
292d08521bSGarrett D'Amore  *
302d08521bSGarrett D'Amore  * Portions of this file developed by Garrett D'Amore are licensed
312d08521bSGarrett D'Amore  * under the terms of the Common Development and Distribution License (CDDL)
322d08521bSGarrett D'Amore  * version 1.0 only.  The use of subsequent versions of the License are
332d08521bSGarrett D'Amore  * is specifically prohibited unless those terms are not in conflict with
342d08521bSGarrett D'Amore  * version 1.0 of the License.  You can find this license on-line at
352d08521bSGarrett D'Amore  * http://www.illumos.org/license/CDDL
362d08521bSGarrett D'Amore  */
372d08521bSGarrett D'Amore 
387c478bd9Sstevel@tonic-gate #ifndef _LOCALE_H
397c478bd9Sstevel@tonic-gate #define	_LOCALE_H
407c478bd9Sstevel@tonic-gate 
417c478bd9Sstevel@tonic-gate #include <iso/locale_iso.h>
427c478bd9Sstevel@tonic-gate 
437c478bd9Sstevel@tonic-gate #if (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
447c478bd9Sstevel@tonic-gate 	defined(__EXTENSIONS__)
457c478bd9Sstevel@tonic-gate #include <libintl.h>
467c478bd9Sstevel@tonic-gate #endif
477c478bd9Sstevel@tonic-gate 
487c478bd9Sstevel@tonic-gate /*
497c478bd9Sstevel@tonic-gate  * Allow global visibility for symbols defined in
507c478bd9Sstevel@tonic-gate  * C++ "std" namespace in <iso/locale_iso.h>.
517c478bd9Sstevel@tonic-gate  */
527c478bd9Sstevel@tonic-gate #if __cplusplus >= 199711L
537c478bd9Sstevel@tonic-gate using std::lconv;
547c478bd9Sstevel@tonic-gate using std::setlocale;
557c478bd9Sstevel@tonic-gate using std::localeconv;
567c478bd9Sstevel@tonic-gate #endif
577c478bd9Sstevel@tonic-gate 
587c478bd9Sstevel@tonic-gate #ifdef __cplusplus
597c478bd9Sstevel@tonic-gate extern "C" {
607c478bd9Sstevel@tonic-gate #endif
617c478bd9Sstevel@tonic-gate 
627c478bd9Sstevel@tonic-gate #define	_LastCategory	LC_MESSAGES	/* This must be last category */
637c478bd9Sstevel@tonic-gate 
647c478bd9Sstevel@tonic-gate #define	_ValidCategory(c) \
657c478bd9Sstevel@tonic-gate 	(((int)(c) >= LC_CTYPE) && ((int)(c) <= _LastCategory) || \
667c478bd9Sstevel@tonic-gate 	((int)c == LC_ALL))
677c478bd9Sstevel@tonic-gate 
682d08521bSGarrett D'Amore 
692d08521bSGarrett D'Amore #if defined(_XPG7) || !defined(_STRICT_SYMBOLS)
702d08521bSGarrett D'Amore 
712d08521bSGarrett D'Amore /*
722d08521bSGarrett D'Amore  * These were added in POSIX 2008 as part of the newlocale() specification.
732d08521bSGarrett D'Amore  */
742d08521bSGarrett D'Amore #define	LC_CTYPE_MASK		(1 << LC_CTYPE)
752d08521bSGarrett D'Amore #define	LC_NUMERIC_MASK		(1 << LC_NUMERIC)
762d08521bSGarrett D'Amore #define	LC_TIME_MASK		(1 << LC_TIME)
772d08521bSGarrett D'Amore #define	LC_COLLATE_MASK		(1 << LC_COLLATE)
782d08521bSGarrett D'Amore #define	LC_MONETARY_MASK	(1 << LC_MONETARY)
792d08521bSGarrett D'Amore #define	LC_MESSAGES_MASK	(1 << LC_MESSAGES)
802d08521bSGarrett D'Amore #define	LC_ALL_MASK		(0x3f)
812d08521bSGarrett D'Amore 
822d08521bSGarrett D'Amore #ifndef _LOCALE_T
832d08521bSGarrett D'Amore #define	_LOCALE_T
84732efd55SDan McDonald typedef struct _locale *locale_t;
852d08521bSGarrett D'Amore #endif
862d08521bSGarrett D'Amore 
872d08521bSGarrett D'Amore extern locale_t	duplocale(locale_t);
882d08521bSGarrett D'Amore extern void	freelocale(locale_t);
892d08521bSGarrett D'Amore extern locale_t	newlocale(int, const char *, locale_t);
902d08521bSGarrett D'Amore extern locale_t	uselocale(locale_t);
912d08521bSGarrett D'Amore 
922d08521bSGarrett D'Amore #define	LC_GLOBAL_LOCALE	(__global_locale())
932d08521bSGarrett D'Amore extern locale_t			__global_locale(void);
942d08521bSGarrett D'Amore 
952d08521bSGarrett D'Amore #endif	/* defined(_XPG7) || !defined(_STRICT_SYMBOLS) */
962d08521bSGarrett D'Amore 
977c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
987c478bd9Sstevel@tonic-gate }
997c478bd9Sstevel@tonic-gate #endif
1007c478bd9Sstevel@tonic-gate 
1017c478bd9Sstevel@tonic-gate #endif	/* _LOCALE_H */
102