OSDN Git Service

Factor out <stdlib.h> vs. <wchar.h> duplicate declarations.
[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  * Written by Rob Savoye <rob@cygnus.com>
10  * Copyright (C) 1997, 1999-2009, 2011, 2015, 2016, MinGW.org Project.
11  *
12  *
13  * Permission is hereby granted, free of charge, to any person obtaining a
14  * copy of this software and associated documentation files (the "Software"),
15  * to deal in the Software without restriction, including without limitation
16  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
17  * and/or sell copies of the Software, and to permit persons to whom the
18  * Software is furnished to do so, subject to the following conditions:
19  *
20  * The above copyright notice, this permission notice, and the following
21  * disclaimer shall be included in all copies or substantial portions of
22  * the Software.
23  *
24  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
27  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OF OR OTHER
30  * DEALINGS IN THE SOFTWARE.
31  *
32  */
33 #ifndef _WCHAR_H
34 #pragma GCC system_header
35
36 /* This header declares prototypes for wchar_t string functions, as are
37  * prescribed by ISO-C, but which MSVC also expects, (in contravention of
38  * ISO-C prescriptions), to find in <string.h>.  To accommodate this MSVC
39  * anomaly, we make provision for <string.h> to include a selected subset
40  * of <wchar.h>; thus, we do not immediately define _WCHAR_T...
41  */
42 #ifndef __STRING_H_SOURCED__
43 /* ...but defer it until we have confirmed that this is NOT inclusion for
44  * only this subset of <wchar.h> declarations.
45  */
46 #define _WCHAR_H
47
48 /* All MinGW headers are required to include <_mingw.h>; in the case of
49  * selective inclusion by <string.h>, we expect it to have already done
50  * so, but since that doesn't apply here, we must do it ourselves.
51  */
52 #include <_mingw.h>
53
54 #ifndef __STRICT_ANSI__
55  /* MSDN says that isw* char classifications appear in both <wchar.h>,
56   * and in <wctype.h>.  Although these <wctype.h> classifications are as
57   * prescribed by ISO-C, their exposure in <wchar.h> is not; nonetheless,
58   * we replicate them here, for MSDN conformity.
59   */
60 # include <wctype.h>
61
62  /* This is also necessary, to support the non-ANSI wchar.h declarations
63   * which MSDN identifies as being provided here.
64   */
65 # include <sys/types.h>
66 #endif  /* !__STRICT_ANSI__ */
67
68 #define WCHAR_MIN       0
69 #define WCHAR_MAX       0xffff
70
71 #define WEOF            (wchar_t)(0xffff)
72
73 #ifndef RC_INVOKED
74 #define __WCHAR_H_SOURCED__
75 /* ISO-C, POSIX, and Microsoft specify an overlap of content between
76  * <wchar.h> and other system header files; by inclusion of such other
77  * headers within this "__WCHAR_H_SOURCED__" scope, we may selectively
78  * retrieve the overlapping content, without requiring duplication of
79  * that content here; thus, from...
80  */
81 #include <stdio.h>
82 /* ...we obtain (possibly indirect) definitions and declarations for:
83  *
84  *  macros  NULL, FILENAME_MAX
85  *  types   size_t, wchar_t, wint_t, va_list (a.k.a. __VALIST), FILE
86  *  types   ssize_t, off_t, __off64_t, (conditionally, as needed)
87  *
88  *  int     fwprintf (FILE *, const wchar_t *, ...);
89  *  int     wprintf (const wchar_t *, ...);
90  *  int     vfwprintf (FILE *, const wchar_t *, __VALIST);
91  *  int     vwprintf (const wchar_t *, __VALIST);
92  *  int     snwprintf (wchar_t *, size_t, const wchar_t *, ...);
93  *  int    _snwprintf (wchar_t *, size_t, const wchar_t *, ...);
94  *  int    _vscwprintf (const wchar_t *, __VALIST);
95  *  int    _vsnwprintf (wchar_t *, size_t, const wchar_t *, __VALIST);
96  *  int     vsnwprintf (wchar_t *, size_t, const wchar_t *, __VALIST);
97  *  int     fwscanf (FILE *, const wchar_t *, ...);
98  *  int     wscanf (const wchar_t *, ...);
99  *  int     swscanf (const wchar_t *, const wchar_t *, ...);
100  *  int     vwscanf (const wchar_t *, __VALIST);
101  *  int     vfwscanf (FILE *, const wchar_t *, __VALIST);
102  *  int     vswscanf (const wchar_t *, const wchar_t *, __VALIST);
103  *  wint_t  fgetwc (FILE *);
104  *  wint_t  fputwc (wchar_t, FILE *);
105  *  wint_t  ungetwc (wchar_t, FILE *);
106  *
107  * The following pair of Microsoft functions conflict with their
108  * corresponding ISO-C prototypes; consequently they will not be
109  * declared when "__STRICT_ANSI__" checking is in effect:
110  *
111  *  int  swprintf (wchar_t *, const wchar_t *, ...);
112  *  int  vswprintf (wchar_t *, const wchar_t *, __VALIST);
113  *
114  * The following group of functions is specified by ISO-C, but
115  * their Microsoft implementations are available only if use of
116  * "__MSVCRT__" is specified:
117  *
118  *  wchar_t * fgetws (wchar_t *, int, FILE *);
119  *  int       fputws (const wchar_t *, FILE *);
120  *  wint_t    getwc (FILE *);
121  *  wint_t    getwchar (void);
122  *  wint_t    putwc (wint_t, FILE *);
123  *  wint_t    putwchar (wint_t);
124  *
125  * The following group of functions is also dependent on use of
126  * "__MSVCRT__"; however, these are Microsoft specific, so they
127  * are not declared if "__STRICT_ANSI__" checking is specified:
128  *
129  *  wchar_t * _getws (wchar_t *);
130  *  int       _putws (const wchar_t *);
131  *  FILE    * _wfdopen (int, const wchar_t *);
132  *  FILE    * _wfopen (const wchar_t *, const wchar_t *);
133  *  FILE    * _wfreopen (const wchar_t *, const wchar_t *, FILE *);
134  *  FILE    * _wfsopen (const wchar_t *, const wchar_t *, int);
135  *  wchar_t * _wtmpnam (wchar_t *);
136  *  wchar_t * _wtempnam (const wchar_t *, const wchar_t *);
137  *  int       _wrename (const wchar_t *, const wchar_t *);
138  *  int       _wremove (const wchar_t *);
139  *  void      _wperror (const wchar_t *);
140  *  FILE    * _wpopen (const wchar_t *, const wchar_t *);
141  *
142  *
143  * In similar fashion, from...
144  */
145 #include <stdlib.h>
146 /* ...we obtain prototypes for universally supported functions:
147  *
148  *  long wcstol (const wchar_t *, wchar_t **, int);
149  *  unsigned long wcstoul (const wchar_t *, wchar_t **, int);
150  *  double wcstod (const wchar_t *, wchar_t **);
151  *
152  * The following are Microsoft specific, and require MSCVRT.DLL,
153  * or any of its non-free derivatives; they are not available to
154  * applications which use CRTDLL.DLL:
155  *
156  *  wchar_t *_wgetenv (const wchar_t *);
157  *  int _wputenv (const wchar_t *);
158  *  void _wsearchenv (const wchar_t *, const wchar_t *, wchar_t *);
159  *  int _wsystem (const wchar_t *);
160  *  void _wmakepath (wchar_t *, const wchar_t *, const wchar_t *,
161  *          const wchar_t *, const wchar_t *
162  *        );
163  *  void _wsplitpath (const wchar_t *, wchar_t *, wchar_t *,
164  *          wchar_t *, wchar_t *
165  *        );
166  *  wchar_t *_wfullpath (wchar_t *, const wchar_t *, size_t);
167  *
168  * ...while this pair are ISO-C99 standards, which are available
169  * in libmingwex.a, but not in any version of MSVCRT.DLL, (nor in
170  * any of its non-free derivatives prior to MSVCR120.DLL), nor in
171  * CRTDLL.DLL:
172  *
173  *  float wcstof (const wchar_t *restrict, wchar_t **restrict);
174  *  long double wcstold (const wchar_t *restrict, wchar_t **restrict);
175  *
176  *
177  * Again, in similar fashion, from...
178  */
179 #include <time.h>
180 /* ...we obtain an opaque forward declaration of:
181  *
182  *  struct tm
183  *
184  * ...and prototype declarations for the following ISO-C99 function,
185  * (which is always provided):
186  *
187  *  size_t wcsftime (wchar_t *, size_t, const wchar_t *, const struct tm *);
188  *
189  * ...together with the following non-ISO-C functions, (which are
190  * NOT exposed when "__STRICT_ANSI__" checking is enabled):
191  *
192  *  wchar_t *_wctime (const time_t *);
193  *  wchar_t *_wasctime (const struct tm *);
194  *  wchar_t *_wstrdate (wchar_t *);
195  *  wchar_t *_wstrtime (wchar_t *);
196  *
197  * Of the preceding group, we also note that, while it remains in
198  * all versions of MSVCRT.DLL, (using a strictly 32-bit data type
199  * to represent its "time_t" argument), the _wctime() function is
200  * NOT present in MSVCR80.DLL, and later versions of the non-free
201  * MSVC runtime libraries, in which it is replaced by either of:
202  *
203  *  wchar_t *_wctime64 (const __time64_t *);
204  *  wchar_t *_wctime32 (const __time32_t *);
205  *
206  * ...with the actual replacement being chosen at compile time, on
207  * the basis of the user specified "_USE_32BIT_TIME_T" feature test
208  * macro, (a Microsoft specific, brain damaged concept), which maps
209  * _wctime() itself, as an in-line alias for its corresponding
210  * replacement library function.
211  *
212  */
213 _BEGIN_C_DECLS
214
215 /* Wide character string functions must be specified here, as required
216  * by the ISO-C Standard; however, MSVC contravenes this standard by also
217  * requiring them to appear in <string.h>.  We declare them here, where
218  * they rightfully belong, but we also arrange for them to be available
219  * for selective inclusion by <string.h>; to facilitate this, we must
220  * change the declarative condition...
221  */
222 #endif  /* ! RC_INVOKED */
223 #endif  /* !__STRING_H_SOURCED__ */
224 #if ! (defined RC_INVOKED || (defined _WCHAR_H && defined _STRING_H))
225 /* ...such that these declarations are exposed when either _WCHAR_H, or
226  * _STRING_H is defined, (but not both, since that would indicate that
227  * these declarations have already been processed).
228  *
229  *
230  * Wide character versions of the ISO-C standard string functions.
231  */
232 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *wcscat (wchar_t *, const wchar_t *);
233 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *wcschr (const wchar_t *, wchar_t);
234 _CRTIMP __cdecl __MINGW_NOTHROW  int wcscmp (const wchar_t *, const wchar_t *);
235 _CRTIMP __cdecl __MINGW_NOTHROW  int wcscoll (const wchar_t *, const wchar_t *);
236 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *wcscpy (wchar_t *, const wchar_t *);
237 _CRTIMP __cdecl __MINGW_NOTHROW  size_t wcscspn (const wchar_t *, const wchar_t *);
238 _CRTIMP __cdecl __MINGW_NOTHROW  size_t wcslen (const wchar_t *);
239 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *wcsncat (wchar_t *, const wchar_t *, size_t);
240 _CRTIMP __cdecl __MINGW_NOTHROW  int wcsncmp (const wchar_t *, const wchar_t *, size_t);
241 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *wcsncpy (wchar_t *, const wchar_t *, size_t);
242 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *wcspbrk (const wchar_t *, const wchar_t *);
243 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *wcsrchr (const wchar_t *, wchar_t);
244 _CRTIMP __cdecl __MINGW_NOTHROW  size_t wcsspn (const wchar_t *, const wchar_t *);
245 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *wcsstr (const wchar_t *, const wchar_t *);
246 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *wcstok (wchar_t *, const wchar_t *);
247 _CRTIMP __cdecl __MINGW_NOTHROW  size_t wcsxfrm (wchar_t *, const wchar_t *, size_t);
248
249 #ifndef __STRICT_ANSI__
250 /* UTF-16LE versions of non-ANSI string functions provided by CRTDLL.DLL
251  */
252 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *_wcsdup (const wchar_t *);
253 _CRTIMP __cdecl __MINGW_NOTHROW  int _wcsicmp (const wchar_t *, const wchar_t *);
254 _CRTIMP __cdecl __MINGW_NOTHROW  int _wcsicoll (const wchar_t *, const wchar_t *);
255 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *_wcslwr (wchar_t*);
256 _CRTIMP __cdecl __MINGW_NOTHROW  int _wcsnicmp (const wchar_t *, const wchar_t *, size_t);
257 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *_wcsnset (wchar_t *, wchar_t, size_t);
258 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *_wcsrev (wchar_t *);
259 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *_wcsset (wchar_t *, wchar_t);
260 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *_wcsupr (wchar_t *);
261
262 #ifdef __MSVCRT__
263 _CRTIMP __cdecl __MINGW_NOTHROW  int _wcsncoll (const wchar_t *, const wchar_t *, size_t);
264 _CRTIMP __cdecl __MINGW_NOTHROW  int _wcsnicoll (const wchar_t *, const wchar_t *, size_t);
265
266 /* A wide character counterpart to the strerror() API was introduced in
267  * MSVCR70.DLL, and subsequently back-ported to MSVCRT.DLL in WinXP.
268  */
269 #if __MSVCRT_VERSION__ >= __MSVCR70_DLL || NTDDI_VERSION >= NTDDI_WINXP
270  /*
271   * These are are the wide character counterparts to the strerror()
272   * function itself, and the _strerror() function, respectively.
273   */
274 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *_wcserror (int);
275 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *__wcserror (const wchar_t *);
276
277 #endif  /* MSVCR70.DLL || WinXP */
278 #endif  /* __MSVCRT__ */
279
280 /* MSVCRT.DLL provides neither _wcscmpi() nor wcscmpi(); the heritage
281  * is uncertain, but for the convenience, (and portability), of legacy
282  * applications which assume wcscmpi() should be available:
283  */
284 #define _wcscmpi _wcsicmp
285 int __cdecl __MINGW_NOTHROW  wcscmpi (const wchar_t *, const wchar_t *);
286
287 #ifndef __NO_INLINE__
288 __CRT_ALIAS __JMPSTUB__(( FUNCTION = wcscmpi, REMAPPED = _wcsicmp ))
289   int wcscmpi (const wchar_t *__ws1, const wchar_t *__ws2)
290   { return _wcsicmp (__ws1, __ws2); }
291 #endif  /* __NO_INLINE__ */
292
293 #ifndef _NO_OLDNAMES
294 /* Older CRTDLL.DLL versions may have provided these alternatively named
295  * functions; we continue to support them, via the OLDNAME libraries:
296  */
297 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *wcsdup (const wchar_t *);
298 _CRTIMP __cdecl __MINGW_NOTHROW  int wcsicmp (const wchar_t *, const wchar_t *);
299 _CRTIMP __cdecl __MINGW_NOTHROW  int wcsicoll (const wchar_t *, const wchar_t *);
300 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *wcslwr (wchar_t *);
301 _CRTIMP __cdecl __MINGW_NOTHROW  int wcsnicmp (const wchar_t *, const wchar_t *, size_t);
302 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *wcsnset (wchar_t *, wchar_t, size_t);
303 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *wcsrev (wchar_t *);
304 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *wcsset (wchar_t *, wchar_t);
305 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *wcsupr (wchar_t *);
306
307 #endif  /* !_NO_OLDNAMES */
308 #endif  /* !__STRICT_ANSI__ */
309
310 /* This completes the set of declarations which are to be duplicated by
311  * inclusion of <string.h>; revert the declarative condition, to make it
312  * specific to <wchar.h> alone.
313  */
314 #endif  /* !(RC_INVOKED || (_WCHAR_H && _STRING_H)) */
315 #if defined _WCHAR_H && ! defined RC_INVOKED
316
317 /* These are resolved by -lmingwex. Alternatively, they can be resolved by
318    adding -lmsvcp60 to your command line, which will give you the VC++
319    versions of these functions. If you want the latter and don't have
320    msvcp60.dll in your windows system directory, you can easily obtain
321    it with a search from your favorite search engine.  */
322 #ifndef __STRICT_ANSI__
323 typedef wchar_t _Wint_t;
324 #endif
325
326 typedef int mbstate_t;
327
328 wint_t __cdecl __MINGW_NOTHROW btowc(int);
329 size_t __cdecl __MINGW_NOTHROW mbrlen(const char * __restrict__, size_t,
330                       mbstate_t * __restrict__);
331 size_t __cdecl __MINGW_NOTHROW mbrtowc(wchar_t * __restrict__, const char * __restrict__,
332                        size_t, mbstate_t * __restrict__);
333 size_t __cdecl __MINGW_NOTHROW mbsrtowcs(wchar_t * __restrict__, const char ** __restrict__,
334                          size_t, mbstate_t * __restrict__);
335 size_t __cdecl __MINGW_NOTHROW wcrtomb(char * __restrict__, wchar_t,
336                        mbstate_t * __restrict__);
337 size_t __cdecl __MINGW_NOTHROW wcsrtombs(char * __restrict__, const wchar_t ** __restrict__,
338                          size_t, mbstate_t * __restrict__);
339 int __cdecl __MINGW_NOTHROW wctob(wint_t);
340
341 #ifndef __NO_ISOCEXT /* these need static lib libmingwex.a */
342 int __cdecl __MINGW_NOTHROW fwide(FILE*, int);
343 int __cdecl __MINGW_NOTHROW mbsinit(const mbstate_t*);
344 #ifndef __NO_INLINE__
345 __CRT_INLINE int __cdecl __MINGW_NOTHROW fwide(FILE* __UNUSED_PARAM(stream),
346                                                int mode)
347   {return mode;} /* Nothing to do  */
348 __CRT_INLINE int __cdecl __MINGW_NOTHROW mbsinit(const mbstate_t* __UNUSED_PARAM(ps))
349   {return 1;}
350 #endif
351 wchar_t* __cdecl __MINGW_NOTHROW wmemset(wchar_t *, wchar_t, size_t);
352 wchar_t* __cdecl __MINGW_NOTHROW wmemchr(const wchar_t*, wchar_t, size_t);
353 int wmemcmp(const wchar_t*, const wchar_t *, size_t);
354 wchar_t* __cdecl __MINGW_NOTHROW wmemcpy(wchar_t* __restrict__,
355                          const wchar_t* __restrict__,
356                          size_t);
357 wchar_t* __cdecl __MINGW_NOTHROW wmemmove(wchar_t* s1, const wchar_t *, size_t);
358 long long __cdecl __MINGW_NOTHROW wcstoll(const wchar_t * __restrict__,
359                           wchar_t** __restrict__, int);
360 unsigned long long __cdecl __MINGW_NOTHROW wcstoull(const wchar_t * __restrict__,
361                             wchar_t ** __restrict__, int);
362 #endif /* __NO_ISOCEXT */
363
364 #ifndef __STRICT_ANSI__
365 /* non-ANSI wide char functions from io.h, direct.h, sys/stat.h and locale.h
366  * FIXME: these should be factored out, to avoid duplication.
367  */
368 #ifndef _FSIZE_T_DEFINED
369 typedef unsigned long  _fsize_t;
370 #define _FSIZE_T_DEFINED
371 #endif
372
373 #ifndef _WFINDDATA_T_DEFINED
374 struct _wfinddata_t {
375         unsigned        attrib;
376         time_t          time_create;    /* -1 for FAT file systems */
377         time_t          time_access;    /* -1 for FAT file systems */
378         time_t          time_write;
379         _fsize_t        size;
380         wchar_t         name[260];      /* may include spaces. */
381 };
382 struct _wfinddatai64_t {
383         unsigned    attrib;
384         time_t      time_create;
385         time_t      time_access;
386         time_t      time_write;
387         __int64     size;
388         wchar_t     name[260];
389 };
390 #if __MSVCRT_VERSION__ >= 0x0601
391 struct __wfinddata64_t {
392         unsigned    attrib;
393         __time64_t  time_create;
394         __time64_t  time_access;
395         __time64_t  time_write;
396 /* 8 bytes are returned so it can't be _fsize_t */
397         __int64    size;
398         wchar_t     name[260];
399 };
400 #endif
401 #if __MSVCRT_VERSION__ >= 0x0800
402 struct __wfinddata32_t {
403         unsigned        attrib;
404         __time32_t      time_create;
405         __time32_t      time_access;
406         __time32_t      time_write;
407         __int32         size;
408         wchar_t         name[FILENAME_MAX];
409 };
410
411 struct _wfinddata32i64_t {
412         unsigned        attrib;
413         __time32_t      time_create;
414         __time32_t      time_access;
415         __time32_t      time_write;
416         __int64         size;
417         wchar_t         name[FILENAME_MAX];
418 };
419
420 struct _wfinddata64i32_t {
421         unsigned        attrib;
422         __time64_t      time_create;
423         __time64_t      time_access;
424         __time64_t      time_write;
425         __int32         size;
426         wchar_t         name[FILENAME_MAX];
427 };
428 #endif /* __MSVCRT_VERSION__ >= 0x0800 */
429 #define _WFINDDATA_T_DEFINED
430 #endif
431
432 /* Wide character versions. Also defined in io.h. */
433 /* CHECK: I believe these only exist in MSVCRT, and not in CRTDLL. Also
434    applies to other wide character versions? */
435 #if !defined (_WIO_DEFINED)
436 #if defined (__MSVCRT__)
437 #include <stdint.h>  /* For intptr_t.  */
438 _CRTIMP int __cdecl __MINGW_NOTHROW     _waccess (const wchar_t*, int);
439 _CRTIMP int __cdecl __MINGW_NOTHROW     _wchmod (const wchar_t*, int);
440 _CRTIMP int __cdecl __MINGW_NOTHROW     _wcreat (const wchar_t*, int);
441 #if __MSVCRT_VERSION__ < 0x0800
442 _CRTIMP long __cdecl __MINGW_NOTHROW    _wfindfirst (const wchar_t*, struct _wfinddata_t *);
443 _CRTIMP int __cdecl __MINGW_NOTHROW     _wfindnext (long, struct _wfinddata_t *);
444 #endif
445 _CRTIMP int __cdecl __MINGW_NOTHROW     _wunlink (const wchar_t*);
446 _CRTIMP int __cdecl __MINGW_NOTHROW     _wopen (const wchar_t*, int, ...);
447 _CRTIMP int __cdecl __MINGW_NOTHROW     _wsopen (const wchar_t*, int, int, ...);
448 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wmktemp (wchar_t*);
449 #if __MSVCRT_VERSION__ < 0x0800
450 _CRTIMP long __cdecl __MINGW_NOTHROW    _wfindfirsti64 (const wchar_t*, struct _wfinddatai64_t*);
451 _CRTIMP int __cdecl __MINGW_NOTHROW     _wfindnexti64 (long, struct _wfinddatai64_t*);
452 #else
453 _CRTIMP long __cdecl __MINGW_NOTHROW    _wfindfirst32i64 (const wchar_t*, struct _wfinddata32i64_t*);
454 _CRTIMP long __cdecl __MINGW_NOTHROW    _wfindfirst64i32 (const wchar_t*, struct _wfinddata64i32_t*);
455 _CRTIMP int  __cdecl __MINGW_NOTHROW    _wfindnext32i64 (long, struct _wfinddata32i64_t*);
456 _CRTIMP int  __cdecl __MINGW_NOTHROW    _wfindnext64i32 (long, struct _wfinddata64i32_t*);
457 #endif /* __MSVCRT_VERSION__ < 0x0800 */
458 #if __MSVCRT_VERSION__ >= 0x0601
459 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wfindfirst64(const wchar_t*, struct __wfinddata64_t*);
460 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wfindnext64(intptr_t, struct __wfinddata64_t*);
461 #endif /* __MSVCRT_VERSION__ >= 0x0601 */
462 #if __MSVCRT_VERSION__ >= 0x0800
463 _CRTIMP long __cdecl __MINGW_NOTHROW    _wfindfirst32 (const wchar_t*, struct __wfinddata32_t*);
464 _CRTIMP int  __cdecl __MINGW_NOTHROW    _wfindnext32 (long, struct __wfinddata32_t*);
465 #ifndef _USE_32BIT_TIME_T
466 _CRTALIAS long __cdecl __MINGW_NOTHROW  _wfindfirst (const wchar_t* _v1, struct _wfinddata_t* _v2)       { return(_wfindfirst64i32 (_v1,(struct _wfinddata64i32_t*)_v2)); }
467 _CRTALIAS int  __cdecl __MINGW_NOTHROW  _wfindnext (long _v1, struct _wfinddata_t* _v2)                  { return(_wfindnext64i32  (_v1,(struct _wfinddata64i32_t*)_v2)); }
468 _CRTALIAS long __cdecl __MINGW_NOTHROW  _wfindfirsti64 (const wchar_t* _v1, struct _wfinddatai64_t* _v2) { return(_wfindfirst64 (_v1,(struct __wfinddata64_t*)_v2)); }
469 _CRTALIAS int  __cdecl __MINGW_NOTHROW  _wfindnexti64 (long _v1, struct _wfinddatai64_t* _v2)            { return(_wfindnext64  (_v1,(struct __wfinddata64_t*)_v2)); }
470 #else
471 _CRTALIAS long __cdecl __MINGW_NOTHROW  _wfindfirst (const wchar_t* _v1, struct _wfinddata_t* _v2)       { return(_wfindfirst32 (_v1,(struct __wfinddata32_t*)_v2)); }
472 _CRTALIAS int  __cdecl __MINGW_NOTHROW  _wfindnext (long _v1, struct _wfinddata_t* _v2)                  { return(_wfindnext32  (_v1,(struct __wfinddata32_t*)_v2)); }
473 _CRTALIAS long __cdecl __MINGW_NOTHROW  _wfindfirsti64 (const wchar_t* _v1, struct _wfinddatai64_t* _v2) { return(_wfindfirst32i64 (_v1,(struct _wfinddata32i64_t*)_v2)); }
474 _CRTALIAS int  __cdecl __MINGW_NOTHROW  _wfindnexti64 (long _v1, struct _wfinddatai64_t* _v2)            { return(_wfindnext32i64  (_v1,(struct _wfinddata32i64_t*)_v2)); }
475 #endif /* !_USE_32BIT_TIME_T*/
476 #endif /* __MSVCRT_VERSION__ >= 0x0800 */
477
478 #endif /* defined (__MSVCRT__) */
479 #define _WIO_DEFINED
480 #endif /* _WIO_DEFINED */
481
482 #ifndef _WDIRECT_DEFINED
483 /* Also in direct.h */
484 #ifdef __MSVCRT__
485 _CRTIMP int __cdecl __MINGW_NOTHROW       _wchdir (const wchar_t*);
486 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW  _wgetcwd (wchar_t*, int);
487 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW  _wgetdcwd (int, wchar_t*, int);
488 _CRTIMP int __cdecl __MINGW_NOTHROW       _wmkdir (const wchar_t*);
489 _CRTIMP int __cdecl __MINGW_NOTHROW       _wrmdir (const wchar_t*);
490 #endif  /* __MSVCRT__ */
491 #define _WDIRECT_DEFINED
492 #endif /* _WDIRECT_DEFINED */
493
494 #ifndef _STAT_DEFINED
495 /*
496  * The structure manipulated and returned by stat and fstat.
497  *
498  * NOTE: If called on a directory the values in the time fields are not only
499  * invalid, they will cause localtime et. al. to return NULL. And calling
500  * asctime with a NULL pointer causes an Invalid Page Fault. So watch it!
501  */
502 struct _stat
503 {
504         _dev_t  st_dev;         /* Equivalent to drive number 0=A 1=B ... */
505         _ino_t  st_ino;         /* Always zero ? */
506         _mode_t st_mode;        /* See above constants */
507         short   st_nlink;       /* Number of links. */
508         short   st_uid;         /* User: Maybe significant on NT ? */
509         short   st_gid;         /* Group: Ditto */
510         _dev_t  st_rdev;        /* Seems useless (not even filled in) */
511         _off_t  st_size;        /* File size in bytes */
512         time_t  st_atime;       /* Accessed date (always 00:00 hrs local
513                                  * on FAT) */
514         time_t  st_mtime;       /* Modified time */
515         time_t  st_ctime;       /* Creation time */
516 };
517
518 #ifndef _NO_OLDNAMES
519 /* NOTE: Must be the same as _stat above. */
520 struct stat
521 {
522         dev_t   st_dev;         /* Equivalent to drive number 0=A 1=B ... */
523         ino_t   st_ino;         /* Always zero ? */
524         mode_t  st_mode;        /* See above constants */
525         short   st_nlink;       /* Number of links. */
526         short   st_uid;         /* User: Maybe significant on NT ? */
527         short   st_gid;         /* Group: Ditto */
528         dev_t   st_rdev;        /* Seems useless (not even filled in) */
529         off_t   st_size;        /* File size in bytes */
530         time_t  st_atime;       /* Accessed date (always 00:00 hrs local
531                                  * on FAT) */
532         time_t  st_mtime;       /* Modified time */
533         time_t  st_ctime;       /* Creation time */
534 };
535 #endif /* _NO_OLDNAMES */
536
537 #if defined (__MSVCRT__)
538 struct _stati64 {
539     _dev_t st_dev;
540     _ino_t st_ino;
541     unsigned short st_mode;
542     short st_nlink;
543     short st_uid;
544     short st_gid;
545     _dev_t st_rdev;
546     __int64 st_size;
547     time_t st_atime;
548     time_t st_mtime;
549     time_t st_ctime;
550 };
551
552 #if __MSVCRT_VERSION__ >= 0x0601
553 struct __stat64
554 {
555     _dev_t st_dev;
556     _ino_t st_ino;
557     _mode_t st_mode;
558     short st_nlink;
559     short st_uid;
560     short st_gid;
561     _dev_t st_rdev;
562     __int64 st_size;
563     __time64_t st_atime;
564     __time64_t st_mtime;
565     __time64_t st_ctime;
566 };
567 #endif  /* __MSVCRT_VERSION__ >= 0x0601*/
568
569 #if __MSVCRT_VERSION__ >= 0x0800
570 struct __stat32
571 {
572         _dev_t          st_dev;
573         _ino_t          st_ino;
574         _mode_t         st_mode;
575         short           st_nlink;
576         short           st_uid;
577         short           st_gid;
578         _dev_t          st_rdev;
579         __int32         st_size;
580         __time32_t      st_atime;
581         __time32_t      st_mtime;
582         __time32_t      st_ctime;
583 };
584 struct _stat32i64 {
585         _dev_t          st_dev;
586         _ino_t          st_ino;
587         _mode_t         st_mode;
588         short           st_nlink;
589         short           st_uid;
590         short           st_gid;
591         _dev_t          st_rdev;
592         __int64         st_size;
593         __time32_t      st_atime;
594         __time32_t      st_mtime;
595         __time32_t      st_ctime;
596 };
597 struct _stat64i32 {
598         _dev_t          st_dev;
599         _ino_t          st_ino;
600         _mode_t         st_mode;
601         short           st_nlink;
602         short           st_uid;
603         short           st_gid;
604         _dev_t          st_rdev;
605         __int32         st_size;
606         __time64_t      st_atime;
607         __time64_t      st_mtime;
608         __time64_t      st_ctime;
609 };
610 #endif /* __MSVCRT_VERSION__ >= 0x0800 */
611
612 #endif  /* __MSVCRT__ */
613 #define _STAT_DEFINED
614 #endif /* _STAT_DEFINED */
615
616 #if !defined ( _WSTAT_DEFINED)
617 /* also declared in sys/stat.h */
618 #if defined __MSVCRT__
619 #if __MSVCRT_VERSION__ < 0x0800
620 _CRTIMP int __cdecl __MINGW_NOTHROW     _wstat (const wchar_t*, struct _stat*);
621 _CRTIMP int __cdecl __MINGW_NOTHROW     _wstati64 (const wchar_t*, struct _stati64*);
622 #endif /* __MSVCRT_VERSION__ < 0x0800 */
623 #if __MSVCRT_VERSION__ >= 0x0601
624 _CRTIMP int __cdecl __MINGW_NOTHROW _wstat64 (const wchar_t*, struct __stat64*);
625 #endif /* __MSVCRT_VERSION__ >= 0x0601 */
626 #if __MSVCRT_VERSION__ >= 0x0800
627 _CRTIMP int __cdecl __MINGW_NOTHROW     _wstat32 (const wchar_t*, struct __stat32*);
628 _CRTIMP int __cdecl __MINGW_NOTHROW     _wstat32i64 (const wchar_t*, struct _stat32i64*);
629 _CRTIMP int __cdecl __MINGW_NOTHROW     _wstat64i32 (const wchar_t*, struct _stat64i32*);
630 #ifndef _USE_32BIT_TIME_T
631 _CRTALIAS int __cdecl __MINGW_NOTHROW   _wstat (const wchar_t* _v1, struct _stat* _v2)       { return(_wstat64i32 (_v1,(struct _stat64i32*)_v2)); }
632 _CRTALIAS int __cdecl __MINGW_NOTHROW   _wstati64 (const wchar_t* _v1, struct _stati64* _v2) { return(_wstat64 (_v1,(struct __stat64*)_v2)); }
633 #else
634 _CRTALIAS int __cdecl __MINGW_NOTHROW   _wstat (const wchar_t* _v1, struct _stat* _v2)       { return(_wstat32 (_v1,(struct __stat32*)_v2)); }
635 _CRTALIAS int __cdecl __MINGW_NOTHROW   _wstati64 (const wchar_t* _v1, struct _stati64* _v2) { return(_wstat32i64 (_v1,(struct _stat32i64*)_v2)); }
636 #endif /* !_USE_32BIT_TIME_T */
637 #endif /* __MSVCRT_VERSION__ >= 0x0800 */
638 #endif  /* __MSVCRT__ */
639 #define _WSTAT_DEFINED
640 #endif /* ! _WSTAT_DEFIND  */
641
642 #ifndef _WLOCALE_DEFINED  /* also declared in locale.h */
643 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wsetlocale (int, const wchar_t*);
644 #define _WLOCALE_DEFINED
645 #endif
646
647 #ifndef _WPROCESS_DEFINED
648 /* Also declared in process.h; FIXME: to be factored out.
649  */
650 #include <stdint.h>  /* For intptr_t.  */
651 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wexecl        (const wchar_t*, const wchar_t*, ...);
652 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wexecle       (const wchar_t*, const wchar_t*, ...);
653 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wexeclp       (const wchar_t*, const wchar_t*, ...);
654 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wexeclpe      (const wchar_t*, const wchar_t*, ...);
655 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wexecv        (const wchar_t*, const wchar_t* const*);
656 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wexecve       (const wchar_t*, const wchar_t* const*, const wchar_t* const*);
657 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wexecvp       (const wchar_t*, const wchar_t* const*);
658 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wexecvpe      (const wchar_t*, const wchar_t* const*, const wchar_t* const*);
659
660 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wspawnl       (int, const wchar_t*, const wchar_t*, ...);
661 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wspawnle      (int, const wchar_t*, const wchar_t*, ...);
662 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wspawnlp      (int, const wchar_t*, const wchar_t*, ...);
663 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wspawnlpe     (int, const wchar_t*, const wchar_t*, ...);
664 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wspawnv       (int, const wchar_t*, const wchar_t* const*);
665 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wspawnve      (int, const wchar_t*, const wchar_t* const*, const wchar_t* const*);
666 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wspawnvp      (int, const wchar_t*, const wchar_t* const*);
667 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wspawnvpe     (int, const wchar_t*, const wchar_t* const*, const wchar_t* const*);
668
669 #define _WPROCESS_DEFINED
670 #endif
671 #endif  /* ! __STRICT_ANSI__ */
672
673 _END_C_DECLS
674
675 #undef __WCHAR_H_SOURCED__
676 #endif  /* _WCHAR_H && ! RC_INVOKED */
677 #endif  /* !_WCHAR_H: $RCSfile$: end of file */