xref: /titanic_53/usr/src/head/wchar.h (revision 2d08521bd15501c8370ba2153b9cca4f094979d0)
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
57257d1b4Sraf  * Common Development and Distribution License (the "License").
67257d1b4Sraf  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217257d1b4Sraf 
227c478bd9Sstevel@tonic-gate /*
23*2d08521bSGarrett D'Amore  * Copyright 2014 Garrett D'Amore <garrett@damore.org>
2423a1cceaSRoger A. Faulkner  * Copyright (c) 1993, 2010, Oracle and/or its affiliates. All rights reserved.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate #ifndef	_WCHAR_H
287c478bd9Sstevel@tonic-gate #define	_WCHAR_H
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #include <sys/feature_tests.h>
317c478bd9Sstevel@tonic-gate #include <iso/wchar_iso.h>
327c478bd9Sstevel@tonic-gate #include <iso/wchar_c99.h>
337c478bd9Sstevel@tonic-gate 
347c478bd9Sstevel@tonic-gate /*
357c478bd9Sstevel@tonic-gate  * Allow global visibility for symbols defined in
367c478bd9Sstevel@tonic-gate  * C++ "std" namespace in <iso/wchar_iso.h>.
377c478bd9Sstevel@tonic-gate  */
387c478bd9Sstevel@tonic-gate #if __cplusplus >= 199711L
397c478bd9Sstevel@tonic-gate using std::FILE;
407c478bd9Sstevel@tonic-gate using std::wint_t;
417c478bd9Sstevel@tonic-gate using std::clock_t;
427c478bd9Sstevel@tonic-gate using std::size_t;
437c478bd9Sstevel@tonic-gate using std::time_t;
447c478bd9Sstevel@tonic-gate using std::tm;
457c478bd9Sstevel@tonic-gate using std::mbstate_t;
467c478bd9Sstevel@tonic-gate using std::fgetwc;
477c478bd9Sstevel@tonic-gate using std::fgetws;
487c478bd9Sstevel@tonic-gate using std::fputwc;
497c478bd9Sstevel@tonic-gate using std::fputws;
507c478bd9Sstevel@tonic-gate using std::ungetwc;
517c478bd9Sstevel@tonic-gate using std::getwc;
527c478bd9Sstevel@tonic-gate using std::getwchar;
537c478bd9Sstevel@tonic-gate using std::putwc;
547c478bd9Sstevel@tonic-gate using std::putwchar;
557c478bd9Sstevel@tonic-gate using std::wcstod;
567c478bd9Sstevel@tonic-gate using std::wcstol;
577c478bd9Sstevel@tonic-gate using std::wcstoul;
587c478bd9Sstevel@tonic-gate using std::wcscat;
597c478bd9Sstevel@tonic-gate using std::wcschr;
607c478bd9Sstevel@tonic-gate using std::wcscmp;
617c478bd9Sstevel@tonic-gate using std::wcscoll;
627c478bd9Sstevel@tonic-gate using std::wcscpy;
637c478bd9Sstevel@tonic-gate using std::wcscspn;
647c478bd9Sstevel@tonic-gate using std::wcslen;
657c478bd9Sstevel@tonic-gate using std::wcsncat;
667c478bd9Sstevel@tonic-gate using std::wcsncmp;
677c478bd9Sstevel@tonic-gate using std::wcsncpy;
687c478bd9Sstevel@tonic-gate using std::wcspbrk;
697c478bd9Sstevel@tonic-gate using std::wcsrchr;
707c478bd9Sstevel@tonic-gate using std::wcsspn;
717c478bd9Sstevel@tonic-gate using std::wcsxfrm;
727c478bd9Sstevel@tonic-gate using std::wcstok;
737c478bd9Sstevel@tonic-gate using std::wcsftime;
747c478bd9Sstevel@tonic-gate /* not XPG4 and not XPG4v2 */
757c478bd9Sstevel@tonic-gate #if (!defined(_XPG4) && !defined(_XPG4_2) || defined(_XPG5))
767c478bd9Sstevel@tonic-gate using std::btowc;
777c478bd9Sstevel@tonic-gate using std::fwprintf;
787c478bd9Sstevel@tonic-gate using std::fwscanf;
797c478bd9Sstevel@tonic-gate using std::fwide;
807c478bd9Sstevel@tonic-gate using std::mbsinit;
817c478bd9Sstevel@tonic-gate using std::mbrlen;
827c478bd9Sstevel@tonic-gate using std::mbrtowc;
837c478bd9Sstevel@tonic-gate using std::mbsrtowcs;
847c478bd9Sstevel@tonic-gate using std::swprintf;
857c478bd9Sstevel@tonic-gate using std::swscanf;
867c478bd9Sstevel@tonic-gate using std::vfwprintf;
877c478bd9Sstevel@tonic-gate using std::vwprintf;
887c478bd9Sstevel@tonic-gate using std::vswprintf;
897c478bd9Sstevel@tonic-gate using std::wcrtomb;
907c478bd9Sstevel@tonic-gate using std::wcsrtombs;
917c478bd9Sstevel@tonic-gate using std::wcsstr;
927c478bd9Sstevel@tonic-gate using std::wctob;
937c478bd9Sstevel@tonic-gate using std::wmemchr;
947c478bd9Sstevel@tonic-gate using std::wmemcmp;
957c478bd9Sstevel@tonic-gate using std::wmemcpy;
967c478bd9Sstevel@tonic-gate using std::wmemmove;
977c478bd9Sstevel@tonic-gate using std::wmemset;
987c478bd9Sstevel@tonic-gate using std::wprintf;
997c478bd9Sstevel@tonic-gate using std::wscanf;
1007c478bd9Sstevel@tonic-gate #endif /* not XPG4 and not XPG4v2 */
1017c478bd9Sstevel@tonic-gate #endif /* __cplusplus >= 199711L */
1027c478bd9Sstevel@tonic-gate 
1037c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1047c478bd9Sstevel@tonic-gate extern "C" {
1057c478bd9Sstevel@tonic-gate #endif
1067c478bd9Sstevel@tonic-gate 
1077c478bd9Sstevel@tonic-gate #if !defined(_STRICT_STDC) || defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__)
1087c478bd9Sstevel@tonic-gate #if !defined(_WCTYPE_T) || __cplusplus >= 199711L
1097c478bd9Sstevel@tonic-gate #define	_WCTYPE_T
1107c478bd9Sstevel@tonic-gate typedef	int	wctype_t;
1117c478bd9Sstevel@tonic-gate #endif
1127c478bd9Sstevel@tonic-gate #endif /* !defined(_STRICT_STDC) || defined(_XOPEN_SOURCE)... */
1137c478bd9Sstevel@tonic-gate 
1147c478bd9Sstevel@tonic-gate /*
1157c478bd9Sstevel@tonic-gate  * XPG6 requires that va_list be defined as defined in <stdarg.h>,
1167c478bd9Sstevel@tonic-gate  * however, inclusion of <stdarg.h> breaks Standard C namespace.
1177c478bd9Sstevel@tonic-gate  */
1187c478bd9Sstevel@tonic-gate #if defined(_XPG6) && !defined(_VA_LIST)
1197c478bd9Sstevel@tonic-gate #define	_VA_LIST
1207c478bd9Sstevel@tonic-gate typedef __va_list va_list;
1217c478bd9Sstevel@tonic-gate #endif  /* defined(_XPG6) && !defined(_VA_LIST) */
1227c478bd9Sstevel@tonic-gate 
1237c478bd9Sstevel@tonic-gate #ifdef __STDC__
1247c478bd9Sstevel@tonic-gate 
1257c478bd9Sstevel@tonic-gate #if !defined(_STRICT_STDC) || defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__)
126693e4d84SAlexander Pyhalov #if __cplusplus >= 199711L
127693e4d84SAlexander Pyhalov namespace std {
128693e4d84SAlexander Pyhalov #endif
1297c478bd9Sstevel@tonic-gate extern int iswalpha(wint_t);
1307c478bd9Sstevel@tonic-gate extern int iswupper(wint_t);
1317c478bd9Sstevel@tonic-gate extern int iswlower(wint_t);
1327c478bd9Sstevel@tonic-gate extern int iswdigit(wint_t);
1337c478bd9Sstevel@tonic-gate extern int iswxdigit(wint_t);
1347c478bd9Sstevel@tonic-gate extern int iswalnum(wint_t);
1357c478bd9Sstevel@tonic-gate extern int iswspace(wint_t);
1367c478bd9Sstevel@tonic-gate extern int iswpunct(wint_t);
1377c478bd9Sstevel@tonic-gate extern int iswprint(wint_t);
1387c478bd9Sstevel@tonic-gate extern int iswgraph(wint_t);
1397c478bd9Sstevel@tonic-gate extern int iswcntrl(wint_t);
1407c478bd9Sstevel@tonic-gate extern int iswctype(wint_t, wctype_t);
1417c478bd9Sstevel@tonic-gate extern wint_t towlower(wint_t);
1427c478bd9Sstevel@tonic-gate extern wint_t towupper(wint_t);
1437c478bd9Sstevel@tonic-gate extern wchar_t *wcswcs(const wchar_t *, const wchar_t *);
1447c478bd9Sstevel@tonic-gate extern int wcswidth(const wchar_t *, size_t);
1457257d1b4Sraf extern int wcwidth(wchar_t);
1467c478bd9Sstevel@tonic-gate extern wctype_t wctype(const char *);
147693e4d84SAlexander Pyhalov #if __cplusplus >= 199711L
148693e4d84SAlexander Pyhalov } /* namespace std */
149693e4d84SAlexander Pyhalov 
150693e4d84SAlexander Pyhalov using std::iswalpha;
151693e4d84SAlexander Pyhalov using std::iswupper;
152693e4d84SAlexander Pyhalov using std::iswlower;
153693e4d84SAlexander Pyhalov using std::iswdigit;
154693e4d84SAlexander Pyhalov using std::iswxdigit;
155693e4d84SAlexander Pyhalov using std::iswalnum;
156693e4d84SAlexander Pyhalov using std::iswspace;
157693e4d84SAlexander Pyhalov using std::iswpunct;
158693e4d84SAlexander Pyhalov using std::iswprint;
159693e4d84SAlexander Pyhalov using std::iswgraph;
160693e4d84SAlexander Pyhalov using std::iswcntrl;
161693e4d84SAlexander Pyhalov using std::iswctype;
162693e4d84SAlexander Pyhalov using std::towlower;
163693e4d84SAlexander Pyhalov using std::towupper;
164693e4d84SAlexander Pyhalov using std::wcswcs;
165693e4d84SAlexander Pyhalov using std::wcswidth;
166693e4d84SAlexander Pyhalov using std::wcwidth;
167693e4d84SAlexander Pyhalov using std::wctype;
168693e4d84SAlexander Pyhalov #endif
1697c478bd9Sstevel@tonic-gate #endif /* !defined(_STRICT_STDC) || defined(_XOPEN_SOURCE)... */
1707c478bd9Sstevel@tonic-gate 
171*2d08521bSGarrett D'Amore #if defined(_XPG7) || !defined(_STRICT_SYMBOLS)
172*2d08521bSGarrett D'Amore 
173*2d08521bSGarrett D'Amore #ifndef _LOCALE_T
174*2d08521bSGarrett D'Amore #define	_LOCALE_T
175*2d08521bSGarrett D'Amore typedef struct locale *locale_t;
176*2d08521bSGarrett D'Amore #endif
177*2d08521bSGarrett D'Amore 
17823a1cceaSRoger A. Faulkner extern size_t wcsnlen(const wchar_t *, size_t);
17923a1cceaSRoger A. Faulkner extern wchar_t *wcpcpy(wchar_t *_RESTRICT_KYWD, const wchar_t *_RESTRICT_KYWD);
18023a1cceaSRoger A. Faulkner extern wchar_t *wcpncpy(wchar_t *_RESTRICT_KYWD, const wchar_t *_RESTRICT_KYWD,
18123a1cceaSRoger A. Faulkner     size_t);
182*2d08521bSGarrett D'Amore extern size_t wcsxfrm_l(wchar_t *_RESTRICT_KYWD, const wchar_t *_RESTRICT_KYWD,
183*2d08521bSGarrett D'Amore     size_t, locale_t);
184*2d08521bSGarrett D'Amore extern int wcscoll_l(const wchar_t *, const wchar_t *, locale_t);
185*2d08521bSGarrett D'Amore extern wchar_t *wcsdup(const wchar_t *);
18623a1cceaSRoger A. Faulkner extern int wcscasecmp(const wchar_t *, const wchar_t *);
187*2d08521bSGarrett D'Amore extern int wcscasecmp_l(const wchar_t *, const wchar_t *, locale_t);
18823a1cceaSRoger A. Faulkner extern int wcsncasecmp(const wchar_t *, const wchar_t *, size_t);
189*2d08521bSGarrett D'Amore extern int wcsncasecmp_l(const wchar_t *, const wchar_t *, size_t, locale_t);
190*2d08521bSGarrett D'Amore extern size_t mbsnrtowcs(wchar_t *_RESTRICT_KYWD, const char **_RESTRICT_KYWD,
191*2d08521bSGarrett D'Amore     size_t, size_t, mbstate_t *_RESTRICT_KYWD);
192*2d08521bSGarrett D'Amore 
193*2d08521bSGarrett D'Amore #endif	/* defined(_XPG7) || !defined(_STRICT_SYMBOLS) */
19423a1cceaSRoger A. Faulkner 
1957c478bd9Sstevel@tonic-gate #else /* __STDC__ */
1967c478bd9Sstevel@tonic-gate 
1977c478bd9Sstevel@tonic-gate #if !defined(_STRICT_STDC) || defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__)
1987c478bd9Sstevel@tonic-gate extern  int iswalpha();
1997c478bd9Sstevel@tonic-gate extern  int iswupper();
2007c478bd9Sstevel@tonic-gate extern  int iswlower();
2017c478bd9Sstevel@tonic-gate extern  int iswdigit();
2027c478bd9Sstevel@tonic-gate extern  int iswxdigit();
2037c478bd9Sstevel@tonic-gate extern  int iswalnum();
2047c478bd9Sstevel@tonic-gate extern  int iswspace();
2057c478bd9Sstevel@tonic-gate extern  int iswpunct();
2067c478bd9Sstevel@tonic-gate extern  int iswprint();
2077c478bd9Sstevel@tonic-gate extern  int iswgraph();
2087c478bd9Sstevel@tonic-gate extern  int iswcntrl();
2097c478bd9Sstevel@tonic-gate extern  int iswctype();
2107c478bd9Sstevel@tonic-gate extern  wint_t towlower();
2117c478bd9Sstevel@tonic-gate extern  wint_t towupper();
2127c478bd9Sstevel@tonic-gate extern wchar_t *wcswcs();
2137c478bd9Sstevel@tonic-gate extern int wcswidth();
2147c478bd9Sstevel@tonic-gate extern int wcwidth();
2157c478bd9Sstevel@tonic-gate extern wctype_t wctype();
2167c478bd9Sstevel@tonic-gate #endif /* !defined(_STRICT_STDC) || defined(_XOPEN_SOURCE)... */
2177c478bd9Sstevel@tonic-gate 
218*2d08521bSGarrett D'Amore #if defined(_XGP7) || !defined(_STRICT_SYMBOLS)
21923a1cceaSRoger A. Faulkner extern size_t wcsnlen();
22023a1cceaSRoger A. Faulkner extern wchar_t *wcpcpy();
22123a1cceaSRoger A. Faulkner extern wchar_t *wcpncpy();
222*2d08521bSGarrett D'Amore extern size_t wcsxfrm_l();
223*2d08521bSGarrett D'Amore extern int wcscoll_l();
224*2d08521bSGarrett D'Amore extern wchar_t *wcsdup();
22523a1cceaSRoger A. Faulkner extern int wcscasecmp();
226*2d08521bSGarrett D'Amore extern int wcscasecmp_l();
22723a1cceaSRoger A. Faulkner extern int wcsncasecmp();
228*2d08521bSGarrett D'Amore extern int wcsncasecmp_l();
229*2d08521bSGarrett D'Amore extern size_t mbsnrtowcs();
23023a1cceaSRoger A. Faulkner #endif
23123a1cceaSRoger A. Faulkner 
2327c478bd9Sstevel@tonic-gate #endif /* __STDC__ */
2337c478bd9Sstevel@tonic-gate 
2347c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
2357c478bd9Sstevel@tonic-gate }
2367c478bd9Sstevel@tonic-gate #endif
2377c478bd9Sstevel@tonic-gate 
2387c478bd9Sstevel@tonic-gate #endif	/* _WCHAR_H */
239