From ff6231d173ca0ec4cc162d6ffa8717e0eb8362f5 Mon Sep 17 00:00:00 2001 From: YongHao Hu Date: Thu, 19 Mar 2015 19:06:46 +0800 Subject: [PATCH] msvcp90: Add istream::operator>>complex implementation and tests. --- dlls/msvcp71/msvcp71.spec | 12 +-- dlls/msvcp80/msvcp80.spec | 12 +-- dlls/msvcp90/ios.c | 177 ++++++++++++++++++++++++++++++++++++++ dlls/msvcp90/msvcp90.spec | 12 +-- dlls/msvcp90/tests/ios.c | 104 ++++++++++++++++++++++ 5 files changed, 299 insertions(+), 18 deletions(-) diff --git a/dlls/msvcp71/msvcp71.spec b/dlls/msvcp71/msvcp71.spec index d330619c94e..c29f0b7f40c 100644 --- a/dlls/msvcp71/msvcp71.spec +++ b/dlls/msvcp71/msvcp71.spec @@ -18,20 +18,20 @@ @ cdecl -arch=win64 ??$?5GU?$char_traits@G@std@@@std@@YAAEAV?$basic_istream@GU?$char_traits@G@std@@@0@AEAV10@PEAG@Z(ptr ptr) basic_istream_short_read_str @ cdecl -arch=win32 ??$?5GU?$char_traits@G@std@@V?$allocator@G@1@@std@@YAAAV?$basic_istream@GU?$char_traits@G@std@@@0@AAV10@AAV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@@Z(ptr ptr) basic_istream_short_read_bstr @ cdecl -arch=win64 ??$?5GU?$char_traits@G@std@@V?$allocator@G@1@@std@@YAAEAV?$basic_istream@GU?$char_traits@G@std@@@0@AEAV10@AEAV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@@Z(ptr ptr) basic_istream_short_read_bstr -@ stub -arch=win32 ??$?5MDU?$char_traits@D@std@@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAV?$complex@M@0@@Z -@ stub -arch=win64 ??$?5MDU?$char_traits@D@std@@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@AEAV?$complex@M@0@@Z +@ cdecl -arch=win32 ??$?5MDU?$char_traits@D@std@@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAV?$complex@M@0@@Z(ptr ptr) basic_istream_char_read_complex_float +@ cdecl -arch=win64 ??$?5MDU?$char_traits@D@std@@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@AEAV?$complex@M@0@@Z(ptr ptr) basic_istream_char_read_complex_float @ stub -arch=win32 ??$?5MGU?$char_traits@G@std@@@std@@YAAAV?$basic_istream@GU?$char_traits@G@std@@@0@AAV10@AAV?$complex@M@0@@Z @ stub -arch=win64 ??$?5MGU?$char_traits@G@std@@@std@@YAAEAV?$basic_istream@GU?$char_traits@G@std@@@0@AEAV10@AEAV?$complex@M@0@@Z @ stub -arch=win32 ??$?5M_WU?$char_traits@_W@std@@@std@@YAAAV?$basic_istream@_WU?$char_traits@_W@std@@@0@AAV10@AAV?$complex@M@0@@Z @ stub -arch=win64 ??$?5M_WU?$char_traits@_W@std@@@std@@YAAEAV?$basic_istream@_WU?$char_traits@_W@std@@@0@AEAV10@AEAV?$complex@M@0@@Z -@ stub -arch=win32 ??$?5NDU?$char_traits@D@std@@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAV?$complex@N@0@@Z -@ stub -arch=win64 ??$?5NDU?$char_traits@D@std@@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@AEAV?$complex@N@0@@Z +@ cdecl -arch=win32 ??$?5NDU?$char_traits@D@std@@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAV?$complex@N@0@@Z(ptr ptr) basic_istream_char_read_complex_double +@ cdecl -arch=win64 ??$?5NDU?$char_traits@D@std@@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@AEAV?$complex@N@0@@Z(ptr ptr) basic_istream_char_read_complex_double @ stub -arch=win32 ??$?5NGU?$char_traits@G@std@@@std@@YAAAV?$basic_istream@GU?$char_traits@G@std@@@0@AAV10@AAV?$complex@N@0@@Z @ stub -arch=win64 ??$?5NGU?$char_traits@G@std@@@std@@YAAEAV?$basic_istream@GU?$char_traits@G@std@@@0@AEAV10@AEAV?$complex@N@0@@Z @ stub -arch=win32 ??$?5N_WU?$char_traits@_W@std@@@std@@YAAAV?$basic_istream@_WU?$char_traits@_W@std@@@0@AAV10@AAV?$complex@N@0@@Z @ stub -arch=win64 ??$?5N_WU?$char_traits@_W@std@@@std@@YAAEAV?$basic_istream@_WU?$char_traits@_W@std@@@0@AEAV10@AEAV?$complex@N@0@@Z -@ stub -arch=win32 ??$?5ODU?$char_traits@D@std@@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAV?$complex@O@0@@Z -@ stub -arch=win64 ??$?5ODU?$char_traits@D@std@@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@AEAV?$complex@O@0@@Z +@ cdecl -arch=win32 ??$?5ODU?$char_traits@D@std@@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAV?$complex@O@0@@Z(ptr ptr) basic_istream_char_read_complex_ldouble +@ cdecl -arch=win64 ??$?5ODU?$char_traits@D@std@@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@AEAV?$complex@O@0@@Z(ptr ptr) basic_istream_char_read_complex_ldouble @ stub -arch=win32 ??$?5OGU?$char_traits@G@std@@@std@@YAAAV?$basic_istream@GU?$char_traits@G@std@@@0@AAV10@AAV?$complex@O@0@@Z @ stub -arch=win64 ??$?5OGU?$char_traits@G@std@@@std@@YAAEAV?$basic_istream@GU?$char_traits@G@std@@@0@AEAV10@AEAV?$complex@O@0@@Z @ stub -arch=win32 ??$?5O_WU?$char_traits@_W@std@@@std@@YAAAV?$basic_istream@_WU?$char_traits@_W@std@@@0@AAV10@AAV?$complex@O@0@@Z diff --git a/dlls/msvcp80/msvcp80.spec b/dlls/msvcp80/msvcp80.spec index 2d0dfd3aa4f..11d628d9545 100644 --- a/dlls/msvcp80/msvcp80.spec +++ b/dlls/msvcp80/msvcp80.spec @@ -10,20 +10,20 @@ @ cdecl -arch=win64 ??$?5GU?$char_traits@G@std@@@std@@YAAEAV?$basic_istream@GU?$char_traits@G@std@@@0@AEAV10@PEAG@Z(ptr ptr) basic_istream_short_read_str @ cdecl -arch=win32 ??$?5GU?$char_traits@G@std@@V?$allocator@G@1@@std@@YAAAV?$basic_istream@GU?$char_traits@G@std@@@0@AAV10@AAV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@@Z(ptr ptr) basic_istream_short_read_bstr @ cdecl -arch=win64 ??$?5GU?$char_traits@G@std@@V?$allocator@G@1@@std@@YAAEAV?$basic_istream@GU?$char_traits@G@std@@@0@AEAV10@AEAV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@@Z(ptr ptr) basic_istream_short_read_bstr -@ stub -arch=win32 ??$?5MDU?$char_traits@D@std@@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAV?$complex@M@0@@Z -@ stub -arch=win64 ??$?5MDU?$char_traits@D@std@@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@AEAV?$complex@M@0@@Z +@ cdecl -arch=win32 ??$?5MDU?$char_traits@D@std@@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAV?$complex@M@0@@Z(ptr ptr) basic_istream_char_read_complex_float +@ cdecl -arch=win64 ??$?5MDU?$char_traits@D@std@@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@AEAV?$complex@M@0@@Z(ptr ptr) basic_istream_char_read_complex_float @ stub -arch=win32 ??$?5MGU?$char_traits@G@std@@@std@@YAAAV?$basic_istream@GU?$char_traits@G@std@@@0@AAV10@AAV?$complex@M@0@@Z @ stub -arch=win64 ??$?5MGU?$char_traits@G@std@@@std@@YAAEAV?$basic_istream@GU?$char_traits@G@std@@@0@AEAV10@AEAV?$complex@M@0@@Z @ stub -arch=win32 ??$?5M_WU?$char_traits@_W@std@@@std@@YAAAV?$basic_istream@_WU?$char_traits@_W@std@@@0@AAV10@AAV?$complex@M@0@@Z @ stub -arch=win64 ??$?5M_WU?$char_traits@_W@std@@@std@@YAAEAV?$basic_istream@_WU?$char_traits@_W@std@@@0@AEAV10@AEAV?$complex@M@0@@Z -@ stub -arch=win32 ??$?5NDU?$char_traits@D@std@@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAV?$complex@N@0@@Z -@ stub -arch=win64 ??$?5NDU?$char_traits@D@std@@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@AEAV?$complex@N@0@@Z +@ cdecl -arch=win32 ??$?5NDU?$char_traits@D@std@@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAV?$complex@N@0@@Z(ptr ptr) basic_istream_char_read_complex_double +@ cdecl -arch=win64 ??$?5NDU?$char_traits@D@std@@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@AEAV?$complex@N@0@@Z(ptr ptr) basic_istream_char_read_complex_double @ stub -arch=win32 ??$?5NGU?$char_traits@G@std@@@std@@YAAAV?$basic_istream@GU?$char_traits@G@std@@@0@AAV10@AAV?$complex@N@0@@Z @ stub -arch=win64 ??$?5NGU?$char_traits@G@std@@@std@@YAAEAV?$basic_istream@GU?$char_traits@G@std@@@0@AEAV10@AEAV?$complex@N@0@@Z @ stub -arch=win32 ??$?5N_WU?$char_traits@_W@std@@@std@@YAAAV?$basic_istream@_WU?$char_traits@_W@std@@@0@AAV10@AAV?$complex@N@0@@Z @ stub -arch=win64 ??$?5N_WU?$char_traits@_W@std@@@std@@YAAEAV?$basic_istream@_WU?$char_traits@_W@std@@@0@AEAV10@AEAV?$complex@N@0@@Z -@ stub -arch=win32 ??$?5ODU?$char_traits@D@std@@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAV?$complex@O@0@@Z -@ stub -arch=win64 ??$?5ODU?$char_traits@D@std@@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@AEAV?$complex@O@0@@Z +@ cdecl -arch=win32 ??$?5ODU?$char_traits@D@std@@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAV?$complex@O@0@@Z(ptr ptr) basic_istream_char_read_complex_ldouble +@ cdecl -arch=win64 ??$?5ODU?$char_traits@D@std@@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@AEAV?$complex@O@0@@Z(ptr ptr) basic_istream_char_read_complex_ldouble @ stub -arch=win32 ??$?5OGU?$char_traits@G@std@@@std@@YAAAV?$basic_istream@GU?$char_traits@G@std@@@0@AAV10@AAV?$complex@O@0@@Z @ stub -arch=win64 ??$?5OGU?$char_traits@G@std@@@std@@YAAEAV?$basic_istream@GU?$char_traits@G@std@@@0@AEAV10@AEAV?$complex@O@0@@Z @ stub -arch=win32 ??$?5O_WU?$char_traits@_W@std@@@std@@YAAAV?$basic_istream@_WU?$char_traits@_W@std@@@0@AAV10@AAV?$complex@O@0@@Z diff --git a/dlls/msvcp90/ios.c b/dlls/msvcp90/ios.c index 59aeea8d0b7..378968f77d1 100644 --- a/dlls/msvcp90/ios.c +++ b/dlls/msvcp90/ios.c @@ -9026,6 +9026,183 @@ basic_istream_char* __thiscall basic_istream_char_read_func_ios_base(basic_istre return this; } +/* ??$?5MDU?$char_traits@D@std@@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAV?$complex@M@0@@Z */ +/* ??$?5MDU?$char_traits@D@std@@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@AEAV?$complex@M@0@@Z */ +basic_istream_char* __cdecl basic_istream_char_read_complex_float(basic_istream_char *this, complex_float *v) +{ + float r; + basic_ios_char *base = basic_istream_char_get_basic_ios(this); + + TRACE("(%p %p)\n", this, v); + + ws_basic_istream_char(this); + if(basic_istream_char_peek(this) == '(') { + char c; + basic_istream_char_get(this); + basic_istream_char_read_float(this, &r); + + if(ios_base_fail(&base->base)) + return this; + + ws_basic_istream_char(this); + c = basic_istream_char_peek(this); + if(c == ',') { + float i; + basic_istream_char_get(this); + basic_istream_char_read_float(this, &i); + + if(ios_base_fail(&base->base)) + return this; + + ws_basic_istream_char(this); + c = basic_istream_char_peek(this); + if(c == ')') { /* supported format: (real, imag) */ + basic_istream_char_get(this); + v->real = r; + v->imag = i; + }else { + basic_ios_char_setstate(base, IOSTATE_failbit); + return this; + } + }else if(c == ')') { /* supported format: (real) */ + basic_istream_char_get(this); + v->real = r; + v->imag = 0; + }else { + basic_ios_char_setstate(base, IOSTATE_failbit); + return this; + } + }else { /* supported format: real */ + basic_istream_char_read_float(this, &r); + + if(ios_base_fail(&base->base)) + return this; + + v->real = r; + v->imag = 0; + } + + return this; +} + +/* ??$?5NDU?$char_traits@D@std@@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAV?$complex@N@0@@Z */ +/* ??$?5DU?$char_traits@D@std@@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@AEAV?$complex@N@0@@Z */ +basic_istream_char* __cdecl basic_istream_char_read_complex_double(basic_istream_char *this, complex_double *v) +{ + double r; + basic_ios_char *base = basic_istream_char_get_basic_ios(this); + + TRACE("(%p %p)\n", this, v); + + ws_basic_istream_char(this); + if(basic_istream_char_peek(this) == '(') { + char c; + basic_istream_char_get(this); + basic_istream_char_read_double(this, &r); + + if(ios_base_fail(&base->base)) + return this; + + ws_basic_istream_char(this); + c = basic_istream_char_peek(this); + if(c == ',') { + double i; + basic_istream_char_get(this); + basic_istream_char_read_double(this, &i); + + if(ios_base_fail(&base->base)) + return this; + + ws_basic_istream_char(this); + c = basic_istream_char_peek(this); + if(c == ')') { /* supported format: (real, imag) */ + basic_istream_char_get(this); + v->real = r; + v->imag = i; + }else { + basic_ios_char_setstate(base, IOSTATE_failbit); + return this; + } + }else if(c == ')') { /* supported format: (real) */ + basic_istream_char_get(this); + v->real = r; + v->imag = 0; + }else { + basic_ios_char_setstate(base, IOSTATE_failbit); + return this; + } + }else { /* supported format: real */ + basic_istream_char_read_double(this, &r); + + if(ios_base_fail(&base->base)) + return this; + + v->real = r; + v->imag = 0; + } + + return this; +} + +/* ??$?5ODU?$char_traits@D@std@@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAV?$complex@O@0@@Z */ +/* ??$?5ODU?$char_traits@D@std@@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@AEAV?$complex@O@0@@Z */ +basic_istream_char* __cdecl basic_istream_char_read_complex_ldouble(basic_istream_char *this, complex_double *v) +{ + double r; + basic_ios_char *base = basic_istream_char_get_basic_ios(this); + + TRACE("(%p %p)\n", this, v); + + ws_basic_istream_char(this); + if(basic_istream_char_peek(this) == '(') { + char c; + basic_istream_char_get(this); + basic_istream_char_read_ldouble(this, &r); + + if(ios_base_fail(&base->base)) + return this; + + ws_basic_istream_char(this); + c = basic_istream_char_peek(this); + if(c == ',') { + double i; + basic_istream_char_get(this); + basic_istream_char_read_ldouble(this, &i); + + if(ios_base_fail(&base->base)) + return this; + + ws_basic_istream_char(this); + c = basic_istream_char_peek(this); + if(c == ')') { /* supported format: (real, imag) */ + basic_istream_char_get(this); + v->real = r; + v->imag = i; + }else { + basic_ios_char_setstate(base, IOSTATE_failbit); + return this; + } + }else if(c == ')') { /* supported format: (real) */ + basic_istream_char_get(this); + v->real = r; + v->imag = 0; + }else { + basic_ios_char_setstate(base, IOSTATE_failbit); + return this; + } + }else { /* supported format: real */ + basic_istream_char_read_ldouble(this, &r); + + if(ios_base_fail(&base->base)) + return this; + + v->real = r; + v->imag = 0; + } + + return this; +} + /* ?swap@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEXAAV12@@Z */ /* ?swap@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAXAEAV12@@Z */ DEFINE_THISCALL_WRAPPER(basic_istream_char_swap, 8) diff --git a/dlls/msvcp90/msvcp90.spec b/dlls/msvcp90/msvcp90.spec index fbdc321ac8b..8f60af1d712 100644 --- a/dlls/msvcp90/msvcp90.spec +++ b/dlls/msvcp90/msvcp90.spec @@ -10,20 +10,20 @@ @ cdecl -arch=win64 ??$?5GU?$char_traits@G@std@@@std@@YAAEAV?$basic_istream@GU?$char_traits@G@std@@@0@AEAV10@PEAG@Z(ptr ptr) basic_istream_short_read_str @ cdecl -arch=win32 ??$?5GU?$char_traits@G@std@@V?$allocator@G@1@@std@@YAAAV?$basic_istream@GU?$char_traits@G@std@@@0@AAV10@AAV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@@Z(ptr ptr) basic_istream_short_read_bstr @ cdecl -arch=win64 ??$?5GU?$char_traits@G@std@@V?$allocator@G@1@@std@@YAAEAV?$basic_istream@GU?$char_traits@G@std@@@0@AEAV10@AEAV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@@Z(ptr ptr) basic_istream_short_read_bstr -@ stub -arch=win32 ??$?5MDU?$char_traits@D@std@@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAV?$complex@M@0@@Z -@ stub -arch=win64 ??$?5MDU?$char_traits@D@std@@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@AEAV?$complex@M@0@@Z +@ cdecl -arch=win32 ??$?5MDU?$char_traits@D@std@@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAV?$complex@M@0@@Z(ptr ptr) basic_istream_char_read_complex_float +@ cdecl -arch=win64 ??$?5MDU?$char_traits@D@std@@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@AEAV?$complex@M@0@@Z(ptr ptr) basic_istream_char_read_complex_float @ stub -arch=win32 ??$?5MGU?$char_traits@G@std@@@std@@YAAAV?$basic_istream@GU?$char_traits@G@std@@@0@AAV10@AAV?$complex@M@0@@Z @ stub -arch=win64 ??$?5MGU?$char_traits@G@std@@@std@@YAAEAV?$basic_istream@GU?$char_traits@G@std@@@0@AEAV10@AEAV?$complex@M@0@@Z @ stub -arch=win32 ??$?5M_WU?$char_traits@_W@std@@@std@@YAAAV?$basic_istream@_WU?$char_traits@_W@std@@@0@AAV10@AAV?$complex@M@0@@Z @ stub -arch=win64 ??$?5M_WU?$char_traits@_W@std@@@std@@YAAEAV?$basic_istream@_WU?$char_traits@_W@std@@@0@AEAV10@AEAV?$complex@M@0@@Z -@ stub -arch=win32 ??$?5NDU?$char_traits@D@std@@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAV?$complex@N@0@@Z -@ stub -arch=win64 ??$?5NDU?$char_traits@D@std@@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@AEAV?$complex@N@0@@Z +@ cdecl -arch=win32 ??$?5NDU?$char_traits@D@std@@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAV?$complex@N@0@@Z(ptr ptr) basic_istream_char_read_complex_double +@ cdecl -arch=win64 ??$?5NDU?$char_traits@D@std@@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@AEAV?$complex@N@0@@Z(ptr ptr) basic_istream_char_read_complex_double @ stub -arch=win32 ??$?5NGU?$char_traits@G@std@@@std@@YAAAV?$basic_istream@GU?$char_traits@G@std@@@0@AAV10@AAV?$complex@N@0@@Z @ stub -arch=win64 ??$?5NGU?$char_traits@G@std@@@std@@YAAEAV?$basic_istream@GU?$char_traits@G@std@@@0@AEAV10@AEAV?$complex@N@0@@Z @ stub -arch=win32 ??$?5N_WU?$char_traits@_W@std@@@std@@YAAAV?$basic_istream@_WU?$char_traits@_W@std@@@0@AAV10@AAV?$complex@N@0@@Z @ stub -arch=win64 ??$?5N_WU?$char_traits@_W@std@@@std@@YAAEAV?$basic_istream@_WU?$char_traits@_W@std@@@0@AEAV10@AEAV?$complex@N@0@@Z -@ stub -arch=win32 ??$?5ODU?$char_traits@D@std@@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAV?$complex@O@0@@Z -@ stub -arch=win64 ??$?5ODU?$char_traits@D@std@@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@AEAV?$complex@O@0@@Z +@ cdecl -arch=win32 ??$?5ODU?$char_traits@D@std@@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAV?$complex@O@0@@Z(ptr ptr) basic_istream_char_read_complex_ldouble +@ cdecl -arch=win64 ??$?5ODU?$char_traits@D@std@@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@AEAV?$complex@O@0@@Z(ptr ptr) basic_istream_char_read_complex_ldouble @ stub -arch=win32 ??$?5OGU?$char_traits@G@std@@@std@@YAAAV?$basic_istream@GU?$char_traits@G@std@@@0@AAV10@AAV?$complex@O@0@@Z @ stub -arch=win64 ??$?5OGU?$char_traits@G@std@@@std@@YAAEAV?$basic_istream@GU?$char_traits@G@std@@@0@AEAV10@AEAV?$complex@O@0@@Z @ stub -arch=win32 ??$?5O_WU?$char_traits@_W@std@@@std@@YAAAV?$basic_istream@_WU?$char_traits@_W@std@@@0@AAV10@AAV?$complex@O@0@@Z diff --git a/dlls/msvcp90/tests/ios.c b/dlls/msvcp90/tests/ios.c index 91833f4d42f..1a7414799da 100644 --- a/dlls/msvcp90/tests/ios.c +++ b/dlls/msvcp90/tests/ios.c @@ -457,6 +457,8 @@ static void (*__thiscall p_basic_fstream_wchar_vbase_dtor)(basic_fstream_wchar*) static basic_istream_char* (*__thiscall p_basic_istream_char_read_uint64)(basic_istream_char*, unsigned __int64*); static basic_istream_char* (*__thiscall p_basic_istream_char_read_float)(basic_istream_char*, float*); static basic_istream_char* (*__thiscall p_basic_istream_char_read_double)(basic_istream_char*, double*); +static basic_istream_char* (*__cdecl p_basic_istream_char_read_str)(basic_istream_char*, char*); +static basic_istream_char* (*__cdecl p_basic_istream_char_read_complex_double)(basic_istream_char*, complex_double*); static int (*__thiscall p_basic_istream_char_get)(basic_istream_char*); static MSVCP_bool (*__thiscall p_basic_istream_char_ipfx)(basic_istream_char*, MSVCP_bool); static basic_istream_char* (*__thiscall p_basic_istream_char_ignore)(basic_istream_char*, streamsize, int); @@ -672,6 +674,10 @@ static BOOL init(void) "??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAM@Z"); SET(p_basic_istream_char_read_double, "??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAN@Z"); + SET(p_basic_istream_char_read_str, + "??$?5DU?$char_traits@D@std@@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@PEAD@Z"); + SET(p_basic_istream_char_read_complex_double, + "??$?5NDU?$char_traits@D@std@@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@AEAV?$complex@N@0@@Z"); SET(p_basic_istream_char_get, "?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAHXZ"); SET(p_basic_istream_char_ipfx, @@ -800,6 +806,10 @@ static BOOL init(void) "??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAAAAV01@AAM@Z"); SET(p_basic_istream_char_read_double, "??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAAAAV01@AAN@Z"); + SET(p_basic_istream_char_read_str, + "??$?5DU?$char_traits@D@std@@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@PAD@Z"); + SET(p_basic_istream_char_read_complex_double, + "??$?5NDU?$char_traits@D@std@@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAV?$complex@N@0@@Z"); SET(p_basic_istream_char_get, "?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QAAHXZ"); SET(p_basic_istream_char_ipfx, @@ -927,6 +937,10 @@ static BOOL init(void) "??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAM@Z"); SET(p_basic_istream_char_read_double, "??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAN@Z"); + SET(p_basic_istream_char_read_str, + "??$?5DU?$char_traits@D@std@@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@PAD@Z"); + SET(p_basic_istream_char_read_complex_double, + "??$?5NDU?$char_traits@D@std@@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAV?$complex@N@0@@Z"); SET(p_basic_istream_char_get, "?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEHXZ"); SET(p_basic_istream_char_ipfx, @@ -2241,6 +2255,95 @@ static void test_ostream_print_complex_ldouble(void) call_func1(p_basic_stringstream_char_vbase_dtor, &ss); } +static void test_istream_read_complex_double(void) +{ + basic_string_char str; + IOSB_iostate state; + complex_double val; + locale lcl, retlcl; + basic_stringstream_char ss; + int i; + char next[100]; + const char deadbeef_str[] = "(3.14159,3456.7890)"; + const complex_double deadbeef = {3.14159, 3456.7890}; + const IOSB_iostate IOSTATE_faileof = IOSTATE_failbit|IOSTATE_eofbit; + + struct _test_istream_read_complex_double { + const char *complex_double_str; + const char *lcl; + complex_double correct_val; + IOSB_iostate state; + const char *str; + } tests[] = { + /* supported format: real */ + { "-12 3", NULL, {-12 , 0}, IOSTATE_goodbit, "3"}, + { "1e2,3", NULL, {100 , 0}, IOSTATE_goodbit, ",3"}, + { "3E2,,", NULL, {300 , 0}, IOSTATE_goodbit, ",,"}, + + /* supported format: (real) */ + { "(3.)", NULL, {3., 0}, IOSTATE_goodbit, "" }, + { "(3E10)1", NULL, {3e+10, 0}, IOSTATE_goodbit, "1"}, + + /* supported format: (real,imaginary) */ + { "(3, -.4)", NULL, {3, -0.4} , IOSTATE_goodbit, ""}, + { " (6.6,\n1.1\t)", NULL, {6.6, 1.1}, IOSTATE_goodbit, ""}, + { "(6.666 , 7.77)mark", NULL, {6.666, 7.77}, IOSTATE_goodbit, "mark"}, + + /* different locales */ + { "1,234e10", "English", {1234.0e10, 0}, IOSTATE_eofbit, ""}, + { "1,234e10", "German" , {1.234e10, 0}, IOSTATE_eofbit, ""}, + { "1,234,567,890", "English", {1234567890.0, 0}, IOSTATE_eofbit , ""}, + { "1,234,567,890", "German" , {1.234, 0} , IOSTATE_goodbit, ",567,890"}, + { "(0.123,-4.5)", "English", {0.123,-4.5}, IOSTATE_goodbit, ""}, + { "(0,123,4,5)" , "German" , {0.123,4.5 }, IOSTATE_goodbit, ""}, + { "(123,456.,4.5678)", "English", {123456,4.5678}, IOSTATE_goodbit, ""}, + { "(123.456,,4,5678)", "German" , {123456,4.5678}, IOSTATE_goodbit, ""}, + + /* eofbit */ + { ".09", NULL, {0.09, 0}, IOSTATE_eofbit, ""}, + { "\t-1e2", NULL, {-100, 0}, IOSTATE_eofbit, ""}, + { "+", NULL, deadbeef, IOSTATE_faileof, ""}, + { "(-1.1,3 \t " , NULL, deadbeef, IOSTATE_faileof, ""}, + { "(-1.1 , \t -3.4E3 \t ", NULL, deadbeef, IOSTATE_faileof, ""}, + + /* nonsupported formats */ + { "(*)" , NULL, deadbeef, IOSTATE_failbit, ""}, + { "(\n*" , NULL, deadbeef, IOSTATE_failbit, ""}, + { "(6..)" , NULL, deadbeef, IOSTATE_failbit, ""}, + { "(3.12,*", NULL, deadbeef, IOSTATE_failbit, ""}, + { "(3.12,)", NULL, deadbeef, IOSTATE_failbit, ""}, + { "(1.0eE10, 3)" , NULL, deadbeef, IOSTATE_failbit, ""}, + }; + + for(i=0; i