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