#ifndef _MSL_CWCTYPE
#define _MSL_CWCTYPE

#include <ansi_params.h>

#if !_MSL_USING_MW_C_HEADERS
    #include <wctype.h>

    #if _MSL_PUT_THIRD_PARTY_C_IN_STD
        #include <msl_cpp_std_wctype.h>
    #endif
#else

#if _MSL_WIDE_CHAR

#include <clocale>
#include <eof.h>
#include <weof.h>
#include <wchar_t.h>
#include <wctrans.h>
#include <wctype_api.h>
#include <locale_api.h>
#include <msl_thread_local_data.h>

#ifndef RC_INVOKED

_MSL_BEGIN_NAMESPACE_STD
_MSL_BEGIN_EXTERN_C

_MSL_IMP_EXP_C wctype_t _MSL_CDECL wctype(const char *) _MSL_CANT_THROW;
_MSL_IMP_EXP_C int _MSL_CDECL iswctype(wint_t, wctype_t) _MSL_CANT_THROW;
_MSL_IMP_EXP_C int _MSL_CDECL iswalnum(wint_t) _MSL_CANT_THROW;
_MSL_IMP_EXP_C int _MSL_CDECL iswalpha(wint_t) _MSL_CANT_THROW;
#if _MSL_C99
_MSL_IMP_EXP_C int _MSL_CDECL iswblank(wint_t) _MSL_CANT_THROW;
#endif
_MSL_IMP_EXP_C int _MSL_CDECL iswcntrl(wint_t) _MSL_CANT_THROW;
_MSL_IMP_EXP_C int _MSL_CDECL iswdigit(wint_t) _MSL_CANT_THROW;
_MSL_IMP_EXP_C int _MSL_CDECL iswgraph(wint_t) _MSL_CANT_THROW;
_MSL_IMP_EXP_C int _MSL_CDECL iswlower(wint_t) _MSL_CANT_THROW;
_MSL_IMP_EXP_C int _MSL_CDECL iswprint(wint_t) _MSL_CANT_THROW;
_MSL_IMP_EXP_C int _MSL_CDECL iswpunct(wint_t) _MSL_CANT_THROW;
_MSL_IMP_EXP_C int _MSL_CDECL iswspace(wint_t) _MSL_CANT_THROW;
_MSL_IMP_EXP_C int _MSL_CDECL iswupper(wint_t) _MSL_CANT_THROW;
_MSL_IMP_EXP_C int _MSL_CDECL iswxdigit(wint_t) _MSL_CANT_THROW;
_MSL_IMP_EXP_C wint_t _MSL_CDECL towlower(wint_t) _MSL_CANT_THROW;
_MSL_IMP_EXP_C wint_t _MSL_CDECL towupper(wint_t) _MSL_CANT_THROW;

_MSL_END_EXTERN_C

#if _MSL_USE_INLINE

#if _MSL_C_LOCALE_ONLY || !_MSL_C99
    #define _MSL_CWMAP_ACCESS __wctype_mapC
    #define _MSL_CWLOWER_ACCESS __wlower_mapC
    #define _MSL_CWUPPER_ACCESS __wupper_mapC
#else
    #define _MSL_CWMAP_ACCESS _MSL_LOCALDATA(_current_locale).ctype_cmpt_ptr->wctype_map_ptr
    #define _MSL_CWLOWER_ACCESS _MSL_LOCALDATA(_current_locale).ctype_cmpt_ptr->wlower_map_ptr
    #define _MSL_CWUPPER_ACCESS _MSL_LOCALDATA(_current_locale).ctype_cmpt_ptr->wupper_map_ptr
#endif

_MSL_INLINE int _MSL_CDECL iswalnum(wint_t c) _MSL_CANT_THROW {return ((c < 0) || (c >= __msl_wcmap_size)) ? 0 : (int)(_MSL_CWMAP_ACCESS[c] & __msl_walnum);}
_MSL_INLINE int _MSL_CDECL iswalpha(wint_t c) _MSL_CANT_THROW {return ((c < 0) || (c >= __msl_wcmap_size)) ? 0 : (int)(_MSL_CWMAP_ACCESS[c] & __msl_walpha);}
#if _MSL_C99
_MSL_INLINE int _MSL_CDECL iswblank(wint_t c) _MSL_CANT_THROW {return ((c < 0) || (c >= __msl_wcmap_size)) ? 0 : (int)(_MSL_CWMAP_ACCESS[c] & __msl_wblank);}
#endif
_MSL_INLINE int _MSL_CDECL iswcntrl(wint_t c) _MSL_CANT_THROW {return ((c < 0) || (c >= __msl_wcmap_size)) ? 0 : (int)(_MSL_CWMAP_ACCESS[c] & __msl_wcntrl);}
_MSL_INLINE int _MSL_CDECL iswdigit(wint_t c) _MSL_CANT_THROW {return ((c < 0) || (c >= __msl_wcmap_size)) ? 0 : (int)(_MSL_CWMAP_ACCESS[c] & __msl_wdigit);}
_MSL_INLINE int _MSL_CDECL iswgraph(wint_t c) _MSL_CANT_THROW {return ((c < 0) || (c >= __msl_wcmap_size)) ? 0 : (int)(_MSL_CWMAP_ACCESS[c] & __msl_wgraph);}
_MSL_INLINE int _MSL_CDECL iswlower(wint_t c) _MSL_CANT_THROW {return ((c < 0) || (c >= __msl_wcmap_size)) ? 0 : (int)(_MSL_CWMAP_ACCESS[c] & __msl_wlower);}
_MSL_INLINE int _MSL_CDECL iswprint(wint_t c) _MSL_CANT_THROW {return ((c < 0) || (c >= __msl_wcmap_size)) ? 0 : (int)(_MSL_CWMAP_ACCESS[c] & __msl_wprint);}
_MSL_INLINE int _MSL_CDECL iswpunct(wint_t c) _MSL_CANT_THROW {return ((c < 0) || (c >= __msl_wcmap_size)) ? 0 : (int)(_MSL_CWMAP_ACCESS[c] & __msl_wpunct);}
_MSL_INLINE int _MSL_CDECL iswspace(wint_t c) _MSL_CANT_THROW {return ((c < 0) || (c >= __msl_wcmap_size)) ? 0 : (int)(_MSL_CWMAP_ACCESS[c] & __msl_wspace);}
_MSL_INLINE int _MSL_CDECL iswupper(wint_t c) _MSL_CANT_THROW {return ((c < 0) || (c >= __msl_wcmap_size)) ? 0 : (int)(_MSL_CWMAP_ACCESS[c] & __msl_wupper);}
_MSL_INLINE int _MSL_CDECL iswxdigit(wint_t c) _MSL_CANT_THROW {return ((c < 0) || (c >= __msl_wcmap_size)) ? 0 : (int)(_MSL_CWMAP_ACCESS[c] & __msl_wxdigit);}
_MSL_INLINE wint_t _MSL_CDECL towlower(wint_t c) _MSL_CANT_THROW {return ((c < 0) || (c >= __msl_wcmap_size)) ? c : (int)(_MSL_CWLOWER_ACCESS[c]);}
_MSL_INLINE wint_t _MSL_CDECL towupper(wint_t c) _MSL_CANT_THROW {return ((c < 0) || (c >= __msl_wcmap_size)) ? c : (int)(_MSL_CWUPPER_ACCESS[c]);}

#endif

_MSL_END_NAMESPACE_STD

#endif

#endif

#endif

#endif
