xref: /reactos/sdk/lib/crt/mbstring/ischira.c (revision c2c66aff)
1*c2c66affSColin Finck #include <precomp.h>
2*c2c66affSColin Finck #include <mbctype.h>
3*c2c66affSColin Finck 
4*c2c66affSColin Finck /*********************************************************************
5*c2c66affSColin Finck  *		_ismbchira(MSVCRT.@)
6*c2c66affSColin Finck  */
_ismbchira(unsigned int c)7*c2c66affSColin Finck int CDECL _ismbchira(unsigned int c)
8*c2c66affSColin Finck {
9*c2c66affSColin Finck   if(get_mbcinfo()->mbcodepage == 932)
10*c2c66affSColin Finck   {
11*c2c66affSColin Finck     /* Japanese/Hiragana, CP 932 */
12*c2c66affSColin Finck     return (c >= 0x829f && c <= 0x82f1);
13*c2c66affSColin Finck   }
14*c2c66affSColin Finck   return 0;
15*c2c66affSColin Finck }
16*c2c66affSColin Finck 
17*c2c66affSColin Finck /*********************************************************************
18*c2c66affSColin Finck  *		_ismbckata(MSVCRT.@)
19*c2c66affSColin Finck  */
_ismbckata(unsigned int c)20*c2c66affSColin Finck int CDECL _ismbckata(unsigned int c)
21*c2c66affSColin Finck {
22*c2c66affSColin Finck   if(get_mbcinfo()->mbcodepage == 932)
23*c2c66affSColin Finck   {
24*c2c66affSColin Finck     /* Japanese/Katakana, CP 932 */
25*c2c66affSColin Finck     return (c >= 0x8340 && c <= 0x8396 && c != 0x837f);
26*c2c66affSColin Finck   }
27*c2c66affSColin Finck   return 0;
28*c2c66affSColin Finck }
29*c2c66affSColin Finck 
30*c2c66affSColin Finck /*********************************************************************
31*c2c66affSColin Finck  *		_mbctohira (MSVCRT.@)
32*c2c66affSColin Finck  *
33*c2c66affSColin Finck  *              Converts a sjis katakana character to hiragana.
34*c2c66affSColin Finck  */
_mbctohira(unsigned int c)35*c2c66affSColin Finck unsigned int CDECL _mbctohira(unsigned int c)
36*c2c66affSColin Finck {
37*c2c66affSColin Finck     if(_ismbckata(c) && c <= 0x8393)
38*c2c66affSColin Finck         return (c - 0x8340 - (c >= 0x837f ? 1 : 0)) + 0x829f;
39*c2c66affSColin Finck     return c;
40*c2c66affSColin Finck }
41*c2c66affSColin Finck 
42*c2c66affSColin Finck /*********************************************************************
43*c2c66affSColin Finck  *		_mbctokata (MSVCRT.@)
44*c2c66affSColin Finck  *
45*c2c66affSColin Finck  *              Converts a sjis hiragana character to katakana.
46*c2c66affSColin Finck  */
_mbctokata(unsigned int c)47*c2c66affSColin Finck unsigned int CDECL _mbctokata(unsigned int c)
48*c2c66affSColin Finck {
49*c2c66affSColin Finck     if(_ismbchira(c))
50*c2c66affSColin Finck         return (c - 0x829f) + 0x8340 + (c >= 0x82de ? 1 : 0);
51*c2c66affSColin Finck     return c;
52*c2c66affSColin Finck }
53*c2c66affSColin Finck 
54*c2c66affSColin Finck 
55