Piotr Caban : msvcp90: Added wctype implementation.
Alexandre Julliard
julliard at winehq.org
Fri Jul 29 12:37:04 CDT 2011
Module: wine
Branch: master
Commit: 7eb800f1854f1b856144059d09f1989774c52b29
URL: http://source.winehq.org/git/wine.git/?a=commit;h=7eb800f1854f1b856144059d09f1989774c52b29
Author: Piotr Caban <piotr at codeweavers.com>
Date: Fri Jul 29 16:35:00 2011 +0200
msvcp90: Added wctype implementation.
---
dlls/msvcp100/msvcp100.spec | 2 +-
dlls/msvcp60/msvcp60.spec | 2 +-
dlls/msvcp70/msvcp70.spec | 2 +-
dlls/msvcp71/msvcp71.spec | 2 +-
dlls/msvcp80/msvcp80.spec | 2 +-
dlls/msvcp90/misc.c | 28 ++++++++++++++++++++++++++++
dlls/msvcp90/msvcp90.spec | 2 +-
dlls/msvcp90/tests/misc.c | 33 +++++++++++++++++++++++++++++++++
8 files changed, 67 insertions(+), 6 deletions(-)
diff --git a/dlls/msvcp100/msvcp100.spec b/dlls/msvcp100/msvcp100.spec
index 260da66..c4b7ffa 100644
--- a/dlls/msvcp100/msvcp100.spec
+++ b/dlls/msvcp100/msvcp100.spec
@@ -2867,4 +2867,4 @@
@ stub __Wcrtomb_lk
@ stub towctrans
@ stub wctrans
-@ stub wctype
+@ cdecl wctype(str) msvcp90.wctype
diff --git a/dlls/msvcp60/msvcp60.spec b/dlls/msvcp60/msvcp60.spec
index 1e6898e..e63636d 100644
--- a/dlls/msvcp60/msvcp60.spec
+++ b/dlls/msvcp60/msvcp60.spec
@@ -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
diff --git a/dlls/msvcp70/msvcp70.spec b/dlls/msvcp70/msvcp70.spec
index 9cb9a2a..fa74b0c 100644
--- a/dlls/msvcp70/msvcp70.spec
+++ b/dlls/msvcp70/msvcp70.spec
@@ -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
diff --git a/dlls/msvcp71/msvcp71.spec b/dlls/msvcp71/msvcp71.spec
index 891d0e5..b21b549 100644
--- a/dlls/msvcp71/msvcp71.spec
+++ b/dlls/msvcp71/msvcp71.spec
@@ -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
diff --git a/dlls/msvcp80/msvcp80.spec b/dlls/msvcp80/msvcp80.spec
index 2c477db..c81a711 100644
--- a/dlls/msvcp80/msvcp80.spec
+++ b/dlls/msvcp80/msvcp80.spec
@@ -5787,4 +5787,4 @@
@ stub __Wcrtomb_lk
@ stub towctrans
@ stub wctrans
-@ stub wctype
+@ cdecl wctype(str) msvcp90.wctype
diff --git a/dlls/msvcp90/misc.c b/dlls/msvcp90/misc.c
index f0d1923..3ce1784 100644
--- a/dlls/msvcp90/misc.c
+++ b/dlls/msvcp90/misc.c
@@ -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;
+}
diff --git a/dlls/msvcp90/msvcp90.spec b/dlls/msvcp90/msvcp90.spec
index c0c1490..4b94f08 100644
--- a/dlls/msvcp90/msvcp90.spec
+++ b/dlls/msvcp90/msvcp90.spec
@@ -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 at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@AAEX_N at Z(ptr long) basic_string_char_tidy_built
diff --git a/dlls/msvcp90/tests/misc.c b/dlls/msvcp90/tests/misc.c
index 179f9a2..069c935 100644
--- a/dlls/msvcp90/tests/misc.c
+++ b/dlls/msvcp90/tests/misc.c
@@ -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 at D@std@@SAXAEADAEBD at Z");
SET(p_wchar_assign, "?assign@?$char_traits at _W@std@@SAXAEA_WAEB_W at 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();
More information about the wine-cvs
mailing list