1*04e0dc4aSTimo Kreuzer /*** 2*04e0dc4aSTimo Kreuzer *ismbalph.c - Test if character is alphabetic (MBCS) 3*04e0dc4aSTimo Kreuzer * 4*04e0dc4aSTimo Kreuzer * Copyright (c) Microsoft Corporation. All rights reserved. 5*04e0dc4aSTimo Kreuzer * 6*04e0dc4aSTimo Kreuzer *Purpose: 7*04e0dc4aSTimo Kreuzer * Test if character is alphabetic (MBCS) 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 * _ismbcalpha - Test if character is alphabetic (MBCS) 20*04e0dc4aSTimo Kreuzer * 21*04e0dc4aSTimo Kreuzer *Purpose: 22*04e0dc4aSTimo Kreuzer * Test if character is alphabetic. 23*04e0dc4aSTimo Kreuzer * Handles MBCS chars correctly. 24*04e0dc4aSTimo Kreuzer * 25*04e0dc4aSTimo Kreuzer * Note: Use test against 0x00FF instead of _ISLEADBYTE 26*04e0dc4aSTimo Kreuzer * to ensure that we don't call SBCS routine with a two-byte 27*04e0dc4aSTimo Kreuzer * value. 28*04e0dc4aSTimo Kreuzer * 29*04e0dc4aSTimo Kreuzer *Entry: 30*04e0dc4aSTimo Kreuzer * unsigned int c = character to test 31*04e0dc4aSTimo Kreuzer * 32*04e0dc4aSTimo Kreuzer *Exit: 33*04e0dc4aSTimo Kreuzer * Returns TRUE if c is alphabetic, else FALSE 34*04e0dc4aSTimo Kreuzer * 35*04e0dc4aSTimo Kreuzer *Exceptions: 36*04e0dc4aSTimo Kreuzer * 37*04e0dc4aSTimo Kreuzer *******************************************************************************/ 38*04e0dc4aSTimo Kreuzer _ismbcalpha_l(unsigned int const c,_locale_t const locale)39*04e0dc4aSTimo Kreuzerextern "C" int __cdecl _ismbcalpha_l(unsigned int const c, _locale_t const locale) 40*04e0dc4aSTimo Kreuzer { 41*04e0dc4aSTimo Kreuzer _LocaleUpdate locale_update(locale); 42*04e0dc4aSTimo Kreuzer 43*04e0dc4aSTimo Kreuzer if (c <= 0x00FF) 44*04e0dc4aSTimo Kreuzer { 45*04e0dc4aSTimo Kreuzer return _ismbbalpha_l(c, locale_update.GetLocaleT()); 46*04e0dc4aSTimo Kreuzer } 47*04e0dc4aSTimo Kreuzer 48*04e0dc4aSTimo Kreuzer return __dcrt_multibyte_check_type(c, locale_update.GetLocaleT(), _ALPHA, true); 49*04e0dc4aSTimo Kreuzer } 50*04e0dc4aSTimo Kreuzer _ismbcalpha(unsigned int const c)51*04e0dc4aSTimo Kreuzerextern "C" int __cdecl _ismbcalpha(unsigned int const c) 52*04e0dc4aSTimo Kreuzer { 53*04e0dc4aSTimo Kreuzer return _ismbcalpha_l(c, nullptr); 54*04e0dc4aSTimo Kreuzer } 55