Piotr Caban : msvcr120: Add wctype implementation.
Alexandre Julliard
julliard at winehq.org
Tue Jan 2 15:01:24 CST 2018
Module: wine
Branch: stable
Commit: 76172bf91172ca59296c4b72ef478929a4d3547d
URL: https://source.winehq.org/git/wine.git/?a=commit;h=76172bf91172ca59296c4b72ef478929a4d3547d
Author: Piotr Caban <piotr at codeweavers.com>
Date: Fri Apr 14 18:21:21 2017 +0200
msvcr120: Add wctype implementation.
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit 42ccd8d9ecb386bb9da311c1faa5c14a12d26de3)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
.../api-ms-win-crt-string-l1-1-0.spec | 2 +-
dlls/msvcr120/msvcr120.spec | 2 +-
dlls/msvcr120/tests/msvcr120.c | 32 ++++++++++++++++++++++
dlls/msvcr120_app/msvcr120_app.spec | 2 +-
dlls/msvcrt/ctype.c | 30 ++++++++++++++++++++
dlls/ucrtbase/ucrtbase.spec | 2 +-
6 files changed, 66 insertions(+), 4 deletions(-)
diff --git a/dlls/api-ms-win-crt-string-l1-1-0/api-ms-win-crt-string-l1-1-0.spec b/dlls/api-ms-win-crt-string-l1-1-0/api-ms-win-crt-string-l1-1-0.spec
index 0095feb..5e8e7b4 100644
--- a/dlls/api-ms-win-crt-string-l1-1-0/api-ms-win-crt-string-l1-1-0.spec
+++ b/dlls/api-ms-win-crt-string-l1-1-0/api-ms-win-crt-string-l1-1-0.spec
@@ -173,6 +173,6 @@
@ cdecl wcstok(wstr wstr) ucrtbase.wcstok
@ cdecl wcstok_s(ptr wstr ptr) ucrtbase.wcstok_s
@ cdecl wcsxfrm(ptr wstr long) ucrtbase.wcsxfrm
-@ stub wctype
+@ cdecl wctype(str) ucrtbase.wctype
@ cdecl wmemcpy_s(ptr long ptr long) ucrtbase.wmemcpy_s
@ cdecl wmemmove_s(ptr long ptr long) ucrtbase.wmemmove_s
diff --git a/dlls/msvcr120/msvcr120.spec b/dlls/msvcr120/msvcr120.spec
index a15db46..8bc3467 100644
--- a/dlls/msvcr120/msvcr120.spec
+++ b/dlls/msvcr120/msvcr120.spec
@@ -2487,7 +2487,7 @@
@ cdecl wctomb(ptr long) MSVCRT_wctomb
@ cdecl wctomb_s(ptr ptr long long) MSVCRT_wctomb_s
@ stub wctrans
-@ stub wctype
+@ cdecl wctype(str)
@ cdecl wmemcpy_s(ptr long ptr long)
@ cdecl wmemmove_s(ptr long ptr long)
@ varargs wprintf(wstr) MSVCRT_wprintf
diff --git a/dlls/msvcr120/tests/msvcr120.c b/dlls/msvcr120/tests/msvcr120.c
index 13f3672..de0ccc4 100644
--- a/dlls/msvcr120/tests/msvcr120.c
+++ b/dlls/msvcr120/tests/msvcr120.c
@@ -182,6 +182,7 @@ static int (CDECL *p_fegetenv)(fenv_t*);
static int (CDECL *p__clearfp)(void);
static _locale_t (__cdecl *p_wcreate_locale)(int, const wchar_t *);
static void (__cdecl *p_free_locale)(_locale_t);
+static unsigned short (__cdecl *p_wctype)(const char*);
/* make sure we use the correct errno */
#undef errno
@@ -236,6 +237,7 @@ static BOOL init(void)
p_errno = (void*)GetProcAddress(module, "_errno");
p_wcreate_locale = (void*)GetProcAddress(module, "_wcreate_locale");
p_free_locale = (void*)GetProcAddress(module, "_free_locale");
+ SET(p_wctype, "wctype");
SET(p_fegetenv, "fegetenv");
SET(p__clearfp, "_clearfp");
if(sizeof(void*) == 8) { /* 64-bit initialization */
@@ -880,6 +882,35 @@ static void test__Condition_variable(void)
CloseHandle(thread_initialized);
}
+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);
+ }
+}
+
START_TEST(msvcr120)
{
if (!init()) return;
@@ -896,4 +927,5 @@ START_TEST(msvcr120)
test_fegetenv();
test__wcreate_locale();
test__Condition_variable();
+ test_wctype();
}
diff --git a/dlls/msvcr120_app/msvcr120_app.spec b/dlls/msvcr120_app/msvcr120_app.spec
index 1226fa5..4cf772d 100644
--- a/dlls/msvcr120_app/msvcr120_app.spec
+++ b/dlls/msvcr120_app/msvcr120_app.spec
@@ -2149,7 +2149,7 @@
@ cdecl wctomb(ptr long) msvcr120.wctomb
@ cdecl wctomb_s(ptr ptr long long) msvcr120.wctomb_s
@ stub wctrans
-@ stub wctype
+@ cdecl wctype(str) msvcr120.wctype
@ cdecl wmemcpy_s(ptr long ptr long) msvcr120.wmemcpy_s
@ cdecl wmemmove_s(ptr long ptr long) msvcr120.wmemmove_s
@ varargs wprintf(wstr) msvcr120.wprintf
diff --git a/dlls/msvcrt/ctype.c b/dlls/msvcrt/ctype.c
index 8b9d14c..a88df58 100644
--- a/dlls/msvcrt/ctype.c
+++ b/dlls/msvcrt/ctype.c
@@ -452,3 +452,33 @@ int CDECL MSVCRT__tolower(int c)
{
return c + 0x20; /* sic */
}
+
+/*********************************************************************
+ * wctype (MSVCR120.@)
+ */
+unsigned short __cdecl wctype(const char *property)
+{
+ static const struct {
+ const char *name;
+ unsigned short mask;
+ } properties[] = {
+ { "alnum", MSVCRT__DIGIT|MSVCRT__ALPHA },
+ { "alpha", MSVCRT__ALPHA },
+ { "cntrl", MSVCRT__CONTROL },
+ { "digit", MSVCRT__DIGIT },
+ { "graph", MSVCRT__DIGIT|MSVCRT__PUNCT|MSVCRT__ALPHA },
+ { "lower", MSVCRT__LOWER },
+ { "print", MSVCRT__DIGIT|MSVCRT__PUNCT|MSVCRT__BLANK|MSVCRT__ALPHA },
+ { "punct", MSVCRT__PUNCT },
+ { "space", MSVCRT__SPACE },
+ { "upper", MSVCRT__UPPER },
+ { "xdigit", MSVCRT__HEX }
+ };
+ unsigned 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/ucrtbase/ucrtbase.spec b/dlls/ucrtbase/ucrtbase.spec
index a6b2043..ee95ee4 100644
--- a/dlls/ucrtbase/ucrtbase.spec
+++ b/dlls/ucrtbase/ucrtbase.spec
@@ -2594,6 +2594,6 @@
@ cdecl wctomb(ptr long) MSVCRT_wctomb
@ cdecl wctomb_s(ptr ptr long long) MSVCRT_wctomb_s
@ stub wctrans
-@ stub wctype
+@ cdecl wctype(str)
@ cdecl wmemcpy_s(ptr long ptr long)
@ cdecl wmemmove_s(ptr long ptr long)
More information about the wine-cvs
mailing list