xref: /netbsd-src/external/cddl/osnet/dist/head/libintl.h (revision cef8759bd76c1b621f8eab8faa6f208faabc2e15)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2014 Garrett D'Amore <garrett@damore.org>
23  *
24  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
25  * Use is subject to license terms.
26  */
27 
28 
29 #ifndef	_LIBINTL_H
30 #define	_LIBINTL_H
31 
32 #ifdef __NetBSD__
33 
34 #define	textdomain(domain)	0
35 #define	gettext(...)		(__VA_ARGS__)
36 #define	dgettext(domain, ...)	(__VA_ARGS__)
37 
38 #else /* __NetBSD__ */
39 
40 #include <sys/isa_defs.h>
41 
42 #ifdef	__cplusplus
43 extern "C" {
44 #endif
45 
46 /*
47  * wchar_t is a built-in type in standard C++ and as such is not
48  * defined here when using standard C++. However, the GNU compiler
49  * fixincludes utility nonetheless creates its own version of this
50  * header for use by gcc and g++. In that version it adds a redundant
51  * guard for __cplusplus. To avoid the creation of a gcc/g++ specific
52  * header we need to include the following magic comment:
53  *
54  * we must use the C++ compiler's type
55  *
56  * The above comment should not be removed or changed until GNU
57  * gcc/fixinc/inclhack.def is updated to bypass this header.
58  */
59 #if !defined(__cplusplus) || (__cplusplus < 199711L && !defined(__GNUG__))
60 #ifndef _WCHAR_T
61 #define	_WCHAR_T
62 #if defined(_LP64)
63 typedef int	wchar_t;
64 #else
65 typedef long	wchar_t;
66 #endif
67 #endif	/* !_WCHAR_T */
68 #endif	/* !defined(__cplusplus) ... */
69 
70 #define	TEXTDOMAINMAX	256
71 
72 #define	__GNU_GETTEXT_SUPPORTED_REVISION(m)	\
73 	((((m) == 0) || ((m) == 1)) ? 1 : -1)
74 
75 extern char *dcgettext(const char *, const char *, const int);
76 extern char *dgettext(const char *, const char *);
77 extern char *gettext(const char *);
78 extern char *textdomain(const char *);
79 extern char *bindtextdomain(const char *, const char *);
80 
81 /*
82  * LI18NUX 2000 Globalization Specification Version 1.0
83  * with Amendment 2
84  */
85 extern char *dcngettext(const char *, const char *,
86 	const char *, unsigned long int, int);
87 extern char *dngettext(const char *, const char *,
88 	const char *, unsigned long int);
89 extern char *ngettext(const char *, const char *, unsigned long int);
90 extern char *bind_textdomain_codeset(const char *, const char *);
91 
92 /* Word handling functions --- requires dynamic linking */
93 /* Warning: these are experimental and subject to change. */
94 extern int wdinit(void);
95 extern int wdchkind(wchar_t);
96 extern int wdbindf(wchar_t, wchar_t, int);
97 extern wchar_t *wddelim(wchar_t, wchar_t, int);
98 extern wchar_t mcfiller(void);
99 extern int mcwrap(void);
100 
101 #ifdef	__cplusplus
102 }
103 #endif
104 
105 #endif /* __NetBSD__ */
106 
107 #endif /* _LIBINTL_H */
108