4 * Functions for testing wide character types and converting characters.
6 * This file is part of the Mingw32 package.
9 * Created by Mumit Khan <khan@xraylith.wisc.edu>
11 * THIS SOFTWARE IS NOT COPYRIGHTED
13 * This source code is offered for use in the public domain. You may
14 * use, modify or distribute it freely.
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.
26 /* All the headers include this file. */
29 #define __need_wchar_t
33 #endif /* Not RC_INVOKED */
36 * The following flags are used to tell iswctype and _isctype what character
37 * types you are looking for.
44 #define _CONTROL 0x0020
47 #define _LEADBYTE 0x8000
58 #define WEOF (wchar_t)(0xFFFF)
61 #ifndef _WCTYPE_T_DEFINED
62 typedef wchar_t wctype_t;
63 #define _WCTYPE_T_DEFINED
66 /* Wide character equivalents - also in ctype.h */
67 _CRTIMP
int __cdecl
iswalnum(wint_t);
68 _CRTIMP
int __cdecl
iswalpha(wint_t);
69 _CRTIMP
int __cdecl
iswascii(wint_t);
70 _CRTIMP
int __cdecl
iswcntrl(wint_t);
71 _CRTIMP
int __cdecl
iswctype(wint_t, wctype_t);
72 _CRTIMP
int __cdecl
is_wctype(wint_t, wctype_t); /* Obsolete! */
73 _CRTIMP
int __cdecl
iswdigit(wint_t);
74 _CRTIMP
int __cdecl
iswgraph(wint_t);
75 _CRTIMP
int __cdecl
iswlower(wint_t);
76 _CRTIMP
int __cdecl
iswprint(wint_t);
77 _CRTIMP
int __cdecl
iswpunct(wint_t);
78 _CRTIMP
int __cdecl
iswspace(wint_t);
79 _CRTIMP
int __cdecl
iswupper(wint_t);
80 _CRTIMP
int __cdecl
iswxdigit(wint_t);
82 /* Older MS docs uses wchar_t for arg and return type, while newer
83 online MS docs say arg is wint_t and return is int.
84 ISO C uses wint_t for both. */
85 _CRTIMP
wint_t __cdecl
towlower (wint_t);
86 _CRTIMP
wint_t __cdecl
towupper (wint_t);
88 _CRTIMP
int __cdecl
isleadbyte (int);
92 #ifdef __DECLSPEC_SUPPORTED
93 __MINGW_IMPORT
unsigned short _ctype
[];
95 __MINGW_IMPORT
unsigned short* _pctype
;
97 __MINGW_IMPORT
unsigned short* _pctype_dll
;
98 # define _pctype _pctype_dll
101 #else /* ! __DECLSPEC_SUPPORTED */
102 extern unsigned short** _imp___ctype
;
103 #define _ctype (*_imp___ctype)
105 extern unsigned short** _imp___pctype
;
106 # define _pctype (*_imp___pctype)
108 extern unsigned short** _imp___pctype_dll
;
109 # define _pctype (*_imp___pctype_dll)
111 #endif /* __DECLSPEC_SUPPORTED */
114 #if !(defined (__NO_INLINE__) || defined(__NO_CTYPE_INLINES) \
115 || defined(__WCTYPE_INLINES_DEFINED))
116 #define __WCTYPE_INLINES_DEFINED
117 __CRT_INLINE
int __cdecl
iswalnum(wint_t wc
) {return (iswctype(wc
,_ALPHA
|_DIGIT
));}
118 __CRT_INLINE
int __cdecl
iswalpha(wint_t wc
) {return (iswctype(wc
,_ALPHA
));}
119 __CRT_INLINE
int __cdecl
iswascii(wint_t wc
) {return ((wc
& ~0x7F) ==0);}
120 __CRT_INLINE
int __cdecl
iswcntrl(wint_t wc
) {return (iswctype(wc
,_CONTROL
));}
121 __CRT_INLINE
int __cdecl
iswdigit(wint_t wc
) {return (iswctype(wc
,_DIGIT
));}
122 __CRT_INLINE
int __cdecl
iswgraph(wint_t wc
) {return (iswctype(wc
,_PUNCT
|_ALPHA
|_DIGIT
));}
123 __CRT_INLINE
int __cdecl
iswlower(wint_t wc
) {return (iswctype(wc
,_LOWER
));}
124 __CRT_INLINE
int __cdecl
iswprint(wint_t wc
) {return (iswctype(wc
,_BLANK
|_PUNCT
|_ALPHA
|_DIGIT
));}
125 __CRT_INLINE
int __cdecl
iswpunct(wint_t wc
) {return (iswctype(wc
,_PUNCT
));}
126 __CRT_INLINE
int __cdecl
iswspace(wint_t wc
) {return (iswctype(wc
,_SPACE
));}
127 __CRT_INLINE
int __cdecl
iswupper(wint_t wc
) {return (iswctype(wc
,_UPPER
));}
128 __CRT_INLINE
int __cdecl
iswxdigit(wint_t wc
) {return (iswctype(wc
,_HEX
));}
129 __CRT_INLINE
int __cdecl
isleadbyte(int c
) {return (_pctype
[(unsigned char)(c
)] & _LEADBYTE
);}
130 #endif /* !(defined(__NO_CTYPE_INLINES) || defined(__WCTYPE_INLINES_DEFINED)) */
133 typedef wchar_t wctrans_t;
135 /* These are resolved by libmingwex.a. Note, that they are also exported
136 by the MS C++ runtime lib (msvcp60.dll). The msvcp60.dll implementations
137 of wctrans and towctrans are not C99 compliant in that wctrans("tolower")
138 returns 0, while std specifies that a non-zero value should be returned
139 for a valid string descriptor. If you want the MS behaviour (and you have
140 msvcp60.dll in your path) add -lmsvcp60 to your command line. */
142 wint_t __cdecl
towctrans(wint_t, wctrans_t);
143 wctrans_t __cdecl
wctrans(const char*);
144 wctype_t __cdecl
wctype(const char*);
150 #endif /* Not RC_INVOKED */
152 #endif /* Not _WCTYPE_H_ */