home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 2000 May / PCP163A.iso / Runimage / Cbuilder4 / Include / CTYPE.H < prev    next >
Encoding:
C/C++ Source or Header  |  1999-01-26  |  6.7 KB  |  222 lines

  1. /*  ctype.h
  2.  
  3.     Defines the locale aware ctype macros.
  4.  
  5. */
  6.  
  7. /*
  8.  *      C/C++ Run Time Library - Version 9.5
  9.  *
  10.  *      Copyright (c) 1987, 1999 by Inprise Corporation
  11.  *      All Rights Reserved.
  12.  *
  13.  */
  14.  
  15. /* $Revision:   9.6  $ */
  16.  
  17. #ifndef __CTYPE_H
  18. #define __CTYPE_H
  19.  
  20. #if !defined(RC_INVOKED)
  21.  
  22. #ifndef ___STDDEF_H
  23. #include <_stddef.h>
  24. #endif
  25.  
  26. #ifdef __cplusplus
  27. namespace std {
  28. #endif /* __cplusplus */
  29.  
  30. #if defined(__STDC__)
  31. #pragma warn -nak
  32. #endif
  33.  
  34. #endif  /* !RC_INVOKED */
  35.  
  36. #ifdef __cplusplus
  37. extern "C" {
  38. #endif
  39.  
  40. extern unsigned short _RTLENTRY _EXPDATA _chartype[ 257 ];
  41. extern unsigned char _RTLENTRY  _EXPDATA _lower[ 256 ];
  42. extern unsigned char _RTLENTRY  _EXPDATA _upper[ 256 ];
  43.  
  44. int _RTLENTRY _EXPFUNC isalnum (int __c);
  45. int _RTLENTRY _EXPFUNC isalpha (int __c);
  46. int _RTLENTRY _EXPFUNC iscntrl (int __c);
  47. int _RTLENTRY _EXPFUNC isdigit (int __c);
  48. int _RTLENTRY _EXPFUNC isgraph (int __c);
  49. int _RTLENTRY _EXPFUNC islower (int __c);
  50. int _RTLENTRY _EXPFUNC isprint (int __c);
  51. int _RTLENTRY _EXPFUNC ispunct (int __c);
  52. int _RTLENTRY _EXPFUNC isspace (int __c);
  53. int _RTLENTRY _EXPFUNC isupper (int __c);
  54. int _RTLENTRY _EXPFUNC isxdigit(int __c);
  55. int _RTLENTRY _EXPFUNC isascii (int __c);
  56.  
  57. int _RTLENTRY _EXPFUNC iswalnum (_WINT_T __c);
  58. int _RTLENTRY _EXPFUNC iswalpha (_WINT_T __c);
  59. int _RTLENTRY _EXPFUNC iswcntrl (_WINT_T __c);
  60. int _RTLENTRY _EXPFUNC iswdigit (_WINT_T __c);
  61. int _RTLENTRY _EXPFUNC iswgraph (_WINT_T __c);
  62. int _RTLENTRY _EXPFUNC iswlower (_WINT_T __c);
  63. int _RTLENTRY _EXPFUNC iswprint (_WINT_T __c);
  64. int _RTLENTRY _EXPFUNC iswpunct (_WINT_T __c);
  65. int _RTLENTRY _EXPFUNC iswspace (_WINT_T __c);
  66. int _RTLENTRY _EXPFUNC iswupper (_WINT_T __c);
  67. int _RTLENTRY _EXPFUNC iswxdigit(_WINT_T __c);
  68. int _RTLENTRY _EXPFUNC iswascii (_WINT_T __c);
  69. #ifdef __cplusplus
  70. }
  71. #endif
  72.  
  73. /* character classes */
  74.  
  75. #define _IS_UPP    0x0001           /* upper case */
  76. #define _IS_LOW    0x0002           /* lower case */
  77. #define _IS_DIG    0x0004           /* digit */
  78. #define _IS_SP     0x0008           /* space */
  79. #define _IS_PUN    0x0010           /* punctuation */
  80. #define _IS_CTL    0x0020           /* control */
  81. #define _IS_BLK    0x0040           /* blank */
  82. #define _IS_HEX    0x0080           /* [0..9] or [A-F] or [a-f] */
  83. #define _IS_ALPHA  0x0100
  84.  
  85. #define _IS_ALNUM    (_IS_DIG | _IS_ALPHA)
  86. #define _IS_GRAPH    (_IS_ALNUM | _IS_HEX | _IS_PUN)
  87.  
  88. #ifndef __USELOCALES__
  89.  
  90. /* C locale character classification macros */
  91.  
  92. #define isalnum(c)   (__STD _chartype[ (c)+1 ] & (_IS_ALNUM))
  93. #define isalpha(c)   (__STD _chartype[ (c)+1 ] & (_IS_ALPHA))
  94. #define iscntrl(c)   (__STD _chartype[ (c)+1 ] & (_IS_CTL))
  95. #define isdigit(c)   (__STD _chartype[ (c)+1 ] & (_IS_DIG))
  96. #define isgraph(c)   (__STD _chartype[ (c)+1 ] & (_IS_GRAPH))
  97. #define islower(c)   (__STD _chartype[ (c)+1 ] & (_IS_LOW))
  98. #define isprint(c)   (__STD _chartype[ (c)+1 ] & (_IS_GRAPH | _IS_BLK))
  99. #define ispunct(c)   (__STD _chartype[ (c)+1 ] & (_IS_PUN))
  100. #define isspace(c)   (__STD _chartype[ (c)+1 ] & (_IS_SP))
  101. #define isupper(c)   (__STD _chartype[ (c)+1 ] & (_IS_UPP))
  102. #define isxdigit(c)  (__STD _chartype[ (c)+1 ] & (_IS_HEX))
  103.  
  104. #ifndef _UNICODE
  105. #define iswalnum(c)   (__STD _chartype[ (c)+1 ] & (_IS_ALNUM))
  106. #define iswalpha(c)   (__STD _chartype[ (c)+1 ] & (_IS_ALPHA))
  107. #define iswcntrl(c)   (__STD _chartype[ (c)+1 ] & (_IS_CTL))
  108. #define iswdigit(c)   (__STD _chartype[ (c)+1 ] & (_IS_DIG))
  109. #define iswgraph(c)   (__STD _chartype[ (c)+1 ] & (_IS_GRAPH))
  110. #define iswlower(c)   (__STD _chartype[ (c)+1 ] & (_IS_LOW))
  111. #define iswprint(c)   (__STD _chartype[ (c)+1 ] & (_IS_GRAPH | _IS_BLK))
  112. #define iswpunct(c)   (__STD _chartype[ (c)+1 ] & (_IS_PUN))
  113. #define iswspace(c)   (__STD _chartype[ (c)+1 ] & (_IS_SP))
  114. #define iswupper(c)   (__STD _chartype[ (c)+1 ] & (_IS_UPP))
  115. #define iswxdigit(c)  (__STD _chartype[ (c)+1 ] & (_IS_HEX))
  116.  
  117. #endif /* _UNICODE */
  118.  
  119. #endif /* __USELOCALES__ */
  120.  
  121. #define iswascii(c)  ((unsigned)(c) < 128)
  122. #define isascii(c)  ((unsigned)(c) < 128)
  123. #define toascii(c)  ((c) & 0x7f)
  124.  
  125. #ifdef __cplusplus
  126. extern "C" {
  127. #endif
  128.  
  129.  
  130. #if !defined( __USELOCALES__ )
  131. int     _RTLENTRY _EXPFUNC tolower(int __ch);
  132. int     _RTLENTRY _EXPFUNC toupper(int __ch);
  133. _WINT_T _RTLENTRY _EXPFUNC towlower(_WINT_T __ch);
  134. _WINT_T _RTLENTRY _EXPFUNC towupper(_WINT_T __ch);
  135. #endif
  136.  
  137. int     _RTLENTRY _EXPFUNC _ltolower(int __ch);
  138. int     _RTLENTRY _EXPFUNC _ltoupper(int __ch);
  139. wchar_t _RTLENTRY _EXPFUNC _ltowupper(wchar_t __ch);
  140. wchar_t _RTLENTRY _EXPFUNC _ltowlower(wchar_t __ch);
  141.  
  142. #if !defined(__STDC__)    /* NON-ANSI */
  143. #define _toupper(__c)   ((__c) + 'A' - 'a')
  144. #define _tolower(__c)   ((__c) + 'a' - 'A')
  145. #endif
  146.  
  147.  
  148. #ifdef __cplusplus
  149. }
  150. #endif
  151.  
  152. #if defined( __USELOCALES__ )
  153. /* The following four functions cannot be macros, since the Rogue Wave headers
  154.    #undef them.  So instead we'll use inline functions. */
  155. __inline int     _RTLENTRY _EXPFUNC tolower(int __ch)      { return _ltolower(__ch);  }
  156. __inline int     _RTLENTRY _EXPFUNC toupper(int __ch)      { return _ltoupper(__ch);  }
  157. __inline _WINT_T _RTLENTRY _EXPFUNC towlower(_WINT_T __ch) { return _ltowlower(__ch); }
  158. __inline _WINT_T _RTLENTRY _EXPFUNC towupper(_WINT_T __ch) { return _ltowupper(__ch); }
  159.  
  160. #define _wcsupr    _lwcsupr
  161. #define _wcslwr    _lwcslwr
  162.  
  163. #endif  /*  __USELOCALES__  */
  164.  
  165. /* some MSC compatible macros */
  166.  
  167. #define __iscsymf(__c)  (isalpha(__c) || ((__c) == '_'))
  168. #define __iscsym(__c)   (isalnum(__c) || ((__c) == '_'))
  169.  
  170. #if !defined(RC_INVOKED)
  171.  
  172. #if defined(__STDC__)
  173. #pragma warn .nak
  174. #endif
  175.  
  176. #ifdef __cplusplus
  177. } // std
  178. #endif /* __cplusplus */
  179.  
  180. #endif  /* !RC_INVOKED */
  181.  
  182. #endif /* __CTYPE_H */
  183.  
  184. #if defined(__cplusplus) && !defined(__USING_CNAME__) && !defined(__CTYPE_H_USING_LIST)
  185. #define __CTYPE_H_USING_LIST
  186.      using std::_chartype;
  187.      using std::_lower;
  188.      using std::_upper;
  189.      using std::isalnum;
  190.      using std::isalpha;
  191.      using std::iscntrl;
  192.      using std::isdigit;
  193.      using std::isgraph;
  194.      using std::islower;
  195.      using std::isprint;
  196.      using std::ispunct;
  197.      using std::isspace;
  198.      using std::isupper;
  199.      using std::isxdigit;
  200.      using std::isascii;
  201.      using std::iswalnum;
  202.      using std::iswalpha;
  203.      using std::iswcntrl;
  204.      using std::iswdigit;
  205.      using std::iswgraph;
  206.      using std::iswlower;
  207.      using std::iswprint;
  208.      using std::iswpunct;
  209.      using std::iswspace;
  210.      using std::iswupper;
  211.      using std::iswxdigit;
  212.      using std::iswascii;
  213.      using std::tolower;
  214.      using std::_ltolower;
  215.      using std::toupper;
  216.      using std::_ltoupper;
  217.      using std::towlower;
  218.      using std::towupper;
  219.      using std::_ltowupper;
  220.      using std::_ltowlower;
  221. #endif /* __USING_CNAME__ */
  222.