9e301888e417c2877999966794251a70f74ab9b2
[reactos.git] / reactos / include / reactos / wine / unicode.h
1 #ifndef _WINE_UNICODE_H
2 #define _WINE_UNICODE_H
3
4 #include <stdarg.h>
5 #include <stdlib.h>
6 #include <wchar.h>
7
8 #include <windef.h>
9 #include <winbase.h>
10 #include <winnls.h>
11
12 #define memicmpW(s1,s2,n) _wcsnicmp((const wchar_t *)(s1),(const wchar_t *)(s2),(n))
13 #define strlenW(s) wcslen((const wchar_t *)(s))
14 #define strcpyW(d,s) wcscpy((wchar_t *)(d),(const wchar_t *)(s))
15 #define strcatW(d,s) wcscat((wchar_t *)(d),(const wchar_t *)(s))
16 #define strcspnW(d,s) wcscspn((wchar_t *)(d),(const wchar_t *)(s))
17 #define strstrW(d,s) wcsstr((const wchar_t *)(d),(const wchar_t *)(s))
18 #define strtolW(s,e,b) wcstol((const wchar_t *)(s),(wchar_t **)(e),(b))
19 #define strchrW(s,c) wcschr((const wchar_t *)(s),(wchar_t)(c))
20 #define strrchrW(s,c) wcsrchr((const wchar_t *)(s),(wchar_t)(c))
21 #define strncmpW(s1,s2,n) wcsncmp((const wchar_t *)(s1),(const wchar_t *)(s2),(n))
22 #define strncpyW(s1,s2,n) wcsncpy((wchar_t *)(s1),(const wchar_t *)(s2),(n))
23 #define strcmpW(s1,s2) wcscmp((const wchar_t *)(s1),(const wchar_t *)(s2))
24 #define strcmpiW(s1,s2) _wcsicmp((const wchar_t *)(s1),(const wchar_t *)(s2))
25 #define strncmpiW(s1,s2,n) _wcsnicmp((const wchar_t *)(s1),(const wchar_t *)(s2),(n))
26 #define strtoulW(s1,s2,b) wcstoul((const wchar_t *)(s1),(wchar_t **)(s2),(b))
27 #define strspnW(str, accept) wcsspn((const wchar_t *)(str), (const wchar_t *)(accept))
28 #define tolowerW(n) towlower((n))
29 #define toupperW(n) towupper((n))
30 #define islowerW(n) iswlower((n))
31 #define isupperW(n) iswupper((n))
32 #define isalphaW(n) iswalpha((n))
33 #define isalnumW(n) iswalnum((n))
34 #define isdigitW(n) iswdigit((n))
35 #define isxdigitW(n) iswxdigit((n))
36 #define isspaceW(n) iswspace((n))
37 #define iscntrlW(n) iswcntrl((n))
38 #define atoiW(s) _wtoi((const wchar_t *)(s))
39 #define atolW(s) _wtol((const wchar_t *)(s))
40 #define strlwrW(s) _wcslwr((wchar_t *)(s))
41 #define struprW(s) _wcsupr((wchar_t *)(s))
42 #define sprintfW swprintf
43 #define vsprintfW vswprintf
44 #define snprintfW _snwprintf
45 #define vsnprintfW _vsnwprintf
46 #define isprintW iswprint
47
48 #ifndef WINE_UNICODE_API
49 # if defined(_MSC_VER)
50 # define WINE_UNICODE_API __declspec(dllimport)
51 # else
52 # define WINE_UNICODE_API __attribute__((dllimport))
53 # endif
54 #endif
55
56 #ifndef __VALIST
57 #ifdef __GNUC__
58 #define __VALIST __gnuc_va_list
59 #else
60 #define __VALIST char*
61 #endif
62 #endif /* defined __VALIST */
63
64 static __inline WCHAR *strpbrkW( const WCHAR *str, const WCHAR *accept )
65 {
66 for ( ; *str; str++) if (strchrW( accept, *str )) return (WCHAR *)str;
67 return NULL;
68 }
69
70 static __inline WCHAR *memchrW( const WCHAR *ptr, WCHAR ch, size_t n )
71 {
72 const WCHAR *end;
73 for (end = ptr + n; ptr < end; ptr++) if (*ptr == ch) return (WCHAR *)ptr;
74 return NULL;
75 }
76
77 static __inline WCHAR *memrchrW( const WCHAR *ptr, WCHAR ch, size_t n )
78 {
79 const WCHAR *end, *ret = NULL;
80 for (end = ptr + n; ptr < end; ptr++) if (*ptr == ch) ret = ptr;
81 return (WCHAR *)ret;
82 }
83
84 #endif