OSDN Git Service

Redo the filters based on assumptions discussed in mingw-dvlpr list.
[mingw/mingw-org-wsl.git] / include / wctype.h
1 /**
2  * @file wctype.h
3  * @copy 2012 MinGW.org project
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  * 
12  * The above copyright notice and this permission notice (including the next
13  * paragraph) shall be included in all copies or substantial portions of the
14  * Software.
15  * 
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  * DEALINGS IN THE SOFTWARE.
23  */
24 #ifndef _WCTYPE_H
25 #define _WCTYPE_H
26 #pragma GCC system_header
27
28 /* All the headers include this file. */
29 #include <_mingw.h>
30
31 #define __need_wchar_t
32 #define __need_wint_t
33 #ifndef RC_INVOKED
34 #include <stddef.h>
35 #endif  /* Not RC_INVOKED */
36
37 /*
38  * The following flags are used to tell iswctype and _isctype what character
39  * types you are looking for.
40  */
41 #define _UPPER          0x0001
42 #define _LOWER          0x0002
43 #define _DIGIT          0x0004
44 #define _SPACE          0x0008
45 #define _PUNCT          0x0010
46 #define _CONTROL        0x0020
47 #define _BLANK          0x0040
48 #define _HEX            0x0080
49 #define _LEADBYTE       0x8000
50
51 #define _ALPHA          0x0103
52
53 #ifndef RC_INVOKED
54
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58
59 #ifndef WEOF
60 #define WEOF    (wchar_t)(0xFFFF)
61 #endif
62
63 #ifndef _WCTYPE_T_DEFINED
64 typedef wchar_t wctype_t;
65 #define _WCTYPE_T_DEFINED
66 #endif
67
68 /* Wide character equivalents - also in ctype.h */
69 _CRTIMP int __cdecl __MINGW_NOTHROW     iswalnum(wint_t);
70 _CRTIMP int __cdecl __MINGW_NOTHROW     iswalpha(wint_t);
71 _CRTIMP int __cdecl __MINGW_NOTHROW     iswascii(wint_t);
72 _CRTIMP int __cdecl __MINGW_NOTHROW     iswcntrl(wint_t);
73 _CRTIMP int __cdecl __MINGW_NOTHROW     iswctype(wint_t, wctype_t);
74 _CRTIMP int __cdecl __MINGW_NOTHROW     is_wctype(wint_t, wctype_t);    /* Obsolete! */
75 _CRTIMP int __cdecl __MINGW_NOTHROW     iswdigit(wint_t);
76 _CRTIMP int __cdecl __MINGW_NOTHROW     iswgraph(wint_t);
77 _CRTIMP int __cdecl __MINGW_NOTHROW     iswlower(wint_t);
78 _CRTIMP int __cdecl __MINGW_NOTHROW     iswprint(wint_t);
79 _CRTIMP int __cdecl __MINGW_NOTHROW     iswpunct(wint_t);
80 _CRTIMP int __cdecl __MINGW_NOTHROW     iswspace(wint_t);
81 _CRTIMP int __cdecl __MINGW_NOTHROW     iswupper(wint_t);
82 _CRTIMP int __cdecl __MINGW_NOTHROW     iswxdigit(wint_t);
83
84 #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \
85      || !defined __STRICT_ANSI__ || defined __cplusplus
86 int __cdecl __MINGW_NOTHROW iswblank (wint_t);
87 #endif
88
89 /* Older MS docs uses wchar_t for arg and return type, while newer
90    online MS docs say arg is wint_t and return is int.
91    ISO C uses wint_t for both.  */
92 _CRTIMP wint_t __cdecl __MINGW_NOTHROW  towlower (wint_t);
93 _CRTIMP wint_t __cdecl __MINGW_NOTHROW  towupper (wint_t);
94
95 _CRTIMP int __cdecl __MINGW_NOTHROW     isleadbyte (int);
96
97 /* Also in ctype.h */
98
99 # if __MSVCRT_VERSION__ <= 0x0700
100   __MINGW_IMPORT unsigned short _ctype[];
101 # endif 
102 __MINGW_IMPORT unsigned short* _pctype;
103
104
105 #if !(defined (__NO_INLINE__) || defined(__NO_CTYPE_INLINES) \
106       || defined(__WCTYPE_INLINES_DEFINED))
107 #define __WCTYPE_INLINES_DEFINED
108 __CRT_INLINE int __cdecl __MINGW_NOTHROW iswalnum(wint_t wc) {return (iswctype(wc,_ALPHA|_DIGIT));}
109 __CRT_INLINE int __cdecl __MINGW_NOTHROW iswalpha(wint_t wc) {return (iswctype(wc,_ALPHA));}
110 __CRT_INLINE int __cdecl __MINGW_NOTHROW iswascii(wint_t wc) {return ((wc & ~0x7F) ==0);}
111 __CRT_INLINE int __cdecl __MINGW_NOTHROW iswcntrl(wint_t wc) {return (iswctype(wc,_CONTROL));}
112 __CRT_INLINE int __cdecl __MINGW_NOTHROW iswdigit(wint_t wc) {return (iswctype(wc,_DIGIT));}
113 __CRT_INLINE int __cdecl __MINGW_NOTHROW iswgraph(wint_t wc) {return (iswctype(wc,_PUNCT|_ALPHA|_DIGIT));}
114 __CRT_INLINE int __cdecl __MINGW_NOTHROW iswlower(wint_t wc) {return (iswctype(wc,_LOWER));}
115 __CRT_INLINE int __cdecl __MINGW_NOTHROW iswprint(wint_t wc) {return (iswctype(wc,_BLANK|_PUNCT|_ALPHA|_DIGIT));}
116 __CRT_INLINE int __cdecl __MINGW_NOTHROW iswpunct(wint_t wc) {return (iswctype(wc,_PUNCT));}
117 __CRT_INLINE int __cdecl __MINGW_NOTHROW iswspace(wint_t wc) {return (iswctype(wc,_SPACE));}
118 __CRT_INLINE int __cdecl __MINGW_NOTHROW iswupper(wint_t wc) {return (iswctype(wc,_UPPER));}
119 __CRT_INLINE int __cdecl __MINGW_NOTHROW iswxdigit(wint_t wc) {return (iswctype(wc,_HEX));}
120 __CRT_INLINE int __cdecl __MINGW_NOTHROW isleadbyte(int c) {return (_pctype[(unsigned char)(c)] & _LEADBYTE);}
121
122 #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \
123      || !defined __STRICT_ANSI__ || defined __cplusplus
124 __CRT_INLINE int __cdecl __MINGW_NOTHROW iswblank (wint_t wc)
125   {return (iswctype(wc, _BLANK) || wc == L'\t');}
126 #endif
127
128 #endif /* !(defined(__NO_CTYPE_INLINES) || defined(__WCTYPE_INLINES_DEFINED)) */
129
130 typedef wchar_t wctrans_t;
131
132 /* These are resolved by libmingwex.a.  Note, that they are also exported
133    by the MS C++ runtime lib (msvcp60.dll).  The msvcp60.dll implementations
134    of wctrans and towctrans are not C99 compliant in that wctrans("tolower")
135    returns 0, while std specifies that a non-zero value should be returned
136    for a valid string descriptor.  If you want the MS behaviour (and you have
137    msvcp60.dll in your path) add -lmsvcp60 to your command line.  */    
138
139 wint_t __cdecl __MINGW_NOTHROW          towctrans(wint_t, wctrans_t);
140 wctrans_t __cdecl __MINGW_NOTHROW       wctrans(const char*);
141 wctype_t __cdecl __MINGW_NOTHROW        wctype(const char*);
142
143 #ifdef __cplusplus
144 }
145 #endif
146
147 #endif  /* Not RC_INVOKED */
148 #endif  /* Not _WCTYPE_H */