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