xref: /illumos-gate/usr/src/head/wchar.h (revision 693e4d84eb49b987c3d66cbcd4b13a5c6e9059bf)
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 /*
23  * Copyright (c) 1993, 2010, Oracle and/or its affiliates. All rights reserved.
24  */
25 
26 #ifndef	_WCHAR_H
27 #define	_WCHAR_H
28 
29 #include <sys/feature_tests.h>
30 #include <iso/wchar_iso.h>
31 #include <iso/wchar_c99.h>
32 
33 /*
34  * Allow global visibility for symbols defined in
35  * C++ "std" namespace in <iso/wchar_iso.h>.
36  */
37 #if __cplusplus >= 199711L
38 using std::FILE;
39 using std::wint_t;
40 using std::clock_t;
41 using std::size_t;
42 using std::time_t;
43 using std::tm;
44 using std::mbstate_t;
45 using std::fgetwc;
46 using std::fgetws;
47 using std::fputwc;
48 using std::fputws;
49 using std::ungetwc;
50 using std::getwc;
51 using std::getwchar;
52 using std::putwc;
53 using std::putwchar;
54 using std::wcstod;
55 using std::wcstol;
56 using std::wcstoul;
57 using std::wcscat;
58 using std::wcschr;
59 using std::wcscmp;
60 using std::wcscoll;
61 using std::wcscpy;
62 using std::wcscspn;
63 using std::wcslen;
64 using std::wcsncat;
65 using std::wcsncmp;
66 using std::wcsncpy;
67 using std::wcspbrk;
68 using std::wcsrchr;
69 using std::wcsspn;
70 using std::wcsxfrm;
71 using std::wcstok;
72 using std::wcsftime;
73 /* not XPG4 and not XPG4v2 */
74 #if (!defined(_XPG4) && !defined(_XPG4_2) || defined(_XPG5))
75 using std::btowc;
76 using std::fwprintf;
77 using std::fwscanf;
78 using std::fwide;
79 using std::mbsinit;
80 using std::mbrlen;
81 using std::mbrtowc;
82 using std::mbsrtowcs;
83 using std::swprintf;
84 using std::swscanf;
85 using std::vfwprintf;
86 using std::vwprintf;
87 using std::vswprintf;
88 using std::wcrtomb;
89 using std::wcsrtombs;
90 using std::wcsstr;
91 using std::wctob;
92 using std::wmemchr;
93 using std::wmemcmp;
94 using std::wmemcpy;
95 using std::wmemmove;
96 using std::wmemset;
97 using std::wprintf;
98 using std::wscanf;
99 #endif /* not XPG4 and not XPG4v2 */
100 #endif /* __cplusplus >= 199711L */
101 
102 #ifdef	__cplusplus
103 extern "C" {
104 #endif
105 
106 #if !defined(_STRICT_STDC) || defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__)
107 #if !defined(_WCTYPE_T) || __cplusplus >= 199711L
108 #define	_WCTYPE_T
109 typedef	int	wctype_t;
110 #endif
111 #endif /* !defined(_STRICT_STDC) || defined(_XOPEN_SOURCE)... */
112 
113 /*
114  * XPG6 requires that va_list be defined as defined in <stdarg.h>,
115  * however, inclusion of <stdarg.h> breaks Standard C namespace.
116  */
117 #if defined(_XPG6) && !defined(_VA_LIST)
118 #define	_VA_LIST
119 typedef __va_list va_list;
120 #endif  /* defined(_XPG6) && !defined(_VA_LIST) */
121 
122 #ifdef __STDC__
123 
124 #if !defined(_STRICT_STDC) || defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__)
125 #if __cplusplus >= 199711L
126 namespace std {
127 #endif
128 extern int iswalpha(wint_t);
129 extern int iswupper(wint_t);
130 extern int iswlower(wint_t);
131 extern int iswdigit(wint_t);
132 extern int iswxdigit(wint_t);
133 extern int iswalnum(wint_t);
134 extern int iswspace(wint_t);
135 extern int iswpunct(wint_t);
136 extern int iswprint(wint_t);
137 extern int iswgraph(wint_t);
138 extern int iswcntrl(wint_t);
139 extern int iswctype(wint_t, wctype_t);
140 extern wint_t towlower(wint_t);
141 extern wint_t towupper(wint_t);
142 extern wchar_t *wcswcs(const wchar_t *, const wchar_t *);
143 extern int wcswidth(const wchar_t *, size_t);
144 extern int wcwidth(wchar_t);
145 extern wctype_t wctype(const char *);
146 #if __cplusplus >= 199711L
147 } /* namespace std */
148 
149 using std::iswalpha;
150 using std::iswupper;
151 using std::iswlower;
152 using std::iswdigit;
153 using std::iswxdigit;
154 using std::iswalnum;
155 using std::iswspace;
156 using std::iswpunct;
157 using std::iswprint;
158 using std::iswgraph;
159 using std::iswcntrl;
160 using std::iswctype;
161 using std::towlower;
162 using std::towupper;
163 using std::wcswcs;
164 using std::wcswidth;
165 using std::wcwidth;
166 using std::wctype;
167 #endif
168 #endif /* !defined(_STRICT_STDC) || defined(_XOPEN_SOURCE)... */
169 
170 #if defined(__EXTENSIONS__) || \
171 	(!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX))
172 	/* || defined(_XPG7) */
173 extern wchar_t *wcsdup(const wchar_t *);
174 extern size_t wcsnlen(const wchar_t *, size_t);
175 extern wchar_t *wcpcpy(wchar_t *_RESTRICT_KYWD, const wchar_t *_RESTRICT_KYWD);
176 extern wchar_t *wcpncpy(wchar_t *_RESTRICT_KYWD, const wchar_t *_RESTRICT_KYWD,
177     size_t);
178 extern int wcscasecmp(const wchar_t *, const wchar_t *);
179 extern int wcsncasecmp(const wchar_t *, const wchar_t *, size_t);
180 #endif
181 
182 #else /* __STDC__ */
183 
184 #if !defined(_STRICT_STDC) || defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__)
185 extern  int iswalpha();
186 extern  int iswupper();
187 extern  int iswlower();
188 extern  int iswdigit();
189 extern  int iswxdigit();
190 extern  int iswalnum();
191 extern  int iswspace();
192 extern  int iswpunct();
193 extern  int iswprint();
194 extern  int iswgraph();
195 extern  int iswcntrl();
196 extern  int iswctype();
197 extern  wint_t towlower();
198 extern  wint_t towupper();
199 extern wchar_t *wcswcs();
200 extern int wcswidth();
201 extern int wcwidth();
202 extern wctype_t wctype();
203 #endif /* !defined(_STRICT_STDC) || defined(_XOPEN_SOURCE)... */
204 
205 #if defined(__EXTENSIONS__) || \
206 	(!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX))
207 	/* || defined(_XPG7) */
208 extern wchar_t *wcsdup();
209 extern size_t wcsnlen();
210 extern wchar_t *wcpcpy();
211 extern wchar_t *wcpncpy();
212 extern int wcscasecmp();
213 extern int wcsncasecmp();
214 #endif
215 
216 #endif /* __STDC__ */
217 
218 #ifdef	__cplusplus
219 }
220 #endif
221 
222 #endif	/* _WCHAR_H */
223