ctype.h (5703B) - Raw
1 /** 2 * This file has no copyright assigned and is placed in the Public Domain. 3 * This file is part of the mingw-w64 runtime package. 4 * No warranty is given; refer to the file DISCLAIMER.PD within this package. 5 */ 6 #ifndef _INC_CTYPE 7 #define _INC_CTYPE 8 9 #include <corecrt_wctype.h> 10 11 #ifdef __cplusplus 12 extern "C" { 13 #endif 14 15 #ifndef WEOF 16 #define WEOF (wint_t)(0xFFFF) 17 #endif 18 19 /* CRT stuff */ 20 #if 1 21 extern const unsigned char __newclmap[]; 22 extern const unsigned char __newcumap[]; 23 extern pthreadlocinfo __ptlocinfo; 24 extern pthreadmbcinfo __ptmbcinfo; 25 extern int __globallocalestatus; 26 extern int __locale_changed; 27 extern struct threadlocaleinfostruct __initiallocinfo; 28 extern _locale_tstruct __initiallocalestructinfo; 29 pthreadlocinfo __cdecl __updatetlocinfo(void); 30 pthreadmbcinfo __cdecl __updatetmbcinfo(void); 31 #endif 32 33 #ifndef _CTYPE_DEFINED 34 #define _CTYPE_DEFINED 35 36 _CRTIMP int __cdecl isalpha(int _C); 37 _CRTIMP int __cdecl isupper(int _C); 38 _CRTIMP int __cdecl islower(int _C); 39 _CRTIMP int __cdecl isdigit(int _C); 40 _CRTIMP int __cdecl isxdigit(int _C); 41 _CRTIMP int __cdecl isspace(int _C); 42 _CRTIMP int __cdecl ispunct(int _C); 43 _CRTIMP int __cdecl isalnum(int _C); 44 _CRTIMP int __cdecl isprint(int _C); 45 _CRTIMP int __cdecl isgraph(int _C); 46 _CRTIMP int __cdecl iscntrl(int _C); 47 _CRTIMP int __cdecl toupper(int _C); 48 _CRTIMP int __cdecl _toupper(int _C); 49 _CRTIMP int __cdecl tolower(int _C); 50 _CRTIMP int __cdecl _tolower(int _C); 51 _CRTIMP int __cdecl _tolower_l(int _C,_locale_t _Locale); 52 _CRTIMP int __cdecl _isctype(int _C,int _Type); 53 _CRTIMP int __cdecl isblank(int _C); 54 _CRTIMP int __cdecl _isalpha_l(int _C,_locale_t _Locale); 55 _CRTIMP int __cdecl _isupper_l(int _C,_locale_t _Locale); 56 _CRTIMP int __cdecl _islower_l(int _C,_locale_t _Locale); 57 _CRTIMP int __cdecl _isdigit_l(int _C,_locale_t _Locale); 58 _CRTIMP int __cdecl _isxdigit_l(int _C,_locale_t _Locale); 59 _CRTIMP int __cdecl _isspace_l(int _C,_locale_t _Locale); 60 _CRTIMP int __cdecl _ispunct_l(int _C,_locale_t _Locale); 61 _CRTIMP int __cdecl _isalnum_l(int _C,_locale_t _Locale); 62 _CRTIMP int __cdecl _isprint_l(int _C,_locale_t _Locale); 63 _CRTIMP int __cdecl _isgraph_l(int _C,_locale_t _Locale); 64 _CRTIMP int __cdecl _iscntrl_l(int _C,_locale_t _Locale); 65 _CRTIMP int __cdecl _toupper_l(int _C,_locale_t _Locale); 66 _CRTIMP int __cdecl _isctype_l(int _C,int _Type,_locale_t _Locale); 67 _CRTIMP int __cdecl _isblank_l(int _C,_locale_t _Locale); 68 _CRTIMP int __cdecl __isascii(int _C); 69 _CRTIMP int __cdecl __toascii(int _C); 70 _CRTIMP int __cdecl __iscsymf(int _C); 71 _CRTIMP int __cdecl __iscsym(int _C); 72 #endif 73 74 #ifndef _CTYPE_DISABLE_MACROS 75 76 #ifndef MB_CUR_MAX 77 #define MB_CUR_MAX ___mb_cur_max_func() 78 #ifndef __mb_cur_max 79 #define __mb_cur_max (___mb_cur_max_func()) 80 #endif 81 _CRTIMP int __cdecl ___mb_cur_max_func(void); 82 #endif 83 84 #define __chvalidchk(a,b) (__PCTYPE_FUNC[(unsigned char)(a)] & (b)) 85 #ifdef _UCRT 86 #define _chvalidchk_l(_Char,_Flag,_Locale) (!_Locale ? __chvalidchk(_Char,_Flag) : ((_locale_t)_Locale)->locinfo->_locale_pctype[(unsigned char)(_Char)] & (_Flag)) 87 #define _ischartype_l(_Char,_Flag,_Locale) (((_Locale)!=NULL && (((_locale_t)(_Locale))->locinfo->_locale_mb_cur_max) > 1) ? _isctype_l(_Char,(_Flag),_Locale) : _chvalidchk_l(_Char,_Flag,_Locale)) 88 #else 89 #define _chvalidchk_l(_Char,_Flag,_Locale) (!_Locale ? __chvalidchk(_Char,_Flag) : ((_locale_t)_Locale)->locinfo->pctype[(unsigned char)(_Char)] & (_Flag)) 90 #define _ischartype_l(_Char,_Flag,_Locale) (((_Locale)!=NULL && (((_locale_t)(_Locale))->locinfo->mb_cur_max) > 1) ? _isctype_l(_Char,(_Flag),_Locale) : _chvalidchk_l(_Char,_Flag,_Locale)) 91 #endif 92 #define _isalpha_l(_Char,_Locale) _ischartype_l(_Char,_ALPHA,_Locale) 93 #define _isupper_l(_Char,_Locale) _ischartype_l(_Char,_UPPER,_Locale) 94 #define _islower_l(_Char,_Locale) _ischartype_l(_Char,_LOWER,_Locale) 95 #define _isdigit_l(_Char,_Locale) _ischartype_l(_Char,_DIGIT,_Locale) 96 #define _isxdigit_l(_Char,_Locale) _ischartype_l(_Char,_HEX,_Locale) 97 #define _isspace_l(_Char,_Locale) _ischartype_l(_Char,_SPACE,_Locale) 98 #define _ispunct_l(_Char,_Locale) _ischartype_l(_Char,_PUNCT,_Locale) 99 #define _isalnum_l(_Char,_Locale) _ischartype_l(_Char,_ALPHA|_DIGIT,_Locale) 100 #define _isprint_l(_Char,_Locale) _ischartype_l(_Char,_BLANK|_PUNCT|_ALPHA|_DIGIT,_Locale) 101 #define _isgraph_l(_Char,_Locale) _ischartype_l(_Char,_PUNCT|_ALPHA|_DIGIT,_Locale) 102 #define _iscntrl_l(_Char,_Locale) _ischartype_l(_Char,_CONTROL,_Locale) 103 #define _isblank_l(_Char,_Locale) (((_Char) == '\t') || _ischartype_l(_Char,_BLANK,_Locale)) 104 #define _tolower(_Char) ((_Char)-'A'+'a') 105 #define _toupper(_Char) ((_Char)-'a'+'A') 106 #define __isascii(_Char) ((unsigned)(_Char) < 0x80) 107 #define __toascii(_Char) ((_Char) & 0x7f) 108 109 #define __iscsymf(_c) (isalpha(_c) || ((_c)=='_')) 110 #define __iscsym(_c) (isalnum(_c) || ((_c)=='_')) 111 #define __iswcsymf(_c) (iswalpha(_c) || ((_c)=='_')) 112 #define __iswcsym(_c) (iswalnum(_c) || ((_c)=='_')) 113 #define _iscsymf_l(_c,_p) (_isalpha_l(_c,_p) || ((_c)=='_')) 114 #define _iscsym_l(_c,_p) (_isalnum_l(_c,_p) || ((_c)=='_')) 115 #define _iswcsymf_l(_c,_p) (_iswalpha_l(_c,_p) || ((_c)=='_')) 116 #define _iswcsym_l(_c,_p) (_iswalnum_l(_c,_p) || ((_c)=='_')) 117 #endif 118 119 #ifndef NO_OLDNAMES 120 #ifndef _CTYPE_DEFINED 121 _CRTIMP int __cdecl isascii(int _C) __MINGW_ATTRIB_DEPRECATED_MSVC2005; 122 _CRTIMP int __cdecl toascii(int _C) __MINGW_ATTRIB_DEPRECATED_MSVC2005; 123 _CRTIMP int __cdecl iscsymf(int _C) __MINGW_ATTRIB_DEPRECATED_MSVC2005; 124 _CRTIMP int __cdecl iscsym(int _C) __MINGW_ATTRIB_DEPRECATED_MSVC2005; 125 #else 126 #define isascii __isascii 127 #define toascii __toascii 128 #define iscsymf __iscsymf 129 #define iscsym __iscsym 130 #endif 131 #endif 132 133 #ifdef __cplusplus 134 } 135 #endif 136 #endif