xref: /illumos-gate/usr/src/head/wchar.h (revision cd62a92d4a964bfe61d35ba2301b69e65e22a509)
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 /*
232d08521bSGarrett 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 #if !defined(_STRICT_STDC) || defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__)
124693e4d84SAlexander Pyhalov #if __cplusplus >= 199711L
125693e4d84SAlexander Pyhalov namespace std {
126693e4d84SAlexander Pyhalov #endif
1277c478bd9Sstevel@tonic-gate extern int iswalpha(wint_t);
1287c478bd9Sstevel@tonic-gate extern int iswupper(wint_t);
1297c478bd9Sstevel@tonic-gate extern int iswlower(wint_t);
1307c478bd9Sstevel@tonic-gate extern int iswdigit(wint_t);
1317c478bd9Sstevel@tonic-gate extern int iswxdigit(wint_t);
1327c478bd9Sstevel@tonic-gate extern int iswalnum(wint_t);
1337c478bd9Sstevel@tonic-gate extern int iswspace(wint_t);
1347c478bd9Sstevel@tonic-gate extern int iswpunct(wint_t);
1357c478bd9Sstevel@tonic-gate extern int iswprint(wint_t);
1367c478bd9Sstevel@tonic-gate extern int iswgraph(wint_t);
1377c478bd9Sstevel@tonic-gate extern int iswcntrl(wint_t);
1387c478bd9Sstevel@tonic-gate extern int iswctype(wint_t, wctype_t);
1397c478bd9Sstevel@tonic-gate extern wint_t towlower(wint_t);
1407c478bd9Sstevel@tonic-gate extern wint_t towupper(wint_t);
1417c478bd9Sstevel@tonic-gate extern wchar_t *wcswcs(const wchar_t *, const wchar_t *);
1427c478bd9Sstevel@tonic-gate extern int wcswidth(const wchar_t *, size_t);
1437257d1b4Sraf extern int wcwidth(wchar_t);
1447c478bd9Sstevel@tonic-gate extern wctype_t wctype(const char *);
145693e4d84SAlexander Pyhalov #if __cplusplus >= 199711L
146693e4d84SAlexander Pyhalov } /* namespace std */
147693e4d84SAlexander Pyhalov 
148693e4d84SAlexander Pyhalov using std::iswalpha;
149693e4d84SAlexander Pyhalov using std::iswupper;
150693e4d84SAlexander Pyhalov using std::iswlower;
151693e4d84SAlexander Pyhalov using std::iswdigit;
152693e4d84SAlexander Pyhalov using std::iswxdigit;
153693e4d84SAlexander Pyhalov using std::iswalnum;
154693e4d84SAlexander Pyhalov using std::iswspace;
155693e4d84SAlexander Pyhalov using std::iswpunct;
156693e4d84SAlexander Pyhalov using std::iswprint;
157693e4d84SAlexander Pyhalov using std::iswgraph;
158693e4d84SAlexander Pyhalov using std::iswcntrl;
159693e4d84SAlexander Pyhalov using std::iswctype;
160693e4d84SAlexander Pyhalov using std::towlower;
161693e4d84SAlexander Pyhalov using std::towupper;
162693e4d84SAlexander Pyhalov using std::wcswcs;
163693e4d84SAlexander Pyhalov using std::wcswidth;
164693e4d84SAlexander Pyhalov using std::wcwidth;
165693e4d84SAlexander Pyhalov using std::wctype;
166693e4d84SAlexander Pyhalov #endif
1677c478bd9Sstevel@tonic-gate #endif /* !defined(_STRICT_STDC) || defined(_XOPEN_SOURCE)... */
1687c478bd9Sstevel@tonic-gate 
1692d08521bSGarrett D'Amore #if defined(_XPG7) || !defined(_STRICT_SYMBOLS)
1702d08521bSGarrett D'Amore 
1712d08521bSGarrett D'Amore #ifndef _LOCALE_T
1722d08521bSGarrett D'Amore #define	_LOCALE_T
173732efd55SDan McDonald typedef struct _locale *locale_t;
1742d08521bSGarrett D'Amore #endif
1752d08521bSGarrett D'Amore 
17623a1cceaSRoger A. Faulkner extern size_t wcsnlen(const wchar_t *, size_t);
17723a1cceaSRoger A. Faulkner extern wchar_t *wcpcpy(wchar_t *_RESTRICT_KYWD, const wchar_t *_RESTRICT_KYWD);
17823a1cceaSRoger A. Faulkner extern wchar_t *wcpncpy(wchar_t *_RESTRICT_KYWD, const wchar_t *_RESTRICT_KYWD,
17923a1cceaSRoger A. Faulkner     size_t);
1802d08521bSGarrett D'Amore extern size_t wcsxfrm_l(wchar_t *_RESTRICT_KYWD, const wchar_t *_RESTRICT_KYWD,
1812d08521bSGarrett D'Amore     size_t, locale_t);
1822d08521bSGarrett D'Amore extern int wcscoll_l(const wchar_t *, const wchar_t *, locale_t);
1832d08521bSGarrett D'Amore extern wchar_t *wcsdup(const wchar_t *);
18423a1cceaSRoger A. Faulkner extern int wcscasecmp(const wchar_t *, const wchar_t *);
1852d08521bSGarrett D'Amore extern int wcscasecmp_l(const wchar_t *, const wchar_t *, locale_t);
18623a1cceaSRoger A. Faulkner extern int wcsncasecmp(const wchar_t *, const wchar_t *, size_t);
1872d08521bSGarrett D'Amore extern int wcsncasecmp_l(const wchar_t *, const wchar_t *, size_t, locale_t);
1882d08521bSGarrett D'Amore extern size_t mbsnrtowcs(wchar_t *_RESTRICT_KYWD, const char **_RESTRICT_KYWD,
1892d08521bSGarrett D'Amore     size_t, size_t, mbstate_t *_RESTRICT_KYWD);
1902d08521bSGarrett D'Amore 
191*cd62a92dSRobert Mustacchi extern FILE	*open_wmemstream(wchar_t **, size_t *);
192*cd62a92dSRobert Mustacchi 
1932d08521bSGarrett D'Amore #endif	/* defined(_XPG7) || !defined(_STRICT_SYMBOLS) */
19423a1cceaSRoger A. Faulkner 
1957c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1967c478bd9Sstevel@tonic-gate }
1977c478bd9Sstevel@tonic-gate #endif
1987c478bd9Sstevel@tonic-gate 
1997c478bd9Sstevel@tonic-gate #endif	/* _WCHAR_H */
200