OSDN Git Service

Refactor to avoid possible time_t conflicts across headers.
[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, 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 #define _WCHAR_H
35 #pragma GCC system_header
36
37 /* All the headers include this file. */
38 #include <_mingw.h>
39
40 /* MSDN says that isw* char classifications are in wchar.h and wctype.h.
41  * Although the wctype names are ANSI, their exposure in this header is
42  * not; nevertheless, we replicate them here, for MSDN conformity.
43  */
44 #include <wctype.h>
45
46 #ifndef __STRICT_ANSI__
47 /* This is also necessary, to support the non-ANSI wchar.h declarations
48  * which MSDN identifies as being provided here.
49  */
50 # include <sys/types.h>
51 #endif /* __STRICT_ANSI__ */
52
53 #define WCHAR_MIN       0
54 #define WCHAR_MAX       0xffff
55
56 # define WEOF           (wchar_t)(0xffff)
57
58 #ifndef RC_INVOKED
59
60 #define __need_size_t
61 #define __need_wint_t
62 #define __need_wchar_t
63 #define __need_NULL
64 #include <stddef.h>
65
66 #ifndef __VALIST
67 # if defined __GNUC__ && __GNUC__ >= 3
68 #  define __need___va_list
69 #  include <stdarg.h>
70 #  define __VALIST __builtin_va_list
71 # else
72 #  define __VALIST char*
73 # endif
74 #endif
75
76 _BEGIN_C_DECLS
77
78 #ifndef _FILE_DEFINED  /* Also in stdio.h */
79 #define _FILE_DEFINED
80 typedef struct _iobuf
81 {
82         char*   _ptr;
83         int     _cnt;
84         char*   _base;
85         int     _flag;
86         int     _file;
87         int     _charbuf;
88         int     _bufsiz;
89         char*   _tmpfname;
90 } FILE;
91 #endif  /* Not _FILE_DEFINED */
92
93 #define __need_time_t
94 #define _FAKE_TIME_H_SOURCED 1
95 #include <parts/time.h>
96
97 #ifndef _TM_DEFINED /* Also in time.h */
98 struct tm {
99         int tm_sec;     /* seconds after the minute - [0,59] */
100         int tm_min;     /* minutes after the hour - [0,59] */
101         int tm_hour;    /* hours since midnight - [0,23] */
102         int tm_mday;    /* day of the month - [1,31] */
103         int tm_mon;     /* months since January - [0,11] */
104         int tm_year;    /* years since 1900 */
105         int tm_wday;    /* days since Sunday - [0,6] */
106         int tm_yday;    /* days since January 1 - [0,365] */
107         int tm_isdst;   /* daylight savings time flag */
108         };
109 #define _TM_DEFINED
110 #endif
111
112 #ifndef _WSTDIO_DEFINED
113 /*  Also in stdio.h - keep in sync */
114 _CRTIMP int __cdecl __MINGW_NOTHROW     fwprintf (FILE*, const wchar_t*, ...);
115 _CRTIMP int __cdecl __MINGW_NOTHROW     wprintf (const wchar_t*, ...);
116 _CRTIMP int __cdecl __MINGW_NOTHROW     _snwprintf (wchar_t*, size_t, const wchar_t*, ...);
117 _CRTIMP int __cdecl __MINGW_NOTHROW     vfwprintf (FILE*, const wchar_t*, __VALIST);
118 _CRTIMP int __cdecl __MINGW_NOTHROW     vwprintf (const wchar_t*, __VALIST);
119 _CRTIMP int __cdecl __MINGW_NOTHROW     _vsnwprintf (wchar_t*, size_t, const wchar_t*, __VALIST);
120 _CRTIMP int __cdecl __MINGW_NOTHROW     fwscanf (FILE*, const wchar_t*, ...);
121 _CRTIMP int __cdecl __MINGW_NOTHROW     wscanf (const wchar_t*, ...);
122 _CRTIMP int __cdecl __MINGW_NOTHROW     swscanf (const wchar_t*, const wchar_t*, ...);
123 _CRTIMP wint_t __cdecl __MINGW_NOTHROW  fgetwc (FILE*);
124 _CRTIMP wint_t __cdecl __MINGW_NOTHROW  fputwc (wchar_t, FILE*);
125 _CRTIMP wint_t __cdecl __MINGW_NOTHROW  ungetwc (wchar_t, FILE*);
126
127 /* These differ from the ISO C prototypes, which have a maxlen parameter like snprintf.  */
128 #ifndef __STRICT_ANSI__
129 _CRTIMP int __cdecl __MINGW_NOTHROW     swprintf (wchar_t*, const wchar_t*, ...);
130 _CRTIMP int __cdecl __MINGW_NOTHROW     vswprintf (wchar_t*, const wchar_t*, __VALIST);
131 #endif
132
133 #ifdef __MSVCRT__
134 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW fgetws (wchar_t*, int, FILE*);
135 _CRTIMP int __cdecl __MINGW_NOTHROW     fputws (const wchar_t*, FILE*);
136 _CRTIMP wint_t __cdecl __MINGW_NOTHROW  getwc (FILE*);
137 _CRTIMP wint_t __cdecl __MINGW_NOTHROW  getwchar (void);
138 _CRTIMP wint_t __cdecl __MINGW_NOTHROW  putwc (wint_t, FILE*);
139 _CRTIMP wint_t __cdecl __MINGW_NOTHROW  putwchar (wint_t);
140 #ifndef __STRICT_ANSI__
141 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _getws (wchar_t*);
142 _CRTIMP int __cdecl __MINGW_NOTHROW     _putws (const wchar_t*);
143 _CRTIMP FILE* __cdecl __MINGW_NOTHROW   _wfdopen(int, const wchar_t *);
144 _CRTIMP FILE* __cdecl __MINGW_NOTHROW   _wfopen (const wchar_t*, const wchar_t*);
145 _CRTIMP FILE* __cdecl __MINGW_NOTHROW   _wfreopen (const wchar_t*, const wchar_t*, FILE*);
146 _CRTIMP FILE* __cdecl __MINGW_NOTHROW   _wfsopen (const wchar_t*, const wchar_t*, int);
147 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wtmpnam (wchar_t*);
148 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wtempnam (const wchar_t*, const wchar_t*);
149 _CRTIMP int __cdecl __MINGW_NOTHROW     _wrename (const wchar_t*, const wchar_t*);
150 _CRTIMP int __cdecl __MINGW_NOTHROW     _wremove (const wchar_t*);
151 _CRTIMP void __cdecl __MINGW_NOTHROW    _wperror (const wchar_t*);
152 _CRTIMP FILE* __cdecl __MINGW_NOTHROW   _wpopen (const wchar_t*, const wchar_t*);
153 #endif  /* __STRICT_ANSI__ */
154 #endif  /* __MSVCRT__ */
155
156 #ifndef __NO_ISOCEXT  /* externs in libmingwex.a */
157 int __cdecl __MINGW_NOTHROW snwprintf (wchar_t*, size_t, const wchar_t*, ...);
158 int __cdecl __MINGW_NOTHROW vsnwprintf (wchar_t*, size_t, const wchar_t*, __VALIST);
159 #ifndef __NO_INLINE__
160 __CRT_INLINE int __cdecl __MINGW_NOTHROW
161 vsnwprintf (wchar_t* s, size_t n, const wchar_t* format, __VALIST arg)
162   { return _vsnwprintf ( s, n, format, arg);}
163 #endif
164 int __cdecl __MINGW_NOTHROW vwscanf (const wchar_t * __restrict__, __VALIST);
165 int __cdecl __MINGW_NOTHROW vfwscanf (FILE * __restrict__,
166                        const wchar_t * __restrict__, __VALIST);
167 int __cdecl __MINGW_NOTHROW vswscanf (const wchar_t * __restrict__,
168                        const wchar_t * __restrict__, __VALIST);
169 #endif
170
171 #define _WSTDIO_DEFINED
172 #endif /* _WSTDIO_DEFINED */
173
174 #ifndef _WSTDLIB_DEFINED /* also declared in stdlib.h */
175 _CRTIMP long __cdecl __MINGW_NOTHROW    wcstol (const wchar_t*, wchar_t**, int);
176 _CRTIMP unsigned long __cdecl __MINGW_NOTHROW wcstoul (const wchar_t*, wchar_t**, int);
177 _CRTIMP double __cdecl __MINGW_NOTHROW  wcstod (const wchar_t*, wchar_t**);
178 #if !defined __NO_ISOCEXT /* in libmingwex.a */
179 float __cdecl __MINGW_NOTHROW wcstof (const wchar_t * __restrict__, wchar_t ** __restrict__);
180 long double __cdecl __MINGW_NOTHROW wcstold (const wchar_t * __restrict__, wchar_t ** __restrict__);
181 #endif /* __NO_ISOCEXT */
182 #ifdef __MSVCRT__
183 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wgetenv(const wchar_t*);
184 _CRTIMP int __cdecl __MINGW_NOTHROW     _wputenv(const wchar_t*);
185 _CRTIMP void __cdecl __MINGW_NOTHROW    _wsearchenv(const wchar_t*, const wchar_t*, wchar_t*);
186 _CRTIMP int __cdecl __MINGW_NOTHROW     _wsystem(const wchar_t*);
187 _CRTIMP void __cdecl __MINGW_NOTHROW    _wmakepath(wchar_t*, const wchar_t*, const wchar_t*, const wchar_t*, const wchar_t*);
188 _CRTIMP void __cdecl __MINGW_NOTHROW    _wsplitpath (const wchar_t*, wchar_t*, wchar_t*, wchar_t*, wchar_t*);
189 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wfullpath (wchar_t*, const wchar_t*, size_t);
190 #endif
191 #define  _WSTDLIB_DEFINED
192 #endif /* _WSTDLIB_DEFINED */
193
194 #ifndef _WTIME_DEFINED
195 #ifndef __STRICT_ANSI__
196 #ifdef __MSVCRT__
197 /* wide function prototypes, also declared in time.h */
198 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW        _wasctime (const struct tm*);
199 #if __MSVCRT_VERSION__ < 0x0800
200 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW        _wctime (const time_t*);
201 #endif
202 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW        _wstrdate (wchar_t*);
203 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW        _wstrtime (wchar_t*);
204 #if __MSVCRT_VERSION__ >= 0x601
205 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW        _wctime64 (const __time64_t*);
206 #endif
207 #if __MSVCRT_VERSION__ >= 0x0800
208 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW        _wctime32 (const __time32_t*);
209 #ifndef _USE_32BIT_TIME_T
210 _CRTALIAS wchar_t* __cdecl __MINGW_NOTHROW      _wctime (const time_t* _v)      { return(_wctime64 (_v)); }
211 #else
212 _CRTALIAS wchar_t* __cdecl __MINGW_NOTHROW      _wctime (const time_t* _v)      { return(_wctime32 (_v)); }
213 #endif
214 #endif
215
216 #endif /* __MSVCRT__ */
217 #endif /* __STRICT_ANSI__ */
218 _CRTIMP size_t __cdecl __MINGW_NOTHROW  wcsftime (wchar_t*, size_t, const wchar_t*, const struct tm*);
219 #define _WTIME_DEFINED
220 #endif /* _WTIME_DEFINED */
221
222
223 #ifndef _WSTRING_DEFINED
224 /*
225  * Unicode versions of the standard string calls.
226  * Also in string.h.
227  */
228 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcscat (wchar_t*, const wchar_t*);
229 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcschr (const wchar_t*, wchar_t);
230 _CRTIMP int __cdecl __MINGW_NOTHROW     wcscmp (const wchar_t*, const wchar_t*);
231 _CRTIMP int __cdecl __MINGW_NOTHROW     wcscoll (const wchar_t*, const wchar_t*);
232 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcscpy (wchar_t*, const wchar_t*);
233 _CRTIMP size_t __cdecl __MINGW_NOTHROW  wcscspn (const wchar_t*, const wchar_t*);
234 /* Note:  _wcserror requires __MSVCRT_VERSION__ >= 0x0700.  */
235 _CRTIMP size_t __cdecl __MINGW_NOTHROW  wcslen (const wchar_t*);
236 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsncat (wchar_t*, const wchar_t*, size_t);
237 _CRTIMP int __cdecl __MINGW_NOTHROW     wcsncmp(const wchar_t*, const wchar_t*, size_t);
238 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsncpy(wchar_t*, const wchar_t*, size_t);
239 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcspbrk(const wchar_t*, const wchar_t*);
240 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsrchr(const wchar_t*, wchar_t);
241 _CRTIMP size_t __cdecl __MINGW_NOTHROW  wcsspn(const wchar_t*, const wchar_t*);
242 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsstr(const wchar_t*, const wchar_t*);
243 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcstok(wchar_t*, const wchar_t*);
244 _CRTIMP size_t __cdecl __MINGW_NOTHROW  wcsxfrm(wchar_t*, const wchar_t*, size_t);
245
246 #ifndef __STRICT_ANSI__
247 /*
248  * Unicode versions of non-ANSI functions provided by CRTDLL.
249  */
250
251 /* NOTE: _wcscmpi not provided by CRTDLL, this define is for portability */
252 #define         _wcscmpi        _wcsicmp
253
254 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wcsdup (const wchar_t*);
255 _CRTIMP int __cdecl __MINGW_NOTHROW     _wcsicmp (const wchar_t*, const wchar_t*);
256 _CRTIMP int __cdecl __MINGW_NOTHROW     _wcsicoll (const wchar_t*, const wchar_t*);
257 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wcslwr (wchar_t*);
258 _CRTIMP int __cdecl __MINGW_NOTHROW     _wcsnicmp (const wchar_t*, const wchar_t*, size_t);
259 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wcsnset (wchar_t*, wchar_t, size_t);
260 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wcsrev (wchar_t*);
261 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wcsset (wchar_t*, wchar_t);
262 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wcsupr (wchar_t*);
263
264 #ifdef __MSVCRT__
265 _CRTIMP int __cdecl __MINGW_NOTHROW  _wcsncoll(const wchar_t*, const wchar_t*, size_t);
266 _CRTIMP int   __cdecl __MINGW_NOTHROW _wcsnicoll(const wchar_t*, const wchar_t*, size_t);
267 #if __MSVCRT_VERSION__ >= 0x0700
268 _CRTIMP  wchar_t* __cdecl __MINGW_NOTHROW _wcserror(int);
269 _CRTIMP  wchar_t* __cdecl __MINGW_NOTHROW __wcserror(const wchar_t*);
270 #endif
271 #endif
272
273 #ifndef _NO_OLDNAMES
274 /* NOTE: There is no _wcscmpi, but this is for compatibility. */
275 int __cdecl __MINGW_NOTHROW wcscmpi (const wchar_t *, const wchar_t *);
276 #ifndef __NO_INLINE__
277 __CRT_INLINE int __cdecl __MINGW_NOTHROW
278 wcscmpi (const wchar_t * __ws1, const wchar_t * __ws2)
279   {return _wcsicmp (__ws1, __ws2);}
280 #endif
281 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsdup (const wchar_t*);
282 _CRTIMP int __cdecl __MINGW_NOTHROW     wcsicmp (const wchar_t*, const wchar_t*);
283 _CRTIMP int __cdecl __MINGW_NOTHROW     wcsicoll (const wchar_t*, const wchar_t*);
284 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcslwr (wchar_t*);
285 _CRTIMP int __cdecl __MINGW_NOTHROW     wcsnicmp (const wchar_t*, const wchar_t*, size_t);
286 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsnset (wchar_t*, wchar_t, size_t);
287 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsrev (wchar_t*);
288 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsset (wchar_t*, wchar_t);
289 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsupr (wchar_t*);
290 #endif  /* Not _NO_OLDNAMES */
291
292 #endif  /* Not strict ANSI */
293
294 #define _WSTRING_DEFINED
295 #endif  /* _WSTRING_DEFINED */
296
297 /* These are resolved by -lmingwex. Alternatively, they can be resolved by
298    adding -lmsvcp60 to your command line, which will give you the VC++
299    versions of these functions. If you want the latter and don't have
300    msvcp60.dll in your windows system directory, you can easily obtain
301    it with a search from your favorite search engine.  */
302 #ifndef __STRICT_ANSI__
303 typedef wchar_t _Wint_t;
304 #endif
305
306 typedef int mbstate_t;
307
308 wint_t __cdecl __MINGW_NOTHROW btowc(int);
309 size_t __cdecl __MINGW_NOTHROW mbrlen(const char * __restrict__, size_t,
310                       mbstate_t * __restrict__);
311 size_t __cdecl __MINGW_NOTHROW mbrtowc(wchar_t * __restrict__, const char * __restrict__,
312                        size_t, mbstate_t * __restrict__);
313 size_t __cdecl __MINGW_NOTHROW mbsrtowcs(wchar_t * __restrict__, const char ** __restrict__,
314                          size_t, mbstate_t * __restrict__);
315 size_t __cdecl __MINGW_NOTHROW wcrtomb(char * __restrict__, wchar_t,
316                        mbstate_t * __restrict__);
317 size_t __cdecl __MINGW_NOTHROW wcsrtombs(char * __restrict__, const wchar_t ** __restrict__,
318                          size_t, mbstate_t * __restrict__);
319 int __cdecl __MINGW_NOTHROW wctob(wint_t);
320
321 #ifndef __NO_ISOCEXT /* these need static lib libmingwex.a */
322 int __cdecl __MINGW_NOTHROW fwide(FILE*, int);
323 int __cdecl __MINGW_NOTHROW mbsinit(const mbstate_t*);
324 #ifndef __NO_INLINE__
325 __CRT_INLINE int __cdecl __MINGW_NOTHROW fwide(FILE* __UNUSED_PARAM(stream),
326                                                int mode)
327   {return mode;} /* Nothing to do  */
328 __CRT_INLINE int __cdecl __MINGW_NOTHROW mbsinit(const mbstate_t* __UNUSED_PARAM(ps))
329   {return 1;}
330 #endif
331 wchar_t* __cdecl __MINGW_NOTHROW wmemset(wchar_t *, wchar_t, size_t);
332 wchar_t* __cdecl __MINGW_NOTHROW wmemchr(const wchar_t*, wchar_t, size_t);
333 int wmemcmp(const wchar_t*, const wchar_t *, size_t);
334 wchar_t* __cdecl __MINGW_NOTHROW wmemcpy(wchar_t* __restrict__,
335                          const wchar_t* __restrict__,
336                          size_t);
337 wchar_t* __cdecl __MINGW_NOTHROW wmemmove(wchar_t* s1, const wchar_t *, size_t);
338 long long __cdecl __MINGW_NOTHROW wcstoll(const wchar_t * __restrict__,
339                           wchar_t** __restrict__, int);
340 unsigned long long __cdecl __MINGW_NOTHROW wcstoull(const wchar_t * __restrict__,
341                             wchar_t ** __restrict__, int);
342 #endif /* __NO_ISOCEXT */
343
344 #ifndef __STRICT_ANSI__
345 /* non-ANSI wide char functions from io.h, direct.h, sys/stat.h and locale.h.  */
346
347 #ifndef _FSIZE_T_DEFINED
348 typedef unsigned long   _fsize_t;
349 #define _FSIZE_T_DEFINED
350 #endif
351
352 #ifndef _WFINDDATA_T_DEFINED
353 struct _wfinddata_t {
354         unsigned        attrib;
355         time_t          time_create;    /* -1 for FAT file systems */
356         time_t          time_access;    /* -1 for FAT file systems */
357         time_t          time_write;
358         _fsize_t        size;
359         wchar_t         name[260];      /* may include spaces. */
360 };
361 struct _wfinddatai64_t {
362         unsigned    attrib;
363         time_t      time_create;
364         time_t      time_access;
365         time_t      time_write;
366         __int64     size;
367         wchar_t     name[260];
368 };
369 #if __MSVCRT_VERSION__ >= 0x0601
370 struct __wfinddata64_t {
371         unsigned    attrib;
372         __time64_t  time_create;
373         __time64_t  time_access;
374         __time64_t  time_write;
375 /* 8 bytes are returned so it can't be _fsize_t */
376         __int64    size;
377         wchar_t     name[260];
378 };
379 #endif
380 #if __MSVCRT_VERSION__ >= 0x0800
381 #include <stdio.h>
382 struct __wfinddata32_t {
383         unsigned        attrib;
384         __time32_t      time_create;
385         __time32_t      time_access;
386         __time32_t      time_write;
387         __int32         size;
388         wchar_t         name[FILENAME_MAX];
389 };
390
391 struct _wfinddata32i64_t {
392         unsigned        attrib;
393         __time32_t      time_create;
394         __time32_t      time_access;
395         __time32_t      time_write;
396         __int64         size;
397         wchar_t         name[FILENAME_MAX];
398 };
399
400 struct _wfinddata64i32_t {
401         unsigned        attrib;
402         __time64_t      time_create;
403         __time64_t      time_access;
404         __time64_t      time_write;
405         __int32         size;
406         wchar_t         name[FILENAME_MAX];
407 };
408 #endif /* __MSVCRT_VERSION__ >= 0x0800 */
409 #define _WFINDDATA_T_DEFINED
410 #endif
411
412 /* Wide character versions. Also defined in io.h. */
413 /* CHECK: I believe these only exist in MSVCRT, and not in CRTDLL. Also
414    applies to other wide character versions? */
415 #if !defined (_WIO_DEFINED)
416 #if defined (__MSVCRT__)
417 #include <stdint.h>  /* For intptr_t.  */
418 _CRTIMP int __cdecl __MINGW_NOTHROW     _waccess (const wchar_t*, int);
419 _CRTIMP int __cdecl __MINGW_NOTHROW     _wchmod (const wchar_t*, int);
420 _CRTIMP int __cdecl __MINGW_NOTHROW     _wcreat (const wchar_t*, int);
421 #if __MSVCRT_VERSION__ < 0x0800
422 _CRTIMP long __cdecl __MINGW_NOTHROW    _wfindfirst (const wchar_t*, struct _wfinddata_t *);
423 _CRTIMP int __cdecl __MINGW_NOTHROW     _wfindnext (long, struct _wfinddata_t *);
424 #endif
425 _CRTIMP int __cdecl __MINGW_NOTHROW     _wunlink (const wchar_t*);
426 _CRTIMP int __cdecl __MINGW_NOTHROW     _wopen (const wchar_t*, int, ...);
427 _CRTIMP int __cdecl __MINGW_NOTHROW     _wsopen (const wchar_t*, int, int, ...);
428 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wmktemp (wchar_t*);
429 #if __MSVCRT_VERSION__ < 0x0800
430 _CRTIMP long __cdecl __MINGW_NOTHROW    _wfindfirsti64 (const wchar_t*, struct _wfinddatai64_t*);
431 _CRTIMP int __cdecl __MINGW_NOTHROW     _wfindnexti64 (long, struct _wfinddatai64_t*);
432 #else
433 _CRTIMP long __cdecl __MINGW_NOTHROW    _wfindfirst32i64 (const wchar_t*, struct _wfinddata32i64_t*);
434 _CRTIMP long __cdecl __MINGW_NOTHROW    _wfindfirst64i32 (const wchar_t*, struct _wfinddata64i32_t*);
435 _CRTIMP int  __cdecl __MINGW_NOTHROW    _wfindnext32i64 (long, struct _wfinddata32i64_t*);
436 _CRTIMP int  __cdecl __MINGW_NOTHROW    _wfindnext64i32 (long, struct _wfinddata64i32_t*);
437 #endif /* __MSVCRT_VERSION__ < 0x0800 */
438 #if __MSVCRT_VERSION__ >= 0x0601
439 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wfindfirst64(const wchar_t*, struct __wfinddata64_t*);
440 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wfindnext64(intptr_t, struct __wfinddata64_t*);
441 #endif /* __MSVCRT_VERSION__ >= 0x0601 */
442 #if __MSVCRT_VERSION__ >= 0x0800
443 _CRTIMP long __cdecl __MINGW_NOTHROW    _wfindfirst32 (const wchar_t*, struct __wfinddata32_t*);
444 _CRTIMP int  __cdecl __MINGW_NOTHROW    _wfindnext32 (long, struct __wfinddata32_t*);
445 #ifndef _USE_32BIT_TIME_T
446 _CRTALIAS long __cdecl __MINGW_NOTHROW  _wfindfirst (const wchar_t* _v1, struct _wfinddata_t* _v2)       { return(_wfindfirst64i32 (_v1,(struct _wfinddata64i32_t*)_v2)); }
447 _CRTALIAS int  __cdecl __MINGW_NOTHROW  _wfindnext (long _v1, struct _wfinddata_t* _v2)                  { return(_wfindnext64i32  (_v1,(struct _wfinddata64i32_t*)_v2)); }
448 _CRTALIAS long __cdecl __MINGW_NOTHROW  _wfindfirsti64 (const wchar_t* _v1, struct _wfinddatai64_t* _v2) { return(_wfindfirst64 (_v1,(struct __wfinddata64_t*)_v2)); }
449 _CRTALIAS int  __cdecl __MINGW_NOTHROW  _wfindnexti64 (long _v1, struct _wfinddatai64_t* _v2)            { return(_wfindnext64  (_v1,(struct __wfinddata64_t*)_v2)); }
450 #else
451 _CRTALIAS long __cdecl __MINGW_NOTHROW  _wfindfirst (const wchar_t* _v1, struct _wfinddata_t* _v2)       { return(_wfindfirst32 (_v1,(struct __wfinddata32_t*)_v2)); }
452 _CRTALIAS int  __cdecl __MINGW_NOTHROW  _wfindnext (long _v1, struct _wfinddata_t* _v2)                  { return(_wfindnext32  (_v1,(struct __wfinddata32_t*)_v2)); }
453 _CRTALIAS long __cdecl __MINGW_NOTHROW  _wfindfirsti64 (const wchar_t* _v1, struct _wfinddatai64_t* _v2) { return(_wfindfirst32i64 (_v1,(struct _wfinddata32i64_t*)_v2)); }
454 _CRTALIAS int  __cdecl __MINGW_NOTHROW  _wfindnexti64 (long _v1, struct _wfinddatai64_t* _v2)            { return(_wfindnext32i64  (_v1,(struct _wfinddata32i64_t*)_v2)); }
455 #endif /* !_USE_32BIT_TIME_T*/
456 #endif /* __MSVCRT_VERSION__ >= 0x0800 */
457
458 #endif /* defined (__MSVCRT__) */
459 #define _WIO_DEFINED
460 #endif /* _WIO_DEFINED */
461
462 #ifndef _WDIRECT_DEFINED
463 /* Also in direct.h */
464 #ifdef __MSVCRT__
465 _CRTIMP int __cdecl __MINGW_NOTHROW       _wchdir (const wchar_t*);
466 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW  _wgetcwd (wchar_t*, int);
467 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW  _wgetdcwd (int, wchar_t*, int);
468 _CRTIMP int __cdecl __MINGW_NOTHROW       _wmkdir (const wchar_t*);
469 _CRTIMP int __cdecl __MINGW_NOTHROW       _wrmdir (const wchar_t*);
470 #endif  /* __MSVCRT__ */
471 #define _WDIRECT_DEFINED
472 #endif /* _WDIRECT_DEFINED */
473
474 #ifndef _STAT_DEFINED
475 /*
476  * The structure manipulated and returned by stat and fstat.
477  *
478  * NOTE: If called on a directory the values in the time fields are not only
479  * invalid, they will cause localtime et. al. to return NULL. And calling
480  * asctime with a NULL pointer causes an Invalid Page Fault. So watch it!
481  */
482 struct _stat
483 {
484         _dev_t  st_dev;         /* Equivalent to drive number 0=A 1=B ... */
485         _ino_t  st_ino;         /* Always zero ? */
486         _mode_t st_mode;        /* See above constants */
487         short   st_nlink;       /* Number of links. */
488         short   st_uid;         /* User: Maybe significant on NT ? */
489         short   st_gid;         /* Group: Ditto */
490         _dev_t  st_rdev;        /* Seems useless (not even filled in) */
491         _off_t  st_size;        /* File size in bytes */
492         time_t  st_atime;       /* Accessed date (always 00:00 hrs local
493                                  * on FAT) */
494         time_t  st_mtime;       /* Modified time */
495         time_t  st_ctime;       /* Creation time */
496 };
497
498 #ifndef _NO_OLDNAMES
499 /* NOTE: Must be the same as _stat above. */
500 struct stat
501 {
502         dev_t   st_dev;         /* Equivalent to drive number 0=A 1=B ... */
503         ino_t   st_ino;         /* Always zero ? */
504         mode_t  st_mode;        /* See above constants */
505         short   st_nlink;       /* Number of links. */
506         short   st_uid;         /* User: Maybe significant on NT ? */
507         short   st_gid;         /* Group: Ditto */
508         dev_t   st_rdev;        /* Seems useless (not even filled in) */
509         off_t   st_size;        /* File size in bytes */
510         time_t  st_atime;       /* Accessed date (always 00:00 hrs local
511                                  * on FAT) */
512         time_t  st_mtime;       /* Modified time */
513         time_t  st_ctime;       /* Creation time */
514 };
515 #endif /* _NO_OLDNAMES */
516
517 #if defined (__MSVCRT__)
518 struct _stati64 {
519     _dev_t st_dev;
520     _ino_t st_ino;
521     unsigned short st_mode;
522     short st_nlink;
523     short st_uid;
524     short st_gid;
525     _dev_t st_rdev;
526     __int64 st_size;
527     time_t st_atime;
528     time_t st_mtime;
529     time_t st_ctime;
530 };
531
532 #if __MSVCRT_VERSION__ >= 0x0601
533 struct __stat64
534 {
535     _dev_t st_dev;
536     _ino_t st_ino;
537     _mode_t st_mode;
538     short st_nlink;
539     short st_uid;
540     short st_gid;
541     _dev_t st_rdev;
542     __int64 st_size;
543     __time64_t st_atime;
544     __time64_t st_mtime;
545     __time64_t st_ctime;
546 };
547 #endif  /* __MSVCRT_VERSION__ >= 0x0601*/
548
549 #if __MSVCRT_VERSION__ >= 0x0800
550 struct __stat32
551 {
552         _dev_t          st_dev;
553         _ino_t          st_ino;
554         _mode_t         st_mode;
555         short           st_nlink;
556         short           st_uid;
557         short           st_gid;
558         _dev_t          st_rdev;
559         __int32         st_size;
560         __time32_t      st_atime;
561         __time32_t      st_mtime;
562         __time32_t      st_ctime;
563 };
564 struct _stat32i64 {
565         _dev_t          st_dev;
566         _ino_t          st_ino;
567         _mode_t         st_mode;
568         short           st_nlink;
569         short           st_uid;
570         short           st_gid;
571         _dev_t          st_rdev;
572         __int64         st_size;
573         __time32_t      st_atime;
574         __time32_t      st_mtime;
575         __time32_t      st_ctime;
576 };
577 struct _stat64i32 {
578         _dev_t          st_dev;
579         _ino_t          st_ino;
580         _mode_t         st_mode;
581         short           st_nlink;
582         short           st_uid;
583         short           st_gid;
584         _dev_t          st_rdev;
585         __int32         st_size;
586         __time64_t      st_atime;
587         __time64_t      st_mtime;
588         __time64_t      st_ctime;
589 };
590 #endif /* __MSVCRT_VERSION__ >= 0x0800 */
591
592 #endif  /* __MSVCRT__ */
593 #define _STAT_DEFINED
594 #endif /* _STAT_DEFINED */
595
596 #if !defined ( _WSTAT_DEFINED)
597 /* also declared in sys/stat.h */
598 #if defined __MSVCRT__
599 #if __MSVCRT_VERSION__ < 0x0800
600 _CRTIMP int __cdecl __MINGW_NOTHROW     _wstat (const wchar_t*, struct _stat*);
601 _CRTIMP int __cdecl __MINGW_NOTHROW     _wstati64 (const wchar_t*, struct _stati64*);
602 #endif /* __MSVCRT_VERSION__ < 0x0800 */
603 #if __MSVCRT_VERSION__ >= 0x0601
604 _CRTIMP int __cdecl __MINGW_NOTHROW _wstat64 (const wchar_t*, struct __stat64*);
605 #endif /* __MSVCRT_VERSION__ >= 0x0601 */
606 #if __MSVCRT_VERSION__ >= 0x0800
607 _CRTIMP int __cdecl __MINGW_NOTHROW     _wstat32 (const wchar_t*, struct __stat32*);
608 _CRTIMP int __cdecl __MINGW_NOTHROW     _wstat32i64 (const wchar_t*, struct _stat32i64*);
609 _CRTIMP int __cdecl __MINGW_NOTHROW     _wstat64i32 (const wchar_t*, struct _stat64i32*);
610 #ifndef _USE_32BIT_TIME_T
611 _CRTALIAS int __cdecl __MINGW_NOTHROW   _wstat (const wchar_t* _v1, struct _stat* _v2)       { return(_wstat64i32 (_v1,(struct _stat64i32*)_v2)); }
612 _CRTALIAS int __cdecl __MINGW_NOTHROW   _wstati64 (const wchar_t* _v1, struct _stati64* _v2) { return(_wstat64 (_v1,(struct __stat64*)_v2)); }
613 #else
614 _CRTALIAS int __cdecl __MINGW_NOTHROW   _wstat (const wchar_t* _v1, struct _stat* _v2)       { return(_wstat32 (_v1,(struct __stat32*)_v2)); }
615 _CRTALIAS int __cdecl __MINGW_NOTHROW   _wstati64 (const wchar_t* _v1, struct _stati64* _v2) { return(_wstat32i64 (_v1,(struct _stat32i64*)_v2)); }
616 #endif /* !_USE_32BIT_TIME_T */
617 #endif /* __MSVCRT_VERSION__ >= 0x0800 */
618 #endif  /* __MSVCRT__ */
619 #define _WSTAT_DEFINED
620 #endif /* ! _WSTAT_DEFIND  */
621
622 #ifndef _WLOCALE_DEFINED  /* also declared in locale.h */
623 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wsetlocale (int, const wchar_t*);
624 #define _WLOCALE_DEFINED
625 #endif
626
627 #ifndef _WPROCESS_DEFINED  /* also declared in process.h */
628 #include <stdint.h>  /* For intptr_t.  */
629 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wexecl        (const wchar_t*, const wchar_t*, ...);
630 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wexecle       (const wchar_t*, const wchar_t*, ...);
631 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wexeclp       (const wchar_t*, const wchar_t*, ...);
632 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wexeclpe      (const wchar_t*, const wchar_t*, ...);
633 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wexecv        (const wchar_t*, const wchar_t* const*);
634 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wexecve       (const wchar_t*, const wchar_t* const*, const wchar_t* const*);
635 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wexecvp       (const wchar_t*, const wchar_t* const*);
636 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wexecvpe      (const wchar_t*, const wchar_t* const*, const wchar_t* const*);
637
638 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wspawnl       (int, const wchar_t*, const wchar_t*, ...);
639 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wspawnle      (int, const wchar_t*, const wchar_t*, ...);
640 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wspawnlp      (int, const wchar_t*, const wchar_t*, ...);
641 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wspawnlpe     (int, const wchar_t*, const wchar_t*, ...);
642 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wspawnv       (int, const wchar_t*, const wchar_t* const*);
643 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wspawnve      (int, const wchar_t*, const wchar_t* const*, const wchar_t* const*);
644 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wspawnvp      (int, const wchar_t*, const wchar_t* const*);
645 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wspawnvpe     (int, const wchar_t*, const wchar_t* const*, const wchar_t* const*);
646
647 #define _WPROCESS_DEFINED
648 #endif
649 #endif /* ! __STRICT_ANSI__ */
650
651 _END_C_DECLS
652
653 #endif /* ! RC_INVOKED */
654 #endif /* ! _WCHAR_H */