|
1 |
| -/* |
2 |
| - * COPYRIGHT: See COPYING in the top level directory |
3 |
| - * PROJECT: ReactOS system libraries |
4 |
| - * FILE: lib/sdk/crt/mbstring/ischira.c |
5 |
| - * PURPOSE: |
6 |
| - * PROGRAMER: |
7 |
| - * UPDATE HISTORY: |
8 |
| - * 12/04/99: Ariadne Created |
9 |
| - * 05/30/08: Samuel Serapion adapted from PROJECT C Library |
10 |
| - * |
11 |
| - */ |
12 |
| - |
| 1 | +#include <precomp.h> |
13 | 2 | #include <mbctype.h>
|
14 | 3 |
|
15 |
| - |
16 |
| -/* |
17 |
| - * @implemented |
| 4 | +/********************************************************************* |
| 5 | + * _ismbchira(MSVCRT.@) |
18 | 6 | */
|
19 |
| -int _ismbchira( unsigned int c ) |
| 7 | +int CDECL _ismbchira(unsigned int c) |
20 | 8 | {
|
21 |
| - return ((c>=0x829F) && (c<=0x82F1)); |
| 9 | + if(get_mbcinfo()->mbcodepage == 932) |
| 10 | + { |
| 11 | + /* Japanese/Hiragana, CP 932 */ |
| 12 | + return (c >= 0x829f && c <= 0x82f1); |
| 13 | + } |
| 14 | + return 0; |
22 | 15 | }
|
23 | 16 |
|
24 |
| -/* |
25 |
| - * @implemented |
| 17 | +/********************************************************************* |
| 18 | + * _ismbckata(MSVCRT.@) |
26 | 19 | */
|
27 |
| -int _ismbckata( unsigned int c ) |
| 20 | +int CDECL _ismbckata(unsigned int c) |
28 | 21 | {
|
29 |
| - return ((c>=0x8340) && (c<=0x8396)); |
| 22 | + if(get_mbcinfo()->mbcodepage == 932) |
| 23 | + { |
| 24 | + /* Japanese/Katakana, CP 932 */ |
| 25 | + return (c >= 0x8340 && c <= 0x8396 && c != 0x837f); |
| 26 | + } |
| 27 | + return 0; |
30 | 28 | }
|
31 | 29 |
|
32 |
| -/* |
33 |
| - * @implemented |
| 30 | +/********************************************************************* |
| 31 | + * _mbctohira (MSVCRT.@) |
| 32 | + * |
| 33 | + * Converts a sjis katakana character to hiragana. |
34 | 34 | */
|
35 |
| -unsigned int _mbctohira( unsigned int c ) |
| 35 | +unsigned int CDECL _mbctohira(unsigned int c) |
36 | 36 | {
|
37 |
| - if (c >= 0x8340 && c <= 0x837e) |
38 |
| - return c - 0xa1; |
39 |
| - else if (c >= 0x8380 && c <= 0x8396) |
40 |
| - return c - 0xa2; |
41 |
| - else |
42 |
| - return c; |
| 37 | + if(_ismbckata(c) && c <= 0x8393) |
| 38 | + return (c - 0x8340 - (c >= 0x837f ? 1 : 0)) + 0x829f; |
| 39 | + return c; |
43 | 40 | }
|
44 | 41 |
|
45 |
| -/* |
46 |
| - * @implemented |
| 42 | +/********************************************************************* |
| 43 | + * _mbctokata (MSVCRT.@) |
| 44 | + * |
| 45 | + * Converts a sjis hiragana character to katakana. |
47 | 46 | */
|
48 |
| -unsigned int _mbctokata( unsigned int c ) |
| 47 | +unsigned int CDECL _mbctokata(unsigned int c) |
49 | 48 | {
|
50 |
| - if (c >= 0x829f && c <= 0x82dd) |
51 |
| - return c + 0xa1; |
52 |
| - else if (c >= 0x82de && c <= 0x82f1) |
53 |
| - return c + 0xa2; |
54 |
| - else |
55 |
| - return c; |
| 49 | + if(_ismbchira(c)) |
| 50 | + return (c - 0x829f) + 0x8340 + (c >= 0x82de ? 1 : 0); |
| 51 | + return c; |
56 | 52 | }
|
57 | 53 |
|
58 | 54 |
|
0 commit comments