xref: /reactos/sdk/lib/ucrt/mbstring/ismbknj.cpp (revision 04e0dc4a)
1*04e0dc4aSTimo Kreuzer /***
2*04e0dc4aSTimo Kreuzer *ismbcknj.c - contains the Kanji specific is* functions.
3*04e0dc4aSTimo Kreuzer *
4*04e0dc4aSTimo Kreuzer *       Copyright (c) Microsoft Corporation. All rights reserved.
5*04e0dc4aSTimo Kreuzer *
6*04e0dc4aSTimo Kreuzer *Purpose:
7*04e0dc4aSTimo Kreuzer *       Provide non-portable Kanji support for MBCS libs.
8*04e0dc4aSTimo Kreuzer *
9*04e0dc4aSTimo Kreuzer *******************************************************************************/
10*04e0dc4aSTimo Kreuzer #ifndef _MBCS
11*04e0dc4aSTimo Kreuzer     #error This file should only be compiled with _MBCS defined
12*04e0dc4aSTimo Kreuzer #endif
13*04e0dc4aSTimo Kreuzer 
14*04e0dc4aSTimo Kreuzer #include <corecrt_internal_mbstring.h>
15*04e0dc4aSTimo Kreuzer #include <locale.h>
16*04e0dc4aSTimo Kreuzer 
17*04e0dc4aSTimo Kreuzer 
18*04e0dc4aSTimo Kreuzer /***
19*04e0dc4aSTimo Kreuzer *int _ismbchira(c) - test character for hiragana (Japanese)
20*04e0dc4aSTimo Kreuzer *
21*04e0dc4aSTimo Kreuzer *Purpose:
22*04e0dc4aSTimo Kreuzer *       Test if the character c is a hiragana character.
23*04e0dc4aSTimo Kreuzer *
24*04e0dc4aSTimo Kreuzer *Entry:
25*04e0dc4aSTimo Kreuzer *       unsigned int c - character to test
26*04e0dc4aSTimo Kreuzer *
27*04e0dc4aSTimo Kreuzer *Exit:
28*04e0dc4aSTimo Kreuzer *       returns TRUE if CP == KANJI and character is hiragana, else FALSE
29*04e0dc4aSTimo Kreuzer *
30*04e0dc4aSTimo Kreuzer *Exceptions:
31*04e0dc4aSTimo Kreuzer *
32*04e0dc4aSTimo Kreuzer *******************************************************************************/
33*04e0dc4aSTimo Kreuzer 
_ismbchira_l(unsigned int c,_locale_t plocinfo)34*04e0dc4aSTimo Kreuzer extern "C" int __cdecl _ismbchira_l(
35*04e0dc4aSTimo Kreuzer         unsigned int c,
36*04e0dc4aSTimo Kreuzer         _locale_t plocinfo
37*04e0dc4aSTimo Kreuzer         )
38*04e0dc4aSTimo Kreuzer {
39*04e0dc4aSTimo Kreuzer     _LocaleUpdate _loc_update(plocinfo);
40*04e0dc4aSTimo Kreuzer 
41*04e0dc4aSTimo Kreuzer     return(_loc_update.GetLocaleT()->mbcinfo->mbcodepage == _KANJI_CP && c >= 0x829f && c <= 0x82f1);
42*04e0dc4aSTimo Kreuzer }
43*04e0dc4aSTimo Kreuzer 
_ismbchira(unsigned int c)44*04e0dc4aSTimo Kreuzer extern "C" int __cdecl _ismbchira(
45*04e0dc4aSTimo Kreuzer         unsigned int c
46*04e0dc4aSTimo Kreuzer         )
47*04e0dc4aSTimo Kreuzer {
48*04e0dc4aSTimo Kreuzer     return _ismbchira_l(c, nullptr);
49*04e0dc4aSTimo Kreuzer }
50*04e0dc4aSTimo Kreuzer 
51*04e0dc4aSTimo Kreuzer 
52*04e0dc4aSTimo Kreuzer /***
53*04e0dc4aSTimo Kreuzer *int _ismbckata(c) - test character for katakana (Japanese)
54*04e0dc4aSTimo Kreuzer *
55*04e0dc4aSTimo Kreuzer *Purpose:
56*04e0dc4aSTimo Kreuzer *       Tests to see if the character c is a katakana character.
57*04e0dc4aSTimo Kreuzer *
58*04e0dc4aSTimo Kreuzer *Entry:
59*04e0dc4aSTimo Kreuzer *       unsigned int c - character to test
60*04e0dc4aSTimo Kreuzer *
61*04e0dc4aSTimo Kreuzer *Exit:
62*04e0dc4aSTimo Kreuzer *       Returns TRUE if CP == KANJI and c is a katakana character, else FALSE.
63*04e0dc4aSTimo Kreuzer *
64*04e0dc4aSTimo Kreuzer *Exceptions:
65*04e0dc4aSTimo Kreuzer *
66*04e0dc4aSTimo Kreuzer *******************************************************************************/
67*04e0dc4aSTimo Kreuzer 
_ismbckata_l(unsigned int c,_locale_t plocinfo)68*04e0dc4aSTimo Kreuzer extern "C" int __cdecl _ismbckata_l (
69*04e0dc4aSTimo Kreuzer         unsigned int c,
70*04e0dc4aSTimo Kreuzer         _locale_t plocinfo
71*04e0dc4aSTimo Kreuzer         )
72*04e0dc4aSTimo Kreuzer {
73*04e0dc4aSTimo Kreuzer     _LocaleUpdate _loc_update(plocinfo);
74*04e0dc4aSTimo Kreuzer 
75*04e0dc4aSTimo Kreuzer     return(_loc_update.GetLocaleT()->mbcinfo->mbcodepage == _KANJI_CP && c >= 0x8340 && c <= 0x8396 && c != 0x837f);
76*04e0dc4aSTimo Kreuzer }
_ismbckata(unsigned int c)77*04e0dc4aSTimo Kreuzer extern "C" int __cdecl _ismbckata(
78*04e0dc4aSTimo Kreuzer         unsigned int c
79*04e0dc4aSTimo Kreuzer         )
80*04e0dc4aSTimo Kreuzer {
81*04e0dc4aSTimo Kreuzer     return _ismbckata_l(c, nullptr);
82*04e0dc4aSTimo Kreuzer }
83*04e0dc4aSTimo Kreuzer 
84*04e0dc4aSTimo Kreuzer 
85*04e0dc4aSTimo Kreuzer /***
86*04e0dc4aSTimo Kreuzer *int _ismbcsymbol(c) - Tests if char is punctuation or symbol of Microsoft Kanji
87*04e0dc4aSTimo Kreuzer *                  code.
88*04e0dc4aSTimo Kreuzer *
89*04e0dc4aSTimo Kreuzer *Purpose:
90*04e0dc4aSTimo Kreuzer *       Returns non-zero if the character is kanji punctuation.
91*04e0dc4aSTimo Kreuzer *
92*04e0dc4aSTimo Kreuzer *Entry:
93*04e0dc4aSTimo Kreuzer *       unsigned int c - character to be tested
94*04e0dc4aSTimo Kreuzer *
95*04e0dc4aSTimo Kreuzer *Exit:
96*04e0dc4aSTimo Kreuzer *       Returns non-zero if CP == KANJI and the specified char is punctuation or symbol of
97*04e0dc4aSTimo Kreuzer *               Microsoft Kanji code, else 0.
98*04e0dc4aSTimo Kreuzer *
99*04e0dc4aSTimo Kreuzer *Exceptions:
100*04e0dc4aSTimo Kreuzer *
101*04e0dc4aSTimo Kreuzer *******************************************************************************/
102*04e0dc4aSTimo Kreuzer 
_ismbcsymbol_l(unsigned int c,_locale_t plocinfo)103*04e0dc4aSTimo Kreuzer extern "C" int __cdecl _ismbcsymbol_l(
104*04e0dc4aSTimo Kreuzer         unsigned int c,
105*04e0dc4aSTimo Kreuzer         _locale_t plocinfo
106*04e0dc4aSTimo Kreuzer         )
107*04e0dc4aSTimo Kreuzer {
108*04e0dc4aSTimo Kreuzer     _LocaleUpdate _loc_update(plocinfo);
109*04e0dc4aSTimo Kreuzer 
110*04e0dc4aSTimo Kreuzer     return(_loc_update.GetLocaleT()->mbcinfo->mbcodepage == _KANJI_CP && c >= 0x8141 && c <= 0x81ac && c != 0x817f);
111*04e0dc4aSTimo Kreuzer }
112*04e0dc4aSTimo Kreuzer 
113*04e0dc4aSTimo Kreuzer extern "C" int (__cdecl _ismbcsymbol)(
114*04e0dc4aSTimo Kreuzer         unsigned int c
115*04e0dc4aSTimo Kreuzer         )
116*04e0dc4aSTimo Kreuzer {
117*04e0dc4aSTimo Kreuzer     return _ismbcsymbol_l(c, nullptr);
118*04e0dc4aSTimo Kreuzer }
119