Reactos
at master 92 lines 2.3 kB view raw
1/*** 2*ismbpunc - Test if character is punctuation (MBCS) 3* 4* Copyright (c) Microsoft Corporation. All rights reserved. 5* 6*Purpose: 7* Test if character is punctuation (MBCS) 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* _ismbcpunct - Test if character is punctuation (MBCS) 20* 21*Purpose: 22* Test if the supplied character is punctuation or not. 23* Handles MBCS characters correctly. 24* 25* Note: Use test against 0x00FF instead of _ISLEADBYTE 26* to ensure that we don't call SBCS routine with a two-byte 27* value. 28* 29*Entry: 30* unsigned int c = character to test 31* 32*Exit: 33* Returns TRUE if c is an punctuation character; else FALSE 34* 35*Exceptions: 36* 37*******************************************************************************/ 38 39extern "C" int __cdecl _ismbcpunct_l(unsigned int const c, _locale_t const locale) 40{ 41 _LocaleUpdate locale_update(locale); 42 43 if (c <= 0x00FF) 44 { 45 return _ismbbpunct_l(c, locale_update.GetLocaleT()); 46 } 47 48 return __dcrt_multibyte_check_type(c, locale_update.GetLocaleT(), _PUNCT, true); 49} 50 51extern "C" int __cdecl _ismbcpunct(unsigned int const c) 52{ 53 return _ismbcpunct_l(c, nullptr); 54} 55 56/*** 57* _ismbcblank - Test if character is blank (MBCS) 58* 59*Purpose: 60* Test if the supplied character is blank or not. 61* Handles MBCS characters correctly. 62* 63* Note: Use test against 0x00FF instead of _ISLEADBYTE 64* to ensure that we don't call SBCS routine with a two-byte 65* value. 66* 67*Entry: 68* unsigned int c = character to test 69* 70*Exit: 71* Returns TRUE if c is a blank character; else FALSE 72* 73*Exceptions: 74* 75*******************************************************************************/ 76 77extern "C" int __cdecl _ismbcblank_l(unsigned int const c, _locale_t const locale) 78{ 79 _LocaleUpdate locale_update(locale); 80 81 if (c <= 0x00FF) 82 { 83 return _ismbbblank_l(c, locale_update.GetLocaleT()); 84 } 85 86 return __dcrt_multibyte_check_type(c, locale_update.GetLocaleT(), _BLANK, true); 87} 88 89extern "C" int __cdecl _ismbcblank(unsigned int const c) 90{ 91 return _ismbcblank_l(c, nullptr); 92}