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