|
|
|
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 |
|
#if _MSC_VER > 1000 |
21 |
|
#pragma once |
22 |
|
#endif |
23 |
|
|
24 |
|
#ifndef _INC_WCTYPE |
25 |
|
#define _INC_WCTYPE |
26 |
|
|
27 |
|
#if !defined(_WIN32) |
28 |
|
#error ERROR: Only Win32 target supported! |
29 |
|
#endif |
30 |
|
|
31 |
|
#include <crtdefs.h> |
32 |
|
|
33 |
|
#ifdef _MSC_VER |
34 |
|
#pragma pack(push,_CRT_PACKING) |
35 |
|
#endif /* _MSC_VER */ |
36 |
|
|
37 |
|
#ifdef __cplusplus |
38 |
|
extern "C" { |
39 |
|
#endif |
40 |
|
|
41 |
|
|
42 |
|
/* Define _CRTIMP */ |
43 |
|
|
44 |
|
#ifndef _CRTIMP |
45 |
|
#ifdef _DLL |
46 |
|
#define _CRTIMP __declspec(dllimport) |
47 |
|
#else /* ndef _DLL */ |
48 |
|
#define _CRTIMP |
49 |
|
#endif /* _DLL */ |
50 |
|
#endif /* _CRTIMP */ |
51 |
|
|
52 |
|
/* Define _CRTIMP2 */ |
53 |
|
#ifndef _CRTIMP2 |
54 |
|
#if defined(_DLL) && !defined(_STATIC_CPPLIB) |
55 |
|
#define _CRTIMP2 __declspec(dllimport) |
56 |
|
#else /* ndef _DLL && !STATIC_CPPLIB */ |
57 |
|
#define _CRTIMP2 |
58 |
|
#endif /* _DLL && !STATIC_CPPLIB */ |
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 |
|
#ifndef __PCTYPE_FUNC |
86 |
|
#if defined(_CRT_DISABLE_PERFCRIT_LOCKS) && !defined(_DLL) |
87 |
|
#define __PCTYPE_FUNC _pctype |
88 |
|
#else |
89 |
|
#define __PCTYPE_FUNC __pctype_func() |
90 |
|
#endif |
91 |
|
#endif /* __PCTYPE_FUNC */ |
92 |
|
|
93 |
|
_CRTIMP const unsigned short * __cdecl __pctype_func(void); |
94 |
|
#if !defined(_M_CEE_PURE) |
95 |
|
_CRTIMP extern const unsigned short *_pctype; |
96 |
|
#else |
97 |
|
#define _pctype (__pctype_func()) |
98 |
|
#endif /* !defined(_M_CEE_PURE) */ |
99 |
|
#endif /* _CTYPE_DISABLE_MACROS */ |
100 |
|
#endif |
101 |
|
|
102 |
|
#ifndef _CRT_WCTYPEDATA_DEFINED |
103 |
|
#define _CRT_WCTYPEDATA_DEFINED |
104 |
|
#ifndef _CTYPE_DISABLE_MACROS |
105 |
|
#if !defined(_M_CEE_PURE) |
106 |
|
_CRTIMP extern const unsigned short _wctype[]; |
107 |
|
#endif /* !defined(_M_CEE_PURE) */ |
108 |
|
|
109 |
|
_CRTIMP const wctype_t * __cdecl __pwctype_func(void); |
110 |
|
#if !defined(_M_CEE_PURE) |
111 |
|
_CRTIMP extern const wctype_t *_pwctype; |
112 |
|
#else |
113 |
|
#define _pwctype (__pwctype_func()) |
114 |
|
#endif /* !defined(_M_CEE_PURE) */ |
115 |
|
#endif /* _CTYPE_DISABLE_MACROS */ |
116 |
|
#endif |
117 |
|
|
118 |
|
|
119 |
|
|
120 |
|
/* set bit masks for the possible character types */ |
121 |
|
|
122 |
|
#define _UPPER 0x1 /* upper case letter */ |
123 |
|
#define _LOWER 0x2 /* lower case letter */ |
124 |
|
#define _DIGIT 0x4 /* digit[0-9] */ |
125 |
|
#define _SPACE 0x8 /* tab, carriage return, newline, */ |
126 |
|
/* vertical tab or form feed */ |
127 |
|
#define _PUNCT 0x10 /* punctuation character */ |
128 |
|
#define _CONTROL 0x20 /* control character */ |
129 |
|
#define _BLANK 0x40 /* space char */ |
130 |
|
#define _HEX 0x80 /* hexadecimal digit */ |
131 |
|
|
132 |
|
#define _LEADBYTE 0x8000 /* multibyte leadbyte */ |
133 |
|
#define _ALPHA (0x0100|_UPPER|_LOWER) /* alphabetic character */ |
134 |
|
|
135 |
|
|
136 |
|
/* Function prototypes */ |
137 |
|
|
138 |
|
#ifndef _WCTYPE_DEFINED |
149 |
|
_CRTIMP int __cdecl iswpunct(wint_t); |
150 |
|
_CRTIMP int __cdecl iswalnum(wint_t); |
151 |
|
_CRTIMP int __cdecl iswprint(wint_t); |
152 |
|
_CRTIMP int __cdecl iswgraph(wint_t); |
153 |
|
_CRTIMP int __cdecl iswcntrl(wint_t); |
154 |
|
_CRTIMP int __cdecl iswascii(wint_t); |
155 |
|
_CRTIMP int __cdecl isleadbyte(int); |
156 |
|
|
157 |
|
_CRTIMP wint_t __cdecl towupper(wint_t); |
158 |
|
_CRTIMP wint_t __cdecl towlower(wint_t); |
159 |
|
|
160 |
|
_CRTIMP int __cdecl iswctype(wint_t, wctype_t); |
161 |
|
|
162 |
|
_CRTIMP int __cdecl __iswcsymf(wint_t); |
163 |
|
_CRTIMP int __cdecl __iswcsym(wint_t); |
164 |
|
|
165 |
|
_CRT_OBSOLETE(iswctype) _CRTIMP int __cdecl is_wctype(wint_t, wctype_t); |
166 |
|
|
167 |
|
#define _WCTYPE_DEFINED |
168 |
|
#endif |
169 |
|
|
170 |
|
#ifndef _WCTYPE_INLINE_DEFINED |
171 |
|
#if !defined(__cplusplus) || defined(_M_CEE_PURE) || defined(MRTDLL) |
172 |
|
#define iswalpha(_c) ( iswctype(_c,_ALPHA) ) |
173 |
|
#define iswupper(_c) ( iswctype(_c,_UPPER) ) |
174 |
|
#define iswlower(_c) ( iswctype(_c,_LOWER) ) |
175 |
|
#define iswdigit(_c) ( iswctype(_c,_DIGIT) ) |
176 |
|
#define iswxdigit(_c) ( iswctype(_c,_HEX) ) |
177 |
|
#define iswspace(_c) ( iswctype(_c,_SPACE) ) |
178 |
|
#define iswpunct(_c) ( iswctype(_c,_PUNCT) ) |
179 |
|
#define iswalnum(_c) ( iswctype(_c,_ALPHA|_DIGIT) ) |
180 |
|
#define iswprint(_c) ( iswctype(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT) ) |
181 |
|
#define iswgraph(_c) ( iswctype(_c,_PUNCT|_ALPHA|_DIGIT) ) |
182 |
|
#define iswcntrl(_c) ( iswctype(_c,_CONTROL) ) |
183 |
|
#define iswascii(_c) ( (unsigned)(_c) < 0x80 ) |
184 |
|
|
185 |
|
#define isleadbyte(c) (__pctype_func()[(unsigned char)(c)] & _LEADBYTE) |
186 |
|
#else /* __cplusplus */ |
187 |
|
inline int __cdecl iswalpha(wint_t _C) {return (iswctype(_C,_ALPHA)); } |
188 |
|
inline int __cdecl iswupper(wint_t _C) {return (iswctype(_C,_UPPER)); } |
189 |
|
inline int __cdecl iswlower(wint_t _C) {return (iswctype(_C,_LOWER)); } |
190 |
|
inline int __cdecl iswdigit(wint_t _C) {return (iswctype(_C,_DIGIT)); } |
191 |
|
inline int __cdecl iswxdigit(wint_t _C) {return (iswctype(_C,_HEX)); } |
192 |
|
inline int __cdecl iswspace(wint_t _C) {return (iswctype(_C,_SPACE)); } |
193 |
|
inline int __cdecl iswpunct(wint_t _C) {return (iswctype(_C,_PUNCT)); } |
194 |
|
inline int __cdecl iswalnum(wint_t _C) {return (iswctype(_C,_ALPHA|_DIGIT)); } |
195 |
|
inline int __cdecl iswprint(wint_t _C) |
196 |
|
{return (iswctype(_C,_BLANK|_PUNCT|_ALPHA|_DIGIT)); } |
197 |
|
inline int __cdecl iswgraph(wint_t _C) |
198 |
|
{return (iswctype(_C,_PUNCT|_ALPHA|_DIGIT)); } |
199 |
|
inline int __cdecl iswcntrl(wint_t _C) {return (iswctype(_C,_CONTROL)); } |
200 |
|
inline int __cdecl iswascii(wint_t _C) {return ((unsigned)(_C) < 0x80); } |
201 |
|
|
202 |
|
inline int __cdecl isleadbyte(int _C) |
203 |
|
{return (__pctype_func()[(unsigned char)(_C)] & _LEADBYTE); } |
204 |
|
#endif /* __cplusplus */ |
205 |
|
#define _WCTYPE_INLINE_DEFINED |
206 |
|
#endif /* _WCTYPE_INLINE_DEFINED */ |
207 |
|
|
208 |
|
typedef wchar_t wctrans_t; |
209 |
|
_MRTIMP2 wint_t __cdecl towctrans(wint_t, wctrans_t); |
210 |
|
_MRTIMP2 wctrans_t __cdecl wctrans(const char *); |
211 |
|
_MRTIMP2 wctype_t __cdecl wctype(const char *); |
212 |
|
|
213 |
|
|
214 |
|
#ifdef __cplusplus |
215 |
|
} |
216 |
|
#endif |
217 |
|
|
218 |
|
#ifdef _MSC_VER |
219 |
|
#pragma pack(pop) |
220 |
|
#endif /* _MSC_VER */ |
221 |
|
|
222 |
|
#endif /* _INC_WCTYPE */ |
223 |
|
|
|
|
|