1 /*** 2 *ismblgl.c - Tests to see if a given character is a legal MBCS char. 3 * 4 * Copyright (c) Microsoft Corporation. All rights reserved. 5 * 6 *Purpose: 7 * Tests to see if a given character is a legal MBCS character. 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 _ismbclegal(c) - tests for a valid MBCS character. 20 * 21 *Purpose: 22 * Tests to see if a given character is a legal MBCS character. 23 * 24 *Entry: 25 * unsigned int c - character to test 26 * 27 *Exit: 28 * returns non-zero if Microsoft Kanji code, else 0 29 * 30 *Exceptions: 31 * 32 ******************************************************************************/ 33 34 extern "C" int __cdecl _ismbclegal_l( 35 unsigned int c, 36 _locale_t plocinfo 37 ) 38 { 39 _LocaleUpdate _loc_update(plocinfo); 40 41 return( (_ismbblead_l(c >> 8, _loc_update.GetLocaleT())) && 42 (_ismbbtrail_l(c & 0x0ff, _loc_update.GetLocaleT())) ); 43 } 44 extern "C" int (__cdecl _ismbclegal)( 45 unsigned int c 46 ) 47 { 48 return _ismbclegal_l(c, nullptr); 49 } 50