Update bash/readline settings for Unicode line editing
[msysgit.git] / mingw / include / wctype.h
blob12660345415e97efd7770c3b71fdcbdb66db304f
1 /*
2 * wctype.h
4 * Functions for testing wide character types and converting characters.
6 * This file is part of the Mingw32 package.
8 * Contributors:
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.
23 #ifndef _WCTYPE_H_
24 #define _WCTYPE_H_
26 /* All the headers include this file. */
27 #include <_mingw.h>
29 #define __need_wchar_t
30 #define __need_wint_t
31 #ifndef RC_INVOKED
32 #include <stddef.h>
33 #endif /* Not RC_INVOKED */
36 * The following flags are used to tell iswctype and _isctype what character
37 * types you are looking for.
39 #define _UPPER 0x0001
40 #define _LOWER 0x0002
41 #define _DIGIT 0x0004
42 #define _SPACE 0x0008
43 #define _PUNCT 0x0010
44 #define _CONTROL 0x0020
45 #define _BLANK 0x0040
46 #define _HEX 0x0080
47 #define _LEADBYTE 0x8000
49 #define _ALPHA 0x0103
51 #ifndef RC_INVOKED
53 #ifdef __cplusplus
54 extern "C" {
55 #endif
57 #ifndef WEOF
58 #define WEOF (wchar_t)(0xFFFF)
59 #endif
61 #ifndef _WCTYPE_T_DEFINED
62 typedef wchar_t wctype_t;
63 #define _WCTYPE_T_DEFINED
64 #endif
66 /* Wide character equivalents - also in ctype.h */
67 _CRTIMP int __cdecl __MINGW_NOTHROW iswalnum(wint_t);
68 _CRTIMP int __cdecl __MINGW_NOTHROW iswalpha(wint_t);
69 _CRTIMP int __cdecl __MINGW_NOTHROW iswascii(wint_t);
70 _CRTIMP int __cdecl __MINGW_NOTHROW iswcntrl(wint_t);
71 _CRTIMP int __cdecl __MINGW_NOTHROW iswctype(wint_t, wctype_t);
72 _CRTIMP int __cdecl __MINGW_NOTHROW is_wctype(wint_t, wctype_t); /* Obsolete! */
73 _CRTIMP int __cdecl __MINGW_NOTHROW iswdigit(wint_t);
74 _CRTIMP int __cdecl __MINGW_NOTHROW iswgraph(wint_t);
75 _CRTIMP int __cdecl __MINGW_NOTHROW iswlower(wint_t);
76 _CRTIMP int __cdecl __MINGW_NOTHROW iswprint(wint_t);
77 _CRTIMP int __cdecl __MINGW_NOTHROW iswpunct(wint_t);
78 _CRTIMP int __cdecl __MINGW_NOTHROW iswspace(wint_t);
79 _CRTIMP int __cdecl __MINGW_NOTHROW iswupper(wint_t);
80 _CRTIMP int __cdecl __MINGW_NOTHROW iswxdigit(wint_t);
82 #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \
83 || !defined __STRICT_ANSI__ || defined __cplusplus
84 int __cdecl __MINGW_NOTHROW iswblank (wint_t);
85 #endif
87 /* Older MS docs uses wchar_t for arg and return type, while newer
88 online MS docs say arg is wint_t and return is int.
89 ISO C uses wint_t for both. */
90 _CRTIMP wint_t __cdecl __MINGW_NOTHROW towlower (wint_t);
91 _CRTIMP wint_t __cdecl __MINGW_NOTHROW towupper (wint_t);
93 _CRTIMP int __cdecl __MINGW_NOTHROW isleadbyte (int);
95 /* Also in ctype.h */
97 #ifdef __DECLSPEC_SUPPORTED
98 # if __MSVCRT_VERSION__ <= 0x0700
99 __MINGW_IMPORT unsigned short _ctype[];
100 # endif
101 # ifdef __MSVCRT__
102 __MINGW_IMPORT unsigned short* _pctype;
103 # else /* CRTDLL */
104 __MINGW_IMPORT unsigned short* _pctype_dll;
105 # define _pctype _pctype_dll
106 # endif
108 #else /* ! __DECLSPEC_SUPPORTED */
109 # if __MSVCRT_VERSION__ <= 0x0700
110 extern unsigned short** _imp___ctype;
111 # define _ctype (*_imp___ctype)
112 # endif
113 # ifdef __MSVCRT__
114 extern unsigned short** _imp___pctype;
115 # define _pctype (*_imp___pctype)
116 # else /* CRTDLL */
117 extern unsigned short** _imp___pctype_dll;
118 # define _pctype (*_imp___pctype_dll)
119 # endif /* CRTDLL */
120 #endif /* __DECLSPEC_SUPPORTED */
123 #if !(defined (__NO_INLINE__) || defined(__NO_CTYPE_INLINES) \
124 || defined(__WCTYPE_INLINES_DEFINED))
125 #define __WCTYPE_INLINES_DEFINED
126 __CRT_INLINE int __cdecl __MINGW_NOTHROW iswalnum(wint_t wc) {return (iswctype(wc,_ALPHA|_DIGIT));}
127 __CRT_INLINE int __cdecl __MINGW_NOTHROW iswalpha(wint_t wc) {return (iswctype(wc,_ALPHA));}
128 __CRT_INLINE int __cdecl __MINGW_NOTHROW iswascii(wint_t wc) {return ((wc & ~0x7F) ==0);}
129 __CRT_INLINE int __cdecl __MINGW_NOTHROW iswcntrl(wint_t wc) {return (iswctype(wc,_CONTROL));}
130 __CRT_INLINE int __cdecl __MINGW_NOTHROW iswdigit(wint_t wc) {return (iswctype(wc,_DIGIT));}
131 __CRT_INLINE int __cdecl __MINGW_NOTHROW iswgraph(wint_t wc) {return (iswctype(wc,_PUNCT|_ALPHA|_DIGIT));}
132 __CRT_INLINE int __cdecl __MINGW_NOTHROW iswlower(wint_t wc) {return (iswctype(wc,_LOWER));}
133 __CRT_INLINE int __cdecl __MINGW_NOTHROW iswprint(wint_t wc) {return (iswctype(wc,_BLANK|_PUNCT|_ALPHA|_DIGIT));}
134 __CRT_INLINE int __cdecl __MINGW_NOTHROW iswpunct(wint_t wc) {return (iswctype(wc,_PUNCT));}
135 __CRT_INLINE int __cdecl __MINGW_NOTHROW iswspace(wint_t wc) {return (iswctype(wc,_SPACE));}
136 __CRT_INLINE int __cdecl __MINGW_NOTHROW iswupper(wint_t wc) {return (iswctype(wc,_UPPER));}
137 __CRT_INLINE int __cdecl __MINGW_NOTHROW iswxdigit(wint_t wc) {return (iswctype(wc,_HEX));}
138 __CRT_INLINE int __cdecl __MINGW_NOTHROW isleadbyte(int c) {return (_pctype[(unsigned char)(c)] & _LEADBYTE);}
140 #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \
141 || !defined __STRICT_ANSI__ || defined __cplusplus
142 __CRT_INLINE int __cdecl __MINGW_NOTHROW iswblank (wint_t wc)
143 {return (iswctype(wc, _BLANK) || wc == L'\t');}
144 #endif
146 #endif /* !(defined(__NO_CTYPE_INLINES) || defined(__WCTYPE_INLINES_DEFINED)) */
148 typedef wchar_t wctrans_t;
150 /* These are resolved by libmingwex.a. Note, that they are also exported
151 by the MS C++ runtime lib (msvcp60.dll). The msvcp60.dll implementations
152 of wctrans and towctrans are not C99 compliant in that wctrans("tolower")
153 returns 0, while std specifies that a non-zero value should be returned
154 for a valid string descriptor. If you want the MS behaviour (and you have
155 msvcp60.dll in your path) add -lmsvcp60 to your command line. */
157 wint_t __cdecl __MINGW_NOTHROW towctrans(wint_t, wctrans_t);
158 wctrans_t __cdecl __MINGW_NOTHROW wctrans(const char*);
159 wctype_t __cdecl __MINGW_NOTHROW wctype(const char*);
161 #ifdef __cplusplus
163 #endif
165 #endif /* Not RC_INVOKED */
167 #endif /* Not _WCTYPE_H_ */