shell32: Add rename icon.
[wine.git] / include / msvcrt / wchar.h
blobce5423ee2785fcc974b14d2f3be112cf6be52217
1 /*
2 * Unicode definitions
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.
7 */
8 #ifndef __WINE_WCHAR_H
9 #define __WINE_WCHAR_H
11 #include <crtdefs.h>
12 #include <stdarg.h>
13 #include <string.h>
15 #include <pshpack8.h>
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
21 #ifndef NULL
22 #ifdef __cplusplus
23 #define NULL 0
24 #else
25 #define NULL ((void *)0)
26 #endif
27 #endif
29 #define WCHAR_MIN 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)))
37 # else
38 # define DECLSPEC_ALIGN(x)
39 # endif
40 #endif
42 typedef int mbstate_t;
44 #ifndef WEOF
45 #define WEOF (wint_t)(0xFFFF)
46 #endif
48 #ifndef _FSIZE_T_DEFINED
49 typedef __msvcrt_ulong _fsize_t;
50 #define _FSIZE_T_DEFINED
51 #endif
53 #ifndef _DEV_T_DEFINED
54 typedef unsigned int _dev_t;
55 #define _DEV_T_DEFINED
56 #endif
58 #ifndef _INO_T_DEFINED
59 typedef unsigned short _ino_t;
60 #define _INO_T_DEFINED
61 #endif
63 #ifndef _OFF_T_DEFINED
64 typedef int _off_t;
65 #define _OFF_T_DEFINED
66 #endif
68 #ifndef _TM_DEFINED
69 #define _TM_DEFINED
70 struct tm {
71 int tm_sec;
72 int tm_min;
73 int tm_hour;
74 int tm_mday;
75 int tm_mon;
76 int tm_year;
77 int tm_wday;
78 int tm_yday;
79 int tm_isdst;
81 #endif /* _TM_DEFINED */
83 #ifndef _FILE_DEFINED
84 #define _FILE_DEFINED
85 typedef struct _iobuf
87 char* _ptr;
88 int _cnt;
89 char* _base;
90 int _flag;
91 int _file;
92 int _charbuf;
93 int _bufsiz;
94 char* _tmpfname;
95 } FILE;
96 #endif /* _FILE_DEFINED */
98 #ifndef _WFINDDATA_T_DEFINED
99 #define _WFINDDATA_T_DEFINED
101 struct _wfinddata_t {
102 unsigned attrib;
103 time_t time_create;
104 time_t time_access;
105 time_t time_write;
106 _fsize_t size;
107 wchar_t name[260];
110 struct _wfinddatai64_t {
111 unsigned attrib;
112 time_t time_create;
113 time_t time_access;
114 time_t time_write;
115 __int64 DECLSPEC_ALIGN(8) size;
116 wchar_t name[260];
119 #endif /* _WFINDDATA_T_DEFINED */
121 #ifndef _STAT_DEFINED
122 #define _STAT_DEFINED
124 struct _stat {
125 _dev_t st_dev;
126 _ino_t st_ino;
127 unsigned short st_mode;
128 short st_nlink;
129 short st_uid;
130 short st_gid;
131 _dev_t st_rdev;
132 _off_t st_size;
133 time_t st_atime;
134 time_t st_mtime;
135 time_t st_ctime;
138 struct stat {
139 _dev_t st_dev;
140 _ino_t st_ino;
141 unsigned short st_mode;
142 short st_nlink;
143 short st_uid;
144 short st_gid;
145 _dev_t st_rdev;
146 _off_t st_size;
147 time_t st_atime;
148 time_t st_mtime;
149 time_t st_ctime;
152 struct _stat32 {
153 _dev_t st_dev;
154 _ino_t st_ino;
155 unsigned short st_mode;
156 short st_nlink;
157 short st_uid;
158 short st_gid;
159 _dev_t st_rdev;
160 _off_t st_size;
161 __time32_t st_atime;
162 __time32_t st_mtime;
163 __time32_t st_ctime;
166 struct _stat32i64 {
167 _dev_t st_dev;
168 _ino_t st_ino;
169 unsigned short st_mode;
170 short st_nlink;
171 short st_uid;
172 short st_gid;
173 _dev_t st_rdev;
174 __int64 DECLSPEC_ALIGN(8) st_size;
175 time_t st_atime;
176 time_t st_mtime;
177 time_t st_ctime;
180 struct _stat64i32 {
181 _dev_t st_dev;
182 _ino_t st_ino;
183 unsigned short st_mode;
184 short st_nlink;
185 short st_uid;
186 short st_gid;
187 _dev_t st_rdev;
188 _off_t st_size;
189 __time64_t st_atime;
190 __time64_t st_mtime;
191 __time64_t st_ctime;
194 struct _stati64 {
195 _dev_t st_dev;
196 _ino_t st_ino;
197 unsigned short st_mode;
198 short st_nlink;
199 short st_uid;
200 short st_gid;
201 _dev_t st_rdev;
202 __int64 DECLSPEC_ALIGN(8) st_size;
203 time_t st_atime;
204 time_t st_mtime;
205 time_t st_ctime;
208 struct _stat64 {
209 _dev_t st_dev;
210 _ino_t st_ino;
211 unsigned short st_mode;
212 short st_nlink;
213 short st_uid;
214 short st_gid;
215 _dev_t st_rdev;
216 __int64 DECLSPEC_ALIGN(8) st_size;
217 __time64_t st_atime;
218 __time64_t st_mtime;
219 __time64_t st_ctime;
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 */
265 #ifndef _WIO_DEFINED
266 #define _WIO_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
455 #endif
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); }
468 #endif
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)
482 const wchar_t *end;
483 for (end = s + n; s < end; s++)
484 if (*s == c) return (wchar_t*)s;
485 return NULL;
488 static inline int wmemcmp(const wchar_t *s1, const wchar_t *s2, size_t n)
490 size_t i;
491 for (i = 0; i < n; i++)
493 if (s1[i] > s2[i]) return 1;
494 if (s1[i] < s2[i]) return -1;
496 return 0;
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)
511 size_t i;
512 for (i = 0; i < n; i++)
513 s[i] = c;
514 return s;
517 #ifdef __cplusplus
519 #endif
521 #include <poppack.h>
523 #endif /* __WINE_WCHAR_H */