home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / borhead.zip / CTYPE.H < prev    next >
C/C++ Source or Header  |  1994-11-09  |  3KB  |  146 lines

  1. /*  ctype.h
  2.  
  3.     Defines the locale aware ctype macros.
  4.  
  5. */
  6.  
  7. /*
  8.  *      C/C++ Run Time Library - Version 1.5
  9.  *
  10.  *      Copyright (c) 1987, 1994 by Borland International
  11.  *      All Rights Reserved.
  12.  *
  13.  */
  14.  
  15. #ifndef __CTYPE_H
  16. #define __CTYPE_H
  17.  
  18. #if !defined(___DEFS_H)
  19. #include <_defs.h>
  20. #endif
  21.  
  22.  
  23. #if !defined(RC_INVOKED)
  24.  
  25. #if defined(__STDC__)
  26. #pragma warn -nak
  27. #endif
  28.  
  29. #endif  /* !RC_INVOKED */
  30.  
  31.  
  32.  
  33. #ifndef _SIZE_T
  34. #define _SIZE_T
  35. typedef unsigned size_t;
  36. #endif
  37.  
  38. extern unsigned char _RTLENTRY _EXPDATA _ctype[ 257 ];
  39. extern unsigned char _RTLENTRY _EXPDATA _lower[ 256 ];
  40. extern unsigned char _RTLENTRY _EXPDATA _upper[ 256 ];
  41.  
  42. #ifdef __cplusplus
  43. extern "C" {
  44. #endif
  45. int _RTLENTRY _EXPFUNC isalnum (int __c);
  46. int _RTLENTRY _EXPFUNC isalpha (int __c);
  47. int _RTLENTRY _EXPFUNC iscntrl (int __c);
  48. int _RTLENTRY _EXPFUNC isdigit (int __c);
  49. int _RTLENTRY _EXPFUNC isgraph (int __c);
  50. int _RTLENTRY _EXPFUNC islower (int __c);
  51. int _RTLENTRY _EXPFUNC isprint (int __c);
  52. int _RTLENTRY _EXPFUNC ispunct (int __c);
  53. int _RTLENTRY _EXPFUNC isspace (int __c);
  54. int _RTLENTRY _EXPFUNC isupper (int __c);
  55. int _RTLENTRY _EXPFUNC isxdigit(int __c);
  56. int _RTLENTRY _EXPFUNC isascii (int __c);
  57.  
  58. #ifdef __cplusplus
  59. }
  60. #endif
  61.  
  62. /* character classes */
  63.  
  64. #define _IS_SP     1           /* space */
  65. #define _IS_DIG    2           /* digit */
  66. #define _IS_UPP    4           /* upper case */
  67. #define _IS_LOW    8           /* lower case */
  68. #define _IS_HEX   16           /* [0..9] or [A-F] or [a-f] */
  69. #define _IS_CTL   32           /* control */
  70. #define _IS_PUN   64           /* punctuation */
  71. #define _IS_BLK  128           /* blank */
  72.  
  73. #define _IS_ALPHA    (_IS_UPP | _IS_LOW)
  74. #define _IS_ALNUM    (_IS_DIG | _IS_ALPHA)
  75. #define _IS_GRAPH    (_IS_ALNUM | _IS_HEX | _IS_PUN)
  76.  
  77. #ifndef __USELOCALES__
  78.  
  79. /* C locale character classification macros */
  80.  
  81. #define isalnum(c)   (_ctype[ (c)+1 ] & (_IS_ALNUM))
  82.                      
  83. #define isalpha(c)   (_ctype[ (c)+1 ] & (_IS_ALPHA))
  84.                      
  85. #define iscntrl(c)   (_ctype[ (c)+1 ] & (_IS_CTL))
  86.                      
  87. #define isdigit(c)   (_ctype[ (c)+1 ] & (_IS_DIG))
  88.                      
  89. #define isgraph(c)   (_ctype[ (c)+1 ] & (_IS_GRAPH))
  90.                      
  91. #define islower(c)   (_ctype[ (c)+1 ] & (_IS_LOW))
  92.                      
  93. #define isprint(c)   (_ctype[ (c)+1 ] & (_IS_GRAPH | _IS_BLK))
  94.                      
  95. #define ispunct(c)   (_ctype[ (c)+1 ] & (_IS_PUN))
  96.                      
  97. #define isspace(c)   (_ctype[ (c)+1 ] & (_IS_SP))
  98.                      
  99. #define isupper(c)   (_ctype[ (c)+1 ] & (_IS_UPP))
  100.                      
  101. #define isxdigit(c)  (_ctype[ (c)+1 ] & (_IS_HEX))
  102.  
  103. #endif /* __USELOCALES__ */
  104.  
  105. #define isascii(c)  ((unsigned)(c) < 128)
  106. #define toascii(c)  ((c) & 0x7f)
  107.  
  108. #ifdef __cplusplus
  109. extern "C" {
  110. #endif
  111.  
  112. int _RTLENTRY _EXPFUNC tolower(int __ch);
  113. int _RTLENTRY _EXPFUNC _ltolower(int __ch);
  114. int _RTLENTRY _EXPFUNC toupper(int __ch);
  115. int _RTLENTRY _EXPFUNC _ltoupper(int __ch);
  116.  
  117. #if !__STDC__             /* NON-ANSI */
  118. #define _toupper(c) ((c) + 'A' - 'a')
  119. #define _tolower(c) ((c) + 'a' - 'A')
  120. #endif
  121.  
  122.  
  123. #ifdef __cplusplus
  124. }
  125. #endif
  126.  
  127. #if defined( __USELOCALES__ )
  128.  
  129. #define toupper    _ltoupper
  130. #define tolower    _ltolower
  131.  
  132. #endif
  133.  
  134.  
  135.  
  136. #if !defined(RC_INVOKED)
  137.  
  138. #if defined(__STDC__)
  139. #pragma warn .nak
  140. #endif
  141.  
  142. #endif  /* !RC_INVOKED */
  143.  
  144.  
  145. #endif /* __CTYPE_H */
  146.