3 * Copyright 2012, 2013 MinGW.org project
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
26 #ifndef __CRT_TESTING__
27 #pragma GCC system_header
35 #define __need_wchar_t
40 #define __need___va_list
42 #define __VALIST __builtin_va_list
43 #endif /* ndef __VALIST */
45 #endif /* Not RC_INVOKED */
48 * MSDN says that isw* char classifications are in wchar.h and wctype.h.
49 * Although the wctype names are ANSI, their exposure in this header is
53 #include <sys/types.h>
56 #define WCHAR_MAX 0xffff
59 #define WEOF (wchar_t)(0xFFFF)
63 #define FILENAME_MAX 260
72 #ifndef _FILE_DEFINED /* Also in stdio.h */
85 #endif /* Not _FILE_DEFINED */
87 #ifndef _TM_DEFINED /* Also in time.h */
89 int tm_sec; /* seconds after the minute - [0,59] */
90 int tm_min; /* minutes after the hour - [0,59] */
91 int tm_hour; /* hours since midnight - [0,23] */
92 int tm_mday; /* day of the month - [1,31] */
93 int tm_mon; /* months since January - [0,11] */
94 int tm_year; /* years since 1900 */
95 int tm_wday; /* days since Sunday - [0,6] */
96 int tm_yday; /* days since January 1 - [0,365] */
97 int tm_isdst; /* daylight savings time flag */
103 * Structure used by _utime function.
105 #ifndef _UTIMBUF_DEFINED
108 time_t actime; /* Access time */
109 time_t modtime; /* Modification time */
124 /* NOTE: Must be the same as _utimbuf above. */
135 #endif /* Not _NO_OLDNAMES */
136 #define _UTIMBUF_DEFINED
137 #endif /* ndef _UTIMBUF_DEFINED */
139 #ifndef _WSTDIO_DEFINED
140 /* Also in stdio.h - keep in sync */
141 _CRTIMP int __cdecl __MINGW_NOTHROW fwprintf (FILE*, const wchar_t*, ...);
142 _CRTIMP int __cdecl __MINGW_NOTHROW wprintf (const wchar_t*, ...);
143 _CRTIMP int __cdecl __MINGW_NOTHROW _snwprintf (wchar_t*, size_t, const wchar_t*, ...);
144 _CRTIMP int __cdecl __MINGW_NOTHROW vfwprintf (FILE*, const wchar_t*, __VALIST);
145 _CRTIMP int __cdecl __MINGW_NOTHROW vwprintf (const wchar_t*, __VALIST);
146 _CRTIMP int __cdecl __MINGW_NOTHROW _vsnwprintf (wchar_t*, size_t, const wchar_t*, __VALIST);
147 _CRTIMP int __cdecl __MINGW_NOTHROW _vscwprintf (const wchar_t*, __VALIST);
148 _CRTIMP int __cdecl __MINGW_NOTHROW fwscanf (FILE*, const wchar_t*, ...);
149 _CRTIMP int __cdecl __MINGW_NOTHROW wscanf (const wchar_t*, ...);
150 _CRTIMP int __cdecl __MINGW_NOTHROW swscanf (const wchar_t*, const wchar_t*, ...);
151 _CRTIMP wint_t __cdecl __MINGW_NOTHROW fgetwc (FILE*);
152 _CRTIMP wint_t __cdecl __MINGW_NOTHROW fputwc (wchar_t, FILE*);
153 _CRTIMP wint_t __cdecl __MINGW_NOTHROW ungetwc (wchar_t, FILE*);
155 /* These differ from the ISO C prototypes, which have a maxlen parameter like snprintf. */
156 #ifndef __STRICT_ANSI__
157 _CRTIMP int __cdecl __MINGW_NOTHROW swprintf (wchar_t*, const wchar_t*, ...);
158 _CRTIMP int __cdecl __MINGW_NOTHROW vswprintf (wchar_t*, const wchar_t*, __VALIST);
159 #endif /* ndef __STRICT_ANSI__ */
161 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW fgetws (wchar_t*, int, FILE*);
162 _CRTIMP int __cdecl __MINGW_NOTHROW fputws (const wchar_t*, FILE*);
163 _CRTIMP wint_t __cdecl __MINGW_NOTHROW getwc (FILE*);
164 _CRTIMP wint_t __cdecl __MINGW_NOTHROW getwchar (void);
165 _CRTIMP wint_t __cdecl __MINGW_NOTHROW putwc (wint_t, FILE*);
166 _CRTIMP wint_t __cdecl __MINGW_NOTHROW putwchar (wint_t);
168 #ifndef __STRICT_ANSI__
169 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _getws (wchar_t*);
170 _CRTIMP int __cdecl __MINGW_NOTHROW _putws (const wchar_t*);
171 _CRTIMP FILE* __cdecl __MINGW_NOTHROW _wfdopen(int, const wchar_t *);
172 _CRTIMP FILE* __cdecl __MINGW_NOTHROW _wfopen (const wchar_t*, const wchar_t*);
173 _CRTIMP FILE* __cdecl __MINGW_NOTHROW _wfreopen (const wchar_t*, const wchar_t*, FILE*);
174 _CRTIMP FILE* __cdecl __MINGW_NOTHROW _wfsopen (const wchar_t*, const wchar_t*, int);
175 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wtmpnam (wchar_t*);
176 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wtempnam (const wchar_t*, const wchar_t*);
177 _CRTIMP int __cdecl __MINGW_NOTHROW _wrename (const wchar_t*, const wchar_t*);
178 _CRTIMP int __cdecl __MINGW_NOTHROW _wremove (const wchar_t*);
179 _CRTIMP void __cdecl __MINGW_NOTHROW _wperror (const wchar_t*);
180 _CRTIMP FILE* __cdecl __MINGW_NOTHROW _wpopen (const wchar_t*, const wchar_t*);
181 #endif /* __STRICT_ANSI__ */
183 #ifndef __NO_ISOCEXT /* externs in libmingwex.a */
184 int __cdecl __MINGW_NOTHROW snwprintf (wchar_t*, size_t, const wchar_t*, ...);
185 int __cdecl __MINGW_NOTHROW vsnwprintf (wchar_t*, size_t, const wchar_t*, __VALIST);
187 #ifndef __NO_INLINE__
188 __CRT_INLINE int __cdecl __MINGW_NOTHROW
189 vsnwprintf (wchar_t* s, size_t n, const wchar_t* format, __VALIST arg)
190 { return _vsnwprintf ( s, n, format, arg);}
193 int __cdecl __MINGW_NOTHROW vwscanf (const wchar_t * __restrict__, __VALIST);
194 int __cdecl __MINGW_NOTHROW vfwscanf (FILE * __restrict__,
195 const wchar_t * __restrict__, __VALIST);
196 int __cdecl __MINGW_NOTHROW vswscanf (const wchar_t * __restrict__,
197 const wchar_t * __restrict__, __VALIST);
198 #endif /* ndef __NO_ISOCEXT__ */
200 #define _WSTDIO_DEFINED
201 #endif /* _WSTDIO_DEFINED */
203 #ifndef _WSTDLIB_DEFINED /* also declared in stdlib.h */
204 _CRTIMP long __cdecl __MINGW_NOTHROW wcstol (const wchar_t*, wchar_t**, int);
205 _CRTIMP unsigned long __cdecl __MINGW_NOTHROW wcstoul (const wchar_t*, wchar_t**, int);
206 _CRTIMP double __cdecl __MINGW_NOTHROW wcstod (const wchar_t*, wchar_t**);
208 #if !defined __NO_ISOCEXT /* in libmingwex.a */
209 float __cdecl __MINGW_NOTHROW wcstof (const wchar_t * __restrict__, wchar_t ** __restrict__);
210 long double __cdecl __MINGW_NOTHROW wcstold (const wchar_t * __restrict__, wchar_t ** __restrict__);
211 #endif /* __NO_ISOCEXT */
213 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wgetenv(const wchar_t*);
214 _CRTIMP int __cdecl __MINGW_NOTHROW _wputenv(const wchar_t*);
215 _CRTIMP void __cdecl __MINGW_NOTHROW _wsearchenv(const wchar_t*, const wchar_t*, wchar_t*);
216 _CRTIMP int __cdecl __MINGW_NOTHROW _wsystem(const wchar_t*);
217 _CRTIMP void __cdecl __MINGW_NOTHROW _wmakepath(wchar_t*, const wchar_t*, const wchar_t*, const wchar_t*, const wchar_t*);
218 _CRTIMP void __cdecl __MINGW_NOTHROW _wsplitpath (const wchar_t*, wchar_t*, wchar_t*, wchar_t*, wchar_t*);
219 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wfullpath (wchar_t*, const wchar_t*, size_t);
220 _CRTIMP __int64 __cdecl _wcstoi64(const wchar_t *, wchar_t **, int);
221 _CRTIMP __int64 __cdecl _wcstoi64_l(const wchar_t *, wchar_t **, int, _locale_t);
222 _CRTIMP unsigned __int64 __cdecl _wcstoui64(const wchar_t *, wchar_t **, int);
223 _CRTIMP unsigned __int64 __cdecl _wcstoui64_l(const wchar_t *, wchar_t **, int, _locale_t);
224 #define _WSTDLIB_DEFINED
225 #endif /* _WSTDLIB_DEFINED */
227 #ifndef _WTIME_DEFINED
228 #ifndef __STRICT_ANSI__
229 /* wide function prototypes, also declared in time.h */
230 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wasctime (const struct tm*);
231 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wstrdate (wchar_t*);
232 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wstrtime (wchar_t*);
233 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wctime64 (const __time64_t*);
235 /* MSVCRT.DLL may not have _wctime32 depending on OS version */
236 #if MSVCRT_VERSION >= 800
237 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wctime32 (const __time32_t*);
239 #else /* MSVCRT_VERSION < 800 */
240 _CRTALIAS wchar_t* __cdecl __MINGW_NOTHROW _wctime32 (const __time32_t* _v1) {
241 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wctime (const __time32_t*);
244 #endif /* MSVCRT_VERSION >= 800 */
246 #if MSVCRT_VERSION >= 800
247 #ifdef _USE_32BIT_TIME_T
248 _CRTALIAS wchar_t* __cdecl __MINGW_NOTHROW _wctime (const time_t* _v) { return(_wctime32 (_v)); }
250 #else /* ! _USE_32BIT_TIME_T */
251 _CRTALIAS wchar_t* __cdecl __MINGW_NOTHROW _wctime (const time_t* _v) { return(_wctime64 (_v)); }
252 #endif /* _USE_32BIT_TIME_T */
254 #else /* MSVCRT_VERSION < 800 */
255 #ifdef _USE_32BIT_TIME_T
256 #define _wctime _wctime32
258 #else /* ndef _USE_32BIT_TIME_T */
259 #define _wctime _wctime64
261 #endif /* def _USE_32BIT_TIME_T */
262 #endif /* MSVCRT_VERSION >= 800 */
263 #endif /* __STRICT_ANSI__ */
265 _CRTIMP size_t __cdecl __MINGW_NOTHROW wcsftime (wchar_t*, size_t, const wchar_t*, const struct tm*);
267 #ifndef _WUTIME_DEFINED
268 _CRTIMP int __cdecl __MINGW_NOTHROW _wutime64 (const wchar_t*, struct __utimbuf64*);
269 #if MSVCRT_VERSION >= 800
270 _CRTIMP int __cdecl __MINGW_NOTHROW _wutime32 (const wchar_t*, struct __utimbuf32*);
272 #else /* MSVCRT_VERSION < 800 */
273 _CRTIMP int __cdecl __MINGW_NOTHROW _wutime (const wchar_t*, struct _utimbuf*);
274 _CRTALIAS int __cdecl __MINGW_NOTHROW _wutime32 (const wchar_t* _v1, struct __utimbuf32* _v2) {
275 return _wutime(_v1, (struct _utimbuf *)_v2);
278 #endif /* MSVCRT_VERSION >= 800 */
279 #ifdef _USE_32BIT_TIME_T
280 #if MSVCRT_VERSION >= 800
281 _CRTALIAS int __cdecl __MINGW_NOTHROW _wutime (const wchar_t* _v1, struct _utimbuf* _v2) {
282 return(_wutime32 (_v1,(struct __utimbuf32*)_v2));
284 #endif /* MSVCRT_VERSION >= 800 */
286 #else /* ndef _USE_32BIT_TIME_T */
287 _CRTALIAS int __cdecl __MINGW_NOTHROW _wutime (const wchar_t* _v1, struct _utimbuf* _v2) {
288 return(_wutime64 (_v1,(struct __utimbuf64*)_v2));
291 #endif /* def _USE_32BIT_TIME_T */
292 #define _WUTIME_DEFINED
293 #endif /* ndef _WUTIME_DEFINED */
295 #define _WTIME_DEFINED
296 #endif /* _WTIME_DEFINED */
299 #ifndef _WSTRING_DEFINED
301 * Unicode versions of the standard string calls.
304 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcscat (wchar_t*, const wchar_t*);
305 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcschr (const wchar_t*, wchar_t);
306 _CRTIMP int __cdecl __MINGW_NOTHROW wcscmp (const wchar_t*, const wchar_t*);
307 _CRTIMP int __cdecl __MINGW_NOTHROW wcscoll (const wchar_t*, const wchar_t*);
308 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcscpy (wchar_t*, const wchar_t*);
309 _CRTIMP size_t __cdecl __MINGW_NOTHROW wcscspn (const wchar_t*, const wchar_t*);
310 /* Note: _wcserror requires __MSVCRT_VERSION__ >= 0x0700. */
311 _CRTIMP size_t __cdecl __MINGW_NOTHROW wcslen (const wchar_t*);
312 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsncat (wchar_t*, const wchar_t*, size_t);
313 _CRTIMP int __cdecl __MINGW_NOTHROW wcsncmp(const wchar_t*, const wchar_t*, size_t);
314 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsncpy(wchar_t*, const wchar_t*, size_t);
315 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcspbrk(const wchar_t*, const wchar_t*);
316 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsrchr(const wchar_t*, wchar_t);
317 _CRTIMP size_t __cdecl __MINGW_NOTHROW wcsspn(const wchar_t*, const wchar_t*);
318 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsstr(const wchar_t*, const wchar_t*);
319 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcstok(wchar_t*, const wchar_t*);
320 _CRTIMP size_t __cdecl __MINGW_NOTHROW wcsxfrm(wchar_t*, const wchar_t*, size_t);
322 #ifndef __STRICT_ANSI__
323 /* NOTE: _wcscmpi not provided by runtime dll, this define is for portability */
324 #define _wcscmpi _wcsicmp
326 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wcsdup (const wchar_t*);
327 _CRTIMP int __cdecl __MINGW_NOTHROW _wcsicmp (const wchar_t*, const wchar_t*);
328 _CRTIMP int __cdecl __MINGW_NOTHROW _wcsicoll (const wchar_t*, const wchar_t*);
329 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wcslwr (wchar_t*);
330 _CRTIMP int __cdecl __MINGW_NOTHROW _wcsnicmp (const wchar_t*, const wchar_t*, size_t);
331 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wcsnset (wchar_t*, wchar_t, size_t);
332 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wcsrev (wchar_t*);
333 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wcsset (wchar_t*, wchar_t);
334 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wcsupr (wchar_t*);
336 _CRTIMP int __cdecl __MINGW_NOTHROW _wcsncoll(const wchar_t*, const wchar_t*, size_t);
337 _CRTIMP int __cdecl __MINGW_NOTHROW _wcsnicoll(const wchar_t*, const wchar_t*, size_t);
338 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wcserror(int);
339 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW __wcserror(const wchar_t*);
342 /* NOTE: There is no _wcscmpi, but this is for compatibility. */
343 int __cdecl __MINGW_NOTHROW wcscmpi (const wchar_t *, const wchar_t *);
344 _CRTALIAS int __cdecl __MINGW_NOTHROW
345 wcscmpi (const wchar_t * __ws1, const wchar_t * __ws2)
346 {return _wcsicmp (__ws1, __ws2);}
347 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsdup (const wchar_t*);
348 _CRTIMP int __cdecl __MINGW_NOTHROW wcsicmp (const wchar_t*, const wchar_t*);
349 _CRTIMP int __cdecl __MINGW_NOTHROW wcsicoll (const wchar_t*, const wchar_t*);
350 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcslwr (wchar_t*);
351 _CRTIMP int __cdecl __MINGW_NOTHROW wcsnicmp (const wchar_t*, const wchar_t*, size_t);
352 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsnset (wchar_t*, wchar_t, size_t);
353 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsrev (wchar_t*);
354 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsset (wchar_t*, wchar_t);
355 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsupr (wchar_t*);
356 #endif /* Not _NO_OLDNAMES */
358 #endif /* Not strict ANSI */
360 #define _WSTRING_DEFINED
361 #endif /* _WSTRING_DEFINED */
363 /* These are resolved by -lmingwex. Alternatively, they can be resolved by
364 adding -lmsvcp60 to your command line, which will give you the VC++
365 versions of these functions. If you want the latter and don't have
366 msvcp60.dll in your windows system directory, you can easily obtain
367 it with a search from your favorite search engine. */
369 #ifndef __STRICT_ANSI__
370 typedef wchar_t _Wint_t;
373 typedef int mbstate_t;
375 wint_t __cdecl __MINGW_NOTHROW btowc(int);
376 size_t __cdecl __MINGW_NOTHROW mbrlen(const char * __restrict__, size_t,
377 mbstate_t * __restrict__);
378 size_t __cdecl __MINGW_NOTHROW mbrtowc(wchar_t * __restrict__, const char * __restrict__,
379 size_t, mbstate_t * __restrict__);
380 size_t __cdecl __MINGW_NOTHROW mbsrtowcs(wchar_t * __restrict__, const char ** __restrict__,
381 size_t, mbstate_t * __restrict__);
382 size_t __cdecl __MINGW_NOTHROW wcrtomb(char * __restrict__, wchar_t,
383 mbstate_t * __restrict__);
384 size_t __cdecl __MINGW_NOTHROW wcsrtombs(char * __restrict__, const wchar_t ** __restrict__,
385 size_t, mbstate_t * __restrict__);
386 int __cdecl __MINGW_NOTHROW wctob(wint_t);
388 #ifndef __NO_ISOCEXT /* these need static lib libmingwex.a */
389 int __cdecl __MINGW_NOTHROW fwide(FILE*, int);
390 int __cdecl __MINGW_NOTHROW mbsinit(const mbstate_t*);
392 #ifndef __NO_INLINE__
393 __CRT_INLINE int __cdecl __MINGW_NOTHROW fwide(FILE* __UNUSED_PARAM(stream),
395 {return mode;} /* Nothing to do */
396 __CRT_INLINE int __cdecl __MINGW_NOTHROW mbsinit(const mbstate_t* __UNUSED_PARAM(ps))
400 wchar_t* __cdecl __MINGW_NOTHROW wmemset(wchar_t *, wchar_t, size_t);
401 wchar_t* __cdecl __MINGW_NOTHROW wmemchr(const wchar_t*, wchar_t, size_t);
402 int wmemcmp(const wchar_t*, const wchar_t *, size_t);
403 wchar_t* __cdecl __MINGW_NOTHROW wmemcpy(wchar_t* __restrict__,
404 const wchar_t* __restrict__,
406 wchar_t* __cdecl __MINGW_NOTHROW wmemmove(wchar_t* s1, const wchar_t *, size_t);
407 long long __cdecl __MINGW_NOTHROW wcstoll(const wchar_t * __restrict__,
408 wchar_t** __restrict__, int);
409 unsigned long long __cdecl __MINGW_NOTHROW wcstoull(const wchar_t * __restrict__,
410 wchar_t ** __restrict__, int);
411 #endif /* __NO_ISOCEXT */
413 #ifndef __STRICT_ANSI__
414 /* non-ANSI wide char functions from io.h, direct.h, sys/stat.h and locale.h. */
416 #ifndef _FSIZE_T_DEFINED
417 typedef unsigned long _fsize_t;
418 #define _FSIZE_T_DEFINED
421 #ifndef _WFINDDATA_T_DEFINED
422 struct _wfinddata_t {
424 time_t time_create; /* -1 for FAT file systems */
425 time_t time_access; /* -1 for FAT file systems */
428 wchar_t name[FILENAME_MAX]; /* may include spaces. */
430 struct _wfinddatai64_t {
436 wchar_t name[FILENAME_MAX];
438 struct _wfinddata64_t {
440 __time64_t time_create;
441 __time64_t time_access;
442 __time64_t time_write;
443 /* 8 bytes are returned so it can't be _fsize_t */
445 wchar_t name[FILENAME_MAX];
447 struct _wfinddata32_t {
449 __time32_t time_create;
450 __time32_t time_access;
451 __time32_t time_write;
453 wchar_t name[FILENAME_MAX];
456 struct _wfinddata32i64_t {
458 __time32_t time_create;
459 __time32_t time_access;
460 __time32_t time_write;
462 wchar_t name[FILENAME_MAX];
465 struct _wfinddata64i32_t {
467 __time64_t time_create;
468 __time64_t time_access;
469 __time64_t time_write;
471 wchar_t name[FILENAME_MAX];
473 #define _WFINDDATA_T_DEFINED
476 /* Wide character versions. Also defined in io.h. */
477 #if !defined (_WIO_DEFINED)
479 #include <stdint.h> /* For intptr_t. */
480 _CRTIMP int __cdecl __MINGW_NOTHROW _waccess (const wchar_t*, int);
481 _CRTIMP int __cdecl __MINGW_NOTHROW _wchmod (const wchar_t*, int);
482 _CRTIMP int __cdecl __MINGW_NOTHROW _wcreat (const wchar_t*, int);
483 _CRTIMP int __cdecl __MINGW_NOTHROW _wunlink (const wchar_t*);
484 _CRTIMP int __cdecl __MINGW_NOTHROW _wopen (const wchar_t*, int, ...);
485 _CRTIMP int __cdecl __MINGW_NOTHROW _wsopen (const wchar_t*, int, int, ...);
486 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wmktemp (wchar_t*);
487 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wfindfirst (const wchar_t*, struct _wfinddata32_t*);
488 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wfindfirsti64 (const wchar_t*, struct _wfinddatai64_t*);
489 _CRTIMP int __cdecl __MINGW_NOTHROW _wfindnexti64 (long, struct _wfinddatai64_t*);
490 intptr_t __cdecl __MINGW_NOTHROW _wfindfirst32i64 (const wchar_t*, struct _wfinddata32i64_t*);
491 intptr_t __cdecl __MINGW_NOTHROW _wfindfirst64i32 (const wchar_t*, struct _wfinddata64i32_t*);
492 _CRTIMP int __cdecl __MINGW_NOTHROW _wfindnext (intptr_t, struct _wfinddata32_t*);
493 int __cdecl __MINGW_NOTHROW _wfindnext32i64 (intptr_t, struct _wfinddata32i64_t*);
494 int __cdecl __MINGW_NOTHROW _wfindnext64i32 (intptr_t, struct _wfinddata64i32_t*);
495 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wfindfirst64(const wchar_t*, struct _wfinddata64_t*);
496 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wfindnext64(intptr_t, struct _wfinddata64_t*);
498 /* _wfindfirst32 and _wfindnext32 do not exist in MSVCRT.DLL */
499 _CRTALIAS intptr_t __cdecl __MINGW_NOTHROW _wfindfirst32 (const wchar_t* _v1, struct _wfinddata32_t* _v2) {
500 return _wfindfirst(_v1, _v2);
502 _CRTALIAS int __cdecl __MINGW_NOTHROW _wfindnext32 (intptr_t _v1, struct _wfinddata32_t* _v2) {
503 return _wfindnext(_v1, _v2);
507 __CRT_MAYBE_INLINE __cdecl __MINGW_NOTHROW intptr_t _wfindfirst32i64(const wchar_t* _filename, struct _wfinddata32i64_t* _fdata) {
508 struct _wfinddata64_t fd;
509 intptr_t ret = _wfindfirst64(_filename, &fd);
511 memset(_fdata, 0, sizeof(struct _wfinddata64_t));
514 _fdata->attrib = fd.attrib;
515 _fdata->time_create = (__time32_t)fd.time_create;
516 _fdata->time_access = (__time32_t)fd.time_access;
517 _fdata->time_write = (__time32_t)fd.time_write;
518 _fdata->size = fd.size;
519 wcsncpy(_fdata->name, fd.name, FILENAME_MAX);
523 __CRT_MAYBE_INLINE __cdecl __MINGW_NOTHROW intptr_t _wfindfirst64i32(const wchar_t* _filename, struct _wfinddata64i32_t* _fdata) {
524 struct _wfinddata32_t fd;
525 intptr_t ret = _wfindfirst32(_filename, &fd);
527 memset(_fdata, 0, sizeof(struct _wfinddata32_t));
530 _fdata->attrib = fd.attrib;
531 _fdata->time_create = (__time64_t)fd.time_create;
532 _fdata->time_access = (__time64_t)fd.time_access;
533 _fdata->time_write = (__time64_t)fd.time_write;
534 _fdata->size = fd.size;
535 wcsncpy(_fdata->name, fd.name, FILENAME_MAX);
539 __CRT_MAYBE_INLINE __cdecl __MINGW_NOTHROW intptr_t _wfindnext32i64(intptr_t _fp, struct _wfinddata32i64_t* _fdata) {
540 struct _wfinddata64_t fd;
541 int ret = _wfindnext64(_fp,&fd);
543 memset(_fdata, 0, sizeof(struct _wfinddata32i64_t));
546 _fdata->attrib = fd.attrib;
547 _fdata->time_create = (__time32_t)fd.time_create;
548 _fdata->time_access = (__time32_t)fd.time_access;
549 _fdata->time_write = (__time32_t)fd.time_write;
550 _fdata->size = fd.size;
551 wcsncpy(_fdata->name, fd.name, FILENAME_MAX);
555 __CRT_MAYBE_INLINE __cdecl __MINGW_NOTHROW intptr_t _wfindnext64i32(intptr_t _fp, struct _wfinddata64i32_t* _fdata) {
556 struct _wfinddata32_t fd;
557 int ret = _wfindnext32(_fp, &fd);
559 memset(_fdata, 0, sizeof(struct _wfinddata64i32_t));
562 _fdata->attrib = fd.attrib;
563 _fdata->time_create = (__time64_t)fd.time_create;
564 _fdata->time_access = (__time64_t)fd.time_access;
565 _fdata->time_write = (__time64_t)fd.time_write;
566 _fdata->size = fd.size;
567 wcsncpy(_fdata->name, fd.name, FILENAME_MAX);
571 #if defined(_USE_32BIT_TIME_T)
572 #define _wfinddata_t _wfinddata32_t
573 #define _wfinddatai64_t _wfinddata32i64_t
574 #define _wfindfirst _wfindfirst32
575 #define _wfindnext _wfindnext32
576 #define _wfindfirsti64 _wfindfirst32i64
577 #define _wfindnexti64 _wfindnext32i64
579 #else /* !defined(_USE_32BIT_TIME_T) */
580 #define _wfinddata_t _wfinddata64i32_t
581 #define _wfinddatai64_t _wfinddata64_t
582 #define _wfindfirst _wfindfirst64i32
583 #define _wfindnext _wfindnext64i32
584 #define _wfindfirsti64 _wfindfirst64
585 #define _wfindnexti64 _wfindnext64
587 #endif /* defined(_USE_32BIT_TIME_T) */
589 #endif /* _WIO_DEFINED */
591 #ifndef _WDIRECT_DEFINED
592 /* Also in direct.h */
593 _CRTIMP int __cdecl __MINGW_NOTHROW _wchdir (const wchar_t*);
594 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wgetcwd (wchar_t*, int);
595 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wgetdcwd (int, wchar_t*, int);
596 _CRTIMP int __cdecl __MINGW_NOTHROW _wmkdir (const wchar_t*);
597 _CRTIMP int __cdecl __MINGW_NOTHROW _wrmdir (const wchar_t*);
598 #define _WDIRECT_DEFINED
599 #endif /* _WDIRECT_DEFINED */
601 /* @TODO: Use sys/stat.h to define these instead of duplicated code. */
602 #ifndef _STAT_DEFINED
604 * The structure manipulated and returned by stat and fstat.
606 * NOTE: If called on a directory the values in the time fields are not only
607 * invalid, they will cause localtime et. al. to return NULL. And calling
608 * asctime with a NULL pointer causes an Invalid Page Fault. So watch it!
612 _dev_t st_dev; /* Equivalent to drive number 0=A 1=B ... */
613 _ino_t st_ino; /* Always zero ? */
614 _mode_t st_mode; /* See above constants */
615 short st_nlink; /* Number of links. */
616 short st_uid; /* User: Maybe significant on NT ? */
617 short st_gid; /* Group: Ditto */
618 _dev_t st_rdev; /* Seems useless (not even filled in) */
619 _off_t st_size; /* File size in bytes */
620 __time32_t st_atime; /* Accessed date (always 00:00 hrs local
622 __time32_t st_mtime; /* Modified time */
623 __time32_t st_ctime; /* Creation time */
626 #ifndef __STRICT_ANSI__
628 _dev_t st_dev; /* Equivalent to drive number 0=A 1=B ... */
629 _ino_t st_ino; /* Always zero ? */
630 _mode_t st_mode; /* See above constants */
631 short st_nlink; /* Number of links. */
632 short st_uid; /* User: Maybe significant on NT ? */
633 short st_gid; /* Group: Ditto */
634 _dev_t st_rdev; /* Seems useless (not even filled in) */
635 _off_t st_size; /* File size in bytes */
636 time_t st_atime; /* Accessed date (always 00:00 hrs local
638 time_t st_mtime; /* Modified time */
639 time_t st_ctime; /* Creation time */
641 #endif /* __STRICT_ANSI__ */
644 dev_t st_dev; /* Equivalent to drive number 0=A 1=B ... */
645 ino_t st_ino; /* Always zero ? */
646 mode_t st_mode; /* See above constants */
647 short st_nlink; /* Number of links. */
648 short st_uid; /* User: Maybe significant on NT ? */
649 short st_gid; /* Group: Ditto */
650 dev_t st_rdev; /* Seems useless (not even filled in) */
651 _off64_t st_size; /* File size in bytes */
652 __time64_t st_atime; /* Accessed date (always 00:00 hrs local
654 __time64_t st_mtime; /* Modified time */
655 __time64_t st_ctime; /* Creation time */
686 /* _stat32 does not exist in MSVCRT.DLL */
687 _CRTIMP int __cdecl __MINGW_NOTHROW _stat (const char*, struct _stat32*);
688 _CRTALIAS int __cdecl __MINGW_NOTHROW _stat32 (const char* _v1, struct _stat32* _v2) {
689 return _stat(_v1, _v2);
692 _CRTIMP int __cdecl __MINGW_NOTHROW _stat64 (const char*, struct _stat64*);
693 int __cdecl __MINGW_NOTHROW _stat32i64 (const char*, struct _stat32i64*);
694 int __cdecl __MINGW_NOTHROW _stat64i32 (const char*, struct _stat64i32*);
696 /* _fstat32 does not exist in MSVCRT.DLL */
697 _CRTIMP int __cdecl __MINGW_NOTHROW _fstat (int, struct _stat32*);
698 _CRTALIAS int __cdecl __MINGW_NOTHROW _fstat32 (int _v1, struct _stat32* _v2) {
699 return _fstat(_v1, _v2);
702 _CRTIMP int __cdecl __MINGW_NOTHROW _fstat64 (int, struct _stat64*);
703 int __cdecl __MINGW_NOTHROW _fstat32i64 (int, struct _stat32i64*);
704 int __cdecl __MINGW_NOTHROW _fstat64i32 (int, struct _stat64i32*);
706 __CRT_MAYBE_INLINE int __cdecl _fstat64i32(int desc, struct _stat64i32 *_stat) {
708 int ret = _fstat64(desc, &st);
710 memset(_stat, 0, sizeof(struct _stat64i32));
713 _stat->st_dev = st.st_dev;
714 _stat->st_ino = st.st_ino;
715 _stat->st_mode = st.st_mode;
716 _stat->st_nlink = st.st_nlink;
717 _stat->st_uid = st.st_uid;
718 _stat->st_gid = st.st_gid;
719 _stat->st_rdev = st.st_rdev;
720 _stat->st_size = (_off_t) st.st_size;
721 _stat->st_atime = st.st_atime;
722 _stat->st_mtime = st.st_mtime;
723 _stat->st_ctime = st.st_ctime;
726 __CRT_MAYBE_INLINE int __cdecl _fstat32i64(int desc, struct _stat32i64 *_stat) {
728 int ret = _fstat32(desc, &st);
730 memset(_stat, 0, sizeof(struct _stat32i64));
733 _stat->st_dev = st.st_dev;
734 _stat->st_ino = st.st_ino;
735 _stat->st_mode = st.st_mode;
736 _stat->st_nlink = st.st_nlink;
737 _stat->st_uid = st.st_uid;
738 _stat->st_gid = st.st_gid;
739 _stat->st_rdev = st.st_rdev;
740 _stat->st_size = (_off_t) st.st_size;
741 _stat->st_atime = st.st_atime;
742 _stat->st_mtime = st.st_mtime;
743 _stat->st_ctime = st.st_ctime;
746 __CRT_MAYBE_INLINE int __cdecl _stat64i32(const char *fname, struct _stat64i32 *_stat) {
748 int ret = _stat64(fname, &st);
750 memset(_stat, 0, sizeof(struct _stat64i32));
753 _stat->st_dev = st.st_dev;
754 _stat->st_ino = st.st_ino;
755 _stat->st_mode = st.st_mode;
756 _stat->st_nlink = st.st_nlink;
757 _stat->st_uid = st.st_uid;
758 _stat->st_gid = st.st_gid;
759 _stat->st_rdev = st.st_rdev;
760 _stat->st_size = (_off_t) st.st_size;
761 _stat->st_atime = st.st_atime;
762 _stat->st_mtime = st.st_mtime;
763 _stat->st_ctime = st.st_ctime;
766 __CRT_MAYBE_INLINE int __cdecl _stat32i64(const char *fname, struct _stat32i64 *_stat) {
768 int ret = _stat32(fname, &st);
770 memset(_stat, 0, sizeof(struct _stat32i64));
773 _stat->st_dev = st.st_dev;
774 _stat->st_ino = st.st_ino;
775 _stat->st_mode = st.st_mode;
776 _stat->st_nlink = st.st_nlink;
777 _stat->st_uid = st.st_uid;
778 _stat->st_gid = st.st_gid;
779 _stat->st_rdev = st.st_rdev;
780 _stat->st_size = (_off_t) st.st_size;
781 _stat->st_atime = st.st_atime;
782 _stat->st_mtime = st.st_mtime;
783 _stat->st_ctime = st.st_ctime;
787 #define __stat64 _stat64
788 #if defined(_USE_32BIT_TIME_T)
789 #define _fstat _fstat32
790 #define _fstati64 _fstat32i64
791 #define _stat _stat32
792 #define _stati64 _stat32i64
794 #else /* !_USE_32BIT_TIME_T */
795 #define _fstat _fstat64i32
796 #define _fstati64 _fstat64
797 #define _stat _stat64i32
798 #define _stati64 _stat64
800 #endif /* _USE_32BIT_TIME_T */
801 #define _STAT_DEFINED
803 #endif /* _STAT_DEFINED */
805 #if !defined ( _WSTAT_DEFINED) /* also declared in sys/stat.h */
806 /* _wstat32 does not exist in MSVCRT.DLL */
807 _CRTIMP int __cdecl __MINGW_NOTHROW _wstat (const wchar_t*, struct _stat32*);
808 _CRTALIAS int __cdecl __MINGW_NOTHROW _wstat32 (const wchar_t* _v1, struct _stat32* _v2) {
809 return _wstat(_v1, _v2);
812 _CRTIMP int __cdecl __MINGW_NOTHROW _wstat64 (const wchar_t*, struct _stat64*);
813 _CRTIMP int __cdecl __MINGW_NOTHROW _wstat32i64 (const wchar_t*, struct _stat32i64*);
814 int __cdecl __MINGW_NOTHROW _wstat64i32 (const wchar_t*, struct _stat64i32*);
815 #include <string.h> /* Need memset declaration. */
816 __CRT_MAYBE_INLINE int __cdecl _wstat64i32(const wchar_t *fname, struct _stat64i32 *_stat)
819 int ret = _wstat64(fname, &st);
821 memset(_stat, 0, sizeof(struct _stat64i32));
824 _stat->st_dev = st.st_dev;
825 _stat->st_ino = st.st_ino;
826 _stat->st_mode = st.st_mode;
827 _stat->st_nlink = st.st_nlink;
828 _stat->st_uid = st.st_uid;
829 _stat->st_gid = st.st_gid;
830 _stat->st_rdev = st.st_rdev;
831 _stat->st_size = (_off_t) st.st_size;
832 _stat->st_atime = st.st_atime;
833 _stat->st_mtime = st.st_mtime;
834 _stat->st_ctime = st.st_ctime;
837 __CRT_MAYBE_INLINE int __cdecl _wstat32i64(const wchar_t *fname, struct _stat32i64 *_stat) {
839 int ret = _wstat32(fname, &st);
841 memset(_stat, 0, sizeof(struct _stat32i64));
844 _stat->st_dev = st.st_dev;
845 _stat->st_ino = st.st_ino;
846 _stat->st_mode = st.st_mode;
847 _stat->st_nlink = st.st_nlink;
848 _stat->st_uid = st.st_uid;
849 _stat->st_gid = st.st_gid;
850 _stat->st_rdev = st.st_rdev;
851 _stat->st_size = (_off_t) st.st_size;
852 _stat->st_atime = st.st_atime;
853 _stat->st_mtime = st.st_mtime;
854 _stat->st_ctime = st.st_ctime;
858 #if defined(_USE_32BIT_TIME_T)
859 #define _wstat _wstat32
860 #define _wstati64 _wstat32i64
862 #else /* ! _USE_32BIT_TIME_T */
863 #define _wstat _wstat64i32
864 #define _wstati64 _wstat64
865 #endif /* _USE_32BIT_TIME_T */
867 #define _WSTAT_DEFINED
868 #endif /* _WSTAT_DEFIND */
870 #ifndef _WLOCALE_DEFINED /* also declared in locale.h */
871 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wsetlocale (int, const wchar_t*);
872 #define _WLOCALE_DEFINED
875 #ifndef _WPROCESS_DEFINED /* also declared in process.h */
876 #include <stdint.h> /* For intptr_t. */
877 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wexecl (const wchar_t*, const wchar_t*, ...);
878 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wexecle (const wchar_t*, const wchar_t*, ...);
879 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wexeclp (const wchar_t*, const wchar_t*, ...);
880 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wexeclpe (const wchar_t*, const wchar_t*, ...);
881 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wexecv (const wchar_t*, const wchar_t* const*);
882 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wexecve (const wchar_t*, const wchar_t* const*, const wchar_t* const*);
883 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wexecvp (const wchar_t*, const wchar_t* const*);
884 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wexecvpe (const wchar_t*, const wchar_t* const*, const wchar_t* const*);
886 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wspawnl (int, const wchar_t*, const wchar_t*, ...);
887 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wspawnle (int, const wchar_t*, const wchar_t*, ...);
888 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wspawnlp (int, const wchar_t*, const wchar_t*, ...);
889 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wspawnlpe (int, const wchar_t*, const wchar_t*, ...);
890 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wspawnv (int, const wchar_t*, const wchar_t* const*);
891 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wspawnve (int, const wchar_t*, const wchar_t* const*, const wchar_t* const*);
892 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wspawnvp (int, const wchar_t*, const wchar_t* const*);
893 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wspawnvpe (int, const wchar_t*, const wchar_t* const*, const wchar_t* const*);
895 #define _WPROCESS_DEFINED
898 #endif /* not __STRICT_ANSI__ */
901 } /* end of extern "C" */
904 #endif /* Not RC_INVOKED */
906 #endif /* not _WCHAR_H_ */