home *** CD-ROM | disk | FTP | other *** search
/ Beginning C++ Through Gam…rogramming (2nd Edition) / BCGP2E.ISO / bloodshed / devcpp-4.9.9.2_setup.exe / wctype.h < prev    next >
C/C++ Source or Header  |  2005-01-29  |  4KB  |  143 lines

  1. /* 
  2.  * wctype.h
  3.  *
  4.  * Functions for testing wide character types and converting characters.
  5.  *
  6.  * This file is part of the Mingw32 package.
  7.  *
  8.  * Contributors:
  9.  *  Created by Mumit Khan <khan@xraylith.wisc.edu>
  10.  *
  11.  *  THIS SOFTWARE IS NOT COPYRIGHTED
  12.  *
  13.  *  This source code is offered for use in the public domain. You may
  14.  *  use, modify or distribute it freely.
  15.  *
  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.
  20.  *
  21.  */
  22.  
  23. #ifndef _WCTYPE_H_
  24. #define _WCTYPE_H_
  25.  
  26. /* All the headers include this file. */
  27. #include <_mingw.h>
  28.  
  29. #define    __need_wchar_t
  30. #define    __need_wint_t
  31. #ifndef RC_INVOKED
  32. #include <stddef.h>
  33. #endif    /* Not RC_INVOKED */
  34.  
  35. /*
  36.  * The following flags are used to tell iswctype and _isctype what character
  37.  * types you are looking for.
  38.  */
  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
  48.  
  49. #define    _ALPHA        0x0103
  50.  
  51. #ifndef RC_INVOKED
  52.  
  53. #ifdef __cplusplus
  54. extern "C" {
  55. #endif
  56.  
  57. #ifndef WEOF
  58. #define    WEOF    (wchar_t)(0xFFFF)
  59. #endif
  60.  
  61. #ifndef _WCTYPE_T_DEFINED
  62. typedef wchar_t wctype_t;
  63. #define _WCTYPE_T_DEFINED
  64. #endif
  65.  
  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);
  81.  
  82. _CRTIMP wchar_t __cdecl    towlower(wchar_t);
  83. _CRTIMP wchar_t __cdecl    towupper(wchar_t);
  84.  
  85. _CRTIMP int __cdecl    isleadbyte (int);
  86.  
  87. /* Also in ctype.h */
  88.  
  89. #ifdef __DECLSPEC_SUPPORTED
  90. __MINGW_IMPORT unsigned short _ctype[];
  91. # ifdef __MSVCRT__
  92.   __MINGW_IMPORT unsigned short* _pctype;
  93. # else    /* CRTDLL */
  94.   __MINGW_IMPORT unsigned short* _pctype_dll;
  95. # define  _pctype _pctype_dll
  96. # endif
  97.  
  98. #else        /* ! __DECLSPEC_SUPPORTED */
  99. extern unsigned short** _imp___ctype;
  100. #define _ctype (*_imp___ctype)
  101. # ifdef __MSVCRT__
  102.   extern unsigned short** _imp___pctype;
  103. # define _pctype (*_imp___pctype)
  104. # else    /* CRTDLL */
  105.   extern unsigned short** _imp___pctype_dll;
  106. # define _pctype (*_imp___pctype_dll)
  107. # endif    /* CRTDLL */
  108. #endif        /*  __DECLSPEC_SUPPORTED */
  109.  
  110.  
  111. #if !(defined (__NO_INLINE__) || defined(__NO_CTYPE_INLINES) \
  112.       || defined(__WCTYPE_INLINES_DEFINED))
  113. #define __WCTYPE_INLINES_DEFINED
  114. __CRT_INLINE int __cdecl iswalnum(wint_t wc) {return (iswctype(wc,_ALPHA|_DIGIT));}
  115. __CRT_INLINE int __cdecl iswalpha(wint_t wc) {return (iswctype(wc,_ALPHA));}
  116. __CRT_INLINE int __cdecl iswascii(wint_t wc) {return ((wc & ~0x7F) ==0);}
  117. __CRT_INLINE int __cdecl iswcntrl(wint_t wc) {return (iswctype(wc,_CONTROL));}
  118. __CRT_INLINE int __cdecl iswdigit(wint_t wc) {return (iswctype(wc,_DIGIT));}
  119. __CRT_INLINE int __cdecl iswgraph(wint_t wc) {return (iswctype(wc,_PUNCT|_ALPHA|_DIGIT));}
  120. __CRT_INLINE int __cdecl iswlower(wint_t wc) {return (iswctype(wc,_LOWER));}
  121. __CRT_INLINE int __cdecl iswprint(wint_t wc) {return (iswctype(wc,_BLANK|_PUNCT|_ALPHA|_DIGIT));}
  122. __CRT_INLINE int __cdecl iswpunct(wint_t wc) {return (iswctype(wc,_PUNCT));}
  123. __CRT_INLINE int __cdecl iswspace(wint_t wc) {return (iswctype(wc,_SPACE));}
  124. __CRT_INLINE int __cdecl iswupper(wint_t wc) {return (iswctype(wc,_UPPER));}
  125. __CRT_INLINE int __cdecl iswxdigit(wint_t wc) {return (iswctype(wc,_HEX));}
  126. __CRT_INLINE int __cdecl isleadbyte(int c) {return (_pctype[(unsigned char)(c)] & _LEADBYTE);}
  127. #endif /* !(defined(__NO_CTYPE_INLINES) || defined(__WCTYPE_INLINES_DEFINED)) */
  128.  
  129.  
  130. typedef wchar_t wctrans_t;
  131. _CRTIMP wint_t __cdecl        towctrans(wint_t, wctrans_t);
  132. _CRTIMP wctrans_t __cdecl    wctrans(const char*);
  133. _CRTIMP wctype_t __cdecl    wctype(const char*);
  134.  
  135. #ifdef __cplusplus
  136. }
  137. #endif
  138.  
  139. #endif    /* Not RC_INVOKED */
  140.  
  141. #endif    /* Not _WCTYPE_H_ */
  142.  
  143.