OSDN Git Service

Merge W32API updates, from Cygwin CVS, into legacy branch.
[mingw/mingw-org-wsl.git] / mingwrt / include / wchar.h
1 /*
2  * wchar.h
3  *
4  * Declarations relating to support for wide characters; many are simply
5  * inherited by (sub-optimal) inclusion of other header files.
6  *
7  * $Id$
8  *
9  * Unattributed original source.
10  * Adapted by Rob Savoye <rob@cygnus.com>
11  * Copyright (C) 1997, 1999-2009, 2011, 2015, 2016, MinGW.org Project.
12  *
13  *
14  * Permission is hereby granted, free of charge, to any person obtaining a
15  * copy of this software and associated documentation files (the "Software"),
16  * to deal in the Software without restriction, including without limitation
17  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
18  * and/or sell copies of the Software, and to permit persons to whom the
19  * Software is furnished to do so, subject to the following conditions:
20  *
21  * The above copyright notice, this permission notice, and the following
22  * disclaimer shall be included in all copies or substantial portions of
23  * the Software.
24  *
25  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
26  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
28  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
30  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OF OR OTHER
31  * DEALINGS IN THE SOFTWARE.
32  *
33  */
34 #ifndef _WCHAR_H
35 #pragma GCC system_header
36
37 /* This header declares prototypes for wchar_t string functions, as are
38  * prescribed by ISO-C, but which MSVC also expects, (in contravention of
39  * ISO-C prescriptions), to find in <string.h>.  To accommodate this MSVC
40  * anomaly, we make provision for <string.h> to include a selected subset
41  * of <wchar.h>; thus, we do not immediately define _WCHAR_T...
42  */
43 #ifndef __STRING_H_SOURCED__
44 /* ...but defer it until we have confirmed that this is NOT inclusion for
45  * only this subset of <wchar.h> declarations.
46  */
47 #define _WCHAR_H
48
49 /* All MinGW headers are required to include <_mingw.h>; in the case of
50  * selective inclusion by <string.h>, we expect it to have already done
51  * so, but since that doesn't apply here, we must do it ourselves.
52  */
53 #include <_mingw.h>
54
55 #ifndef __STRICT_ANSI__
56  /* MSDN says that isw* char classifications appear in both <wchar.h>,
57   * and in <wctype.h>.  Although these <wctype.h> classifications are as
58   * prescribed by ISO-C, their exposure in <wchar.h> is not; nonetheless,
59   * we replicate them here, for MSDN conformity.
60   */
61 # include <wctype.h>
62
63  /* This is also necessary, to support the non-ANSI wchar.h declarations
64   * which MSDN identifies as being provided here.
65   */
66 # include <sys/types.h>
67
68 #endif  /* !__STRICT_ANSI__ */
69
70 #define WCHAR_MIN       0
71 #define WCHAR_MAX       0xffff
72
73 #define WEOF            (wchar_t)(0xffff)
74
75 #ifndef RC_INVOKED
76 #define __WCHAR_H_SOURCED__
77 /* ISO-C, POSIX, and Microsoft specify an overlap of content between
78  * <wchar.h> and other system header files; by inclusion of such other
79  * headers within this "__WCHAR_H_SOURCED__" scope, we may selectively
80  * retrieve the overlapping content, without requiring duplication of
81  * that content here; thus, from...
82  */
83 #include "stdio.h"
84 /* ...we obtain (possibly indirect) definitions and declarations for:
85  *
86  *  macros  NULL, FILENAME_MAX
87  *  types   size_t, wchar_t, wint_t, va_list (a.k.a. __VALIST), FILE
88  *  types   ssize_t, off_t, __off64_t, (conditionally, as needed)
89  *
90  *  int     fwprintf (FILE *, const wchar_t *, ...);
91  *  int     wprintf (const wchar_t *, ...);
92  *  int     vfwprintf (FILE *, const wchar_t *, __VALIST);
93  *  int     vwprintf (const wchar_t *, __VALIST);
94  *  int     snwprintf (wchar_t *, size_t, const wchar_t *, ...);
95  *  int    _snwprintf (wchar_t *, size_t, const wchar_t *, ...);
96  *  int    _vscwprintf (const wchar_t *, __VALIST);
97  *  int    _vsnwprintf (wchar_t *, size_t, const wchar_t *, __VALIST);
98  *  int     vsnwprintf (wchar_t *, size_t, const wchar_t *, __VALIST);
99  *  int     fwscanf (FILE *, const wchar_t *, ...);
100  *  int     wscanf (const wchar_t *, ...);
101  *  int     swscanf (const wchar_t *, const wchar_t *, ...);
102  *  int     vwscanf (const wchar_t *, __VALIST);
103  *  int     vfwscanf (FILE *, const wchar_t *, __VALIST);
104  *  int     vswscanf (const wchar_t *, const wchar_t *, __VALIST);
105  *  wint_t  fgetwc (FILE *);
106  *  wint_t  fputwc (wchar_t, FILE *);
107  *  wint_t  ungetwc (wchar_t, FILE *);
108  *
109  * The following pair of Microsoft functions conflict with their
110  * corresponding ISO-C prototypes; consequently they will not be
111  * declared when "__STRICT_ANSI__" checking is in effect:
112  *
113  *  int  swprintf (wchar_t *, const wchar_t *, ...);
114  *  int  vswprintf (wchar_t *, const wchar_t *, __VALIST);
115  *
116  * The following group of functions is specified by ISO-C, but
117  * their Microsoft implementations are available only if use of
118  * "__MSVCRT__" is specified:
119  *
120  *  wchar_t * fgetws (wchar_t *, int, FILE *);
121  *  int       fputws (const wchar_t *, FILE *);
122  *  wint_t    getwc (FILE *);
123  *  wint_t    getwchar (void);
124  *  wint_t    putwc (wint_t, FILE *);
125  *  wint_t    putwchar (wint_t);
126  *
127  * The following group of functions is also dependent on use of
128  * "__MSVCRT__"; however, these are Microsoft specific, so they
129  * are not declared if "__STRICT_ANSI__" checking is specified:
130  *
131  *  wchar_t * _getws (wchar_t *);
132  *  int       _putws (const wchar_t *);
133  *  FILE    * _wfdopen (int, const wchar_t *);
134  *  FILE    * _wfopen (const wchar_t *, const wchar_t *);
135  *  FILE    * _wfreopen (const wchar_t *, const wchar_t *, FILE *);
136  *  FILE    * _wfsopen (const wchar_t *, const wchar_t *, int);
137  *  wchar_t * _wtmpnam (wchar_t *);
138  *  wchar_t * _wtempnam (const wchar_t *, const wchar_t *);
139  *  int       _wrename (const wchar_t *, const wchar_t *);
140  *  int       _wremove (const wchar_t *);
141  *  void      _wperror (const wchar_t *);
142  *  FILE    * _wpopen (const wchar_t *, const wchar_t *);
143  *
144  *
145  * In similar fashion, from...
146  */
147 #include "stdlib.h"
148 /* ...we obtain prototypes for universally supported functions:
149  *
150  *  long wcstol (const wchar_t *, wchar_t **, int);
151  *  unsigned long wcstoul (const wchar_t *, wchar_t **, int);
152  *  double wcstod (const wchar_t *, wchar_t **);
153  *
154  * The following are Microsoft specific, and require MSCVRT.DLL,
155  * or any of its non-free derivatives; they are not available to
156  * applications which use CRTDLL.DLL:
157  *
158  *  wchar_t *_wgetenv (const wchar_t *);
159  *  int _wputenv (const wchar_t *);
160  *  void _wsearchenv (const wchar_t *, const wchar_t *, wchar_t *);
161  *  int _wsystem (const wchar_t *);
162  *  void _wmakepath (wchar_t *, const wchar_t *, const wchar_t *,
163  *          const wchar_t *, const wchar_t *
164  *        );
165  *  void _wsplitpath (const wchar_t *, wchar_t *, wchar_t *,
166  *          wchar_t *, wchar_t *
167  *        );
168  *  wchar_t *_wfullpath (wchar_t *, const wchar_t *, size_t);
169  *
170  * ...while this pair are ISO-C99 standards, which are available
171  * in libmingwex.a, but not in any version of MSVCRT.DLL, (nor in
172  * any of its non-free derivatives prior to MSVCR120.DLL), nor in
173  * CRTDLL.DLL:
174  *
175  *  float wcstof (const wchar_t *restrict, wchar_t **restrict);
176  *  long double wcstold (const wchar_t *restrict, wchar_t **restrict);
177  *
178  *
179  * while from...
180  */
181 #include "direct.h"
182 /* ...we obtain prototypes for each of the following functions,
183  * (none of which are available when using CRTDLL.DLL):
184  *
185  *  int _wchdir (const wchar_t *);
186  *  wchar_t *_wgetcwd (wchar_t *, int);
187  *  wchar_t *_wgetdcwd (int, wchar_t *, int);
188  *  int _wmkdir (const wchar_t *);
189  *  int _wrmdir (const wchar_t *);
190  *
191  *
192  * From...
193  */
194 #include "sys/stat.h"
195 /* ...we obtain function prototypes, and all associated data type
196  * definitions for this pair of actual functions, in all versions of
197  * MSVCRT.DLL, and its non-free derivatives preceding MSVCR80.DLL, (or
198  * inline replacement implementations for MSVCR80.DLL and later):
199  *
200  *  int _wstat (const wchar_t *, struct _stat *);
201  *  int _wstati64 (const wchar_t *, struct _stati64 *);
202  *
203  * ...this additional actual function, available in MSVCRT.DLL from
204  * Win2K onwards, or in non-free MSVCR61.DLL and again requiring an
205  * inline replacement from MSVCR80.DLL onwards:
206  *
207  *  int _wstat64 (const wchar_t *, struct __stat64 *);
208  *
209  * ...and these actual functions, which are available only in non-free
210  * MSVCR80.DLL, and its later derivatives:
211  *
212  *  int _wstat32 (const wchar_t *, struct __stat32 *);
213  *  int _wstat32i64 (const wchar_t *, struct _stat32i64 *);
214  *  int _wstat64i32 (const wchar_t *, struct _stat64i32 *);
215  *
216  *
217  * while from...
218  */
219 #include "io.h"
220 /* ...we obtain function prototypes for each of the following, which
221  * are available in all versions of MSVCRT.DLL, (and all its non-free
222  * derivatives), but are not supported by CRTDLL.DLL:
223  *
224  *  int _waccess (const wchar_t *, int);
225  *  int _wchmod (const wchar_t *, int);
226  *  int _wcreat (const wchar_t *, int);
227  *  int _wopen (const wchar_t *, int, ...);
228  *  int _wsopen (const wchar_t *, int, int, ...);
229  *  int _wunlink (const wchar_t *);
230  *  wchar_t *_wmktemp (wchar_t *);
231  *
232  * ...and also function prototypes and definitions of all associated
233  * data types and manifest constants for the following, each of which
234  * is physically implemented in all versions of MSVCRT.DLL, and in each
235  * of its non-free variants prior to MSVCR80.DLL, or emulated by inline
236  * replacement functions for MSVCR80.DLL and later:
237  *
238  *  intptr_t _wfindfirst (wchar_t *, struct _wfinddata_t *);
239  *  int _wfindnext (intptr_t, struct _wfinddata_t *);
240  *
241  *  intptr_t _wfindfirsti64 (wchar_t *, struct _wfinddatai64_t *);
242  *  int _wfindnexti64 (intptr_t, struct _wfinddatai64_t *);
243  *
244  * ...this additional pair of functions, available in all versions of
245  * MSVCRT.DLL from Win2K, and non-free variants from MSVCR61.DLL:
246  *
247  *  intptr_t _wfindfirst64 (wchar_t *, struct __wfinddata64_t *);
248  *  int _wfindnext64 (intptr_t, struct __wfinddata64_t *);
249  *
250  * ...and these, which are only available in the non-free run-times
251  * from MSVCR80.DLL onwards:
252  *
253  *  intptr_t _wfindfirst32 (wchar_t *, struct __wfinddata32_t *);
254  *  int _wfindnext32 (intptr_t, struct __wfinddata32_t *);
255  *
256  *  intptr_t _wfindfirst32i64 (wchar_t *, struct _wfinddata32i64_t *);
257  *  int _wfindnext32i64 (intptr_t, struct _wfinddata32i64_t *);
258  *
259  *  intptr_t _wfindfirst64i32 (wchar_t *, struct _wfinddata64i32_t *);
260  *  int _wfindnext64i32 (intptr_t, struct _wfinddata64i32_t *);
261  *
262  * Additionally, although Microsoft's <wchar.h> may not declare it,
263  * this is required to complement all variants of the _wfindfirst()
264  * and _wfindnext() API, so we also declare the prototype for:
265  *
266  *  int _findclose (intptr_t);
267  *
268  *
269  * and from...
270  */
271 #include "time.h"
272 /* ...we obtain an opaque forward declaration of:
273  *
274  *  struct tm
275  *
276  * ...and prototype declarations for the following ISO-C99 function,
277  * (which is always provided):
278  *
279  *  size_t wcsftime (wchar_t *, size_t, const wchar_t *, const struct tm *);
280  *
281  * ...together with the following non-ISO-C functions, (which are
282  * NOT exposed when "__STRICT_ANSI__" checking is enabled):
283  *
284  *  wchar_t *_wctime (const time_t *);
285  *  wchar_t *_wasctime (const struct tm *);
286  *  wchar_t *_wstrdate (wchar_t *);
287  *  wchar_t *_wstrtime (wchar_t *);
288  *
289  * Of the preceding group, we also note that, while it remains in
290  * all versions of MSVCRT.DLL, (using a strictly 32-bit data type
291  * to represent its "time_t" argument), the _wctime() function is
292  * NOT present in MSVCR80.DLL, and later versions of the non-free
293  * MSVC runtime libraries, in which it is replaced by either of:
294  *
295  *  wchar_t *_wctime64 (const __time64_t *);
296  *  wchar_t *_wctime32 (const __time32_t *);
297  *
298  * ...with the actual replacement being chosen at compile time, on
299  * the basis of the user specified "_USE_32BIT_TIME_T" feature test
300  * macro, (a Microsoft specific, brain damaged concept), which maps
301  * _wctime() itself, as an in-line alias for its corresponding
302  * replacement library function.
303  *
304  *
305  * Also, from...
306  */
307 #include "locale.h"
308 /* ...we obtain the declaration for:
309  *
310  *   wchar_t *_wsetlocale (int, const wchar_t *);
311  *
312  *
313  * and from...
314  */
315 #include "process.h"
316 /* ...we obtain function prototypes for:
317  *
318  *  intptr_t _wexecl (const wchar_t *, const wchar_t *, ...);
319  *  intptr_t _wexecle (const wchar_t *, const wchar_t *, ...);
320  *  intptr_t _wexeclp (const wchar_t *, const wchar_t *, ...);
321  *  intptr_t _wexeclpe (const wchar_t *, const wchar_t *, ...);
322  *
323  *  intptr_t _wexecv (const wchar_t *, const wchar_t * const *);
324  *  intptr_t _wexecve (
325  *    const wchar_t *, const wchar_t * const *, const wchar_t * const *
326  *   );
327  *  intptr_t _wexecvp (const wchar_t *, const wchar_t * const *);
328  *  intptr_t _wexecvpe (
329  *    const wchar_t *, const wchar_t * const *, const wchar_t * const *
330  *   );
331  *
332  *  intptr_t _wspawnl (int, const wchar_t *, const wchar_t *, ...);
333  *  intptr_t _wspawnle (int, const wchar_t *, const wchar_t *, ...);
334  *  intptr_t _wspawnlp (int, const wchar_t *, const wchar_t *, ...);
335  *  intptr_t _wspawnlpe (int, const wchar_t *, const wchar_t *, ...);
336  *
337  *  intptr_t _wspawnv (int, const wchar_t *, const wchar_t * const *);
338  *  intptr_t _wspawnve (
339  *    int, const wchar_t *, const wchar_t * const *, const wchar_t * const *
340  *   );
341  *  intptr_t _wspawnvp (int, const wchar_t *, const wchar_t * const *);
342  *  intptr_t _wspawnvpe (
343  *    int, const wchar_t *, const wchar_t * const *, const wchar_t * const *
344  *   );
345  *
346  */
347 _BEGIN_C_DECLS
348
349 /* Wide character string functions must be specified here, as required
350  * by the ISO-C Standard; however, MSVC contravenes this standard by also
351  * requiring them to appear in <string.h>.  We declare them here, where
352  * they rightfully belong, but we also arrange for them to be available
353  * for selective inclusion by <string.h>; to facilitate this, we must
354  * change the declarative condition...
355  */
356 #endif  /* ! RC_INVOKED */
357 #endif  /* !__STRING_H_SOURCED__ */
358 #if ! (defined RC_INVOKED || (defined _WCHAR_H && defined _STRING_H))
359 /* ...such that these declarations are exposed when either _WCHAR_H, or
360  * _STRING_H is defined, (but not both, since that would indicate that
361  * these declarations have already been processed).
362  *
363  *
364  * Wide character versions of the ISO-C standard string functions.
365  */
366 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *wcscat (wchar_t *, const wchar_t *);
367 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *wcschr (const wchar_t *, wchar_t);
368 _CRTIMP __cdecl __MINGW_NOTHROW  int wcscmp (const wchar_t *, const wchar_t *);
369 _CRTIMP __cdecl __MINGW_NOTHROW  int wcscoll (const wchar_t *, const wchar_t *);
370 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *wcscpy (wchar_t *, const wchar_t *);
371 _CRTIMP __cdecl __MINGW_NOTHROW  size_t wcscspn (const wchar_t *, const wchar_t *);
372 _CRTIMP __cdecl __MINGW_NOTHROW  size_t wcslen (const wchar_t *);
373 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *wcsncat (wchar_t *, const wchar_t *, size_t);
374 _CRTIMP __cdecl __MINGW_NOTHROW  int wcsncmp (const wchar_t *, const wchar_t *, size_t);
375 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *wcsncpy (wchar_t *, const wchar_t *, size_t);
376 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *wcspbrk (const wchar_t *, const wchar_t *);
377 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *wcsrchr (const wchar_t *, wchar_t);
378 _CRTIMP __cdecl __MINGW_NOTHROW  size_t wcsspn (const wchar_t *, const wchar_t *);
379 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *wcsstr (const wchar_t *, const wchar_t *);
380 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *wcstok (wchar_t *, const wchar_t *);
381 _CRTIMP __cdecl __MINGW_NOTHROW  size_t wcsxfrm (wchar_t *, const wchar_t *, size_t);
382
383 #ifndef __STRICT_ANSI__
384 /* UTF-16LE versions of non-ANSI string functions provided by CRTDLL.DLL
385  */
386 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *_wcsdup (const wchar_t *);
387 _CRTIMP __cdecl __MINGW_NOTHROW  int _wcsicmp (const wchar_t *, const wchar_t *);
388 _CRTIMP __cdecl __MINGW_NOTHROW  int _wcsicoll (const wchar_t *, const wchar_t *);
389 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *_wcslwr (wchar_t*);
390 _CRTIMP __cdecl __MINGW_NOTHROW  int _wcsnicmp (const wchar_t *, const wchar_t *, size_t);
391 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *_wcsnset (wchar_t *, wchar_t, size_t);
392 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *_wcsrev (wchar_t *);
393 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *_wcsset (wchar_t *, wchar_t);
394 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *_wcsupr (wchar_t *);
395
396 #ifdef __MSVCRT__
397 _CRTIMP __cdecl __MINGW_NOTHROW  int _wcsncoll (const wchar_t *, const wchar_t *, size_t);
398 _CRTIMP __cdecl __MINGW_NOTHROW  int _wcsnicoll (const wchar_t *, const wchar_t *, size_t);
399
400 /* A wide character counterpart to the strerror() API was introduced in
401  * MSVCR70.DLL, and subsequently back-ported to MSVCRT.DLL in WinXP.
402  */
403 #if __MSVCRT_VERSION__ >= __MSVCR70_DLL || NTDDI_VERSION >= NTDDI_WINXP
404  /*
405   * These are are the wide character counterparts to the strerror()
406   * function itself, and the _strerror() function, respectively.
407   */
408 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *_wcserror (int);
409 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *__wcserror (const wchar_t *);
410
411 #endif  /* MSVCR70.DLL || WinXP */
412 #endif  /* __MSVCRT__ */
413
414 /* MSVCRT.DLL provides neither _wcscmpi() nor wcscmpi(); the heritage
415  * is uncertain, but for the convenience, (and portability), of legacy
416  * applications which assume wcscmpi() should be available:
417  */
418 #define _wcscmpi _wcsicmp
419 int __cdecl __MINGW_NOTHROW  wcscmpi (const wchar_t *, const wchar_t *);
420
421 #ifndef __NO_INLINE__
422 __CRT_ALIAS __JMPSTUB__(( FUNCTION = wcscmpi, REMAPPED = _wcsicmp ))
423   int wcscmpi (const wchar_t *__ws1, const wchar_t *__ws2)
424   { return _wcsicmp (__ws1, __ws2); }
425 #endif  /* __NO_INLINE__ */
426
427 #ifndef _NO_OLDNAMES
428 /* Older CRTDLL.DLL versions may have provided these alternatively named
429  * functions; we continue to support them, via the OLDNAME libraries:
430  */
431 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *wcsdup (const wchar_t *);
432 _CRTIMP __cdecl __MINGW_NOTHROW  int wcsicmp (const wchar_t *, const wchar_t *);
433 _CRTIMP __cdecl __MINGW_NOTHROW  int wcsicoll (const wchar_t *, const wchar_t *);
434 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *wcslwr (wchar_t *);
435 _CRTIMP __cdecl __MINGW_NOTHROW  int wcsnicmp (const wchar_t *, const wchar_t *, size_t);
436 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *wcsnset (wchar_t *, wchar_t, size_t);
437 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *wcsrev (wchar_t *);
438 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *wcsset (wchar_t *, wchar_t);
439 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *wcsupr (wchar_t *);
440
441 #endif  /* !_NO_OLDNAMES */
442 #endif  /* !__STRICT_ANSI__ */
443
444 /* This completes the set of declarations which are to be duplicated by
445  * inclusion of <string.h>; revert the declarative condition, to make it
446  * specific to <wchar.h> alone.
447  */
448 #endif  /* !(RC_INVOKED || (_WCHAR_H && _STRING_H)) */
449 #if defined _WCHAR_H && ! defined RC_INVOKED
450
451 #ifndef __STRICT_ANSI__
452 typedef wchar_t  _Wint_t;
453 #endif
454
455 typedef int mbstate_t;
456
457 /* The following multi-byte character conversion functions are
458  * implemented in libmingwex.a, (and maybe also in some non-free
459  * Microsoft libraries, such as MSVCP60.DLL and later).
460  */
461 __cdecl __MINGW_NOTHROW  wint_t btowc (int);
462 __cdecl __MINGW_NOTHROW  int wctob (wint_t);
463
464 __cdecl __MINGW_NOTHROW
465 size_t mbrlen (const char *__restrict__, size_t, mbstate_t *__restrict__);
466
467 __cdecl __MINGW_NOTHROW  size_t mbrtowc
468 (wchar_t *__restrict__, const char *__restrict__, size_t, mbstate_t *__restrict__);
469
470 __cdecl __MINGW_NOTHROW  size_t mbsrtowcs
471 (wchar_t *__restrict__, const char **__restrict__, size_t, mbstate_t *__restrict__);
472
473 __cdecl __MINGW_NOTHROW
474 size_t wcrtomb (char * __restrict__, wchar_t, mbstate_t *__restrict__);
475
476 __cdecl __MINGW_NOTHROW  size_t wcsrtombs
477 (char *__restrict__, const wchar_t **__restrict__, size_t, mbstate_t *__restrict__);
478
479 #ifdef _ISOC99_SOURCE
480 /* These ISO-C99 functions are implemented in libmingwex.a,
481  * or, in some cases, by inline stubs.
482  */
483 __cdecl __MINGW_NOTHROW  int fwide (FILE *, int);
484 __cdecl __MINGW_NOTHROW  int mbsinit (const mbstate_t *);
485
486 #ifndef __NO_INLINE__
487 __CRT_INLINE __cdecl __MINGW_NOTHROW
488 int fwide (FILE *__UNUSED_PARAM(stream), int mode)
489   { return mode; } /* Nothing to do  */
490
491 __CRT_INLINE __cdecl __MINGW_NOTHROW
492 int mbsinit (const mbstate_t *__UNUSED_PARAM(ps))
493   { return 1; }
494 #endif
495
496 __cdecl __MINGW_NOTHROW  wchar_t *wmemset (wchar_t *, wchar_t, size_t);
497 __cdecl __MINGW_NOTHROW  wchar_t *wmemchr (const wchar_t *, wchar_t, size_t);
498
499 /* FIXME: what makes this so different from every other function
500  * in this group?  Why is it not qualified with the __cdecl, and
501  * __MINGW_NOTHROW attributes?
502  */
503 int wmemcmp (const wchar_t *, const wchar_t *, size_t);
504
505 __cdecl __MINGW_NOTHROW
506 wchar_t *wmemcpy (wchar_t *__restrict__, const wchar_t *__restrict__, size_t);
507
508 __cdecl __MINGW_NOTHROW  wchar_t *wmemmove (wchar_t *, const wchar_t *, size_t);
509
510 __cdecl __MINGW_NOTHROW
511 long long wcstoll (const wchar_t *__restrict__, wchar_t **__restrict__, int);
512
513 __cdecl __MINGW_NOTHROW  unsigned long long wcstoull
514 (const wchar_t *__restrict__, wchar_t **__restrict__, int);
515 #endif /* _ISOC99_SOURCE */
516
517 _END_C_DECLS
518
519 #undef __WCHAR_H_SOURCED__
520 #endif  /* _WCHAR_H && ! RC_INVOKED */
521 #endif  /* !_WCHAR_H: $RCSfile$: end of file */