Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
4148ac0a
Commit
4148ac0a
authored
Feb 24, 2010
by
David Hedberg
Committed by
Alexandre Julliard
Feb 24, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Implement _mbctombb.
parent
9b02b5cd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
70 additions
and
1 deletion
+70
-1
mbcs.c
dlls/msvcrt/mbcs.c
+46
-0
msvcrt.spec
dlls/msvcrt/msvcrt.spec
+1
-1
string.c
dlls/msvcrt/tests/string.c
+23
-0
No files found.
dlls/msvcrt/mbcs.c
View file @
4148ac0a
...
@@ -53,6 +53,24 @@ static struct cp_extra_info_t g_cpextrainfo[] =
...
@@ -53,6 +53,24 @@ static struct cp_extra_info_t g_cpextrainfo[] =
{
0
,
{
1
,
255
,
0
,
0
}}
/* match all with FIXME */
{
0
,
{
1
,
255
,
0
,
0
}}
/* match all with FIXME */
};
};
/* Maps multibyte cp932 punctuation marks to single byte equivalents */
static
const
unsigned
char
mbctombb_932_punct
[]
=
{
0x20
,
0xa4
,
0xa1
,
0x2c
,
0x2e
,
0xa5
,
0x3a
,
0x3b
,
0x3f
,
0x21
,
0xde
,
0xdf
,
0x00
,
0x00
,
0x00
,
0x5e
,
0x7e
,
0x5f
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0xb0
,
0x00
,
0x00
,
0x2f
,
0x00
,
0x00
,
0x00
,
0x7c
,
0x00
,
0x00
,
0x60
,
0x27
,
0x00
,
0x22
,
0x28
,
0x29
,
0x00
,
0x00
,
0x5b
,
0x5d
,
0x7b
,
0x7d
,
0x00
,
0x00
,
0x00
,
0x00
,
0xa2
,
0xa3
,
0x00
,
0x00
,
0x00
,
0x00
,
0x2b
,
0x2d
,
0x00
,
0x00
,
0x00
,
0x00
,
0x3d
,
0x00
,
0x3c
,
0x3e
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x5c
,
0x24
,
0x00
,
0x00
,
0x25
,
0x23
,
0x26
,
0x2a
,
0x40
};
/* Maps multibyte cp932 hiragana/katakana to single-byte equivalents */
static
const
unsigned
char
mbctombb_932_kana
[]
=
{
0xa7
,
0xb1
,
0xa8
,
0xb2
,
0xa9
,
0xb3
,
0xaa
,
0xb4
,
0xab
,
0xb5
,
0xb6
,
0xb6
,
0xb7
,
0xb7
,
0xb8
,
0xb8
,
0xb9
,
0xb9
,
0xba
,
0xba
,
0xbb
,
0xbb
,
0xbc
,
0xbc
,
0xbd
,
0xbd
,
0xbe
,
0xbe
,
0xbf
,
0xbf
,
0xc0
,
0xc0
,
0xc1
,
0xc1
,
0xaf
,
0xc2
,
0xc2
,
0xc3
,
0xc3
,
0xc4
,
0xc4
,
0xc5
,
0xc6
,
0xc7
,
0xc8
,
0xc9
,
0xca
,
0xca
,
0xca
,
0xcb
,
0xcb
,
0xcb
,
0xcc
,
0xcc
,
0xcc
,
0xcd
,
0xcd
,
0xcd
,
0xce
,
0xce
,
0xce
,
0xcf
,
0xd0
,
0xd1
,
0xd2
,
0xd3
,
0xac
,
0xd4
,
0xad
,
0xd5
,
0xae
,
0xd6
,
0xd7
,
0xd8
,
0xd9
,
0xda
,
0xdb
,
0xdc
,
0xdc
,
0xb2
,
0xb4
,
0xa6
,
0xdd
,
0xb3
,
0xb6
,
0xb9
};
static
MSVCRT_wchar_t
msvcrt_mbc_to_wc
(
unsigned
int
ch
)
static
MSVCRT_wchar_t
msvcrt_mbc_to_wc
(
unsigned
int
ch
)
{
{
MSVCRT_wchar_t
chW
;
MSVCRT_wchar_t
chW
;
...
@@ -319,6 +337,34 @@ unsigned int CDECL _mbctoupper(unsigned int c)
...
@@ -319,6 +337,34 @@ unsigned int CDECL _mbctoupper(unsigned int c)
}
}
/*********************************************************************
/*********************************************************************
* _mbctombb (MSVCRT.@)
*/
unsigned
int
CDECL
_mbctombb
(
unsigned
int
c
)
{
unsigned
int
value
;
if
(
MSVCRT___lc_codepage
==
932
)
{
if
(
c
>=
0x829f
&&
c
<=
0x82f1
)
/* Hiragana */
return
mbctombb_932_kana
[
c
-
0x829f
];
if
(
c
>=
0x8340
&&
c
<=
0x8396
&&
c
!=
0x837f
)
/* Katakana */
return
mbctombb_932_kana
[
c
-
0x8340
-
(
c
>=
0x837f
?
1
:
0
)];
if
(
c
>=
0x8140
&&
c
<=
0x8197
)
/* Punctuation */
{
value
=
mbctombb_932_punct
[
c
-
0x8140
];
return
value
?
value
:
c
;
}
if
((
c
>=
0x824f
&&
c
<=
0x8258
)
||
/* Fullwidth digits */
(
c
>=
0x8260
&&
c
<=
0x8279
))
/* Fullwidth capitals letters */
return
c
-
0x821f
;
if
(
c
>=
0x8281
&&
c
<=
0x829a
)
/* Fullwidth small letters */
return
c
-
0x8220
;
/* all other cases return c */
}
return
c
;
}
/*********************************************************************
* _mbcjistojms(MSVCRT.@)
* _mbcjistojms(MSVCRT.@)
*
*
* Converts a jis character to sjis.
* Converts a jis character to sjis.
...
...
dlls/msvcrt/msvcrt.spec
View file @
4148ac0a
...
@@ -380,7 +380,7 @@
...
@@ -380,7 +380,7 @@
@ stub _mbctohira #(long)
@ stub _mbctohira #(long)
@ stub _mbctokata #(long)
@ stub _mbctokata #(long)
@ cdecl _mbctolower(long)
@ cdecl _mbctolower(long)
@
stub _mbctombb #
(long)
@
cdecl _mbctombb
(long)
@ cdecl _mbctoupper(long)
@ cdecl _mbctoupper(long)
@ extern _mbctype MSVCRT_mbctype
@ extern _mbctype MSVCRT_mbctype
@ cdecl _mbsbtype(str long)
@ cdecl _mbsbtype(str long)
...
...
dlls/msvcrt/tests/string.c
View file @
4148ac0a
...
@@ -730,6 +730,28 @@ static void test_mbcjisjms(void)
...
@@ -730,6 +730,28 @@ static void test_mbcjisjms(void)
}
while
(
jisjms
[
i
++
][
0
]
!=
0
);
}
while
(
jisjms
[
i
++
][
0
]
!=
0
);
}
}
static
void
test_mbctombb
(
void
)
{
static
const
unsigned
int
mbcmbb_932
[][
2
]
=
{
{
0x829e
,
0x829e
},
{
0x829f
,
0xa7
},
{
0x82f1
,
0xdd
},
{
0x82f2
,
0x82f2
},
{
0x833f
,
0x833f
},
{
0x8340
,
0xa7
},
{
0x837e
,
0xd0
},
{
0x837f
,
0x837f
},
{
0x8380
,
0xd1
},
{
0x8396
,
0xb9
},
{
0x8397
,
0x8397
},
{
0x813f
,
0x813f
},
{
0x8140
,
0x20
},
{
0x814c
,
0x814c
},
{
0x814f
,
0x5e
},
{
0x8197
,
0x40
},
{
0x8198
,
0x8198
},
{
0x8258
,
0x39
},
{
0x8259
,
0x8259
},
{
0x825f
,
0x825f
},
{
0x8260
,
0x41
},
{
0x82f1
,
0xdd
},
{
0x82f2
,
0x82f2
},
{
0
,
0
}};
unsigned
int
exp
,
ret
,
i
;
unsigned
int
prev_cp
=
_getmbcp
();
_setmbcp
(
932
);
for
(
i
=
0
;
mbcmbb_932
[
i
][
0
]
!=
0
;
i
++
)
{
ret
=
_mbctombb
(
mbcmbb_932
[
i
][
0
]);
exp
=
mbcmbb_932
[
i
][
1
];
ok
(
ret
==
exp
,
"Expected 0x%x, got 0x%x
\n
"
,
exp
,
ret
);
}
_setmbcp
(
prev_cp
);
}
static
void
test_ismbclegal
(
void
)
{
static
void
test_ismbclegal
(
void
)
{
unsigned
int
prev_cp
=
_getmbcp
();
unsigned
int
prev_cp
=
_getmbcp
();
int
ret
,
exp
,
err
;
int
ret
,
exp
,
err
;
...
@@ -931,6 +953,7 @@ START_TEST(string)
...
@@ -931,6 +953,7 @@ START_TEST(string)
test_strcat_s
();
test_strcat_s
();
test__mbsnbcpy_s
();
test__mbsnbcpy_s
();
test_mbcjisjms
();
test_mbcjisjms
();
test_mbctombb
();
test_ismbclegal
();
test_ismbclegal
();
test_strtok
();
test_strtok
();
test_wcscpy_s
();
test_wcscpy_s
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment