1999-11-23 20:39:11 +01:00
|
|
|
/*
|
|
|
|
* Unicode routines for use inside the server
|
|
|
|
*
|
|
|
|
* Copyright (C) 1999 Alexandre Julliard
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __WINE_SERVER_UNICODE_H
|
|
|
|
#define __WINE_SERVER_UNICODE_H
|
|
|
|
|
|
|
|
#ifndef __WINE_SERVER__
|
|
|
|
#error This file can only be used in the Wine server
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <ctype.h>
|
|
|
|
#ifdef HAVE_WCTYPE_H
|
|
|
|
#include <wctype.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "windef.h"
|
1999-11-25 22:30:24 +01:00
|
|
|
#include "object.h"
|
1999-11-23 20:39:11 +01:00
|
|
|
|
|
|
|
static inline size_t strlenW( const WCHAR *str )
|
|
|
|
{
|
|
|
|
const WCHAR *s = str;
|
|
|
|
while (*s) s++;
|
|
|
|
return s - str;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int strcmpW( const WCHAR *str1, const WCHAR *str2 )
|
|
|
|
{
|
|
|
|
while (*str1 && (*str1 == *str2)) { str1++; str2++; }
|
|
|
|
return *str1 - *str2;
|
|
|
|
}
|
|
|
|
|
1999-11-28 20:47:21 +01:00
|
|
|
#ifndef HAVE_WCTYPE_H
|
|
|
|
/* FIXME */
|
|
|
|
#define towupper(ch) (HIBYTE(ch) ? ch : (WCHAR)toupper(LOBYTE(ch)))
|
|
|
|
#endif
|
|
|
|
|
1999-11-23 20:39:11 +01:00
|
|
|
static inline int strcmpiW( const WCHAR *str1, const WCHAR *str2 )
|
|
|
|
{
|
|
|
|
while (*str1 && (towupper(*str1) == towupper(*str2))) { str1++; str2++; }
|
|
|
|
return towupper(*str1) - towupper(*str2);
|
|
|
|
}
|
|
|
|
|
2000-02-13 14:56:13 +01:00
|
|
|
static inline WCHAR *strcpyW( WCHAR *dst, const WCHAR *src )
|
1999-11-23 20:39:11 +01:00
|
|
|
{
|
|
|
|
const WCHAR *ret = dst;
|
2000-02-13 14:56:13 +01:00
|
|
|
while ((*dst++ = *src++));
|
1999-11-23 20:39:11 +01:00
|
|
|
return (WCHAR *)ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline WCHAR *strdupW( const WCHAR *str )
|
|
|
|
{
|
|
|
|
size_t len = (strlenW(str) + 1) * sizeof(WCHAR);
|
|
|
|
return memdup( str, len );
|
|
|
|
}
|
|
|
|
|
1999-11-25 22:30:24 +01:00
|
|
|
extern int dump_strW( const WCHAR *str, size_t len, FILE *f, char escape[2] );
|
|
|
|
|
1999-11-23 20:39:11 +01:00
|
|
|
#endif /* __WINE_SERVER_UNICODE_H */
|