From 905752e0f4363acff031a2d503bc6def8b033683 Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Thu, 13 Sep 2012 14:34:02 +0200 Subject: [PATCH] msvcp90: Added ios_base flags manipulators implementation. --- dlls/msvcp90/ios.c | 59 +++++++++++++++++++++++++++++++++++++++ dlls/msvcp90/msvcp90.spec | 6 ++-- 2 files changed, 62 insertions(+), 3 deletions(-) diff --git a/dlls/msvcp90/ios.c b/dlls/msvcp90/ios.c index 39e9a9fb1f9..18168842122 100644 --- a/dlls/msvcp90/ios.c +++ b/dlls/msvcp90/ios.c @@ -50,6 +50,11 @@ typedef struct { streamsize arg; } manip_streamsize; +typedef struct { + void (__cdecl *pfunc)(ios_base*, int); + int arg; +} manip_int; + typedef enum { INITFL_new = 0, INITFL_open = 1, @@ -12877,6 +12882,60 @@ manip_streamsize* __cdecl setw(manip_streamsize *ret, streamsize width) return ret; } +static void __cdecl resetioflags_func(ios_base *base, int mask) +{ + ios_base_setf_mask(base, 0, mask); +} + +/* ?resetiosflags@std@@YA?AU?$_Smanip@H@1@H@Z */ +manip_int* __cdecl resetiosflags(manip_int *ret, int mask) +{ + TRACE("(%p %d)\n", ret, mask); + + ret->pfunc = resetioflags_func; + ret->arg = mask; + return ret; +} + +static void __cdecl setiosflags_func(ios_base *base, int mask) +{ + ios_base_setf_mask(base, FMTFLAG_mask, mask); +} + +/* ?setiosflags@std@@YA?AU?$_Smanip@H@1@H@Z */ +manip_int* __cdecl setiosflags(manip_int *ret, int mask) +{ + TRACE("(%p %d)\n", ret, mask); + + ret->pfunc = setiosflags_func; + ret->arg = mask; + return ret; +} + +static void __cdecl setbase_func(ios_base *base, int set_base) +{ + if(set_base == 10) + set_base = FMTFLAG_dec; + else if(set_base == 8) + set_base = FMTFLAG_oct; + else if(set_base == 16) + set_base = FMTFLAG_hex; + else + set_base = 0; + + ios_base_setf_mask(base, set_base, FMTFLAG_basefield); +} + +/* ?setbase@std@@YA?AU?$_Smanip@H@1@H@Z */ +manip_int* __cdecl setbase(manip_int *ret, int base) +{ + TRACE("(%p %d)\n", ret, base); + + ret->pfunc = setbase_func; + ret->arg = base; + return ret; +} + static basic_filebuf_char filebuf_char_stdin; /* ?cin@std@@3V?$basic_istream@DU?$char_traits@D@std@@@1@A */ struct { diff --git a/dlls/msvcp90/msvcp90.spec b/dlls/msvcp90/msvcp90.spec index b70fd27f90c..576541c13d5 100644 --- a/dlls/msvcp90/msvcp90.spec +++ b/dlls/msvcp90/msvcp90.spec @@ -5173,7 +5173,7 @@ @ cdecl -arch=win64 ?reserve@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAX_K@Z(ptr long) MSVCP_basic_string_wchar_reserve @ thiscall -arch=win32 ?reserve@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAEXI@Z(ptr long) MSVCP_basic_string_wchar_reserve @ cdecl -arch=win64 ?reserve@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAAX_K@Z(ptr long) MSVCP_basic_string_wchar_reserve -@ stub ?resetiosflags@std@@YA?AU?$_Smanip@H@1@H@Z +@ cdecl ?resetiosflags@std@@YA?AU?$_Smanip@H@1@H@Z(ptr long) resetiosflags @ thiscall -arch=win32 ?resize@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXI@Z(ptr long) MSVCP_basic_string_char_resize @ cdecl -arch=win64 ?resize@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAX_K@Z(ptr long) MSVCP_basic_string_char_resize @ thiscall -arch=win32 ?resize@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXID@Z(ptr long long) MSVCP_basic_string_char_resize_ch @@ -5312,7 +5312,7 @@ @ cdecl -arch=win64 ?seekpos@strstreambuf@std@@MEAA?AV?$fpos@H@2@V32@H@Z(ptr ptr ptr long) strstreambuf_seekpos @ cdecl ?set_new_handler@std@@YAP6AXXZH@Z(long) set_new_handler_reset @ cdecl ?set_new_handler@std@@YAP6AXXZP6AXXZ@Z(ptr) set_new_handler -@ stub ?setbase@std@@YA?AU?$_Smanip@H@1@H@Z +@ cdecl ?setbase@std@@YA?AU?$_Smanip@H@1@H@Z(ptr long) setbase @ thiscall -arch=win32 ?setbuf@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAEPAV?$basic_streambuf@DU?$char_traits@D@std@@@2@PADH@Z(ptr ptr long) basic_filebuf_char_setbuf @ cdecl -arch=win64 ?setbuf@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MEAAPEAV?$basic_streambuf@DU?$char_traits@D@std@@@2@PEAD_J@Z(ptr ptr long) basic_filebuf_char_setbuf @ thiscall -arch=win32 ?setbuf@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAEPAV?$basic_streambuf@GU?$char_traits@G@std@@@2@PAGH@Z(ptr ptr long) basic_filebuf_char_setbuf @@ -5335,7 +5335,7 @@ @ cdecl -arch=win64 ?setg@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAXPEAG00@Z(ptr ptr ptr ptr) basic_streambuf_wchar_setg @ thiscall -arch=win32 ?setg@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEXPA_W00@Z(ptr ptr ptr ptr) basic_streambuf_wchar_setg @ cdecl -arch=win64 ?setg@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAXPEA_W00@Z(ptr ptr ptr ptr) basic_streambuf_wchar_setg -@ stub ?setiosflags@std@@YA?AU?$_Smanip@H@1@H@Z +@ cdecl ?setiosflags@std@@YA?AU?$_Smanip@H@1@H@Z(ptr long) setiosflags @ thiscall -arch=win32 ?setp@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXPAD00@Z(ptr ptr ptr ptr) basic_streambuf_char_setp_next @ cdecl -arch=win64 ?setp@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAXPEAD00@Z(ptr ptr ptr ptr) basic_streambuf_char_setp_next @ thiscall -arch=win32 ?setp@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXPAD0@Z(ptr ptr ptr) basic_streambuf_char_setp