Encapsulated Wine internal data into an ifdef __WINE__.
[wine.git] / server / unicode.h
blobdd7d03b740e4dae20eb42ca952b17706d3cf6901
1 /*
2 * Unicode routines for use inside the server
4 * Copyright (C) 1999 Alexandre Julliard
5 */
7 #ifndef __WINE_SERVER_UNICODE_H
8 #define __WINE_SERVER_UNICODE_H
10 #ifndef __WINE_SERVER__
11 #error This file can only be used in the Wine server
12 #endif
14 #include "config.h"
16 #include <ctype.h>
17 #ifdef HAVE_WCTYPE_H
18 #include <wctype.h>
19 #endif
21 #include "windef.h"
22 #include "object.h"
24 static inline size_t strlenW( const WCHAR *str )
26 const WCHAR *s = str;
27 while (*s) s++;
28 return s - str;
31 static inline int strcmpW( const WCHAR *str1, const WCHAR *str2 )
33 while (*str1 && (*str1 == *str2)) { str1++; str2++; }
34 return *str1 - *str2;
37 #ifndef HAVE_WCTYPE_H
38 /* FIXME */
39 #define towupper(ch) (HIBYTE(ch) ? ch : (WCHAR)toupper(LOBYTE(ch)))
40 #endif
42 static inline int strcmpiW( const WCHAR *str1, const WCHAR *str2 )
44 while (*str1 && (towupper(*str1) == towupper(*str2))) { str1++; str2++; }
45 return towupper(*str1) - towupper(*str2);
48 static inline WCHAR *strcpyW( WCHAR *src, const WCHAR *dst )
50 const WCHAR *ret = dst;
51 while ((*src++ = *dst++));
52 return (WCHAR *)ret;
55 static inline WCHAR *strdupW( const WCHAR *str )
57 size_t len = (strlenW(str) + 1) * sizeof(WCHAR);
58 return memdup( str, len );
61 extern int dump_strW( const WCHAR *str, size_t len, FILE *f, char escape[2] );
63 #endif /* __WINE_SERVER_UNICODE_H */