- New ERESOURCE implementation: fixes the return value of some functions (VOID vs...
[reactos.git] / reactos / include / wine / unicode.h
1 #ifndef _WINE_UNICODE_H
2 #define _WINE_UNICODE_H
3
4 #include <stdarg.h>
5
6 #include <windef.h>
7 #include <winbase.h>
8 #include <winnls.h>
9
10 #define strlenW(s) wcslen((const wchar_t *)(s))
11 #define strcpyW(d,s) wcscpy((wchar_t *)(d),(const wchar_t *)(s))
12 #define strcatW(d,s) wcscat((wchar_t *)(d),(const wchar_t *)(s))
13 #define strstrW(d,s) wcsstr((const wchar_t *)(d),(const wchar_t *)(s))
14 #define strtolW(s,e,b) wcstol((const wchar_t *)(s),(wchar_t **)(e),(b))
15 #define strchrW(s,c) wcschr((const wchar_t *)(s),(wchar_t)(c))
16 #define strrchrW(s,c) wcsrchr((const wchar_t *)(s),(wchar_t)(c))
17 #define strncmpW(s1,s2,n) wcsncmp((const wchar_t *)(s1),(const wchar_t *)(s2),(n))
18 #define strncpyW(s1,s2,n) wcsncpy((wchar_t *)(s1),(const wchar_t *)(s2),(n))
19 #define strcmpW(s1,s2) wcscmp((const wchar_t *)(s1),(const wchar_t *)(s2))
20 #define strcmpiW(s1,s2) _wcsicmp((const wchar_t *)(s1),(const wchar_t *)(s2))
21 #define strncmpiW(s1,s2,n) _wcsnicmp((const wchar_t *)(s1),(const wchar_t *)(s2),(n))
22 #define strtoulW(s1,s2,b) wcstoul((const wchar_t *)(s1),(wchar_t **)(s2),(b))
23 #define strspnW(str, accept) wcsspn((const wchar_t *)(str), (const wchar_t *)(accept))
24 #define tolowerW(n) towlower((n))
25 #define toupperW(n) towupper((n))
26 #define islowerW(n) iswlower((n))
27 #define isupperW(n) iswupper((n))
28 #define isalphaW(n) iswalpha((n))
29 #define isalnumW(n) iswalnum((n))
30 #define isdigitW(n) iswdigit((n))
31 #define isxdigitW(n) iswxdigit((n))
32 #define isspaceW(n) iswspace((n))
33 #define atoiW(s) _wtoi((const wchar_t *)(s))
34 #define atolW(s) _wtol((const wchar_t *)(s))
35 #define strlwrW(s) _wcslwr((wchar_t *)(s))
36 #define struprW(s) _wcsupr((wchar_t *)(s))
37 #define sprintfW swprintf
38 #define vsprintfW vswprintf
39 #define snprintfW _snwprintf
40 #define vsnprintfW vsnwprintf
41
42 #ifndef WINE_UNICODE_API
43 #define WINE_UNICODE_API __attribute__((dllimport))
44 #endif
45
46 static __inline WCHAR *strpbrkW( const WCHAR *str, const WCHAR *accept )
47 {
48 for ( ; *str; str++) if (strchrW( accept, *str )) return (WCHAR *)str;
49 return NULL;
50 }
51
52 static __inline WCHAR *memchrW( const WCHAR *ptr, WCHAR ch, size_t n )
53 {
54 const WCHAR *end;
55 for (end = ptr + n; ptr < end; ptr++) if (*ptr == ch) return (WCHAR *)ptr;
56 return NULL;
57 }
58
59 static __inline WCHAR *memrchrW( const WCHAR *ptr, WCHAR ch, size_t n )
60 {
61 const WCHAR *end, *ret = NULL;
62 for (end = ptr + n; ptr < end; ptr++) if (*ptr == ch) ret = ptr;
63 return (WCHAR *)ret;
64 }
65
66 #endif