STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
wctype.h
Go to the documentation of this file.
1 /***
2 *wctype.h - declarations for wide character functions
3 *
4 * Copyright (c) Microsoft Corporation. All rights reserved.
5 * Created from wchar.h January 1996 by P.J. Plauger
6 *
7 *Purpose:
8 * This file contains the types, macros and function declarations for
9 * all ctype-style wide-character functions. They may also be declared in
10 * wchar.h.
11 * [ISO]
12 *
13 * Note: keep in sync with ctype.h and wchar.h.
14 *
15 * [Public]
16 *
17 ****/
18 
19 
20 #pragma once
21 
22 #ifndef _INC_WCTYPE
23 #define _INC_WCTYPE
24 
25 #if !defined(_WIN32)
26 #error ERROR: Only Win32 target supported!
27 #endif
28 
29 #include <crtdefs.h>
30 
31 #pragma pack(push,_CRT_PACKING)
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 
38 /* Define _CRTIMP */
39 
40 #ifndef _CRTIMP
41 #ifdef _DLL
42 #define _CRTIMP __declspec(dllimport)
43 #else /* ndef _DLL */
44 #define _CRTIMP
45 #endif /* _DLL */
46 #endif /* _CRTIMP */
47 
48 /* Define _CRTIMP2 */
49 #ifndef _CRTIMP2
50 #if defined(CRTDLL2) && defined(_CRTBLD)
51 #define _CRTIMP2 __declspec(dllexport)
52 #else /* ndef CRTDLL2 && _CRTBLD */
53 #if defined(_DLL) && !defined(_STATIC_CPPLIB)
54 #define _CRTIMP2 __declspec(dllimport)
55 #else /* ndef _DLL && !STATIC_CPPLIB */
56 #define _CRTIMP2
57 #endif /* _DLL && !STATIC_CPPLIB */
58 #endif /* CRTDLL2 && _CRTBLD */
59 #endif /* _CRTIMP2 */
60 
61 #ifndef _WCHAR_T_DEFINED
62 typedef unsigned short wchar_t;
63 #define _WCHAR_T_DEFINED
64 #endif
65 
66 #ifndef _WCTYPE_T_DEFINED
67 typedef unsigned short wint_t;
68 typedef unsigned short wctype_t;
69 #define _WCTYPE_T_DEFINED
70 #endif
71 
72 
73 #ifndef WEOF
74 #define WEOF (wint_t)(0xFFFF)
75 #endif
76 
77 /*
78  * This declaration allows the user access to the ctype look-up
79  * array _ctype defined in ctype.obj by simply including ctype.h
80  */
81 #ifndef _CRT_CTYPEDATA_DEFINED
82 #define _CRT_CTYPEDATA_DEFINED
83 #ifndef _CTYPE_DISABLE_MACROS
84 
85 #ifdef _CRTBLD
86 extern const unsigned short __newctype[];
87 #if defined(_DLL) && defined(_M_IX86)
88 /* Retained for compatibility with VC++ 5.0 and earlier versions */
89 _CRTIMP const unsigned short ** __cdecl __p__pctype(void);
90 #endif
91 #endif /* _CRTBLD */
92 
93 #ifndef __PCTYPE_FUNC
94 #if defined(_CRT_DISABLE_PERFCRIT_LOCKS) && !defined(_DLL)
95 #define __PCTYPE_FUNC _pctype
96 #else
97 #define __PCTYPE_FUNC __pctype_func()
98 #endif
99 #endif /* __PCTYPE_FUNC */
100 
101 _CRTIMP const unsigned short * __cdecl __pctype_func(void);
102 #if !defined(_M_CEE_PURE)
103 _CRTIMP extern const unsigned short *_pctype;
104 #else
105 #define _pctype (__pctype_func())
106 #endif /* !defined(_M_CEE_PURE) */
107 #endif /* _CTYPE_DISABLE_MACROS */
108 #endif
109 
110 #ifndef _CRT_WCTYPEDATA_DEFINED
111 #define _CRT_WCTYPEDATA_DEFINED
112 #ifndef _CTYPE_DISABLE_MACROS
113 #if !defined(_M_CEE_PURE)
114 _CRTIMP extern const unsigned short _wctype[];
115 #endif /* !defined(_M_CEE_PURE) */
116 
117 #ifdef _CRTBLD
118 extern const unsigned short __newctype[];
119 #if defined(_DLL) && defined(_M_IX86)
120 /* Retained for compatibility with VC++ 5.0 and earlier versions */
121 _CRTIMP const wctype_t ** __cdecl __p__pwctype(void);
122 #endif
123 #endif /* _CRTBLD */
124 
125 _CRTIMP const wctype_t * __cdecl __pwctype_func(void);
126 #if !defined(_M_CEE_PURE)
127 _CRTIMP extern const wctype_t *_pwctype;
128 #else
129 #define _pwctype (__pwctype_func())
130 #endif /* !defined(_M_CEE_PURE) */
131 #endif /* _CTYPE_DISABLE_MACROS */
132 #endif
133 
134 
135 
136 /* set bit masks for the possible character types */
137 
138 #define _UPPER 0x1 /* upper case letter */
139 #define _LOWER 0x2 /* lower case letter */
140 #define _DIGIT 0x4 /* digit[0-9] */
141 #define _SPACE 0x8 /* space, tab, carriage return, newline, */
142  /* vertical tab or form feed */
143 #define _PUNCT 0x10 /* punctuation character */
144 #define _CONTROL 0x20 /* control character */
145 #define _BLANK 0x40 /* space char (tab handled separately) */
146 #define _HEX 0x80 /* hexadecimal digit */
147 
148 #define _LEADBYTE 0x8000 /* multibyte leadbyte */
149 #define _ALPHA (0x0100|_UPPER|_LOWER) /* alphabetic character */
150 
151 
152 /* Function prototypes */
153 
154 #ifndef _WCTYPE_DEFINED
155 
156 /* Character classification function prototypes */
157 /* also declared in ctype.h */
158 
159 _CRTIMP int __cdecl iswalpha(wint_t);
160 _CRTIMP int __cdecl iswupper(wint_t);
161 _CRTIMP int __cdecl iswlower(wint_t);
162 _CRTIMP int __cdecl iswdigit(wint_t);
163 _CRTIMP int __cdecl iswxdigit(wint_t);
164 _CRTIMP int __cdecl iswspace(wint_t);
165 _CRTIMP int __cdecl iswpunct(wint_t);
166 _CRTIMP int __cdecl iswblank(wint_t);
167 _CRTIMP int __cdecl iswalnum(wint_t);
168 _CRTIMP int __cdecl iswprint(wint_t);
169 _CRTIMP int __cdecl iswgraph(wint_t);
170 _CRTIMP int __cdecl iswcntrl(wint_t);
171 _CRTIMP int __cdecl iswascii(wint_t);
172 _CRTIMP int __cdecl isleadbyte(int);
173 
174 _CRTIMP wint_t __cdecl towupper(wint_t);
175 _CRTIMP wint_t __cdecl towlower(wint_t);
176 
177 _CRTIMP int __cdecl iswctype(wint_t, wctype_t);
178 
179 _CRTIMP int __cdecl __iswcsymf(wint_t);
180 _CRTIMP int __cdecl __iswcsym(wint_t);
181 
182 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
183 _CRT_OBSOLETE(iswctype) _CRTIMP int __cdecl is_wctype(wint_t, wctype_t);
184 #endif /* _CRT_USE_WINAPI_FAMILY_DESKTOP_APP */
185 
186 #define _WCTYPE_DEFINED
187 #endif
188 
189 #ifndef _WCTYPE_INLINE_DEFINED
190 #if !defined(__cplusplus) || defined(_M_CEE_PURE) || defined(MRTDLL)
191 #define iswalpha(_c) ( iswctype(_c,_ALPHA) )
192 #define iswupper(_c) ( iswctype(_c,_UPPER) )
193 #define iswlower(_c) ( iswctype(_c,_LOWER) )
194 #define iswdigit(_c) ( iswctype(_c,_DIGIT) )
195 #define iswxdigit(_c) ( iswctype(_c,_HEX) )
196 #define iswspace(_c) ( iswctype(_c,_SPACE) )
197 #define iswpunct(_c) ( iswctype(_c,_PUNCT) )
198 #define iswblank(_c) (((_c) == '\t') ? _BLANK : iswctype(_c,_BLANK) )
199 #define iswalnum(_c) ( iswctype(_c,_ALPHA|_DIGIT) )
200 #define iswprint(_c) ( iswctype(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT) )
201 #define iswgraph(_c) ( iswctype(_c,_PUNCT|_ALPHA|_DIGIT) )
202 #define iswcntrl(_c) ( iswctype(_c,_CONTROL) )
203 #define iswascii(_c) ( (unsigned)(_c) < 0x80 )
204 
205 #define isleadbyte(c) (__pctype_func()[(unsigned char)(c)] & _LEADBYTE)
206 #else /* __cplusplus */
207 inline int __cdecl iswalpha(wint_t _C) {return (iswctype(_C,_ALPHA)); }
208 inline int __cdecl iswupper(wint_t _C) {return (iswctype(_C,_UPPER)); }
209 inline int __cdecl iswlower(wint_t _C) {return (iswctype(_C,_LOWER)); }
210 inline int __cdecl iswdigit(wint_t _C) {return (iswctype(_C,_DIGIT)); }
211 inline int __cdecl iswxdigit(wint_t _C) {return (iswctype(_C,_HEX)); }
212 inline int __cdecl iswspace(wint_t _C) {return (iswctype(_C,_SPACE)); }
213 inline int __cdecl iswpunct(wint_t _C) {return (iswctype(_C,_PUNCT)); }
214 inline int __cdecl iswblank(wint_t _C) {return (((_C) == '\t') ? _BLANK : iswctype(_C,_BLANK)); }
215 inline int __cdecl iswalnum(wint_t _C) {return (iswctype(_C,_ALPHA|_DIGIT)); }
216 inline int __cdecl iswprint(wint_t _C)
217  {return (iswctype(_C,_BLANK|_PUNCT|_ALPHA|_DIGIT)); }
218 inline int __cdecl iswgraph(wint_t _C)
219  {return (iswctype(_C,_PUNCT|_ALPHA|_DIGIT)); }
220 inline int __cdecl iswcntrl(wint_t _C) {return (iswctype(_C,_CONTROL)); }
221 inline int __cdecl iswascii(wint_t _C) {return ((unsigned)(_C) < 0x80); }
222 
223 inline int __cdecl isleadbyte(int _C)
224  {return (__pctype_func()[(unsigned char)(_C)] & _LEADBYTE); }
225 #endif /* __cplusplus */
226 #define _WCTYPE_INLINE_DEFINED
227 #endif /* _WCTYPE_INLINE_DEFINED */
228 
229 typedef wchar_t wctrans_t;
230 _CRTIMP wint_t __cdecl towctrans(wint_t, wctrans_t);
231 _CRTIMP wctrans_t __cdecl wctrans(const char *);
232 _CRTIMP wctype_t __cdecl wctype(const char *);
233 
234 
235 #ifdef __cplusplus
236 }
237 #endif
238 
239 #pragma pack(pop)
240 
241 #endif /* _INC_WCTYPE */
_CRTIMP wint_t __cdecl towlower(wint_t)
#define _BLANK
Definition: wctype.h:145
#define iswalnum(_c)
Definition: wctype.h:199
#define _LEADBYTE
Definition: wctype.h:148
#define _ALPHA
Definition: wctype.h:149
#define _CRTIMP
Definition: crtdefs.h:23
wchar_t wctrans_t
Definition: wctype.h:229
_CRTIMP const unsigned short * _pctype
_CRTIMP int __cdecl __iswcsymf(wint_t)
#define iswprint(_c)
Definition: wctype.h:200
#define isleadbyte(c)
Definition: wctype.h:205
#define iswspace(_c)
Definition: wctype.h:196
unsigned short wint_t
Definition: crtdefs.h:541
#define _LOWER
Definition: wctype.h:139
_CRTIMP wctrans_t __cdecl wctrans(const char *)
#define iswgraph(_c)
Definition: wctype.h:201
#define _CONTROL
Definition: wctype.h:144
#define iswlower(_c)
Definition: wctype.h:193
_CRTIMP wint_t __cdecl towupper(wint_t)
_CRTIMP int __cdecl __iswcsym(wint_t)
#define iswalpha(_c)
Definition: wctype.h:191
#define iswxdigit(_c)
Definition: wctype.h:195
_CRTIMP const unsigned short *__cdecl __pctype_func(void)
unsigned short wchar_t
Definition: crtdefs.h:536
#define iswupper(_c)
Definition: wctype.h:192
_CRT_OBSOLETE(iswctype) _CRTIMP int __cdecl is_wctype(wint_t
_CRTIMP wint_t __cdecl towctrans(wint_t, wctrans_t)
_In_ wchar_t _C
Definition: wchar.h:1295
_CRTIMP int __cdecl iswctype(wint_t, wctype_t)
_CRTIMP wctype_t __cdecl wctype(const char *)
#define _DIGIT
Definition: wctype.h:140
#define _PUNCT
Definition: wctype.h:143
_CRTIMP const wctype_t * _pwctype
#define iswcntrl(_c)
Definition: wctype.h:202
#define iswblank(_c)
Definition: wctype.h:198
#define _UPPER
Definition: wctype.h:138
wctype_t
Definition: wctype.h:183
#define _SPACE
Definition: wctype.h:141
#define _HEX
Definition: wctype.h:146
_CRTIMP const wctype_t *__cdecl __pwctype_func(void)
_CRTIMP const unsigned short _wctype[]
#define iswascii(_c)
Definition: wctype.h:203
#define iswpunct(_c)
Definition: wctype.h:197
#define iswdigit(_c)
Definition: wctype.h:194