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)
30 #define WCHAR_MAX ((wchar_t)-1)
32 #ifndef DECLSPEC_ALIGN
33 # if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS)
34 # define DECLSPEC_ALIGN(x) __declspec(align(x))
35 # elif defined(__GNUC__)
36 # define DECLSPEC_ALIGN(x) __attribute__((aligned(x)))
38 # define DECLSPEC_ALIGN(x)
42 typedef int mbstate_t;
45 #define WEOF (wint_t)(0xFFFF)
48 #ifndef _FSIZE_T_DEFINED
49 typedef __msvcrt_ulong _fsize_t
;
50 #define _FSIZE_T_DEFINED
53 #ifndef _DEV_T_DEFINED
54 typedef unsigned int _dev_t
;
55 #define _DEV_T_DEFINED
58 #ifndef _INO_T_DEFINED
59 typedef unsigned short _ino_t
;
60 #define _INO_T_DEFINED
63 #ifndef _OFF_T_DEFINED
65 #define _OFF_T_DEFINED
81 #endif /* _TM_DEFINED */
96 #endif /* _FILE_DEFINED */
98 #ifndef _WFINDDATA_T_DEFINED
99 #define _WFINDDATA_T_DEFINED
101 struct _wfinddata_t
{
110 struct _wfinddatai64_t
{
115 __int64
DECLSPEC_ALIGN(8) size
;
119 #endif /* _WFINDDATA_T_DEFINED */
121 #ifndef _STAT_DEFINED
122 #define _STAT_DEFINED
127 unsigned short st_mode
;
141 unsigned short st_mode
;
155 unsigned short st_mode
;
169 unsigned short st_mode
;
174 __int64
DECLSPEC_ALIGN(8) st_size
;
183 unsigned short st_mode
;
197 unsigned short st_mode
;
202 __int64
DECLSPEC_ALIGN(8) st_size
;
211 unsigned short st_mode
;
216 __int64
DECLSPEC_ALIGN(8) st_size
;
221 #endif /* _STAT_DEFINED */
223 /* ASCII char classification table - binary compatible */
224 #define _UPPER 0x0001 /* C1_UPPER */
225 #define _LOWER 0x0002 /* C1_LOWER */
226 #define _DIGIT 0x0004 /* C1_DIGIT */
227 #define _SPACE 0x0008 /* C1_SPACE */
228 #define _PUNCT 0x0010 /* C1_PUNCT */
229 #define _CONTROL 0x0020 /* C1_CNTRL */
230 #define _BLANK 0x0040 /* C1_BLANK */
231 #define _HEX 0x0080 /* C1_XDIGIT */
232 #define _LEADBYTE 0x8000
233 #define _ALPHA (0x0100|_UPPER|_LOWER) /* (C1_ALPHA|_UPPER|_LOWER) */
235 #ifndef _WCTYPE_DEFINED
236 #define _WCTYPE_DEFINED
237 int __cdecl
is_wctype(wint_t,wctype_t);
238 int __cdecl
isleadbyte(int);
239 int __cdecl
iswalnum(wint_t);
240 int __cdecl
iswalpha(wint_t);
241 int __cdecl
iswascii(wint_t);
242 int __cdecl
iswcntrl(wint_t);
243 int __cdecl
iswctype(wint_t,wctype_t);
244 int __cdecl
iswdigit(wint_t);
245 int __cdecl
iswgraph(wint_t);
246 int __cdecl
iswlower(wint_t);
247 int __cdecl
iswprint(wint_t);
248 int __cdecl
iswpunct(wint_t);
249 int __cdecl
iswspace(wint_t);
250 int __cdecl
iswupper(wint_t);
251 int __cdecl
iswxdigit(wint_t);
252 wchar_t __cdecl
towlower(wchar_t);
253 wchar_t __cdecl
towupper(wchar_t);
254 #endif /* _WCTYPE_DEFINED */
256 #ifndef _WDIRECT_DEFINED
257 #define _WDIRECT_DEFINED
258 int __cdecl
_wchdir(const wchar_t*);
259 wchar_t* __cdecl
_wgetcwd(wchar_t*,int);
260 wchar_t* __cdecl
_wgetdcwd(int,wchar_t*,int);
261 int __cdecl
_wmkdir(const wchar_t*);
262 int __cdecl
_wrmdir(const wchar_t*);
263 #endif /* _WDIRECT_DEFINED */
267 int __cdecl
_waccess(const wchar_t*,int);
268 int __cdecl
_wchmod(const wchar_t*,int);
269 int __cdecl
_wcreat(const wchar_t*,int);
270 intptr_t __cdecl
_wfindfirst(const wchar_t*,struct _wfinddata_t
*);
271 intptr_t __cdecl
_wfindfirsti64(const wchar_t*, struct _wfinddatai64_t
*);
272 int __cdecl
_wfindnext(intptr_t,struct _wfinddata_t
*);
273 int __cdecl
_wfindnexti64(intptr_t, struct _wfinddatai64_t
*);
274 wchar_t* __cdecl
_wmktemp(wchar_t*);
275 int WINAPIV
_wopen(const wchar_t*,int,...);
276 int __cdecl
_wrename(const wchar_t*,const wchar_t*);
277 int WINAPIV
_wsopen(const wchar_t*,int,int,...);
278 int __cdecl
_wunlink(const wchar_t*);
279 #endif /* _WIO_DEFINED */
281 #ifndef _WLOCALE_DEFINED
282 #define _WLOCALE_DEFINED
283 wchar_t* __cdecl
_wsetlocale(int,const wchar_t*);
284 #endif /* _WLOCALE_DEFINED */
286 #ifndef _WPROCESS_DEFINED
287 #define _WPROCESS_DEFINED
288 int WINAPIV
_wexecl(const wchar_t*,const wchar_t*,...);
289 int WINAPIV
_wexecle(const wchar_t*,const wchar_t*,...);
290 int WINAPIV
_wexeclp(const wchar_t*,const wchar_t*,...);
291 int WINAPIV
_wexeclpe(const wchar_t*,const wchar_t*,...);
292 int __cdecl
_wexecv(const wchar_t*,const wchar_t* const *);
293 int __cdecl
_wexecve(const wchar_t*,const wchar_t* const *,const wchar_t* const *);
294 int __cdecl
_wexecvp(const wchar_t*,const wchar_t* const *);
295 int __cdecl
_wexecvpe(const wchar_t*,const wchar_t* const *,const wchar_t* const *);
296 int WINAPIV
_wspawnl(int,const wchar_t*,const wchar_t*,...);
297 int WINAPIV
_wspawnle(int,const wchar_t*,const wchar_t*,...);
298 int WINAPIV
_wspawnlp(int,const wchar_t*,const wchar_t*,...);
299 int WINAPIV
_wspawnlpe(int,const wchar_t*,const wchar_t*,...);
300 int __cdecl
_wspawnv(int,const wchar_t*,const wchar_t* const *);
301 int __cdecl
_wspawnve(int,const wchar_t*,const wchar_t* const *,const wchar_t* const *);
302 int __cdecl
_wspawnvp(int,const wchar_t*,const wchar_t* const *);
303 int __cdecl
_wspawnvpe(int,const wchar_t*,const wchar_t* const *,const wchar_t* const *);
304 int __cdecl
_wsystem(const wchar_t*);
305 #endif /* _WPROCESS_DEFINED */
307 #ifndef _WSTAT_DEFINED
308 #define _WSTAT_DEFINED
309 int __cdecl
_wstat(const wchar_t*,struct _stat
*);
310 int __cdecl
_wstat32(const wchar_t*, struct _stat32
*);
311 int __cdecl
_wstati64(const wchar_t*,struct _stati64
*);
312 int __cdecl
_wstat64(const wchar_t*,struct _stat64
*);
313 #endif /* _WSTAT_DEFINED */
315 #ifndef _WSTDIO_DEFINED
316 #define _WSTDIO_DEFINED
317 wint_t __cdecl
_fgetwc_nolock(FILE*);
318 wint_t __cdecl
_fgetwchar(void);
319 wint_t __cdecl
_fputwc_nolock(wint_t,FILE*);
320 wint_t __cdecl
_fputwchar(wint_t);
321 wint_t __cdecl
_getwc_nolock(FILE*);
322 wchar_t* __cdecl
_getws(wchar_t*);
323 wint_t __cdecl
_putwc_nolock(wint_t,FILE*);
324 int __cdecl
_putws(const wchar_t*);
325 int WINAPIV
_snwprintf(wchar_t*,size_t,const wchar_t*,...);
326 int WINAPIV
_snwprintf_s(wchar_t*,size_t,size_t,const wchar_t*,...);
327 int WINAPIV
_scwprintf(const wchar_t*,...);
328 wint_t __cdecl
_ungetwc_nolock(wint_t,FILE*);
329 int __cdecl
_vscwprintf(const wchar_t*,__ms_va_list
);
330 int __cdecl
_vscwprintf_p_l(const wchar_t*,_locale_t
,__ms_va_list
);
331 int __cdecl
_vsnwprintf(wchar_t*,size_t,const wchar_t*,__ms_va_list
);
332 int __cdecl
_vsnwprintf_s(wchar_t*,size_t,size_t,const wchar_t*,__ms_va_list
);
333 int __cdecl
_vswprintf_p_l(wchar_t*,size_t,const wchar_t*,_locale_t
,__ms_va_list
);
334 FILE* __cdecl
_wfdopen(int,const wchar_t*);
335 FILE* __cdecl
_wfopen(const wchar_t*,const wchar_t*);
336 errno_t __cdecl
_wfopen_s(FILE**,const wchar_t*,const wchar_t*);
337 FILE* __cdecl
_wfreopen(const wchar_t*,const wchar_t*,FILE*);
338 FILE* __cdecl
_wfsopen(const wchar_t*,const wchar_t*,int);
339 void __cdecl
_wperror(const wchar_t*);
340 FILE* __cdecl
_wpopen(const wchar_t*,const wchar_t*);
341 int __cdecl
_wremove(const wchar_t*);
342 wchar_t* __cdecl
_wtempnam(const wchar_t*,const wchar_t*);
343 wchar_t* __cdecl
_wtmpnam(wchar_t*);
345 wint_t __cdecl
fgetwc(FILE*);
346 wchar_t* __cdecl
fgetws(wchar_t*,int,FILE*);
347 wint_t __cdecl
fputwc(wint_t,FILE*);
348 int __cdecl
fputws(const wchar_t*,FILE*);
349 int WINAPIV
fwprintf(FILE*,const wchar_t*,...);
350 int WINAPIV
fwprintf_s(FILE*,const wchar_t*,...);
351 int __cdecl
fputws(const wchar_t*,FILE*);
352 int WINAPIV
fwscanf(FILE*,const wchar_t*,...);
353 int WINAPIV
fwscanf_s(FILE*,const wchar_t*,...);
354 wint_t __cdecl
getwc(FILE*);
355 wint_t __cdecl
getwchar(void);
356 wchar_t* __cdecl
getws(wchar_t*);
357 wint_t __cdecl
putwc(wint_t,FILE*);
358 wint_t __cdecl
putwchar(wint_t);
359 int __cdecl
putws(const wchar_t*);
360 int WINAPIV
swprintf(wchar_t*,const wchar_t*,...);
361 int WINAPIV
swprintf_s(wchar_t*,size_t,const wchar_t*,...);
362 int WINAPIV
swscanf(const wchar_t*,const wchar_t*,...);
363 int WINAPIV
swscanf_s(const wchar_t*,const wchar_t*,...);
364 wint_t __cdecl
ungetwc(wint_t,FILE*);
365 int __cdecl
vfwprintf(FILE*,const wchar_t*,__ms_va_list
);
366 int __cdecl
vfwprintf_s(FILE*,const wchar_t*,__ms_va_list
);
367 int __cdecl
vswprintf(wchar_t*,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*,...);
375 #endif /* _WSTDIO_DEFINED */
377 #ifndef _WSTDLIB_DEFINED
378 #define _WSTDLIB_DEFINED
379 wchar_t* __cdecl
_itow(int,wchar_t*,int);
380 wchar_t* __cdecl
_i64tow(__int64
,wchar_t*,int);
381 wchar_t* __cdecl
_ltow(__msvcrt_long
,wchar_t*,int);
382 wchar_t* __cdecl
_ui64tow(unsigned __int64
,wchar_t*,int);
383 wchar_t* __cdecl
_ultow(__msvcrt_ulong
,wchar_t*,int);
384 wchar_t* __cdecl
_wfullpath(wchar_t*,const wchar_t*,size_t);
385 wchar_t* __cdecl
_wgetenv(const wchar_t*);
386 void __cdecl
_wmakepath(wchar_t*,const wchar_t*,const wchar_t*,const wchar_t*,const wchar_t*);
387 void __cdecl
_wperror(const wchar_t*);
388 int __cdecl
_wputenv(const wchar_t*);
389 void __cdecl
_wsearchenv(const wchar_t*,const wchar_t*,wchar_t*);
390 void __cdecl
_wsplitpath(const wchar_t*,wchar_t*,wchar_t*,wchar_t*,wchar_t*);
391 errno_t __cdecl
_wsplitpath_s(const wchar_t*,wchar_t*,size_t,wchar_t*,size_t,
392 wchar_t*,size_t,wchar_t*,size_t);
393 int __cdecl
_wsystem(const wchar_t*);
394 double __cdecl
_wtof(const wchar_t*);
395 int __cdecl
_wtoi(const wchar_t*);
396 __int64 __cdecl
_wtoi64(const wchar_t*);
397 __msvcrt_long __cdecl
_wtol(const wchar_t*);
399 size_t __cdecl
mbstowcs(wchar_t*,const char*,size_t);
400 errno_t __cdecl
mbstowcs_s(size_t*,wchar_t*,size_t,const char*,size_t);
401 int __cdecl
mbtowc(wchar_t*,const char*,size_t);
402 float __cdecl
wcstof(const wchar_t*,wchar_t**);
403 double __cdecl
wcstod(const wchar_t*,wchar_t**);
404 __msvcrt_long __cdecl
wcstol(const wchar_t*,wchar_t**,int);
405 size_t __cdecl
wcstombs(char*,const wchar_t*,size_t);
406 errno_t __cdecl
wcstombs_s(size_t*,char*,size_t,const wchar_t*,size_t);
407 __msvcrt_ulong __cdecl
wcstoul(const wchar_t*,wchar_t**,int);
408 int __cdecl
wctomb(char*,wchar_t);
409 #endif /* _WSTDLIB_DEFINED */
411 #ifndef _WSTRING_DEFINED
412 #define _WSTRING_DEFINED
413 int __cdecl
_wcscoll_l(const wchar_t*,const wchar_t*,_locale_t
);
414 wchar_t* __cdecl
_wcsdup(const wchar_t*);
415 int __cdecl
_wcsicmp(const wchar_t*,const wchar_t*);
416 int __cdecl
_wcsicoll(const wchar_t*,const wchar_t*);
417 int __cdecl
_wcsicoll_l(const wchar_t*,const wchar_t*,_locale_t
);
418 wchar_t* __cdecl
_wcslwr(wchar_t*);
419 int __cdecl
_wcsncoll(const wchar_t*,const wchar_t*,size_t);
420 int __cdecl
_wcsncoll_l(const wchar_t*,const wchar_t*,size_t,_locale_t
);
421 int __cdecl
_wcsnicmp(const wchar_t*,const wchar_t*,size_t);
422 int __cdecl
_wcsnicoll(const wchar_t*,const wchar_t*,size_t);
423 int __cdecl
_wcsnicoll_l(const wchar_t*,const wchar_t*,size_t,_locale_t
);
424 wchar_t* __cdecl
_wcsnset(wchar_t*,wchar_t,size_t);
425 wchar_t* __cdecl
_wcsrev(wchar_t*);
426 wchar_t* __cdecl
_wcsset(wchar_t*,wchar_t);
427 wchar_t* __cdecl
_wcsupr(wchar_t*);
429 wchar_t* __cdecl
wcscat(wchar_t*,const wchar_t*);
430 errno_t __cdecl
wcscat_s(wchar_t*,size_t,const wchar_t*);
431 wchar_t* __cdecl
wcschr(const wchar_t*,wchar_t);
432 int __cdecl
wcscmp(const wchar_t*,const wchar_t*);
433 int __cdecl
wcscoll(const wchar_t*,const wchar_t*);
434 wchar_t* __cdecl
wcscpy(wchar_t*,const wchar_t*);
435 errno_t __cdecl
wcscpy_s(wchar_t*,size_t,const wchar_t*);
436 size_t __cdecl
wcscspn(const wchar_t*,const wchar_t*);
437 size_t __cdecl
wcslen(const wchar_t*);
438 wchar_t* __cdecl
wcsncat(wchar_t*,const wchar_t*,size_t);
439 int __cdecl
wcsncmp(const wchar_t*,const wchar_t*,size_t);
440 wchar_t* __cdecl
wcsncpy(wchar_t*,const wchar_t*,size_t);
441 errno_t __cdecl
wcsncpy_s(wchar_t*,size_t,const wchar_t*,size_t);
442 wchar_t* __cdecl
wcspbrk(const wchar_t*,const wchar_t*);
443 wchar_t* __cdecl
wcsrchr(const wchar_t*,wchar_t wcFor
);
444 size_t __cdecl
wcsspn(const wchar_t*,const wchar_t*);
445 wchar_t* __cdecl
wcsstr(const wchar_t*,const wchar_t*);
446 wchar_t* __cdecl
wcstok(wchar_t*,const wchar_t*);
447 size_t __cdecl
wcsxfrm(wchar_t*,const wchar_t*,size_t);
448 #endif /* _WSTRING_DEFINED */
450 #ifndef _WTIME_DEFINED
451 #define _WTIME_DEFINED
453 #ifdef _USE_32BIT_TIME_T
454 #define _wctime32 _wctime
457 wchar_t* __cdecl
_wasctime(const struct tm
*);
458 size_t __cdecl
wcsftime(wchar_t*,size_t,const wchar_t*,const struct tm
*);
459 wchar_t* __cdecl
_wctime32(const __time32_t
*);
460 wchar_t* __cdecl
_wctime64(const __time64_t
*);
461 wchar_t* __cdecl
_wstrdate(wchar_t*);
462 errno_t __cdecl
_wstrdate_s(wchar_t*,size_t);
463 wchar_t* __cdecl
_wstrtime(wchar_t*);
464 errno_t __cdecl
_wstrtime_s(wchar_t*,size_t);
466 #ifndef _USE_32BIT_TIME_T
467 static inline wchar_t* _wctime(const time_t *t
) { return _wctime64(t
); }
470 #endif /* _WTIME_DEFINED */
472 wchar_t __cdecl
btowc(int);
473 size_t __cdecl
mbrlen(const char *,size_t,mbstate_t*);
474 size_t __cdecl
mbrtowc(wchar_t*,const char*,size_t,mbstate_t*);
475 size_t __cdecl
mbsrtowcs(wchar_t*,const char**,size_t,mbstate_t*);
476 size_t __cdecl
wcrtomb(char*,wchar_t,mbstate_t*);
477 size_t __cdecl
wcsrtombs(char*,const wchar_t**,size_t,mbstate_t*);
478 int __cdecl
wctob(wint_t);
480 static inline wchar_t *wmemchr(const wchar_t *s
, wchar_t c
, size_t n
)
483 for (end
= s
+ n
; s
< end
; s
++)
484 if (*s
== c
) return (wchar_t*)s
;
488 static inline int wmemcmp(const wchar_t *s1
, const wchar_t *s2
, size_t n
)
491 for (i
= 0; i
< n
; i
++)
493 if (s1
[i
] > s2
[i
]) return 1;
494 if (s1
[i
] < s2
[i
]) return -1;
499 static inline wchar_t* __cdecl
wmemcpy(wchar_t *dst
, const wchar_t *src
, size_t n
)
501 return memcpy(dst
, src
, n
* sizeof(wchar_t));
504 static inline wchar_t* __cdecl
wmemmove(wchar_t *dst
, const wchar_t *src
, size_t n
)
506 return memmove(dst
, src
, n
* sizeof(wchar_t));
509 static inline wchar_t* __cdecl
wmemset(wchar_t *s
, wchar_t c
, size_t n
)
512 for (i
= 0; i
< n
; i
++)
523 #endif /* __WINE_WCHAR_H */