branch update for HEAD-2003021201
[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  *  DISCLAIMED. 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 /* HT  LF  VT  FF  CR  SP */
43 #define _PUNCT      0x0010
44 #define _CONTROL    0x0020
45 #define _BLANK      0x0040 /* this is SP only, not SP and HT as in C99  */
46 #define _HEX        0x0080
47 #define _LEADBYTE   0x8000
48
49 #define _ALPHA      0x0103
50
51
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
55
56 int isalnum(int);
57 int isalpha(int);
58 int iscntrl(int);
59 int isdigit(int);
60 int isgraph(int);
61 int islower(int);
62 int isprint(int);
63 int ispunct(int);
64 int isspace(int);
65 int isupper(int);
66 int isxdigit(int);
67
68 #ifndef __STRICT_ANSI__
69 int _isctype (unsigned int, int);
70 #endif
71
72 /* These are the ANSI versions, with correct checking of argument */
73 int tolower(int);
74 int toupper(int);
75
76 /*
77  * NOTE: The above are not old name type wrappers, but functions exported
78  * explicitly by MSVCRT/CRTDLL. However, underscored versions are also
79  * exported.
80  */
81 #ifndef __STRICT_ANSI__
82 /*
83  *  These are the cheap non-std versions: The return values are undefined
84  *  if the argument is not ASCII char or is not of appropriate case
85  */ 
86 int _tolower(int);
87 int _toupper(int);
88 #endif
89
90 /*
91  * TODO: MB_CUR_MAX should be defined here (if not already defined, since
92  *       it should also be defined in stdlib.h). It is supposed to be the
93  *       maximum number of bytes in a multi-byte character in the current
94  *       locale. Perhaps accessible through the __mb_curr_max_dll entry point,
95  *       but I think (again) that that is a variable pointer, which leads to
96  *       problems under the current Cygwin compiler distribution.
97  */
98
99 typedef int wctype_t;
100
101
102 /* Wide character equivalents */
103 #ifndef WEOF
104 #define WEOF    (wchar_t)(0xFFFF)
105 #endif
106
107 int iswalnum(wint_t);
108 int iswalpha(wint_t);
109 int iswascii(wint_t);
110 int iswcntrl(wint_t);
111 int iswctype(wint_t, wctype_t);
112 int is_wctype(wint_t, wctype_t);    /* Obsolete! */
113 int iswdigit(wint_t);
114 int iswgraph(wint_t);
115 int iswlower(wint_t);
116 int iswprint(wint_t);
117 int iswpunct(wint_t);
118 int iswspace(wint_t);
119 int iswupper(wint_t);
120 int iswxdigit(wint_t);
121
122 //wchar_t towlower(wchar_t);
123 wchar_t towupper(wchar_t);
124 wchar_t towlower(wchar_t);
125 //int towupper(wint_t);
126
127 int isleadbyte(int);
128
129 #ifndef __STRICT_ANSI__
130 int __isascii(int);
131 int __toascii(int);
132 int __iscsymf(int);    /* Valid first character in C symbol */
133 int __iscsym(int); /* Valid character in C symbol (after first) */
134
135 #ifndef _NO_OLDNAMES
136 #define isascii(c)  __isascii(c)
137 #define toascii(c)  _toascii(c)
138 #define iscsymf(c)  __iscsymf(c)
139 #define iscsym(c)   __iscsym(c)
140 #endif  /* Not _NO_OLDNAMES */
141
142 #endif  /* Not __STRICT_ANSI__ */
143
144 #ifdef __cplusplus
145 }
146 #endif
147
148 #endif  /* Not _CTYPE_H_ */