c0e9f947240441b6ee855e799175dcb64b28102f
[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 tolowerW(n) towlower((n))
24 #define toupperW(n) towupper((n))
25 #define islowerW(n) iswlower((n))
26 #define isupperW(n) iswupper((n))
27 #define isalphaW(n) iswalpha((n))
28 #define isalnumW(n) iswalnum((n))
29 #define isdigitW(n) iswdigit((n))
30 #define isxdigitW(n) iswxdigit((n))
31 #define isspaceW(n) iswspace((n))
32 #define atoiW(s) _wtoi((const wchar_t *)(s))
33 #define atolW(s) _wtol((const wchar_t *)(s))
34 #define strlwrW(s) _wcslwr((wchar_t *)(s))
35 #define struprW(s) _wcsupr((wchar_t *)(s))
36 #define sprintfW swprintf
37 #define snprintfW _snwprintf
38 #define vsnprintfW vsnwprintf
39
40 #ifndef WINE_UNICODE_API
41 #define WINE_UNICODE_API __attribute__((dllimport))
42 #endif
43
44 static __inline WCHAR *strpbrkW( const WCHAR *str, const WCHAR *accept )
45 {
46 for ( ; *str; str++) if (strchrW( accept, *str )) return (WCHAR *)str;
47 return NULL;
48 }
49
50 static __inline WCHAR *memchrW( const WCHAR *ptr, WCHAR ch, size_t n )
51 {
52 const WCHAR *end;
53 for (end = ptr + n; ptr < end; ptr++) if (*ptr == ch) return (WCHAR *)ptr;
54 return NULL;
55 }
56
57 static __inline WCHAR *memrchrW( const WCHAR *ptr, WCHAR ch, size_t n )
58 {
59 const WCHAR *end, *ret = NULL;
60 for (end = ptr + n; ptr < end; ptr++) if (*ptr == ch) ret = ptr;
61 return (WCHAR *)ret;
62 }
63
64 #endif