Debian Codegraph @

mingw-w64-headers/crt/ctype.h

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 _CTYPE_DISABLE_MACROS
16
17 #ifndef MB_CUR_MAX
18 #define MB_CUR_MAX ___mb_cur_max_func()
19 #ifndef __mb_cur_max
20 #define __mb_cur_max (___mb_cur_max_func())
21 #endif
22 _CRTIMP int __cdecl ___mb_cur_max_func(void);
23 #endif
24
25 #endif /* !_CTYPE_DISABLE_MACROS */
26
27 /**
28 * Standard C functions.
29 */
30
31 _CRTIMP int __cdecl isalnum(int _C);
32 _CRTIMP int __cdecl isalpha(int _C);
33 _CRTIMP int __cdecl isblank(int _C);
34 _CRTIMP int __cdecl iscntrl(int _C);
35 _CRTIMP int __cdecl isdigit(int _C);
36 _CRTIMP int __cdecl isgraph(int _C);
37 _CRTIMP int __cdecl islower(int _C);
38 _CRTIMP int __cdecl isprint(int _C);
39 _CRTIMP int __cdecl ispunct(int _C);
40 _CRTIMP int __cdecl isspace(int _C);
41 _CRTIMP int __cdecl isupper(int _C);
42 _CRTIMP int __cdecl isxdigit(int _C);
43
44 _CRTIMP int __cdecl tolower(int _C);
45 _CRTIMP int __cdecl toupper(int _C);
46
47 #if !defined(_CTYPE_DISABLE_MACROS) && !defined(__cplusplus)
48 #define __chvalidchk(a,b) (__PCTYPE_FUNC[(unsigned char)(a)] & (b))
49 #endif /* !_CTYPE_DISABLE_MACROS && !__cplusplus */
50
51 /**
52 * Locale-specific versions of Standard C functions.
53 *
54 * They are available since msvcr80.dll.
55 */
56
57 /* These are also available in msvcrt.dll since Windows Vista. */
58 #if __MSVCRT_VERSION__ >= 0x0800 || (__MSVCRT_VERSION__ == 0x0600 && _WIN32_WINNT >= 0x0600)
59 _CRTIMP int __cdecl _isalnum_l(int _C,_locale_t _Locale);
60 _CRTIMP int __cdecl _isalpha_l(int _C,_locale_t _Locale);
61 _CRTIMP int __cdecl _isblank_l(int _C,_locale_t _Locale);
62 _CRTIMP int __cdecl _iscntrl_l(int _C,_locale_t _Locale);
63 _CRTIMP int __cdecl _isdigit_l(int _C,_locale_t _Locale);
64 _CRTIMP int __cdecl _isgraph_l(int _C,_locale_t _Locale);
65 _CRTIMP int __cdecl _islower_l(int _C,_locale_t _Locale);
66 _CRTIMP int __cdecl _isprint_l(int _C,_locale_t _Locale);
67 _CRTIMP int __cdecl _ispunct_l(int _C,_locale_t _Locale);
68 _CRTIMP int __cdecl _isspace_l(int _C,_locale_t _Locale);
69 _CRTIMP int __cdecl _isupper_l(int _C,_locale_t _Locale);
70 _CRTIMP int __cdecl _isxdigit_l(int _C,_locale_t _Locale);
71
72 _CRTIMP int __cdecl _tolower_l(int _C,_locale_t _Locale);
73 _CRTIMP int __cdecl _toupper_l(int _C,_locale_t _Locale);
74
75 #if !defined(_CTYPE_DISABLE_MACROS) && !defined(__cplusplus)
76 #ifdef _UCRT
77 #define _chvalidchk_l(_Char,_Flag,_Locale) (!_Locale ? __chvalidchk(_Char,_Flag) : ((_locale_t)_Locale)->locinfo->_locale_pctype[(unsigned char)(_Char)] & (_Flag))
78 #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))
79 #else
80 #define _chvalidchk_l(_Char,_Flag,_Locale) (!_Locale ? __chvalidchk(_Char,_Flag) : ((_locale_t)_Locale)->locinfo->pctype[(unsigned char)(_Char)] & (_Flag))
81 #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))
82 #endif
83
84 #define _isalnum_l(_Char,_Locale) _ischartype_l(_Char,_ALPHA|_DIGIT,_Locale)
85 #define _isalpha_l(_Char,_Locale) _ischartype_l(_Char,_ALPHA,_Locale)
86 #define _isblank_l(_Char,_Locale) (((_Char) == '\t') || _ischartype_l(_Char,_BLANK,_Locale))
87 #define _iscntrl_l(_Char,_Locale) _ischartype_l(_Char,_CONTROL,_Locale)
88 #define _isdigit_l(_Char,_Locale) _ischartype_l(_Char,_DIGIT,_Locale)
89 #define _isgraph_l(_Char,_Locale) _ischartype_l(_Char,_PUNCT|_ALPHA|_DIGIT,_Locale)
90 #define _islower_l(_Char,_Locale) _ischartype_l(_Char,_LOWER,_Locale)
91 #define _isprint_l(_Char,_Locale) _ischartype_l(_Char,_BLANK|_PUNCT|_ALPHA|_DIGIT,_Locale)
92 #define _ispunct_l(_Char,_Locale) _ischartype_l(_Char,_PUNCT,_Locale)
93 #define _isspace_l(_Char,_Locale) _ischartype_l(_Char,_SPACE,_Locale)
94 #define _isupper_l(_Char,_Locale) _ischartype_l(_Char,_UPPER,_Locale)
95 #define _isxdigit_l(_Char,_Locale) _ischartype_l(_Char,_HEX,_Locale)
96 #endif /* !_CTYPE_DISABLE_MACROS && !__cplusplus */
97 #endif
98
99 /**
100 * POSIX functions.
101 */
102
103 _CRTIMP int __cdecl __isascii(int _C);
104 _CRTIMP int __cdecl __toascii(int _C);
105 _CRTIMP int __cdecl _tolower(int _C);
106 _CRTIMP int __cdecl _toupper(int _C);
107
108 #if !defined(_CTYPE_DISABLE_MACROS) && !defined(__cplusplus)
109 #define __isascii(_Char) ((unsigned)(_Char) < 0x80)
110 #define __toascii(_Char) ((_Char) & 0x7f)
111 #define _tolower(_Char) ((_Char)-'A'+'a')
112 #define _toupper(_Char) ((_Char)-'a'+'A')
113 #endif /* !_CTYPE_DISABLE_MACROS && !__cplusplus */
114
115 #ifndef NO_OLDNAMES
116 #if !defined(_CTYPE_DISABLE_MACROS) && !defined(__cplusplus)
117 #define isascii __isascii
118 #define toascii __toascii
119 #else
120 _CRTIMP int __cdecl isascii(int _C) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
121 _CRTIMP int __cdecl toascii(int _C) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
122 #endif /* !_CTYPE_DISABLE_MACROS && !__cplusplus */
123 #endif /* !NO_OLDNAMES */
124
125 /**
126 * Microsoft-specific functions.
127 */
128
129 _CRTIMP int __cdecl _isctype(int _C,int _Type);
130
131 _CRTIMP int __cdecl __iscsym(int _C);
132 _CRTIMP int __cdecl __iscsymf(int _C);
133
134 #if !defined(_CTYPE_DISABLE_MACROS) && !defined(__cplusplus)
135 #define __iscsym(_c) (isalnum(_c) || ((_c)=='_'))
136 #define __iscsymf(_c) (isalpha(_c) || ((_c)=='_'))
137 #endif /* !_CTYPE_DISABLE_MACROS && !__cplusplus */
138
139 #ifndef NO_OLDNAMES
140 #if !defined(_CTYPE_DISABLE_MACROS) && !defined(__cplusplus)
141 #define iscsym __iscsym
142 #define iscsymf __iscsymf
143 #else
144 _CRTIMP int __cdecl iscsym(int _C) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
145 _CRTIMP int __cdecl iscsymf(int _C) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
146 #endif /* !_CTYPE_DISABLE_MACROS && !__cplusplus */
147 #endif /* !NO_OLDNAMES */
148
149 /**
150 * Locale-specific versions of Microsoft functions.
151 *
152 * They are available since msvcr80.dll.
153 */
154
155 /**
156 * _iscsym_l and _iscsymf_l are only available as macros in Microsoft headers.
157 *
158 * We do not expose those macros under following conditions:
159 *
160 * - when _CTYPE_DISABLE_MACROS is defined; this is what Microsoft headers do
161 * - for C++ compilations; this avoids possible clashes with class member names
162 *
163 * To make them available under above conditions, we provide them as externals.
164 */
165 #if __MSVCRT_VERSION__ >= 0x0800
166 int __cdecl _iscsym_l(wint_t _C, _locale_t _Locale);
167 int __cdecl _iscsymf_l(wint_t _C, _locale_t _Locale);
168
169 #if !defined(_CTYPE_DISABLE_MACROS) && !defined(__cplusplus)
170 #define _iscsym_l(_c,_p) (_isalnum_l(_c,_p) || ((_c)=='_'))
171 #define _iscsymf_l(_c,_p) (_isalpha_l(_c,_p) || ((_c)=='_'))
172 #endif /* !_CTYPE_DISABLE_MACROS && !__cplusplus */
173 #endif
174
175 /* These are also available in msvcrt.dll since Windows Vista. */
176 #if __MSVCRT_VERSION__ >= 0x0800 || (__MSVCRT_VERSION__ == 0x0600 && _WIN32_WINNT >= 0x0600)
177 _CRTIMP int __cdecl _isctype_l(int _C,int _Type,_locale_t _Locale);
178 #endif
179
180 #ifdef __cplusplus
181 }
182 #endif
183 #endif