]>
Commit | Line | Data |
---|---|---|
4c1423ed | 1 | /* Copyright (C) 1995-2008, 2009, 2010, 2011 Free Software Foundation, Inc. |
b5791037 | 2 | This file is part of the GNU C Library. |
30de3b18 | 3 | |
b5791037 | 4 | The GNU C Library is free software; you can redistribute it and/or |
41bdb6e2 AJ |
5 | modify it under the terms of the GNU Lesser General Public |
6 | License as published by the Free Software Foundation; either | |
7 | version 2.1 of the License, or (at your option) any later version. | |
30de3b18 | 8 | |
b5791037 UD |
9 | The GNU C Library is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
41bdb6e2 | 12 | Lesser General Public License for more details. |
30de3b18 | 13 | |
41bdb6e2 AJ |
14 | You should have received a copy of the GNU Lesser General Public |
15 | License along with the GNU C Library; if not, write to the Free | |
16 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | |
17 | 02111-1307 USA. */ | |
30de3b18 RM |
18 | |
19 | /* | |
d1646309 UD |
20 | * ISO C99 Standard: 7.24 |
21 | * Extended multibyte and wide character utilities <wchar.h> | |
30de3b18 RM |
22 | */ |
23 | ||
24 | #ifndef _WCHAR_H | |
5107cf1d | 25 | |
7b503bcc | 26 | #if !defined __need_mbstate_t && !defined __need_wint_t |
d64b6ad0 UD |
27 | # define _WCHAR_H 1 |
28 | # include <features.h> | |
29 | #endif | |
30de3b18 | 30 | |
d64b6ad0 | 31 | #ifdef _WCHAR_H |
9756dfe1 | 32 | /* Get FILE definition. */ |
d1646309 | 33 | # define __need___FILE |
a912a4f8 | 34 | # if defined __USE_UNIX98 || defined __USE_XOPEN2K |
d9826675 UD |
35 | # define __need_FILE |
36 | # endif | |
d64b6ad0 | 37 | # include <stdio.h> |
655c0697 UD |
38 | /* Get va_list definition. */ |
39 | # define __need___va_list | |
d64b6ad0 | 40 | # include <stdarg.h> |
30de3b18 | 41 | |
7b503bcc UD |
42 | # include <bits/wchar.h> |
43 | ||
59dd8641 | 44 | /* Get size_t, wchar_t, wint_t and NULL from <stddef.h>. */ |
d64b6ad0 UD |
45 | # define __need_size_t |
46 | # define __need_wchar_t | |
47 | # define __need_NULL | |
48 | #endif | |
7b503bcc UD |
49 | #if defined _WCHAR_H || defined __need_wint_t || !defined __WINT_TYPE__ |
50 | # undef __need_wint_t | |
51 | # define __need_wint_t | |
52 | # include <stddef.h> | |
417bafec | 53 | |
71a40c74 RM |
54 | /* We try to get wint_t from <stddef.h>, but not all GCC versions define it |
55 | there. So define it ourselves if it remains undefined. */ | |
7b503bcc | 56 | # ifndef _WINT_T |
71a40c74 RM |
57 | /* Integral type unchanged by default argument promotions that can |
58 | hold any value corresponding to members of the extended character | |
59 | set, as well as at least one value that does not correspond to any | |
60 | member of the extended character set. */ | |
7b503bcc | 61 | # define _WINT_T |
71a40c74 | 62 | typedef unsigned int wint_t; |
7b503bcc | 63 | # else |
e6d32996 UD |
64 | /* Work around problems with the <stddef.h> file which doesn't put |
65 | wint_t in the std namespace. */ | |
7b503bcc UD |
66 | # if defined __cplusplus && defined _GLIBCPP_USE_NAMESPACES \ |
67 | && defined __WINT_TYPE__ | |
e6d32996 UD |
68 | __BEGIN_NAMESPACE_STD |
69 | typedef __WINT_TYPE__ wint_t; | |
70 | __END_NAMESPACE_STD | |
7b503bcc | 71 | # endif |
7a5affeb | 72 | # endif |
9ac9129d UD |
73 | |
74 | /* Tell the caller that we provide correct C++ prototypes. */ | |
75 | # if defined __cplusplus && __GNUC_PREREQ (4, 4) | |
76 | # define __CORRECT_ISO_CPP_WCHAR_H_PROTO | |
77 | # endif | |
71a40c74 RM |
78 | #endif |
79 | ||
7b503bcc | 80 | #if (defined _WCHAR_H || defined __need_mbstate_t) && !defined __mbstate_t_defined |
d64b6ad0 | 81 | # define __mbstate_t_defined 1 |
30de3b18 | 82 | /* Conversion state information. */ |
07a4742f RM |
83 | typedef struct |
84 | { | |
aa831d6d UD |
85 | int __count; |
86 | union | |
87 | { | |
7b503bcc UD |
88 | # ifdef __WINT_TYPE__ |
89 | __WINT_TYPE__ __wch; | |
90 | # else | |
aa831d6d | 91 | wint_t __wch; |
7b503bcc | 92 | # endif |
aa831d6d UD |
93 | char __wchb[4]; |
94 | } __value; /* Value so far. */ | |
d64b6ad0 UD |
95 | } __mbstate_t; |
96 | #endif | |
97 | #undef __need_mbstate_t | |
98 | ||
99 | ||
100 | /* The rest of the file is only used if used if __need_mbstate_t is not | |
101 | defined. */ | |
102 | #ifdef _WCHAR_H | |
103 | ||
7a5affeb | 104 | __BEGIN_NAMESPACE_C99 |
d64b6ad0 UD |
105 | /* Public type. */ |
106 | typedef __mbstate_t mbstate_t; | |
7a5affeb UD |
107 | __END_NAMESPACE_C99 |
108 | #ifdef __USE_GNU | |
109 | __USING_NAMESPACE_C99(mbstate_t) | |
110 | #endif | |
30de3b18 | 111 | |
cc3fa755 UD |
112 | #ifndef WCHAR_MIN |
113 | /* These constants might also be defined in <inttypes.h>. */ | |
417bafec UD |
114 | # define WCHAR_MIN __WCHAR_MIN |
115 | # define WCHAR_MAX __WCHAR_MAX | |
cc3fa755 | 116 | #endif |
30de3b18 RM |
117 | |
118 | #ifndef WEOF | |
119 | # define WEOF (0xffffffffu) | |
120 | #endif | |
121 | ||
e918a7fe UD |
122 | /* For XPG4 compliance we have to define the stuff from <wctype.h> here |
123 | as well. */ | |
124 | #if defined __USE_XOPEN && !defined __USE_UNIX98 | |
125 | # include <wctype.h> | |
126 | #endif | |
127 | ||
7a5affeb UD |
128 | |
129 | __BEGIN_DECLS | |
130 | ||
131 | __BEGIN_NAMESPACE_STD | |
9756dfe1 UD |
132 | /* This incomplete type is defined in <time.h> but needed here because |
133 | of `wcsftime'. */ | |
134 | struct tm; | |
2e0e802a | 135 | __END_NAMESPACE_STD |
7a5affeb UD |
136 | /* XXX We have to clean this up at some point. Since tm is in the std |
137 | namespace but wcsftime is in __c99 the type wouldn't be found | |
138 | without inserting it in the global namespace. */ | |
139 | __USING_NAMESPACE_STD(tm) | |
9756dfe1 UD |
140 | |
141 | ||
bb27a6eb | 142 | __BEGIN_NAMESPACE_STD |
30de3b18 | 143 | /* Copy SRC to DEST. */ |
c1422e5b UD |
144 | extern wchar_t *wcscpy (wchar_t *__restrict __dest, |
145 | __const wchar_t *__restrict __src) __THROW; | |
30de3b18 | 146 | /* Copy no more than N wide-characters of SRC to DEST. */ |
c1422e5b UD |
147 | extern wchar_t *wcsncpy (wchar_t *__restrict __dest, |
148 | __const wchar_t *__restrict __src, size_t __n) | |
149 | __THROW; | |
30de3b18 RM |
150 | |
151 | /* Append SRC onto DEST. */ | |
c1422e5b UD |
152 | extern wchar_t *wcscat (wchar_t *__restrict __dest, |
153 | __const wchar_t *__restrict __src) __THROW; | |
30de3b18 | 154 | /* Append no more than N wide-characters of SRC onto DEST. */ |
c1422e5b UD |
155 | extern wchar_t *wcsncat (wchar_t *__restrict __dest, |
156 | __const wchar_t *__restrict __src, size_t __n) | |
157 | __THROW; | |
30de3b18 RM |
158 | |
159 | /* Compare S1 and S2. */ | |
fb4dfa0c AJ |
160 | extern int wcscmp (__const wchar_t *__s1, __const wchar_t *__s2) |
161 | __THROW __attribute_pure__; | |
30de3b18 | 162 | /* Compare N wide-characters of S1 and S2. */ |
c1422e5b | 163 | extern int wcsncmp (__const wchar_t *__s1, __const wchar_t *__s2, size_t __n) |
fb4dfa0c | 164 | __THROW __attribute_pure__; |
bb27a6eb | 165 | __END_NAMESPACE_STD |
30de3b18 | 166 | |
6cbe890a | 167 | #ifdef __USE_XOPEN2K8 |
2f6d1f1b | 168 | /* Compare S1 and S2, ignoring case. */ |
c1422e5b | 169 | extern int wcscasecmp (__const wchar_t *__s1, __const wchar_t *__s2) __THROW; |
2f6d1f1b UD |
170 | |
171 | /* Compare no more than N chars of S1 and S2, ignoring case. */ | |
c1422e5b UD |
172 | extern int wcsncasecmp (__const wchar_t *__s1, __const wchar_t *__s2, |
173 | size_t __n) __THROW; | |
0501d603 UD |
174 | |
175 | /* Similar to the two functions above but take the information from | |
176 | the provided locale and not the global locale. */ | |
177 | # include <xlocale.h> | |
178 | ||
1ab62b32 RM |
179 | extern int wcscasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2, |
180 | __locale_t __loc) __THROW; | |
0501d603 | 181 | |
1ab62b32 RM |
182 | extern int wcsncasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2, |
183 | size_t __n, __locale_t __loc) __THROW; | |
2f6d1f1b UD |
184 | #endif |
185 | ||
bb27a6eb | 186 | __BEGIN_NAMESPACE_STD |
75cd5204 RM |
187 | /* Compare S1 and S2, both interpreted as appropriate to the |
188 | LC_COLLATE category of the current locale. */ | |
c1422e5b | 189 | extern int wcscoll (__const wchar_t *__s1, __const wchar_t *__s2) __THROW; |
75cd5204 RM |
190 | /* Transform S2 into array pointed to by S1 such that if wcscmp is |
191 | applied to two transformed strings the result is the as applying | |
192 | `wcscoll' to the original strings. */ | |
c1422e5b UD |
193 | extern size_t wcsxfrm (wchar_t *__restrict __s1, |
194 | __const wchar_t *__restrict __s2, size_t __n) __THROW; | |
bb27a6eb | 195 | __END_NAMESPACE_STD |
75cd5204 | 196 | |
6cbe890a | 197 | #ifdef __USE_XOPEN2K8 |
c84142e8 UD |
198 | /* Similar to the two functions above but take the information from |
199 | the provided locale and not the global locale. */ | |
c84142e8 UD |
200 | |
201 | /* Compare S1 and S2, both interpreted as appropriate to the | |
202 | LC_COLLATE category of the given locale. */ | |
1ab62b32 RM |
203 | extern int wcscoll_l (__const wchar_t *__s1, __const wchar_t *__s2, |
204 | __locale_t __loc) __THROW; | |
205 | ||
c84142e8 UD |
206 | /* Transform S2 into array pointed to by S1 such that if wcscmp is |
207 | applied to two transformed strings the result is the as applying | |
208 | `wcscoll' to the original strings. */ | |
1ab62b32 RM |
209 | extern size_t wcsxfrm_l (wchar_t *__s1, __const wchar_t *__s2, |
210 | size_t __n, __locale_t __loc) __THROW; | |
c84142e8 | 211 | |
30de3b18 | 212 | /* Duplicate S, returning an identical malloc'd string. */ |
fb4dfa0c | 213 | extern wchar_t *wcsdup (__const wchar_t *__s) __THROW __attribute_malloc__; |
1618c590 | 214 | #endif |
30de3b18 | 215 | |
bb27a6eb | 216 | __BEGIN_NAMESPACE_STD |
6d52618b | 217 | /* Find the first occurrence of WC in WCS. */ |
d8387c7b UD |
218 | #ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO |
219 | extern "C++" wchar_t *wcschr (wchar_t *__wcs, wchar_t __wc) | |
220 | __THROW __asm ("wcschr") __attribute_pure__; | |
221 | extern "C++" __const wchar_t *wcschr (__const wchar_t *__wcs, wchar_t __wc) | |
9ac9129d | 222 | __THROW __asm ("wcschr") __attribute_pure__; |
d8387c7b | 223 | #else |
fb4dfa0c AJ |
224 | extern wchar_t *wcschr (__const wchar_t *__wcs, wchar_t __wc) |
225 | __THROW __attribute_pure__; | |
d8387c7b | 226 | #endif |
6d52618b | 227 | /* Find the last occurrence of WC in WCS. */ |
d8387c7b UD |
228 | #ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO |
229 | extern "C++" wchar_t *wcsrchr (wchar_t *__wcs, wchar_t __wc) | |
230 | __THROW __asm ("wcsrchr") __attribute_pure__; | |
231 | extern "C++" __const wchar_t *wcsrchr (__const wchar_t *__wcs, wchar_t __wc) | |
232 | __THROW __asm ("wcsrchr") __attribute_pure__; | |
233 | #else | |
fb4dfa0c AJ |
234 | extern wchar_t *wcsrchr (__const wchar_t *__wcs, wchar_t __wc) |
235 | __THROW __attribute_pure__; | |
d8387c7b | 236 | #endif |
bb27a6eb | 237 | __END_NAMESPACE_STD |
30de3b18 | 238 | |
d64b6ad0 | 239 | #ifdef __USE_GNU |
557a9213 | 240 | /* This function is similar to `wcschr'. But it returns a pointer to |
d64b6ad0 | 241 | the closing NUL wide character in case C is not found in S. */ |
fb4dfa0c AJ |
242 | extern wchar_t *wcschrnul (__const wchar_t *__s, wchar_t __wc) |
243 | __THROW __attribute_pure__; | |
d64b6ad0 UD |
244 | #endif |
245 | ||
bb27a6eb | 246 | __BEGIN_NAMESPACE_STD |
30de3b18 | 247 | /* Return the length of the initial segmet of WCS which |
1618c590 | 248 | consists entirely of wide characters not in REJECT. */ |
c1422e5b | 249 | extern size_t wcscspn (__const wchar_t *__wcs, __const wchar_t *__reject) |
fb4dfa0c | 250 | __THROW __attribute_pure__; |
30de3b18 | 251 | /* Return the length of the initial segmet of WCS which |
1618c590 | 252 | consists entirely of wide characters in ACCEPT. */ |
c1422e5b | 253 | extern size_t wcsspn (__const wchar_t *__wcs, __const wchar_t *__accept) |
fb4dfa0c | 254 | __THROW __attribute_pure__; |
6d52618b | 255 | /* Find the first occurrence in WCS of any character in ACCEPT. */ |
d8387c7b UD |
256 | #ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO |
257 | extern "C++" wchar_t *wcspbrk (wchar_t *__wcs, __const wchar_t *__accept) | |
258 | __THROW __asm ("wcspbrk") __attribute_pure__; | |
259 | extern "C++" __const wchar_t *wcspbrk (__const wchar_t *__wcs, | |
260 | __const wchar_t *__accept) | |
261 | __THROW __asm ("wcspbrk") __attribute_pure__; | |
262 | #else | |
c1422e5b | 263 | extern wchar_t *wcspbrk (__const wchar_t *__wcs, __const wchar_t *__accept) |
fb4dfa0c | 264 | __THROW __attribute_pure__; |
d8387c7b | 265 | #endif |
6d52618b | 266 | /* Find the first occurrence of NEEDLE in HAYSTACK. */ |
d8387c7b UD |
267 | #ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO |
268 | extern "C++" wchar_t *wcsstr (wchar_t *__haystack, __const wchar_t *__needle) | |
269 | __THROW __asm ("wcsstr") __attribute_pure__; | |
270 | extern "C++" __const wchar_t *wcsstr (__const wchar_t *__haystack, | |
271 | __const wchar_t *__needle) | |
272 | __THROW __asm ("wcsstr") __attribute_pure__; | |
273 | #else | |
c1422e5b | 274 | extern wchar_t *wcsstr (__const wchar_t *__haystack, __const wchar_t *__needle) |
fb4dfa0c | 275 | __THROW __attribute_pure__; |
d8387c7b | 276 | #endif |
e918a7fe | 277 | |
30de3b18 | 278 | /* Divide WCS into tokens separated by characters in DELIM. */ |
c1422e5b UD |
279 | extern wchar_t *wcstok (wchar_t *__restrict __s, |
280 | __const wchar_t *__restrict __delim, | |
281 | wchar_t **__restrict __ptr) __THROW; | |
30de3b18 | 282 | |
1618c590 | 283 | /* Return the number of wide characters in S. */ |
fb4dfa0c | 284 | extern size_t wcslen (__const wchar_t *__s) __THROW __attribute_pure__; |
bb27a6eb | 285 | __END_NAMESPACE_STD |
7a5affeb UD |
286 | |
287 | #ifdef __USE_XOPEN | |
288 | /* Another name for `wcsstr' from XPG4. */ | |
d8387c7b UD |
289 | # ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO |
290 | extern "C++" wchar_t *wcswcs (wchar_t *__haystack, __const wchar_t *__needle) | |
291 | __THROW __asm ("wcswcs") __attribute_pure__; | |
292 | extern "C++" __const wchar_t *wcswcs (__const wchar_t *__haystack, | |
293 | __const wchar_t *__needle) | |
294 | __THROW __asm ("wcswcs") __attribute_pure__; | |
295 | # else | |
7a5affeb UD |
296 | extern wchar_t *wcswcs (__const wchar_t *__haystack, __const wchar_t *__needle) |
297 | __THROW __attribute_pure__; | |
d8387c7b | 298 | # endif |
7a5affeb | 299 | #endif |
30de3b18 | 300 | |
6cbe890a | 301 | #ifdef __USE_XOPEN2K8 |
4bca4c17 | 302 | /* Return the number of wide characters in S, but at most MAXLEN. */ |
fb4dfa0c AJ |
303 | extern size_t wcsnlen (__const wchar_t *__s, size_t __maxlen) |
304 | __THROW __attribute_pure__; | |
4bca4c17 UD |
305 | #endif |
306 | ||
30de3b18 | 307 | |
bb27a6eb | 308 | __BEGIN_NAMESPACE_STD |
1618c590 | 309 | /* Search N wide characters of S for C. */ |
d8387c7b UD |
310 | #ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO |
311 | extern "C++" wchar_t *wmemchr (wchar_t *__s, wchar_t __c, size_t __n) | |
312 | __THROW __asm ("wmemchr") __attribute_pure__; | |
313 | extern "C++" __const wchar_t *wmemchr (__const wchar_t *__s, wchar_t __c, | |
314 | size_t __n) | |
315 | __THROW __asm ("wmemchr") __attribute_pure__; | |
316 | #else | |
c1422e5b | 317 | extern wchar_t *wmemchr (__const wchar_t *__s, wchar_t __c, size_t __n) |
fb4dfa0c | 318 | __THROW __attribute_pure__; |
d8387c7b | 319 | #endif |
30de3b18 | 320 | |
1618c590 | 321 | /* Compare N wide characters of S1 and S2. */ |
c6e13027 | 322 | extern int wmemcmp (__const wchar_t *__s1, __const wchar_t *__s2, size_t __n) |
fb4dfa0c | 323 | __THROW __attribute_pure__; |
30de3b18 | 324 | |
1618c590 | 325 | /* Copy N wide characters of SRC to DEST. */ |
c1422e5b UD |
326 | extern wchar_t *wmemcpy (wchar_t *__restrict __s1, |
327 | __const wchar_t *__restrict __s2, size_t __n) __THROW; | |
30de3b18 | 328 | |
1618c590 | 329 | /* Copy N wide characters of SRC to DEST, guaranteeing |
30de3b18 | 330 | correct behavior for overlapping strings. */ |
c1422e5b UD |
331 | extern wchar_t *wmemmove (wchar_t *__s1, __const wchar_t *__s2, size_t __n) |
332 | __THROW; | |
30de3b18 | 333 | |
1618c590 | 334 | /* Set N wide characters of S to C. */ |
c1422e5b | 335 | extern wchar_t *wmemset (wchar_t *__s, wchar_t __c, size_t __n) __THROW; |
bb27a6eb | 336 | __END_NAMESPACE_STD |
30de3b18 | 337 | |
d64b6ad0 UD |
338 | #ifdef __USE_GNU |
339 | /* Copy N wide characters of SRC to DEST and return pointer to following | |
340 | wide character. */ | |
c1422e5b UD |
341 | extern wchar_t *wmempcpy (wchar_t *__restrict __s1, |
342 | __const wchar_t *__restrict __s2, size_t __n) | |
343 | __THROW; | |
d64b6ad0 UD |
344 | #endif |
345 | ||
30de3b18 | 346 | |
bb27a6eb | 347 | __BEGIN_NAMESPACE_STD |
30de3b18 RM |
348 | /* Determine whether C constitutes a valid (one-byte) multibyte |
349 | character. */ | |
c1422e5b | 350 | extern wint_t btowc (int __c) __THROW; |
30de3b18 RM |
351 | |
352 | /* Determine whether C corresponds to a member of the extended | |
353 | character set whose multibyte representation is a single byte. */ | |
c1422e5b | 354 | extern int wctob (wint_t __c) __THROW; |
30de3b18 RM |
355 | |
356 | /* Determine whether PS points to an object representing the initial | |
357 | state. */ | |
8db6604d | 358 | extern int mbsinit (__const mbstate_t *__ps) __THROW __attribute_pure__; |
30de3b18 | 359 | |
30de3b18 RM |
360 | /* Write wide character representation of multibyte character pointed |
361 | to by S to PWC. */ | |
c1422e5b UD |
362 | extern size_t mbrtowc (wchar_t *__restrict __pwc, |
363 | __const char *__restrict __s, size_t __n, | |
364 | mbstate_t *__p) __THROW; | |
30de3b18 RM |
365 | |
366 | /* Write multibyte representation of wide character WC to S. */ | |
c1422e5b UD |
367 | extern size_t wcrtomb (char *__restrict __s, wchar_t __wc, |
368 | mbstate_t *__restrict __ps) __THROW; | |
30de3b18 | 369 | |
07a4742f | 370 | /* Return number of bytes in multibyte character pointed to by S. */ |
c1422e5b UD |
371 | extern size_t __mbrlen (__const char *__restrict __s, size_t __n, |
372 | mbstate_t *__restrict __ps) __THROW; | |
373 | extern size_t mbrlen (__const char *__restrict __s, size_t __n, | |
374 | mbstate_t *__restrict __ps) __THROW; | |
bb27a6eb | 375 | __END_NAMESPACE_STD |
07a4742f | 376 | |
07c416ed | 377 | #ifdef __USE_EXTERN_INLINES |
07a4742f | 378 | /* Define inline function as optimization. */ |
91682d70 UD |
379 | |
380 | /* We can use the BTOWC and WCTOB optimizations since we know that all | |
381 | locales must use ASCII encoding for the values in the ASCII range | |
382 | and because the wchar_t encoding is always ISO 10646. */ | |
383 | extern wint_t __btowc_alias (int __c) __asm ("btowc"); | |
b037a293 | 384 | __extern_inline wint_t |
91682d70 UD |
385 | __NTH (btowc (int __c)) |
386 | { return (__builtin_constant_p (__c) && __c >= '\0' && __c <= '\x7f' | |
387 | ? (wint_t) __c : __btowc_alias (__c)); } | |
388 | ||
389 | extern int __wctob_alias (wint_t __c) __asm ("wctob"); | |
b037a293 | 390 | __extern_inline int |
91682d70 UD |
391 | __NTH (wctob (wint_t __wc)) |
392 | { return (__builtin_constant_p (__wc) && __wc >= L'\0' && __wc <= L'\x7f' | |
393 | ? (int) __wc : __wctob_alias (__wc)); } | |
394 | ||
b037a293 | 395 | __extern_inline size_t |
f377d022 UD |
396 | __NTH (mbrlen (__const char *__restrict __s, size_t __n, |
397 | mbstate_t *__restrict __ps)) | |
2f6d1f1b | 398 | { return (__ps != NULL |
bdbf022d | 399 | ? mbrtowc (NULL, __s, __n, __ps) : __mbrlen (__s, __n, NULL)); } |
07a4742f RM |
400 | #endif |
401 | ||
bb27a6eb | 402 | __BEGIN_NAMESPACE_STD |
036cc82f RM |
403 | /* Write wide character representation of multibyte character string |
404 | SRC to DST. */ | |
c1422e5b UD |
405 | extern size_t mbsrtowcs (wchar_t *__restrict __dst, |
406 | __const char **__restrict __src, size_t __len, | |
407 | mbstate_t *__restrict __ps) __THROW; | |
30de3b18 RM |
408 | |
409 | /* Write multibyte character representation of wide character string | |
410 | SRC to DST. */ | |
c1422e5b UD |
411 | extern size_t wcsrtombs (char *__restrict __dst, |
412 | __const wchar_t **__restrict __src, size_t __len, | |
413 | mbstate_t *__restrict __ps) __THROW; | |
bb27a6eb | 414 | __END_NAMESPACE_STD |
30de3b18 | 415 | |
75cd5204 | 416 | |
6cbe890a | 417 | #ifdef __USE_XOPEN2K8 |
036cc82f RM |
418 | /* Write wide character representation of at most NMC bytes of the |
419 | multibyte character string SRC to DST. */ | |
c1422e5b UD |
420 | extern size_t mbsnrtowcs (wchar_t *__restrict __dst, |
421 | __const char **__restrict __src, size_t __nmc, | |
422 | size_t __len, mbstate_t *__restrict __ps) __THROW; | |
036cc82f RM |
423 | |
424 | /* Write multibyte character representation of at most NWC characters | |
425 | from the wide character string SRC to DST. */ | |
c1422e5b UD |
426 | extern size_t wcsnrtombs (char *__restrict __dst, |
427 | __const wchar_t **__restrict __src, | |
428 | size_t __nwc, size_t __len, | |
429 | mbstate_t *__restrict __ps) __THROW; | |
6cbe890a | 430 | #endif /* use POSIX 2008 */ |
e34b0f29 | 431 | |
036cc82f | 432 | |
75cd5204 | 433 | /* The following functions are extensions found in X/Open CAE. */ |
9756dfe1 | 434 | #ifdef __USE_XOPEN |
75cd5204 | 435 | /* Determine number of column positions required for C. */ |
b6d64fb0 | 436 | extern int wcwidth (wchar_t __c) __THROW; |
75cd5204 RM |
437 | |
438 | /* Determine number of column positions required for first N wide | |
439 | characters (or fewer if S ends before this) in S. */ | |
c1422e5b | 440 | extern int wcswidth (__const wchar_t *__s, size_t __n) __THROW; |
9756dfe1 | 441 | #endif /* Use X/Open. */ |
75cd5204 RM |
442 | |
443 | ||
bb27a6eb | 444 | __BEGIN_NAMESPACE_STD |
75cd5204 RM |
445 | /* Convert initial portion of the wide string NPTR to `double' |
446 | representation. */ | |
c1422e5b UD |
447 | extern double wcstod (__const wchar_t *__restrict __nptr, |
448 | wchar_t **__restrict __endptr) __THROW; | |
bb27a6eb | 449 | __END_NAMESPACE_STD |
75cd5204 | 450 | |
ec751a23 | 451 | #ifdef __USE_ISOC99 |
bb27a6eb | 452 | __BEGIN_NAMESPACE_C99 |
75cd5204 | 453 | /* Likewise for `float' and `long double' sizes of floating-point numbers. */ |
c1422e5b UD |
454 | extern float wcstof (__const wchar_t *__restrict __nptr, |
455 | wchar_t **__restrict __endptr) __THROW; | |
456 | extern long double wcstold (__const wchar_t *__restrict __nptr, | |
457 | wchar_t **__restrict __endptr) __THROW; | |
bb27a6eb | 458 | __END_NAMESPACE_C99 |
91bc38d0 | 459 | #endif /* C99 */ |
75cd5204 RM |
460 | |
461 | ||
bb27a6eb | 462 | __BEGIN_NAMESPACE_STD |
75cd5204 RM |
463 | /* Convert initial portion of wide string NPTR to `long int' |
464 | representation. */ | |
c1422e5b UD |
465 | extern long int wcstol (__const wchar_t *__restrict __nptr, |
466 | wchar_t **__restrict __endptr, int __base) __THROW; | |
75cd5204 RM |
467 | |
468 | /* Convert initial portion of wide string NPTR to `unsigned long int' | |
469 | representation. */ | |
c1422e5b UD |
470 | extern unsigned long int wcstoul (__const wchar_t *__restrict __nptr, |
471 | wchar_t **__restrict __endptr, int __base) | |
472 | __THROW; | |
bb27a6eb | 473 | __END_NAMESPACE_STD |
75cd5204 | 474 | |
7a5affeb | 475 | #if defined __USE_ISOC99 || (defined __GNUC__ && defined __USE_GNU) |
bb27a6eb | 476 | __BEGIN_NAMESPACE_C99 |
9e6e344e | 477 | /* Convert initial portion of wide string NPTR to `long long int' |
75cd5204 | 478 | representation. */ |
7782d0bf | 479 | __extension__ |
7a5affeb UD |
480 | extern long long int wcstoll (__const wchar_t *__restrict __nptr, |
481 | wchar_t **__restrict __endptr, int __base) | |
c1422e5b | 482 | __THROW; |
75cd5204 RM |
483 | |
484 | /* Convert initial portion of wide string NPTR to `unsigned long long int' | |
485 | representation. */ | |
7782d0bf | 486 | __extension__ |
7a5affeb UD |
487 | extern unsigned long long int wcstoull (__const wchar_t *__restrict __nptr, |
488 | wchar_t **__restrict __endptr, | |
489 | int __base) __THROW; | |
7a5affeb | 490 | __END_NAMESPACE_C99 |
bb27a6eb | 491 | #endif /* ISO C99 or GCC and GNU. */ |
75cd5204 | 492 | |
7a5affeb | 493 | #if defined __GNUC__ && defined __USE_GNU |
9e6e344e | 494 | /* Convert initial portion of wide string NPTR to `long long int' |
2f6d1f1b | 495 | representation. */ |
7782d0bf | 496 | __extension__ |
7a5affeb UD |
497 | extern long long int wcstoq (__const wchar_t *__restrict __nptr, |
498 | wchar_t **__restrict __endptr, int __base) | |
c1422e5b | 499 | __THROW; |
2f6d1f1b UD |
500 | |
501 | /* Convert initial portion of wide string NPTR to `unsigned long long int' | |
502 | representation. */ | |
7782d0bf | 503 | __extension__ |
7a5affeb UD |
504 | extern unsigned long long int wcstouq (__const wchar_t *__restrict __nptr, |
505 | wchar_t **__restrict __endptr, | |
506 | int __base) __THROW; | |
507 | #endif /* GCC and use GNU. */ | |
2f6d1f1b | 508 | |
0501d603 UD |
509 | #ifdef __USE_GNU |
510 | /* The concept of one static locale per category is not very well | |
511 | thought out. Many applications will need to process its data using | |
512 | information from several different locales. Another application is | |
513 | the implementation of the internationalization handling in the | |
514 | upcoming ISO C++ standard library. To support this another set of | |
515 | the functions using locale data exist which have an additional | |
516 | argument. | |
517 | ||
518 | Attention: all these functions are *not* standardized in any form. | |
519 | This is a proof-of-concept implementation. */ | |
520 | ||
521 | /* Structure for reentrant locale using functions. This is an | |
522 | (almost) opaque type for the user level programs. */ | |
523 | # include <xlocale.h> | |
524 | ||
525 | /* Special versions of the functions above which take the locale to | |
526 | use as an additional parameter. */ | |
1ab62b32 RM |
527 | extern long int wcstol_l (__const wchar_t *__restrict __nptr, |
528 | wchar_t **__restrict __endptr, int __base, | |
529 | __locale_t __loc) __THROW; | |
0501d603 | 530 | |
1ab62b32 RM |
531 | extern unsigned long int wcstoul_l (__const wchar_t *__restrict __nptr, |
532 | wchar_t **__restrict __endptr, | |
533 | int __base, __locale_t __loc) __THROW; | |
0501d603 | 534 | |
7782d0bf | 535 | __extension__ |
1ab62b32 RM |
536 | extern long long int wcstoll_l (__const wchar_t *__restrict __nptr, |
537 | wchar_t **__restrict __endptr, | |
538 | int __base, __locale_t __loc) __THROW; | |
0501d603 | 539 | |
7782d0bf | 540 | __extension__ |
1ab62b32 RM |
541 | extern unsigned long long int wcstoull_l (__const wchar_t *__restrict __nptr, |
542 | wchar_t **__restrict __endptr, | |
543 | int __base, __locale_t __loc) | |
544 | __THROW; | |
0501d603 | 545 | |
1ab62b32 RM |
546 | extern double wcstod_l (__const wchar_t *__restrict __nptr, |
547 | wchar_t **__restrict __endptr, __locale_t __loc) | |
548 | __THROW; | |
0501d603 | 549 | |
1ab62b32 RM |
550 | extern float wcstof_l (__const wchar_t *__restrict __nptr, |
551 | wchar_t **__restrict __endptr, __locale_t __loc) | |
552 | __THROW; | |
0501d603 | 553 | |
1ab62b32 RM |
554 | extern long double wcstold_l (__const wchar_t *__restrict __nptr, |
555 | wchar_t **__restrict __endptr, | |
556 | __locale_t __loc) __THROW; | |
8593482f | 557 | #endif /* use GNU */ |
0501d603 | 558 | |
75cd5204 | 559 | |
8593482f | 560 | #ifdef __USE_XOPEN2K8 |
75cd5204 RM |
561 | /* Copy SRC to DEST, returning the address of the terminating L'\0' in |
562 | DEST. */ | |
4f197237 AS |
563 | extern wchar_t *wcpcpy (wchar_t *__restrict __dest, |
564 | __const wchar_t *__restrict __src) __THROW; | |
75cd5204 RM |
565 | |
566 | /* Copy no more than N characters of SRC to DEST, returning the address of | |
567 | the last character written into DEST. */ | |
4f197237 AS |
568 | extern wchar_t *wcpncpy (wchar_t *__restrict __dest, |
569 | __const wchar_t *__restrict __src, size_t __n) | |
c1422e5b | 570 | __THROW; |
75cd5204 RM |
571 | |
572 | ||
d64b6ad0 | 573 | /* Wide character I/O functions. */ |
1c31aa79 | 574 | |
1c31aa79 UD |
575 | /* Like OPEN_MEMSTREAM, but the stream is wide oriented and produces |
576 | a wide character string. */ | |
577 | extern __FILE *open_wmemstream (wchar_t **__bufloc, size_t *__sizeloc) __THROW; | |
578 | #endif | |
579 | ||
087722b8 | 580 | #if defined __USE_ISOC95 || defined __USE_UNIX98 |
bb27a6eb | 581 | __BEGIN_NAMESPACE_STD |
d64b6ad0 UD |
582 | |
583 | /* Select orientation for stream. */ | |
d1646309 | 584 | extern int fwide (__FILE *__fp, int __mode) __THROW; |
d64b6ad0 UD |
585 | |
586 | ||
2c008571 UD |
587 | /* Write formatted output to STREAM. |
588 | ||
589 | This function is a possible cancellation point and therefore not | |
590 | marked with __THROW. */ | |
d1646309 | 591 | extern int fwprintf (__FILE *__restrict __stream, |
c1422e5b | 592 | __const wchar_t *__restrict __format, ...) |
2c008571 UD |
593 | /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */; |
594 | /* Write formatted output to stdout. | |
595 | ||
596 | This function is a possible cancellation point and therefore not | |
597 | marked with __THROW. */ | |
c1422e5b | 598 | extern int wprintf (__const wchar_t *__restrict __format, ...) |
2c008571 | 599 | /* __attribute__ ((__format__ (__wprintf__, 1, 2))) */; |
d64b6ad0 | 600 | /* Write formatted output of at most N characters to S. */ |
c1422e5b UD |
601 | extern int swprintf (wchar_t *__restrict __s, size_t __n, |
602 | __const wchar_t *__restrict __format, ...) | |
603 | __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */; | |
d64b6ad0 | 604 | |
2c008571 UD |
605 | /* Write formatted output to S from argument list ARG. |
606 | ||
607 | This function is a possible cancellation point and therefore not | |
608 | marked with __THROW. */ | |
d1646309 | 609 | extern int vfwprintf (__FILE *__restrict __s, |
c1422e5b UD |
610 | __const wchar_t *__restrict __format, |
611 | __gnuc_va_list __arg) | |
2c008571 UD |
612 | /* __attribute__ ((__format__ (__wprintf__, 2, 0))) */; |
613 | /* Write formatted output to stdout from argument list ARG. | |
614 | ||
615 | This function is a possible cancellation point and therefore not | |
616 | marked with __THROW. */ | |
c1422e5b UD |
617 | extern int vwprintf (__const wchar_t *__restrict __format, |
618 | __gnuc_va_list __arg) | |
2c008571 | 619 | /* __attribute__ ((__format__ (__wprintf__, 1, 0))) */; |
d64b6ad0 UD |
620 | /* Write formatted output of at most N character to S from argument |
621 | list ARG. */ | |
c1422e5b UD |
622 | extern int vswprintf (wchar_t *__restrict __s, size_t __n, |
623 | __const wchar_t *__restrict __format, | |
624 | __gnuc_va_list __arg) | |
625 | __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */; | |
d64b6ad0 UD |
626 | |
627 | ||
2c008571 UD |
628 | /* Read formatted input from STREAM. |
629 | ||
630 | This function is a possible cancellation point and therefore not | |
631 | marked with __THROW. */ | |
d1646309 | 632 | extern int fwscanf (__FILE *__restrict __stream, |
c1422e5b | 633 | __const wchar_t *__restrict __format, ...) |
2c008571 UD |
634 | /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */; |
635 | /* Read formatted input from stdin. | |
636 | ||
637 | This function is a possible cancellation point and therefore not | |
638 | marked with __THROW. */ | |
c1422e5b | 639 | extern int wscanf (__const wchar_t *__restrict __format, ...) |
2c008571 | 640 | /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */; |
d64b6ad0 | 641 | /* Read formatted input from S. */ |
c1422e5b UD |
642 | extern int swscanf (__const wchar_t *__restrict __s, |
643 | __const wchar_t *__restrict __format, ...) | |
644 | __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */; | |
7a5affeb | 645 | |
874aa523 UD |
646 | # if defined __USE_ISOC99 && !defined __USE_GNU \ |
647 | && (!defined __LDBL_COMPAT || !defined __REDIRECT) \ | |
648 | && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K) | |
649 | # ifdef __REDIRECT | |
650 | /* For strict ISO C99 or POSIX compliance disallow %as, %aS and %a[ | |
651 | GNU extension which conflicts with valid %a followed by letter | |
652 | s, S or [. */ | |
653 | extern int __REDIRECT (fwscanf, (__FILE *__restrict __stream, | |
654 | __const wchar_t *__restrict __format, ...), | |
655 | __isoc99_fwscanf) | |
656 | /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */; | |
657 | extern int __REDIRECT (wscanf, (__const wchar_t *__restrict __format, ...), | |
658 | __isoc99_wscanf) | |
659 | /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */; | |
f32f2869 JJ |
660 | extern int __REDIRECT_NTH (swscanf, (__const wchar_t *__restrict __s, |
661 | __const wchar_t *__restrict __format, | |
662 | ...), __isoc99_swscanf) | |
663 | /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */; | |
874aa523 UD |
664 | # else |
665 | extern int __isoc99_fwscanf (__FILE *__restrict __stream, | |
666 | __const wchar_t *__restrict __format, ...); | |
667 | extern int __isoc99_wscanf (__const wchar_t *__restrict __format, ...); | |
668 | extern int __isoc99_swscanf (__const wchar_t *__restrict __s, | |
669 | __const wchar_t *__restrict __format, ...) | |
670 | __THROW; | |
671 | # define fwscanf __isoc99_fwscanf | |
672 | # define wscanf __isoc99_wscanf | |
673 | # define swscanf __isoc99_swscanf | |
674 | # endif | |
675 | # endif | |
676 | ||
bb27a6eb | 677 | __END_NAMESPACE_STD |
087722b8 | 678 | #endif /* Use ISO C95, C99 and Unix98. */ |
d64b6ad0 | 679 | |
91bc38d0 | 680 | #ifdef __USE_ISOC99 |
7a5affeb | 681 | __BEGIN_NAMESPACE_C99 |
2c008571 UD |
682 | /* Read formatted input from S into argument list ARG. |
683 | ||
684 | This function is a possible cancellation point and therefore not | |
685 | marked with __THROW. */ | |
d1646309 | 686 | extern int vfwscanf (__FILE *__restrict __s, |
c1422e5b UD |
687 | __const wchar_t *__restrict __format, |
688 | __gnuc_va_list __arg) | |
2c008571 UD |
689 | /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */; |
690 | /* Read formatted input from stdin into argument list ARG. | |
691 | ||
692 | This function is a possible cancellation point and therefore not | |
693 | marked with __THROW. */ | |
c1422e5b UD |
694 | extern int vwscanf (__const wchar_t *__restrict __format, |
695 | __gnuc_va_list __arg) | |
2c008571 | 696 | /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */; |
d64b6ad0 | 697 | /* Read formatted input from S into argument list ARG. */ |
c1422e5b UD |
698 | extern int vswscanf (__const wchar_t *__restrict __s, |
699 | __const wchar_t *__restrict __format, | |
700 | __gnuc_va_list __arg) | |
701 | __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */; | |
7a5affeb | 702 | |
874aa523 UD |
703 | # if !defined __USE_GNU \ |
704 | && (!defined __LDBL_COMPAT || !defined __REDIRECT) \ | |
705 | && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K) | |
706 | # ifdef __REDIRECT | |
707 | extern int __REDIRECT (vfwscanf, (__FILE *__restrict __s, | |
708 | __const wchar_t *__restrict __format, | |
709 | __gnuc_va_list __arg), __isoc99_vfwscanf) | |
710 | /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */; | |
711 | extern int __REDIRECT (vwscanf, (__const wchar_t *__restrict __format, | |
712 | __gnuc_va_list __arg), __isoc99_vwscanf) | |
713 | /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */; | |
f32f2869 JJ |
714 | extern int __REDIRECT_NTH (vswscanf, (__const wchar_t *__restrict __s, |
715 | __const wchar_t *__restrict __format, | |
716 | __gnuc_va_list __arg), __isoc99_vswscanf) | |
717 | /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */; | |
874aa523 UD |
718 | # else |
719 | extern int __isoc99_vfwscanf (__FILE *__restrict __s, | |
720 | __const wchar_t *__restrict __format, | |
721 | __gnuc_va_list __arg); | |
722 | extern int __isoc99_vwscanf (__const wchar_t *__restrict __format, | |
723 | __gnuc_va_list __arg); | |
724 | extern int __isoc99_vswscanf (__const wchar_t *__restrict __s, | |
725 | __const wchar_t *__restrict __format, | |
726 | __gnuc_va_list __arg) __THROW; | |
727 | # define vfwscanf __isoc99_vfwscanf | |
728 | # define vwscanf __isoc99_vwscanf | |
729 | # define vswscanf __isoc99_vswscanf | |
730 | # endif | |
731 | # endif | |
732 | ||
7a5affeb | 733 | __END_NAMESPACE_C99 |
91bc38d0 | 734 | #endif /* Use ISO C99. */ |
d64b6ad0 UD |
735 | |
736 | ||
bb27a6eb | 737 | __BEGIN_NAMESPACE_STD |
2c008571 UD |
738 | /* Read a character from STREAM. |
739 | ||
740 | These functions are possible cancellation points and therefore not | |
741 | marked with __THROW. */ | |
742 | extern wint_t fgetwc (__FILE *__stream); | |
743 | extern wint_t getwc (__FILE *__stream); | |
d64b6ad0 | 744 | |
2c008571 | 745 | /* Read a character from stdin. |
d64b6ad0 | 746 | |
2c008571 UD |
747 | This function is a possible cancellation point and therefore not |
748 | marked with __THROW. */ | |
749 | extern wint_t getwchar (void); | |
d64b6ad0 | 750 | |
d64b6ad0 | 751 | |
2c008571 UD |
752 | /* Write a character to STREAM. |
753 | ||
754 | These functions are possible cancellation points and therefore not | |
755 | marked with __THROW. */ | |
756 | extern wint_t fputwc (wchar_t __wc, __FILE *__stream); | |
757 | extern wint_t putwc (wchar_t __wc, __FILE *__stream); | |
758 | ||
759 | /* Write a character to stdout. | |
760 | ||
4c1423ed | 761 | This function is a possible cancellation point and therefore not |
2c008571 UD |
762 | marked with __THROW. */ |
763 | extern wint_t putwchar (wchar_t __wc); | |
d64b6ad0 | 764 | |
91bc38d0 UD |
765 | |
766 | /* Get a newline-terminated wide character string of finite length | |
2c008571 UD |
767 | from STREAM. |
768 | ||
4c1423ed | 769 | This function is a possible cancellation point and therefore not |
2c008571 | 770 | marked with __THROW. */ |
91bc38d0 | 771 | extern wchar_t *fgetws (wchar_t *__restrict __ws, int __n, |
2c008571 UD |
772 | __FILE *__restrict __stream); |
773 | ||
774 | /* Write a string to STREAM. | |
91bc38d0 | 775 | |
4c1423ed | 776 | This function is a possible cancellation point and therefore not |
2c008571 | 777 | marked with __THROW. */ |
91bc38d0 | 778 | extern int fputws (__const wchar_t *__restrict __ws, |
2c008571 UD |
779 | __FILE *__restrict __stream); |
780 | ||
91bc38d0 | 781 | |
2c008571 | 782 | /* Push a character back onto the input buffer of STREAM. |
91bc38d0 | 783 | |
4c1423ed | 784 | This function is a possible cancellation point and therefore not |
2c008571 UD |
785 | marked with __THROW. */ |
786 | extern wint_t ungetwc (wint_t __wc, __FILE *__stream); | |
bb27a6eb | 787 | __END_NAMESPACE_STD |
91bc38d0 UD |
788 | |
789 | ||
d64b6ad0 | 790 | #ifdef __USE_GNU |
91bc38d0 | 791 | /* These are defined to be equivalent to the `char' functions defined |
2c008571 | 792 | in POSIX.1:1996. |
91bc38d0 | 793 | |
2c008571 UD |
794 | These functions are not part of POSIX and therefore no official |
795 | cancellation point. But due to similarity with an POSIX interface | |
796 | or due to the implementation they are cancellation points and | |
797 | therefore not marked with __THROW. */ | |
798 | extern wint_t getwc_unlocked (__FILE *__stream); | |
799 | extern wint_t getwchar_unlocked (void); | |
91bc38d0 | 800 | |
2c008571 UD |
801 | /* This is the wide character version of a GNU extension. |
802 | ||
803 | This function is not part of POSIX and therefore no official | |
804 | cancellation point. But due to similarity with an POSIX interface | |
805 | or due to the implementation it is a cancellation point and | |
806 | therefore not marked with __THROW. */ | |
807 | extern wint_t fgetwc_unlocked (__FILE *__stream); | |
808 | ||
809 | /* Faster version when locking is not necessary. | |
810 | ||
811 | This function is not part of POSIX and therefore no official | |
812 | cancellation point. But due to similarity with an POSIX interface | |
813 | or due to the implementation it is a cancellation point and | |
814 | therefore not marked with __THROW. */ | |
815 | extern wint_t fputwc_unlocked (wchar_t __wc, __FILE *__stream); | |
d64b6ad0 UD |
816 | |
817 | /* These are defined to be equivalent to the `char' functions defined | |
2c008571 | 818 | in POSIX.1:1996. |
d64b6ad0 | 819 | |
2c008571 UD |
820 | These functions are not part of POSIX and therefore no official |
821 | cancellation point. But due to similarity with an POSIX interface | |
822 | or due to the implementation they are cancellation points and | |
823 | therefore not marked with __THROW. */ | |
824 | extern wint_t putwc_unlocked (wchar_t __wc, __FILE *__stream); | |
825 | extern wint_t putwchar_unlocked (wchar_t __wc); | |
d64b6ad0 | 826 | |
2c008571 UD |
827 | |
828 | /* This function does the same as `fgetws' but does not lock the stream. | |
829 | ||
830 | This function is not part of POSIX and therefore no official | |
831 | cancellation point. But due to similarity with an POSIX interface | |
832 | or due to the implementation it is a cancellation point and | |
833 | therefore not marked with __THROW. */ | |
c1422e5b | 834 | extern wchar_t *fgetws_unlocked (wchar_t *__restrict __ws, int __n, |
2c008571 UD |
835 | __FILE *__restrict __stream); |
836 | ||
837 | /* This function does the same as `fputws' but does not lock the stream. | |
d64b6ad0 | 838 | |
2c008571 UD |
839 | This function is not part of POSIX and therefore no official |
840 | cancellation point. But due to similarity with an POSIX interface | |
841 | or due to the implementation it is a cancellation point and | |
842 | therefore not marked with __THROW. */ | |
c1422e5b | 843 | extern int fputws_unlocked (__const wchar_t *__restrict __ws, |
2c008571 | 844 | __FILE *__restrict __stream); |
d64b6ad0 UD |
845 | #endif |
846 | ||
847 | ||
7a5affeb | 848 | __BEGIN_NAMESPACE_C99 |
d64b6ad0 UD |
849 | /* Format TP into S according to FORMAT. |
850 | Write no more than MAXSIZE wide characters and return the number | |
851 | of wide characters written, or 0 if it would exceed MAXSIZE. */ | |
c1422e5b UD |
852 | extern size_t wcsftime (wchar_t *__restrict __s, size_t __maxsize, |
853 | __const wchar_t *__restrict __format, | |
21848d0b | 854 | __const struct tm *__restrict __tp) __THROW; |
7a5affeb | 855 | __END_NAMESPACE_C99 |
d64b6ad0 | 856 | |
c4d6f155 RM |
857 | # ifdef __USE_GNU |
858 | # include <xlocale.h> | |
859 | ||
860 | /* Similar to `wcsftime' but takes the information from | |
861 | the provided locale and not the global locale. */ | |
c4d6f155 RM |
862 | extern size_t wcsftime_l (wchar_t *__restrict __s, size_t __maxsize, |
863 | __const wchar_t *__restrict __format, | |
864 | __const struct tm *__restrict __tp, | |
865 | __locale_t __loc) __THROW; | |
866 | # endif | |
867 | ||
9756dfe1 UD |
868 | /* The X/Open standard demands that most of the functions defined in |
869 | the <wctype.h> header must also appear here. This is probably | |
870 | because some X/Open members wrote their implementation before the | |
871 | ISO C standard was published and introduced the better solution. | |
872 | We have to provide these definitions for compliance reasons but we | |
873 | do this nonsense only if really necessary. */ | |
874 | #if defined __USE_UNIX98 && !defined __USE_GNU | |
875 | # define __need_iswxxx | |
876 | # include <wctype.h> | |
877 | #endif | |
878 | ||
8215c9ec | 879 | /* Define some macros helping to catch buffer overflows. */ |
de1c3ebb | 880 | #if __USE_FORTIFY_LEVEL > 0 && defined __extern_always_inline |
8215c9ec UD |
881 | # include <bits/wchar2.h> |
882 | #endif | |
883 | ||
54e98f69 RM |
884 | #ifdef __LDBL_COMPAT |
885 | # include <bits/wchar-ldbl.h> | |
886 | #endif | |
887 | ||
30de3b18 RM |
888 | __END_DECLS |
889 | ||
d64b6ad0 UD |
890 | #endif /* _WCHAR_H defined */ |
891 | ||
0f2ae55c UD |
892 | #endif /* wchar.h */ |
893 | ||
9ac9129d | 894 | /* Undefine all __need_* constants in case we are included to get those |
b4354cf4 UD |
895 | constants but the whole file was already read. */ |
896 | #undef __need_mbstate_t | |
897 | #undef __need_wint_t |