msvcrt: Add _mbctokata implementation.

This commit is contained in:
Akihiro Sagawa 2015-03-16 21:48:48 +09:00 committed by Alexandre Julliard
parent b6ab2b6268
commit cd5a76b182
10 changed files with 50 additions and 8 deletions

View File

@ -1084,7 +1084,7 @@
@ stub _mbclen_l
@ cdecl _mbctohira(long)
@ stub _mbctohira_l
@ stub _mbctokata(long)
@ cdecl _mbctokata(long)
@ stub _mbctokata_l
@ cdecl _mbctolower(long)
@ stub _mbctolower_l

View File

@ -1442,7 +1442,7 @@
@ stub _mbclen_l
@ cdecl _mbctohira(long)
@ stub _mbctohira_l
@ stub _mbctokata(long)
@ cdecl _mbctokata(long)
@ stub _mbctokata_l
@ cdecl _mbctolower(long)
@ stub _mbctolower_l

View File

@ -1450,7 +1450,7 @@
@ stub _mbclen_l
@ cdecl _mbctohira(long)
@ stub _mbctohira_l
@ stub _mbctokata(long)
@ cdecl _mbctokata(long)
@ stub _mbctokata_l
@ cdecl _mbctolower(long)
@ stub _mbctolower_l

View File

@ -424,7 +424,7 @@
@ cdecl _mbcjmstojis(long)
@ cdecl _mbclen(ptr)
@ cdecl _mbctohira(long)
@ stub _mbctokata(long)
@ cdecl _mbctokata(long)
@ cdecl _mbctolower(long)
@ cdecl _mbctombb(long)
@ cdecl _mbctoupper(long)

View File

@ -419,7 +419,7 @@
@ cdecl _mbcjmstojis(long)
@ cdecl _mbclen(ptr)
@ cdecl _mbctohira(long)
@ stub _mbctokata(long)
@ cdecl _mbctokata(long)
@ cdecl _mbctolower(long)
@ cdecl _mbctombb(long)
@ cdecl _mbctoupper(long)

View File

@ -757,7 +757,7 @@
@ stub _mbclen_l
@ cdecl _mbctohira(long)
@ stub _mbctohira_l
@ stub _mbctokata(long)
@ cdecl _mbctokata(long)
@ stub _mbctokata_l
@ cdecl _mbctolower(long)
@ stub _mbctolower_l

View File

@ -734,7 +734,7 @@
@ stub _mbclen_l
@ cdecl _mbctohira(long)
@ stub _mbctohira_l
@ stub _mbctokata(long)
@ cdecl _mbctokata(long)
@ stub _mbctokata_l
@ cdecl _mbctolower(long)
@ stub _mbctolower_l

View File

@ -2288,3 +2288,15 @@ unsigned int CDECL _mbctohira(unsigned int c)
return (c - 0x8340 - (c >= 0x837f ? 1 : 0)) + 0x829f;
return c;
}
/*********************************************************************
* _mbctokata (MSVCRT.@)
*
* Converts a sjis hiragana character to katakana.
*/
unsigned int CDECL _mbctokata(unsigned int c)
{
if(_ismbchira(c))
return (c - 0x829f) + 0x8340 + (c >= 0x82de ? 1 : 0);
return c;
}

View File

@ -700,7 +700,7 @@
# stub _mbclen_l(ptr ptr)
@ cdecl _mbctohira(long)
# stub _mbctohira_l(long ptr)
@ stub _mbctokata(long)
@ cdecl _mbctokata(long)
# stub _mbctokata_l(long ptr)
@ cdecl _mbctolower(long)
# stub _mbctolower_l(long ptr)

View File

@ -1172,6 +1172,35 @@ static void test_mbctohira(void)
_setmbcp(prev_cp);
}
static void test_mbctokata(void)
{
static const unsigned int mbckata_932[][2] = {
{0x8152, 0x8152}, {0x8153, 0x8153}, {0x8154, 0x8154}, {0x8155, 0x8155},
{0x833f, 0x833f}, {0x829f, 0x8340}, {0x82dd, 0x837e}, {0x837f, 0x837f},
{0x82de, 0x8380}, {0x8394, 0x8394}, {0x8397, 0x8397},
{0xa5, 0xa5}, {0xb0, 0xb0}, {0xdd, 0xdd} };
unsigned int i;
unsigned int prev_cp = _getmbcp();
_setmbcp(_MB_CP_SBCS);
for (i = 0; i < sizeof(mbckata_932)/sizeof(mbckata_932[0]); i++)
{
int ret, exp = mbckata_932[i][0];
ret = _mbctokata(mbckata_932[i][0]);
ok(ret == exp, "Expected 0x%x, got 0x%x\n", exp, ret);
}
_setmbcp(932);
for (i = 0; i < sizeof(mbckata_932)/sizeof(mbckata_932[0]); i++)
{
unsigned int ret, exp;
ret = _mbctokata(mbckata_932[i][0]);
exp = mbckata_932[i][1];
ok(ret == exp, "Expected 0x%x, got 0x%x\n", exp, ret);
}
_setmbcp(prev_cp);
}
static void test_mbbtombc(void)
{
static const unsigned int mbbmbc[][2] = {
@ -2919,6 +2948,7 @@ START_TEST(string)
test_mbcjisjms();
test_mbcjmsjis();
test_mbctohira();
test_mbctokata();
test_mbbtombc();
test_mbctombb();
test_ismbckata();