msvcp90: Added wctype implementation.

This commit is contained in:
Piotr Caban 2011-07-29 16:35:00 +02:00 committed by Alexandre Julliard
parent 62a5540259
commit 7eb800f185
8 changed files with 67 additions and 6 deletions

View File

@ -2867,4 +2867,4 @@
@ stub __Wcrtomb_lk
@ stub towctrans
@ stub wctrans
@ stub wctype
@ cdecl wctype(str) msvcp90.wctype

View File

@ -4317,4 +4317,4 @@
@ cdecl wcsrtombs(ptr ptr long ptr) msvcrt.wcsrtombs
@ cdecl wctob(long) msvcrt.wctob
@ stub wctrans
@ stub wctype
@ cdecl wctype(str) msvcp90.wctype

View File

@ -5106,4 +5106,4 @@
@ cdecl wcsrtombs(ptr ptr long ptr) msvcrt.wcsrtombs
@ cdecl wctob(long) msvcrt.wctob
@ stub wctrans
@ stub wctype
@ cdecl wctype(str) msvcp90.wctype

View File

@ -5166,4 +5166,4 @@
@ cdecl wcsrtombs(ptr ptr long ptr) msvcrt.wcsrtombs
@ cdecl wctob(long) msvcrt.wctob
@ stub wctrans
@ stub wctype
@ cdecl wctype(str) msvcp90.wctype

View File

@ -5787,4 +5787,4 @@
@ stub __Wcrtomb_lk
@ stub towctrans
@ stub wctrans
@ stub wctype
@ cdecl wctype(str) msvcp90.wctype

View File

@ -172,3 +172,31 @@ void __thiscall _Lockit_dtor(_Lockit *this)
{
_Lockit__Lockit_dtor(this);
}
/* wctype */
unsigned short __cdecl wctype(const char *property)
{
static const struct {
const char *name;
unsigned short mask;
} properties[] = {
{ "alnum", _DIGIT|_ALPHA },
{ "alpha", _ALPHA },
{ "cntrl", _CONTROL },
{ "digit", _DIGIT },
{ "graph", _DIGIT|_PUNCT|_ALPHA },
{ "lower", _LOWER },
{ "print", _DIGIT|_PUNCT|_BLANK|_ALPHA },
{ "punct", _PUNCT },
{ "space", _SPACE },
{ "upper", _UPPER },
{ "xdigit", _HEX }
};
int i;
for(i=0; i<sizeof(properties)/sizeof(properties[0]); i++)
if(!strcmp(property, properties[i].name))
return properties[i].mask;
return 0;
}

View File

@ -5809,7 +5809,7 @@
@ stub __Wcrtomb_lk
@ stub towctrans
@ stub wctrans
@ stub wctype
@ cdecl wctype(str)
#Functions not exported in native dll:
@ thiscall -arch=win32 ?_Tidy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAEX_N@Z(ptr long) basic_string_char_tidy_built

View File

@ -34,6 +34,8 @@ static BYTE (__cdecl *p_short_eq)(const void*, const void*);
static char* (__cdecl *p_Copy_s)(char*, size_t, const char*, size_t);
static unsigned short (__cdecl *p_wctype)(const char*);
#ifdef __i386__
#define __thiscall __stdcall
#else
@ -124,6 +126,7 @@ static BOOL init(void)
p_set_invalid_parameter_handler(test_invalid_parameter_handler);
SET(p_wctype, "wctype");
if(sizeof(void*) == 8) { /* 64-bit initialization */
SET(p_char_assign, "?assign@?$char_traits@D@std@@SAXAEADAEBD@Z");
SET(p_wchar_assign, "?assign@?$char_traits@_W@std@@SAXAEA_WAEB_W@Z");
@ -259,6 +262,35 @@ static void test_Copy_s(void)
ok(errno == 0xdeadbeef, "errno = %d\n", errno);
}
static void test_wctype(void)
{
static const struct {
const char *name;
unsigned short mask;
} properties[] = {
{ "alnum", 0x107 },
{ "alpha", 0x103 },
{ "cntrl", 0x020 },
{ "digit", 0x004 },
{ "graph", 0x117 },
{ "lower", 0x002 },
{ "print", 0x157 },
{ "punct", 0x010 },
{ "space", 0x008 },
{ "upper", 0x001 },
{ "xdigit", 0x080 },
{ "ALNUM", 0x000 },
{ "Alnum", 0x000 },
{ "", 0x000 }
};
int i, ret;
for(i=0; i<sizeof(properties)/sizeof(properties[0]); i++) {
ret = p_wctype(properties[i].name);
ok(properties[i].mask == ret, "%d - Expected %x, got %x\n", i, properties[i].mask, ret);
}
}
static void test_allocator_char(void)
{
void *allocator = (void*)0xdeadbeef;
@ -298,6 +330,7 @@ START_TEST(misc)
test_assign();
test_equal();
test_Copy_s();
test_wctype();
test_allocator_char();