Home | History | Annotate | Download | only in include
      1 /**
      2  * This file has no copyright assigned and is placed in the Public Domain.
      3  * This file is part of the mingw-w64 runtime package.
      4  * No warranty is given; refer to the file DISCLAIMER.PD within this package.
      5  */
      6 #ifndef _INC_WCTYPE
      7 #define _INC_WCTYPE
      8 
      9 #ifndef _WIN32
     10 #error Only Win32 target is supported!
     11 #endif
     12 
     13 #include <crtdefs.h>
     14 
     15 #pragma pack(push,_CRT_PACKING)
     16 
     17 #ifdef __cplusplus
     18 extern "C" {
     19 #endif
     20 
     21 #ifndef _CRTIMP
     22 #define _CRTIMP __declspec(dllimport)
     23 #endif
     24 
     25 #ifndef _WCHAR_T_DEFINED
     26 #define _WCHAR_T_DEFINED
     27 #ifndef __cplusplus
     28   typedef unsigned short wchar_t;
     29 #endif /* C++ */
     30 #endif /* _WCHAR_T_DEFINED */
     31 
     32 #ifndef _WCTYPE_T_DEFINED
     33 #define _WCTYPE_T_DEFINED
     34   typedef unsigned short wint_t;
     35   typedef unsigned short wctype_t;
     36 #endif /* _WCTYPE_T_DEFINED */
     37 
     38 #ifndef WEOF
     39 #define WEOF (wint_t)(0xFFFF)
     40 #endif
     41 
     42 #ifndef _CRT_CTYPEDATA_DEFINED
     43 #define _CRT_CTYPEDATA_DEFINED
     44 #ifndef _CTYPE_DISABLE_MACROS
     45 
     46 #ifndef __PCTYPE_FUNC
     47 #define __PCTYPE_FUNC __pctype_func()
     48 #ifdef _MSVCRT_
     49 #define __pctype_func() (_pctype)
     50 #else
     51 #define __pctype_func() (* __MINGW_IMP_SYMBOL(_pctype))
     52 #endif
     53 #endif
     54 
     55 #ifndef _pctype
     56 #ifdef _MSVCRT_
     57   extern unsigned short *_pctype;
     58 #else
     59   extern unsigned short ** __MINGW_IMP_SYMBOL(_pctype);
     60 #define _pctype (* __MINGW_IMP_SYMBOL(_pctype))
     61 #endif
     62 #endif
     63 
     64 #endif
     65 #endif
     66 
     67 #ifndef _CRT_WCTYPEDATA_DEFINED
     68 #define _CRT_WCTYPEDATA_DEFINED
     69 #ifndef _CTYPE_DISABLE_MACROS
     70 #ifndef _wctype
     71 #ifdef _MSVCRT_
     72   extern unsigned short *_wctype;
     73 #else
     74   extern unsigned short ** __MINGW_IMP_SYMBOL(_wctype);
     75 #define _wctype (* __MINGW_IMP_SYMBOL(_wctype))
     76 #endif
     77 #endif
     78 
     79 #ifndef _pwctype
     80 #ifdef _MSVCRT_
     81   extern unsigned short *_pwctype;
     82 #else
     83   extern unsigned short ** __MINGW_IMP_SYMBOL(_pwctype);
     84 #define _pwctype (* __MINGW_IMP_SYMBOL(_pwctype))
     85 #define __pwctype_func() (* __MINGW_IMP_SYMBOL(_pwctype))
     86 #endif
     87 #endif
     88 #endif
     89 #endif
     90 
     91 #define _UPPER 0x1
     92 #define _LOWER 0x2
     93 #define _DIGIT 0x4
     94 #define _SPACE 0x8
     95 
     96 #define _PUNCT 0x10
     97 #define _CONTROL 0x20
     98 #define _BLANK 0x40
     99 #define _HEX 0x80
    100 
    101 #define _LEADBYTE 0x8000
    102 #define _ALPHA (0x0100|_UPPER|_LOWER)
    103 
    104 #ifndef _WCTYPE_DEFINED
    105 #define _WCTYPE_DEFINED
    106 
    107   int __cdecl iswalpha(wint_t);
    108   int __cdecl iswupper(wint_t);
    109   int __cdecl iswlower(wint_t);
    110   int __cdecl iswdigit(wint_t);
    111   int __cdecl iswxdigit(wint_t);
    112   int __cdecl iswspace(wint_t);
    113   int __cdecl iswpunct(wint_t);
    114   int __cdecl iswalnum(wint_t);
    115   int __cdecl iswprint(wint_t);
    116   int __cdecl iswgraph(wint_t);
    117   int __cdecl iswcntrl(wint_t);
    118   int __cdecl iswascii(wint_t);
    119   int __cdecl isleadbyte(int);
    120   wint_t __cdecl towupper(wint_t);
    121   wint_t __cdecl towlower(wint_t);
    122   int __cdecl iswctype(wint_t,wctype_t);
    123   _CRTIMP int __cdecl __iswcsymf(wint_t);
    124   _CRTIMP int __cdecl __iswcsym(wint_t);
    125   int __cdecl is_wctype(wint_t,wctype_t);
    126 #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || !defined (NO_OLDNAMES) || defined (__cplusplus)
    127 int __cdecl iswblank(wint_t _C);
    128 #endif
    129 #endif
    130 
    131 #ifndef _WCTYPE_INLINE_DEFINED
    132 #define _WCTYPE_INLINE_DEFINED
    133 #ifndef __cplusplus
    134 #define iswalpha(_c) (iswctype(_c,_ALPHA))
    135 #define iswupper(_c) (iswctype(_c,_UPPER))
    136 #define iswlower(_c) (iswctype(_c,_LOWER))
    137 #define iswdigit(_c) (iswctype(_c,_DIGIT))
    138 #define iswxdigit(_c) (iswctype(_c,_HEX))
    139 #define iswspace(_c) (iswctype(_c,_SPACE))
    140 #define iswpunct(_c) (iswctype(_c,_PUNCT))
    141 #define iswalnum(_c) (iswctype(_c,_ALPHA|_DIGIT))
    142 #define iswprint(_c) (iswctype(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT))
    143 #define iswgraph(_c) (iswctype(_c,_PUNCT|_ALPHA|_DIGIT))
    144 #define iswcntrl(_c) (iswctype(_c,_CONTROL))
    145 #define iswascii(_c) ((unsigned)(_c) < 0x80)
    146 #define isleadbyte(c) (__pctype_func()[(unsigned char)(c)] & _LEADBYTE)
    147 #else
    148 #ifndef __CRT__NO_INLINE
    149   __CRT_INLINE int __cdecl iswalpha(wint_t _C) {return (iswctype(_C,_ALPHA)); }
    150   __CRT_INLINE int __cdecl iswupper(wint_t _C) {return (iswctype(_C,_UPPER)); }
    151   __CRT_INLINE int __cdecl iswlower(wint_t _C) {return (iswctype(_C,_LOWER)); }
    152   __CRT_INLINE int __cdecl iswdigit(wint_t _C) {return (iswctype(_C,_DIGIT)); }
    153   __CRT_INLINE int __cdecl iswxdigit(wint_t _C) {return (iswctype(_C,_HEX)); }
    154   __CRT_INLINE int __cdecl iswspace(wint_t _C) {return (iswctype(_C,_SPACE)); }
    155   __CRT_INLINE int __cdecl iswpunct(wint_t _C) {return (iswctype(_C,_PUNCT)); }
    156   __CRT_INLINE int __cdecl iswalnum(wint_t _C) {return (iswctype(_C,_ALPHA|_DIGIT)); }
    157   __CRT_INLINE int __cdecl iswprint(wint_t _C) {return (iswctype(_C,_BLANK|_PUNCT|_ALPHA|_DIGIT)); }
    158   __CRT_INLINE int __cdecl iswgraph(wint_t _C) {return (iswctype(_C,_PUNCT|_ALPHA|_DIGIT)); }
    159   __CRT_INLINE int __cdecl iswcntrl(wint_t _C) {return (iswctype(_C,_CONTROL)); }
    160   __CRT_INLINE int __cdecl iswascii(wint_t _C) {return ((unsigned)(_C) < 0x80); }
    161   __CRT_INLINE int __cdecl isleadbyte(int _C) {return (__pctype_func()[(unsigned char)(_C)] & _LEADBYTE); }
    162 #endif /* !__CRT__NO_INLINE */
    163 #endif /* __cplusplus */
    164 #endif
    165 
    166   typedef wchar_t wctrans_t;
    167   wint_t __cdecl towctrans(wint_t,wctrans_t);
    168   wctrans_t __cdecl wctrans(const char *);
    169   wctype_t __cdecl wctype(const char *);
    170 
    171 #ifdef __cplusplus
    172 }
    173 #endif
    174 
    175 #pragma pack(pop)
    176 #endif
    177