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
12extern "C" {
13#endif
14
15/**
16 * Standard C functions.
17 */
18
19_CRTIMP int __cdecl isalnum(int _C);
20_CRTIMP int __cdecl isalpha(int _C);
21_CRTIMP int __cdecl isblank(int _C);
22_CRTIMP int __cdecl iscntrl(int _C);
23_CRTIMP int __cdecl isdigit(int _C);
24_CRTIMP int __cdecl isgraph(int _C);
25_CRTIMP int __cdecl islower(int _C);
26_CRTIMP int __cdecl isprint(int _C);
27_CRTIMP int __cdecl ispunct(int _C);
28_CRTIMP int __cdecl isspace(int _C);
29_CRTIMP int __cdecl isupper(int _C);
30_CRTIMP int __cdecl isxdigit(int _C);
31
32_CRTIMP int __cdecl tolower(int _C);
33_CRTIMP int __cdecl toupper(int _C);
34
35/**
36 * Locale-specific versions of Standard C functions.
37 *
38 * They are available since msvcr80.dll.
39 */
40
41/* These are also available in msvcrt.dll since Windows Vista. */
42#if __MSVCRT_VERSION__ >= 0x0800 || (__MSVCRT_VERSION__ == 0x0600 && _WIN32_WINNT >= 0x0600)
43_CRTIMP int __cdecl _isalnum_l(int _C,_locale_t _Locale);
44_CRTIMP int __cdecl _isalpha_l(int _C,_locale_t _Locale);
45_CRTIMP int __cdecl _isblank_l(int _C,_locale_t _Locale);
46_CRTIMP int __cdecl _iscntrl_l(int _C,_locale_t _Locale);
47_CRTIMP int __cdecl _isdigit_l(int _C,_locale_t _Locale);
48_CRTIMP int __cdecl _isgraph_l(int _C,_locale_t _Locale);
49_CRTIMP int __cdecl _islower_l(int _C,_locale_t _Locale);
50_CRTIMP int __cdecl _isprint_l(int _C,_locale_t _Locale);
51_CRTIMP int __cdecl _ispunct_l(int _C,_locale_t _Locale);
52_CRTIMP int __cdecl _isspace_l(int _C,_locale_t _Locale);
53_CRTIMP int __cdecl _isupper_l(int _C,_locale_t _Locale);
54_CRTIMP int __cdecl _isxdigit_l(int _C,_locale_t _Locale);
55
56_CRTIMP int __cdecl _tolower_l(int _C,_locale_t _Locale);
57_CRTIMP int __cdecl _toupper_l(int _C,_locale_t _Locale);
58#endif
59
60/**
61 * POSIX functions.
62 */
63
64_CRTIMP int __cdecl __isascii(int _C);
65_CRTIMP int __cdecl __toascii(int _C);
66_CRTIMP int __cdecl _tolower(int _C);
67_CRTIMP int __cdecl _toupper(int _C);
68
69#if !defined(_CTYPE_DISABLE_MACROS) && !defined(__cplusplus)
70#define __isascii(_Char) ((unsigned)(_Char) < 0x80)
71#define __toascii(_Char) ((_Char) & 0x7f)
72#define _tolower(_Char) ((_Char)-'A'+'a')
73#define _toupper(_Char) ((_Char)-'a'+'A')
74#endif /* !_CTYPE_DISABLE_MACROS && !__cplusplus */
75
76#ifndef NO_OLDNAMES
77#if !defined(_CTYPE_DISABLE_MACROS) && !defined(__cplusplus)
78#define isascii __isascii
79#define toascii __toascii
80#else
81_CRTIMP int __cdecl isascii(int _C) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
82_CRTIMP int __cdecl toascii(int _C) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
83#endif /* !_CTYPE_DISABLE_MACROS && !__cplusplus */
84#endif /* !NO_OLDNAMES */
85
86/**
87 * Microsoft-specific functions.
88 */
89
90_CRTIMP int __cdecl _isctype(int _C,int _Type);
91
92_CRTIMP int __cdecl __iscsym(int _C);
93_CRTIMP int __cdecl __iscsymf(int _C);
94
95#if !defined(_CTYPE_DISABLE_MACROS) && !defined(__cplusplus)
96#define __iscsym(_c) (isalnum(_c) || ((_c)=='_'))
97#define __iscsymf(_c) (isalpha(_c) || ((_c)=='_'))
98#endif /* !_CTYPE_DISABLE_MACROS && !__cplusplus */
99
100#ifndef NO_OLDNAMES
101#if !defined(_CTYPE_DISABLE_MACROS) && !defined(__cplusplus)
102#define iscsym __iscsym
103#define iscsymf __iscsymf
104#else
105_CRTIMP int __cdecl iscsym(int _C) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
106_CRTIMP int __cdecl iscsymf(int _C) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
107#endif /* !_CTYPE_DISABLE_MACROS && !__cplusplus */
108#endif /* !NO_OLDNAMES */
109
110/**
111 * Locale-specific versions of Microsoft functions.
112 *
113 * They are available since msvcr80.dll.
114 */
115
116/**
117 * _iscsym_l and _iscsymf_l are only available as macros in Microsoft headers.
118 *
119 * We do not expose those macros under following conditions:
120 *
121 * - when _CTYPE_DISABLE_MACROS is defined; this is what Microsoft headers do
122 * - for C++ compilations; this avoids possible clashes with class member names
123 *
124 * To make them available under above conditions, we provide them as externals.
125 */
126#if __MSVCRT_VERSION__ >= 0x0800
127int __cdecl _iscsym_l(wint_t _C, _locale_t _Locale);
128int __cdecl _iscsymf_l(wint_t _C, _locale_t _Locale);
129
130#if !defined(_CTYPE_DISABLE_MACROS) && !defined(__cplusplus)
131#define _iscsym_l(_c,_p) (_isalnum_l(_c,_p) || ((_c)=='_'))
132#define _iscsymf_l(_c,_p) (_isalpha_l(_c,_p) || ((_c)=='_'))
133#endif /* !_CTYPE_DISABLE_MACROS && !__cplusplus */
134#endif
135
136/* These are also available in msvcrt.dll since Windows Vista. */
137#if __MSVCRT_VERSION__ >= 0x0800 || (__MSVCRT_VERSION__ == 0x0600 && _WIN32_WINNT >= 0x0600)
138_CRTIMP int __cdecl _isctype_l(int _C,int _Type,_locale_t _Locale);
139#endif
140
141#ifdef __cplusplus
142}
143#endif
144#endif