[DDK]
[reactos.git] / include / crt / wctype.h
1 /**
2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the w64 mingw-runtime package.
4 * No warranty is given; refer to the file DISCLAIMER within this package.
5 */
6 #ifndef _INC_WCTYPE
7 #define _INC_WCTYPE
8
9 #ifndef _WIN32
10 #error Only Win32 target is supported!
11 #endif
12
13 #include <crtdefs.h>
14
15 #pragma pack(push,_CRT_PACKING)
16
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20
21 #ifndef _CRTIMP
22 #define _CRTIMP __declspec(dllimport)
23 #endif
24
25 #ifndef _WCHAR_T_DEFINED
26 typedef unsigned short wchar_t;
27 #define _WCHAR_T_DEFINED
28 #endif
29
30 #ifndef _WCTYPE_T_DEFINED
31 typedef unsigned short wint_t;
32 typedef unsigned short wctype_t;
33 #define _WCTYPE_T_DEFINED
34 #endif
35
36 #ifndef WEOF
37 #define WEOF (wint_t)(0xFFFF)
38 #endif
39
40 #ifndef _CRT_CTYPEDATA_DEFINED
41 #define _CRT_CTYPEDATA_DEFINED
42 #ifndef _CTYPE_DISABLE_MACROS
43
44 #ifndef __PCTYPE_FUNC
45 #define __PCTYPE_FUNC __pctype_func()
46 #ifdef _MSVCRT_
47 #define __pctype_func() (_pctype)
48 #else
49 #define __pctype_func() (*_imp___pctype)
50 #endif
51 #endif
52
53 #ifndef _pctype
54 #ifdef _MSVCRT_
55 extern unsigned short *_pctype;
56 #else
57 extern unsigned short **_imp___pctype;
58 #define _pctype (*_imp___pctype)
59 #endif
60 #endif
61
62 #endif
63 #endif
64
65 #ifndef _CRT_WCTYPEDATA_DEFINED
66 #define _CRT_WCTYPEDATA_DEFINED
67 #ifndef _CTYPE_DISABLE_MACROS
68 #ifndef _wctype
69 #ifdef _MSVCRT_
70 extern unsigned short *_wctype;
71 #else
72 extern unsigned short **_imp___wctype;
73 #define _wctype (*_imp___wctype)
74 #endif
75 #endif
76
77 #ifndef _pwctype
78 #ifdef _MSVCRT_
79 extern unsigned short *_pwctype;
80 #else
81 extern unsigned short **_imp___pwctype;
82 #define _pwctype (*_imp___pwctype)
83 #define __pwctype_func() (*_imp___pwctype)
84 #endif
85 #endif
86 #endif
87 #endif
88
89 #define _UPPER 0x1
90 #define _LOWER 0x2
91 #define _DIGIT 0x4
92 #define _SPACE 0x8
93
94 #define _PUNCT 0x10
95 #define _CONTROL 0x20
96 #define _BLANK 0x40
97 #define _HEX 0x80
98
99 #define _LEADBYTE 0x8000
100 #define _ALPHA (0x0100|_UPPER|_LOWER)
101
102 #ifndef _WCTYPE_DEFINED
103 #define _WCTYPE_DEFINED
104
105 int __cdecl iswalpha(wint_t);
106 int __cdecl iswupper(wint_t);
107 int __cdecl iswlower(wint_t);
108 int __cdecl iswdigit(wint_t);
109 int __cdecl iswxdigit(wint_t);
110 int __cdecl iswspace(wint_t);
111 int __cdecl iswpunct(wint_t);
112 int __cdecl iswalnum(wint_t);
113 int __cdecl iswprint(wint_t);
114 int __cdecl iswgraph(wint_t);
115 int __cdecl iswcntrl(wint_t);
116 int __cdecl iswascii(wint_t);
117 int __cdecl isleadbyte(int);
118 wint_t __cdecl towupper(wint_t);
119 wint_t __cdecl towlower(wint_t);
120 int __cdecl iswctype(wint_t,wctype_t);
121 _CRTIMP int __cdecl __iswcsymf(wint_t);
122 _CRTIMP int __cdecl __iswcsym(wint_t);
123 int __cdecl is_wctype(wint_t,wctype_t);
124 #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || !defined (NO_OLDNAMES)
125 _CRTIMP int __cdecl iswblank(wint_t _C);
126 #endif
127 #endif
128
129 #ifndef _WCTYPE_INLINE_DEFINED
130 #define _WCTYPE_INLINE_DEFINED
131 #ifndef __cplusplus
132 #define iswalpha(_c) (iswctype(_c,_ALPHA))
133 #define iswupper(_c) (iswctype(_c,_UPPER))
134 #define iswlower(_c) (iswctype(_c,_LOWER))
135 #define iswdigit(_c) (iswctype(_c,_DIGIT))
136 #define iswxdigit(_c) (iswctype(_c,_HEX))
137 #define iswspace(_c) (iswctype(_c,_SPACE))
138 #define iswpunct(_c) (iswctype(_c,_PUNCT))
139 #define iswalnum(_c) (iswctype(_c,_ALPHA|_DIGIT))
140 #define iswprint(_c) (iswctype(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT))
141 #define iswgraph(_c) (iswctype(_c,_PUNCT|_ALPHA|_DIGIT))
142 #define iswcntrl(_c) (iswctype(_c,_CONTROL))
143 #define iswascii(_c) ((unsigned)(_c) < 0x80)
144 #define isleadbyte(c) (__pctype_func()[(unsigned char)(c)] & _LEADBYTE)
145 #else
146 __CRT_INLINE int __cdecl iswalpha(wint_t _C) {return (iswctype(_C,_ALPHA)); }
147 __CRT_INLINE int __cdecl iswupper(wint_t _C) {return (iswctype(_C,_UPPER)); }
148 __CRT_INLINE int __cdecl iswlower(wint_t _C) {return (iswctype(_C,_LOWER)); }
149 __CRT_INLINE int __cdecl iswdigit(wint_t _C) {return (iswctype(_C,_DIGIT)); }
150 __CRT_INLINE int __cdecl iswxdigit(wint_t _C) {return (iswctype(_C,_HEX)); }
151 __CRT_INLINE int __cdecl iswspace(wint_t _C) {return (iswctype(_C,_SPACE)); }
152 __CRT_INLINE int __cdecl iswpunct(wint_t _C) {return (iswctype(_C,_PUNCT)); }
153 __CRT_INLINE int __cdecl iswalnum(wint_t _C) {return (iswctype(_C,_ALPHA|_DIGIT)); }
154 __CRT_INLINE int __cdecl iswprint(wint_t _C) {return (iswctype(_C,_BLANK|_PUNCT|_ALPHA|_DIGIT)); }
155 __CRT_INLINE int __cdecl iswgraph(wint_t _C) {return (iswctype(_C,_PUNCT|_ALPHA|_DIGIT)); }
156 __CRT_INLINE int __cdecl iswcntrl(wint_t _C) {return (iswctype(_C,_CONTROL)); }
157 __CRT_INLINE int __cdecl iswascii(wint_t _C) {return ((unsigned)(_C) < 0x80); }
158 __CRT_INLINE int __cdecl isleadbyte(int _C) {return (__pctype_func()[(unsigned char)(_C)] & _LEADBYTE); }
159 #endif
160 #endif
161
162 typedef wchar_t wctrans_t;
163 wint_t __cdecl towctrans(wint_t,wctrans_t);
164 wctrans_t __cdecl wctrans(const char *);
165 wctype_t __cdecl wctype(const char *);
166
167 #ifdef __cplusplus
168 }
169 #endif
170
171 #pragma pack(pop)
172 #endif