4 * Derived from the mingw header written by Colin Peters.
5 * Modified for Wine use by Jon Griffiths and Francois Gouget.
6 * This file is in the public domain.
25 #define NULL ((void *)0)
29 #ifndef WCHAR_MIN /* also in stdint.h */
31 #define WCHAR_MAX 0xffffU
34 #ifndef DECLSPEC_ALIGN
35 # if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS)
36 # define DECLSPEC_ALIGN(x) __declspec(align(x))
37 # elif defined(__GNUC__)
38 # define DECLSPEC_ALIGN(x) __attribute__((aligned(x)))
40 # define DECLSPEC_ALIGN(x)
44 typedef int mbstate_t;
47 #define WEOF (wint_t)(0xFFFF)
50 #ifndef _FSIZE_T_DEFINED
51 typedef __msvcrt_ulong _fsize_t
;
52 #define _FSIZE_T_DEFINED
55 #ifndef _DEV_T_DEFINED
56 typedef unsigned int _dev_t
;
57 #define _DEV_T_DEFINED
60 #ifndef _INO_T_DEFINED
61 typedef unsigned short _ino_t
;
62 #define _INO_T_DEFINED
65 #ifndef _OFF_T_DEFINED
67 #define _OFF_T_DEFINED
83 #endif /* _TM_DEFINED */
98 #endif /* _FILE_DEFINED */
100 #ifndef _WFINDDATA_T_DEFINED
101 #define _WFINDDATA_T_DEFINED
103 struct _wfinddata_t
{
112 struct _wfinddatai64_t
{
117 __int64
DECLSPEC_ALIGN(8) size
;
121 #endif /* _WFINDDATA_T_DEFINED */
123 #ifndef _STAT_DEFINED
124 #define _STAT_DEFINED
129 unsigned short st_mode
;
143 unsigned short st_mode
;
157 unsigned short st_mode
;
171 unsigned short st_mode
;
176 __int64
DECLSPEC_ALIGN(8) st_size
;
185 unsigned short st_mode
;
199 unsigned short st_mode
;
204 __int64
DECLSPEC_ALIGN(8) st_size
;
213 unsigned short st_mode
;
218 __int64
DECLSPEC_ALIGN(8) st_size
;
223 #endif /* _STAT_DEFINED */
225 /* ASCII char classification table - binary compatible */
226 #define _UPPER 0x0001 /* C1_UPPER */
227 #define _LOWER 0x0002 /* C1_LOWER */
228 #define _DIGIT 0x0004 /* C1_DIGIT */
229 #define _SPACE 0x0008 /* C1_SPACE */
230 #define _PUNCT 0x0010 /* C1_PUNCT */
231 #define _CONTROL 0x0020 /* C1_CNTRL */
232 #define _BLANK 0x0040 /* C1_BLANK */
233 #define _HEX 0x0080 /* C1_XDIGIT */
234 #define _LEADBYTE 0x8000
235 #define _ALPHA (0x0100|_UPPER|_LOWER) /* (C1_ALPHA|_UPPER|_LOWER) */
237 #ifndef _WCTYPE_DEFINED
238 #define _WCTYPE_DEFINED
239 int __cdecl
is_wctype(wint_t,wctype_t);
240 int __cdecl
isleadbyte(int);
241 int __cdecl
iswalnum(wint_t);
242 int __cdecl
iswalpha(wint_t);
243 int __cdecl
iswascii(wint_t);
244 int __cdecl
iswcntrl(wint_t);
245 int __cdecl
iswctype(wint_t,wctype_t);
246 int __cdecl
iswdigit(wint_t);
247 int __cdecl
iswgraph(wint_t);
248 int __cdecl
iswlower(wint_t);
249 int __cdecl
iswprint(wint_t);
250 int __cdecl
iswpunct(wint_t);
251 int __cdecl
iswspace(wint_t);
252 int __cdecl
iswupper(wint_t);
253 int __cdecl
iswxdigit(wint_t);
254 wchar_t __cdecl
towlower(wchar_t);
255 wchar_t __cdecl
towupper(wchar_t);
256 #endif /* _WCTYPE_DEFINED */
258 #ifndef _WDIRECT_DEFINED
259 #define _WDIRECT_DEFINED
260 int __cdecl
_wchdir(const wchar_t*);
261 wchar_t* __cdecl
_wgetcwd(wchar_t*,int);
262 wchar_t* __cdecl
_wgetdcwd(int,wchar_t*,int);
263 int __cdecl
_wmkdir(const wchar_t*);
264 int __cdecl
_wrmdir(const wchar_t*);
265 #endif /* _WDIRECT_DEFINED */
269 int __cdecl
_waccess(const wchar_t*,int);
270 int __cdecl
_wchmod(const wchar_t*,int);
271 int __cdecl
_wcreat(const wchar_t*,int);
272 intptr_t __cdecl
_wfindfirst(const wchar_t*,struct _wfinddata_t
*);
273 intptr_t __cdecl
_wfindfirsti64(const wchar_t*, struct _wfinddatai64_t
*);
274 int __cdecl
_wfindnext(intptr_t,struct _wfinddata_t
*);
275 int __cdecl
_wfindnexti64(intptr_t, struct _wfinddatai64_t
*);
276 wchar_t* __cdecl
_wmktemp(wchar_t*);
277 int WINAPIV
_wopen(const wchar_t*,int,...);
278 int __cdecl
_wrename(const wchar_t*,const wchar_t*);
279 int WINAPIV
_wsopen(const wchar_t*,int,int,...);
280 int __cdecl
_wunlink(const wchar_t*);
281 #endif /* _WIO_DEFINED */
283 #ifndef _WLOCALE_DEFINED
284 #define _WLOCALE_DEFINED
285 wchar_t* __cdecl
_wsetlocale(int,const wchar_t*);
286 #endif /* _WLOCALE_DEFINED */
288 #ifndef _WPROCESS_DEFINED
289 #define _WPROCESS_DEFINED
290 int WINAPIV
_wexecl(const wchar_t*,const wchar_t*,...);
291 int WINAPIV
_wexecle(const wchar_t*,const wchar_t*,...);
292 int WINAPIV
_wexeclp(const wchar_t*,const wchar_t*,...);
293 int WINAPIV
_wexeclpe(const wchar_t*,const wchar_t*,...);
294 int __cdecl
_wexecv(const wchar_t*,const wchar_t* const *);
295 int __cdecl
_wexecve(const wchar_t*,const wchar_t* const *,const wchar_t* const *);
296 int __cdecl
_wexecvp(const wchar_t*,const wchar_t* const *);
297 int __cdecl
_wexecvpe(const wchar_t*,const wchar_t* const *,const wchar_t* const *);
298 int WINAPIV
_wspawnl(int,const wchar_t*,const wchar_t*,...);
299 int WINAPIV
_wspawnle(int,const wchar_t*,const wchar_t*,...);
300 int WINAPIV
_wspawnlp(int,const wchar_t*,const wchar_t*,...);
301 int WINAPIV
_wspawnlpe(int,const wchar_t*,const wchar_t*,...);
302 int __cdecl
_wspawnv(int,const wchar_t*,const wchar_t* const *);
303 int __cdecl
_wspawnve(int,const wchar_t*,const wchar_t* const *,const wchar_t* const *);
304 int __cdecl
_wspawnvp(int,const wchar_t*,const wchar_t* const *);
305 int __cdecl
_wspawnvpe(int,const wchar_t*,const wchar_t* const *,const wchar_t* const *);
306 int __cdecl
_wsystem(const wchar_t*);
307 #endif /* _WPROCESS_DEFINED */
309 #ifndef _WSTAT_DEFINED
310 #define _WSTAT_DEFINED
311 int __cdecl
_wstat(const wchar_t*,struct _stat
*);
312 int __cdecl
_wstat32(const wchar_t*, struct _stat32
*);
313 int __cdecl
_wstati64(const wchar_t*,struct _stati64
*);
314 int __cdecl
_wstat64(const wchar_t*,struct _stat64
*);
315 #endif /* _WSTAT_DEFINED */
317 #ifndef _WSTDIO_DEFINED
318 #define _WSTDIO_DEFINED
319 wint_t __cdecl
_fgetwc_nolock(FILE*);
320 wint_t __cdecl
_fgetwchar(void);
321 wint_t __cdecl
_fputwc_nolock(wint_t,FILE*);
322 wint_t __cdecl
_fputwchar(wint_t);
323 wint_t __cdecl
_getwc_nolock(FILE*);
324 wchar_t* __cdecl
_getws(wchar_t*);
325 wint_t __cdecl
_putwc_nolock(wint_t,FILE*);
326 int __cdecl
_putws(const wchar_t*);
327 int WINAPIV
_snwprintf(wchar_t*,size_t,const wchar_t*,...);
328 int WINAPIV
_snwprintf_s(wchar_t*,size_t,size_t,const wchar_t*,...);
329 int WINAPIV
_scwprintf(const wchar_t*,...);
330 wint_t __cdecl
_ungetwc_nolock(wint_t,FILE*);
331 int __cdecl
_vscwprintf(const wchar_t*,__ms_va_list
);
332 int __cdecl
_vscwprintf_p_l(const wchar_t*,_locale_t
,__ms_va_list
);
333 int __cdecl
_vsnwprintf(wchar_t*,size_t,const wchar_t*,__ms_va_list
);
334 int __cdecl
_vsnwprintf_s(wchar_t*,size_t,size_t,const wchar_t*,__ms_va_list
);
335 int __cdecl
_vswprintf_p_l(wchar_t*,size_t,const wchar_t*,_locale_t
,__ms_va_list
);
336 FILE* __cdecl
_wfdopen(int,const wchar_t*);
337 FILE* __cdecl
_wfopen(const wchar_t*,const wchar_t*);
338 errno_t __cdecl
_wfopen_s(FILE**,const wchar_t*,const wchar_t*);
339 FILE* __cdecl
_wfreopen(const wchar_t*,const wchar_t*,FILE*);
340 FILE* __cdecl
_wfsopen(const wchar_t*,const wchar_t*,int);
341 void __cdecl
_wperror(const wchar_t*);
342 FILE* __cdecl
_wpopen(const wchar_t*,const wchar_t*);
343 int __cdecl
_wremove(const wchar_t*);
344 wchar_t* __cdecl
_wtempnam(const wchar_t*,const wchar_t*);
345 wchar_t* __cdecl
_wtmpnam(wchar_t*);
347 wint_t __cdecl
fgetwc(FILE*);
348 wchar_t* __cdecl
fgetws(wchar_t*,int,FILE*);
349 wint_t __cdecl
fputwc(wint_t,FILE*);
350 int __cdecl
fputws(const wchar_t*,FILE*);
351 int WINAPIV
fwprintf(FILE*,const wchar_t*,...);
352 int WINAPIV
fwprintf_s(FILE*,const wchar_t*,...);
353 int __cdecl
fputws(const wchar_t*,FILE*);
354 int WINAPIV
fwscanf(FILE*,const wchar_t*,...);
355 int WINAPIV
fwscanf_s(FILE*,const wchar_t*,...);
356 wint_t __cdecl
getwc(FILE*);
357 wint_t __cdecl
getwchar(void);
358 wchar_t* __cdecl
getws(wchar_t*);
359 wint_t __cdecl
putwc(wint_t,FILE*);
360 wint_t __cdecl
putwchar(wint_t);
361 int __cdecl
putws(const wchar_t*);
362 int WINAPIV
swprintf_s(wchar_t*,size_t,const wchar_t*,...);
363 int WINAPIV
swscanf(const wchar_t*,const wchar_t*,...);
364 int WINAPIV
swscanf_s(const wchar_t*,const wchar_t*,...);
365 wint_t __cdecl
ungetwc(wint_t,FILE*);
366 int __cdecl
vfwprintf(FILE*,const wchar_t*,__ms_va_list
);
367 int __cdecl
vfwprintf_s(FILE*,const wchar_t*,__ms_va_list
);
368 int __cdecl
vswprintf_s(wchar_t*,size_t,const wchar_t*,__ms_va_list
);
369 int __cdecl
vwprintf(const wchar_t*,__ms_va_list
);
370 int __cdecl
vwprintf_s(const wchar_t*,__ms_va_list
);
371 int WINAPIV
wprintf(const wchar_t*,...);
372 int WINAPIV
wprintf_s(const wchar_t*,...);
373 int WINAPIV
wscanf(const wchar_t*,...);
374 int WINAPIV
wscanf_s(const wchar_t*,...);
376 #ifdef _CRT_NON_CONFORMING_SWPRINTFS
377 int WINAPIV
swprintf(wchar_t*,const wchar_t*,...);
378 int __cdecl
vswprintf(wchar_t*,const wchar_t*,__ms_va_list
);
379 #else /* _CRT_NON_CONFORMING_SWPRINTFS */
380 static inline int vswprintf(wchar_t *buffer
, size_t size
, const wchar_t *format
, __ms_va_list args
) { return _vsnwprintf(buffer
,size
,format
,args
); }
381 static inline int WINAPIV
swprintf(wchar_t *buffer
, size_t size
, const wchar_t *format
, ...)
386 __ms_va_start(args
, format
);
387 ret
= _vsnwprintf(buffer
, size
, format
, args
);
391 #endif /* _CRT_NON_CONFORMING_SWPRINTFS */
392 #endif /* _WSTDIO_DEFINED */
394 #ifndef _WSTDLIB_DEFINED
395 #define _WSTDLIB_DEFINED
396 wchar_t* __cdecl
_itow(int,wchar_t*,int);
397 errno_t __cdecl
_itow_s(int,wchar_t*,int, int);
398 wchar_t* __cdecl
_i64tow(__int64
,wchar_t*,int);
399 errno_t __cdecl
_i64tow_s(__int64
, wchar_t*, size_t, int);
400 wchar_t* __cdecl
_ltow(__msvcrt_long
,wchar_t*,int);
401 errno_t __cdecl
_ltow_s(__msvcrt_long
,wchar_t*,int,int);
402 wchar_t* __cdecl
_ui64tow(unsigned __int64
,wchar_t*,int);
403 errno_t __cdecl
_ui64tow_s(unsigned __int64
, wchar_t*, size_t, int);
404 wchar_t* __cdecl
_ultow(__msvcrt_ulong
,wchar_t*,int);
405 errno_t __cdecl
_ultow_s(__msvcrt_ulong
, wchar_t*, size_t, int);
406 wchar_t* __cdecl
_wfullpath(wchar_t*,const wchar_t*,size_t);
407 wchar_t* __cdecl
_wgetenv(const wchar_t*);
408 void __cdecl
_wmakepath(wchar_t*,const wchar_t*,const wchar_t*,const wchar_t*,const wchar_t*);
409 int __cdecl
_wmakepath_s(wchar_t*,size_t,const wchar_t*,const wchar_t*,const wchar_t*,const wchar_t*);
410 void __cdecl
_wperror(const wchar_t*);
411 int __cdecl
_wputenv(const wchar_t*);
412 void __cdecl
_wsearchenv(const wchar_t*,const wchar_t*,wchar_t*);
413 void __cdecl
_wsplitpath(const wchar_t*,wchar_t*,wchar_t*,wchar_t*,wchar_t*);
414 errno_t __cdecl
_wsplitpath_s(const wchar_t*,wchar_t*,size_t,wchar_t*,size_t,
415 wchar_t*,size_t,wchar_t*,size_t);
416 int __cdecl
_wsystem(const wchar_t*);
417 double __cdecl
_wtof(const wchar_t*);
418 int __cdecl
_wtoi(const wchar_t*);
419 __int64 __cdecl
_wtoi64(const wchar_t*);
420 __msvcrt_long __cdecl
_wtol(const wchar_t*);
422 size_t __cdecl
mbstowcs(wchar_t*,const char*,size_t);
423 errno_t __cdecl
mbstowcs_s(size_t*,wchar_t*,size_t,const char*,size_t);
424 int __cdecl
mbtowc(wchar_t*,const char*,size_t);
425 float __cdecl
wcstof(const wchar_t*,wchar_t**);
426 double __cdecl
wcstod(const wchar_t*,wchar_t**);
427 __msvcrt_long __cdecl
wcstol(const wchar_t*,wchar_t**,int);
428 size_t __cdecl
wcstombs(char*,const wchar_t*,size_t);
429 errno_t __cdecl
wcstombs_s(size_t*,char*,size_t,const wchar_t*,size_t);
430 __msvcrt_ulong __cdecl
wcstoul(const wchar_t*,wchar_t**,int);
431 int __cdecl
wctomb(char*,wchar_t);
432 #endif /* _WSTDLIB_DEFINED */
434 #ifndef _WSTRING_DEFINED
435 #define _WSTRING_DEFINED
436 int __cdecl
_wcscoll_l(const wchar_t*,const wchar_t*,_locale_t
);
437 wchar_t* __cdecl
_wcsdup(const wchar_t*);
438 int __cdecl
_wcsicmp(const wchar_t*,const wchar_t*);
439 int __cdecl
_wcsicoll(const wchar_t*,const wchar_t*);
440 int __cdecl
_wcsicoll_l(const wchar_t*,const wchar_t*,_locale_t
);
441 wchar_t* __cdecl
_wcslwr(wchar_t*);
442 errno_t __cdecl
_wcslwr_s(wchar_t*, size_t);
443 int __cdecl
_wcsncoll(const wchar_t*,const wchar_t*,size_t);
444 int __cdecl
_wcsncoll_l(const wchar_t*,const wchar_t*,size_t,_locale_t
);
445 int __cdecl
_wcsnicmp(const wchar_t*,const wchar_t*,size_t);
446 int __cdecl
_wcsnicoll(const wchar_t*,const wchar_t*,size_t);
447 int __cdecl
_wcsnicoll_l(const wchar_t*,const wchar_t*,size_t,_locale_t
);
448 wchar_t* __cdecl
_wcsnset(wchar_t*,wchar_t,size_t);
449 wchar_t* __cdecl
_wcsrev(wchar_t*);
450 wchar_t* __cdecl
_wcsset(wchar_t*,wchar_t);
451 wchar_t* __cdecl
_wcsupr(wchar_t*);
452 errno_t __cdecl
_wcsupr_s(wchar_t*, size_t);
454 wchar_t* __cdecl
wcscat(wchar_t*,const wchar_t*);
455 errno_t __cdecl
wcscat_s(wchar_t*,size_t,const wchar_t*);
456 wchar_t* __cdecl
wcschr(const wchar_t*,wchar_t);
457 int __cdecl
wcscmp(const wchar_t*,const wchar_t*);
458 int __cdecl
wcscoll(const wchar_t*,const wchar_t*);
459 wchar_t* __cdecl
wcscpy(wchar_t*,const wchar_t*);
460 errno_t __cdecl
wcscpy_s(wchar_t*,size_t,const wchar_t*);
461 size_t __cdecl
wcscspn(const wchar_t*,const wchar_t*);
462 size_t __cdecl
wcslen(const wchar_t*);
463 wchar_t* __cdecl
wcsncat(wchar_t*,const wchar_t*,size_t);
464 errno_t __cdecl
wcsncat_s(wchar_t *, size_t, const wchar_t *, size_t);
465 int __cdecl
wcsncmp(const wchar_t*,const wchar_t*,size_t);
466 wchar_t* __cdecl
wcsncpy(wchar_t*,const wchar_t*,size_t);
467 errno_t __cdecl
wcsncpy_s(wchar_t*,size_t,const wchar_t*,size_t);
468 size_t __cdecl
wcsnlen(const size_t*,size_t);
469 wchar_t* __cdecl
wcspbrk(const wchar_t*,const wchar_t*);
470 wchar_t* __cdecl
wcsrchr(const wchar_t*,wchar_t wcFor
);
471 size_t __cdecl
wcsspn(const wchar_t*,const wchar_t*);
472 wchar_t* __cdecl
wcsstr(const wchar_t*,const wchar_t*);
473 wchar_t* __cdecl
wcstok(wchar_t*,const wchar_t*);
474 size_t __cdecl
wcsxfrm(wchar_t*,const wchar_t*,size_t);
475 #endif /* _WSTRING_DEFINED */
477 #ifndef _WTIME_DEFINED
478 #define _WTIME_DEFINED
480 #ifdef _USE_32BIT_TIME_T
481 #define _wctime32 _wctime
484 wchar_t* __cdecl
_wasctime(const struct tm
*);
485 size_t __cdecl
wcsftime(wchar_t*,size_t,const wchar_t*,const struct tm
*);
486 wchar_t* __cdecl
_wctime32(const __time32_t
*);
487 wchar_t* __cdecl
_wctime64(const __time64_t
*);
488 wchar_t* __cdecl
_wstrdate(wchar_t*);
489 errno_t __cdecl
_wstrdate_s(wchar_t*,size_t);
490 wchar_t* __cdecl
_wstrtime(wchar_t*);
491 errno_t __cdecl
_wstrtime_s(wchar_t*,size_t);
493 #ifndef _USE_32BIT_TIME_T
494 static inline wchar_t* _wctime(const time_t *t
) { return _wctime64(t
); }
497 #endif /* _WTIME_DEFINED */
499 wchar_t __cdecl
btowc(int);
500 size_t __cdecl
mbrlen(const char *,size_t,mbstate_t*);
501 size_t __cdecl
mbrtowc(wchar_t*,const char*,size_t,mbstate_t*);
502 size_t __cdecl
mbsrtowcs(wchar_t*,const char**,size_t,mbstate_t*);
503 size_t __cdecl
wcrtomb(char*,wchar_t,mbstate_t*);
504 size_t __cdecl
wcsrtombs(char*,const wchar_t**,size_t,mbstate_t*);
505 int __cdecl
wctob(wint_t);
506 errno_t __cdecl
wmemcpy_s(wchar_t *, size_t, const wchar_t *, size_t);
508 static inline wchar_t *wmemchr(const wchar_t *s
, wchar_t c
, size_t n
)
511 for (end
= s
+ n
; s
< end
; s
++)
512 if (*s
== c
) return (wchar_t*)s
;
516 static inline int wmemcmp(const wchar_t *s1
, const wchar_t *s2
, size_t n
)
519 for (i
= 0; i
< n
; i
++)
521 if (s1
[i
] > s2
[i
]) return 1;
522 if (s1
[i
] < s2
[i
]) return -1;
527 static inline wchar_t* __cdecl
wmemcpy(wchar_t *dst
, const wchar_t *src
, size_t n
)
529 return memcpy(dst
, src
, n
* sizeof(wchar_t));
532 static inline wchar_t* __cdecl
wmemmove(wchar_t *dst
, const wchar_t *src
, size_t n
)
534 return memmove(dst
, src
, n
* sizeof(wchar_t));
537 static inline wchar_t* __cdecl
wmemset(wchar_t *s
, wchar_t c
, size_t n
)
540 for (i
= 0; i
< n
; i
++)
551 #endif /* __WINE_WCHAR_H */