msvcp90: Added basic_ios::narrow implementation.

oldstable
Piotr Caban 2012-06-15 11:09:04 +02:00 committed by Alexandre Julliard
parent 609d7dbb68
commit 65a364a2f3
3 changed files with 46 additions and 15 deletions

View File

@ -3186,8 +3186,8 @@ locale *__thiscall basic_ios_char_imbue(basic_ios_char *this, locale *ret, const
DEFINE_THISCALL_WRAPPER(basic_ios_char_narrow, 12)
char __thiscall basic_ios_char_narrow(basic_ios_char *this, char ch, char def)
{
FIXME("(%p %c %c) stub\n", this, ch, def);
return def;
TRACE("(%p %c %c)\n", this, ch, def);
return ctype_char_narrow_ch(ctype_char_use_facet(this->strbuf->loc), ch, def);
}
/* ?rdbuf@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEPAV?$basic_streambuf@DU?$char_traits@D@std@@@2@PAV32@@Z */
@ -3452,8 +3452,8 @@ locale *__thiscall basic_ios_wchar_imbue(basic_ios_wchar *this, locale *ret, con
DEFINE_THISCALL_WRAPPER(basic_ios_wchar_narrow, 12)
char __thiscall basic_ios_wchar_narrow(basic_ios_wchar *this, wchar_t ch, char def)
{
FIXME("(%p %c %c) stub\n", this, ch, def);
return def;
TRACE("(%p %c %c)\n", this, ch, def);
return ctype_wchar_narrow_ch(ctype_wchar_use_facet(this->strbuf->loc), ch, def);
}
/* ?rdbuf@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAEPAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@PAV32@@Z */

View File

@ -73,22 +73,11 @@ typedef struct {
unsigned page;
} _Collvec;
typedef struct {
LCID handle;
unsigned page;
} _Cvtvec;
typedef struct {
locale_facet facet;
_Collvec coll;
} collate;
typedef struct {
ctype_base base;
_Ctypevec ctype;
_Cvtvec cvt;
} ctype_wchar;
typedef struct {
locale_facet facet;
const char *grouping;
@ -2235,6 +2224,32 @@ wchar_t __cdecl _Towlower(wchar_t ch, const _Ctypevec *ctype)
return tolowerW(ch);
}
ctype_wchar* ctype_wchar_use_facet(const locale *loc)
{
static ctype_wchar *obj = NULL;
_Lockit lock;
const locale_facet *fac;
_Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
fac = locale__Getfacet(loc, ctype_wchar_id.id);
if(fac) {
_Lockit_dtor(&lock);
return (ctype_wchar*)fac;
}
if(obj)
return obj;
ctype_wchar__Getcat(&fac, loc);
obj = (ctype_wchar*)fac;
locale_facet__Incref(&obj->base.facet);
locale_facet_register(&obj->base.facet);
_Lockit_dtor(&lock);
return obj;
}
/* ?do_tolower@?$ctype@_W@std@@MBE_W_W@Z */
/* ?do_tolower@?$ctype@_W@std@@MEBA_W_W@Z */
/* ?do_tolower@?$ctype@G@std@@MBEGG@Z */

View File

@ -331,6 +331,21 @@ typedef struct {
} ctype_char;
MSVCP_bool __thiscall ctype_char_is_ch(const ctype_char*, short, char);
char __thiscall ctype_char_narrow_ch(const ctype_char*, char, char);
typedef struct {
LCID handle;
unsigned page;
} _Cvtvec;
/* class ctype<wchar> */
typedef struct {
ctype_base base;
_Ctypevec ctype;
_Cvtvec cvt;
} ctype_wchar;
char __thiscall ctype_wchar_narrow_ch(const ctype_wchar*, wchar_t, char);
/* class locale */
typedef struct
@ -345,6 +360,7 @@ void __thiscall locale_dtor(locale*);
void free_locale(void);
codecvt_char* codecvt_char_use_facet(const locale*);
ctype_char* ctype_char_use_facet(const locale*);
ctype_wchar* ctype_wchar_use_facet(const locale*);
/* class _Lockit */
typedef struct {