c610ba9a826f60b95aa097f442ce69c33a58a668
[reactos.git] / include / msvcrt / ctype.h
1 /* 
2  * ctype.h
3  *
4  * Functions for testing character types and converting characters.
5  *
6  * This file is part of the Mingw32 package.
7  *
8  * Contributors:
9  *  Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
10  *
11  *  THIS SOFTWARE IS NOT COPYRIGHTED
12  *
13  *  This source code is offered for use in the public domain. You may
14  *  use, modify or distribute it freely.
15  *
16  *  This code is distributed in the hope that it will be useful but
17  *  WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
18  *  DISCLAMED. This includes but is not limited to warranties of
19  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20  *
21  * $Revision$
22  * $Author$
23  * $Date$
24  *
25  */
26
27 #ifndef _CTYPE_H_
28 #define _CTYPE_H_
29
30 #define __need_wchar_t
31 #define __need_wint_t
32 #include <msvcrt/stddef.h>
33
34
35 /*
36  * The following flags are used to tell iswctype and _isctype what character
37  * types you are looking for.
38  */
39 #define _UPPER          0x0001
40 #define _LOWER          0x0002
41 #define _DIGIT          0x0004
42 #define _SPACE          0x0008
43 #define _PUNCT          0x0010
44 #define _CONTROL        0x0020
45 #define _BLANK          0x0040
46 #define _HEX            0x0080
47
48 #define _ALPHA          0x0103
49 #define _LEADBYTE       0x8000
50
51
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
55
56 int     isalnum(int c);
57 int     isalpha(int c);
58 int     iscntrl(int c);
59 int     isdigit(int c);
60 int     isgraph(int c);
61 int     islower(int c);
62 int     isprint(int c);
63 int     ispunct(int c);
64 int     isspace(int c);
65 int     isupper(int c);
66 int     isxdigit(int c);
67
68 #ifndef __STRICT_ANSI__
69 int     _isctype (unsigned int c, int ctypeFlags);
70 #endif
71
72 int     tolower(int c);
73 int     toupper(int c);
74
75 /*
76  * NOTE: The above are not old name type wrappers, but functions exported
77  * explicitly by MSVCRT. However, underscored versions are also exported.
78  */
79 #ifndef __STRICT_ANSI__
80 int     _tolower(int c);
81 int     _toupper(int c);
82 #endif
83
84 #ifndef WEOF
85 #define WEOF    (wchar_t)(0xFFFF)
86 #endif
87
88 /*
89  * TODO: MB_CUR_MAX should be defined here (if not already defined, since
90  *       it should also be defined in stdlib.h). It is supposed to be the
91  *       maximum number of bytes in a multi-byte character in the current
92  *       locale. Perhaps accessible through the __mb_curr_max_dll entry point,
93  *       but I think (again) that that is a variable pointer, which leads to
94  *       problems under the current Cygwin compiler distribution.
95  */
96
97 typedef int     wctype_t;
98
99 /* Wide character equivalents */
100 int     iswalnum(wint_t wc);
101 int     iswalpha(wint_t wc);
102 int     iswascii(wint_t wc);
103 int     iswcntrl(wint_t wc);
104 int     iswctype(wint_t wc, wctype_t wctypeFlags);
105 int     is_wctype(wint_t wc, wctype_t wctypeFlags);     /* Obsolete! */
106 int     iswdigit(wint_t wc);
107 int     iswgraph(wint_t wc);
108 int     iswlower(wint_t wc);
109 int     iswprint(wint_t wc);
110 int     iswpunct(wint_t wc);
111 int     iswspace(wint_t wc);
112 int     iswupper(wint_t wc);
113 int     iswxdigit(wint_t wc);
114
115 wchar_t towlower(wchar_t c);
116 wchar_t towupper(wchar_t c);
117
118 int     isleadbyte (int c);
119
120 #ifndef __STRICT_ANSI__
121 int     __isascii (int c);
122 int     __toascii (int c);
123 int     __iscsymf (int c);      /* Valid first character in C symbol */
124 int     __iscsym (int c);       /* Valid character in C symbol (after first) */
125
126 #ifndef _NO_OLDNAMES
127 #define isascii(c)      __isascii(c)
128 #define toascii(c)      _toascii(c)
129 #define iscsymf(c)      __iscsymf(c)
130 #define iscsym(c)       __iscsym(c)
131 #endif  /* Not _NO_OLDNAMES */
132
133 #endif  /* Not __STRICT_ANSI__ */
134
135 #ifdef __cplusplus
136 }
137 #endif
138
139 #endif  /* Not _CTYPE_H_ */