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