xref: /illumos-gate/usr/src/head/wchar.h (revision afab0816ecb604f0099a09ad8ee398f0d7b77b1c)
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 extern int iswalpha(wint_t);
126 extern int iswupper(wint_t);
127 extern int iswlower(wint_t);
128 extern int iswdigit(wint_t);
129 extern int iswxdigit(wint_t);
130 extern int iswalnum(wint_t);
131 extern int iswspace(wint_t);
132 extern int iswpunct(wint_t);
133 extern int iswprint(wint_t);
134 extern int iswgraph(wint_t);
135 extern int iswcntrl(wint_t);
136 extern int iswctype(wint_t, wctype_t);
137 extern wint_t towlower(wint_t);
138 extern wint_t towupper(wint_t);
139 extern wchar_t *wcswcs(const wchar_t *, const wchar_t *);
140 extern int wcswidth(const wchar_t *, size_t);
141 extern int wcwidth(wchar_t);
142 extern wctype_t wctype(const char *);
143 #endif /* !defined(_STRICT_STDC) || defined(_XOPEN_SOURCE)... */
144 
145 #if defined(__EXTENSIONS__) || \
146 	(!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX))
147 	/* || defined(_XPG7) */
148 extern wchar_t *wcsdup(const wchar_t *);
149 extern size_t wcsnlen(const wchar_t *, size_t);
150 extern wchar_t *wcpcpy(wchar_t *_RESTRICT_KYWD, const wchar_t *_RESTRICT_KYWD);
151 extern wchar_t *wcpncpy(wchar_t *_RESTRICT_KYWD, const wchar_t *_RESTRICT_KYWD,
152     size_t);
153 extern int wcscasecmp(const wchar_t *, const wchar_t *);
154 extern int wcsncasecmp(const wchar_t *, const wchar_t *, size_t);
155 #endif
156 
157 #else /* __STDC__ */
158 
159 #if !defined(_STRICT_STDC) || defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__)
160 extern  int iswalpha();
161 extern  int iswupper();
162 extern  int iswlower();
163 extern  int iswdigit();
164 extern  int iswxdigit();
165 extern  int iswalnum();
166 extern  int iswspace();
167 extern  int iswpunct();
168 extern  int iswprint();
169 extern  int iswgraph();
170 extern  int iswcntrl();
171 extern  int iswctype();
172 extern  wint_t towlower();
173 extern  wint_t towupper();
174 extern wchar_t *wcswcs();
175 extern int wcswidth();
176 extern int wcwidth();
177 extern wctype_t wctype();
178 #endif /* !defined(_STRICT_STDC) || defined(_XOPEN_SOURCE)... */
179 
180 #if defined(__EXTENSIONS__) || \
181 	(!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX))
182 	/* || defined(_XPG7) */
183 extern wchar_t *wcsdup();
184 extern size_t wcsnlen();
185 extern wchar_t *wcpcpy();
186 extern wchar_t *wcpncpy();
187 extern int wcscasecmp();
188 extern int wcsncasecmp();
189 #endif
190 
191 #endif /* __STDC__ */
192 
193 #ifdef	__cplusplus
194 }
195 #endif
196 
197 #endif	/* _WCHAR_H */
198