home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / e / emxdev8f.zip / CTYPE.H < prev    next >
C/C++ Source or Header  |  1992-11-18  |  2KB  |  66 lines

  1. /* ctype.h (emx+gcc) */
  2.  
  3. #if !defined (_CTYPE_H)
  4. #define _CTYPE_H
  5.  
  6. #if defined (__cplusplus)
  7. extern "C" {
  8. #endif
  9.  
  10. #if !defined (_CTYPE_C)
  11. extern unsigned char _ctype[];
  12. #endif
  13.  
  14. #define _UPPER  0x01
  15. #define _LOWER  0x02
  16. #define _DIGIT  0x04
  17. #define _XDIGIT 0x08
  18. #define _CNTRL  0x10
  19. #define _SPACE  0x20
  20. #define _PUNCT  0x40
  21. #define _PRINT  0x80
  22.  
  23. #define CTYPE_ISALNUM(c)  ((_ctype+1)[c] & (_UPPER|_LOWER|_DIGIT))
  24. #define CTYPE_ISALPHA(c)  ((_ctype+1)[c] & (_UPPER|_LOWER))
  25. #define CTYPE_ISCNTRL(c)  ((_ctype+1)[c] & (_CNTRL))
  26. #define CTYPE_ISDIGIT(c)  ((_ctype+1)[c] & (_DIGIT))
  27. #define CTYPE_ISGRAPH(c)  ((_ctype+1)[c] & (_PUNCT|_UPPER|_LOWER|_DIGIT))
  28. #define CTYPE_ISLOWER(c)  ((_ctype+1)[c] & (_LOWER))
  29. #define CTYPE_ISPRINT(c)  ((_ctype+1)[c] & (_PRINT))
  30. #define CTYPE_ISPUNCT(c)  ((_ctype+1)[c] & (_PUNCT))
  31. #define CTYPE_ISSPACE(c)  ((_ctype+1)[c] & (_SPACE))
  32. #define CTYPE_ISUPPER(c)  ((_ctype+1)[c] & (_UPPER))
  33. #define CTYPE_ISXDIGIT(c) ((_ctype+1)[c] & (_XDIGIT))
  34.  
  35. #define CTYPE_ISASCII(c) ((unsigned)(c) <= 0x7f)
  36. #define CTYPE_TOASCII(c) ((c) & 0x7f)
  37.  
  38. #if !defined (_CTYPE_FUN)
  39. #define isalnum(c)  CTYPE_ISALNUM (c)
  40. #define isalpha(c)  CTYPE_ISALPHA (c)
  41. #define iscntrl(c)  CTYPE_ISCNTRL (c)
  42. #define isdigit(c)  CTYPE_ISDIGIT (c)
  43. #define isgraph(c)  CTYPE_ISGRAPH (c)
  44. #define islower(c)  CTYPE_ISLOWER (c)
  45. #define isprint(c)  CTYPE_ISPRINT (c)
  46. #define ispunct(c)  CTYPE_ISPUNCT (c)
  47. #define isspace(c)  CTYPE_ISSPACE (c)
  48. #define isupper(c)  CTYPE_ISUPPER (c)
  49. #define isxdigit(c) CTYPE_ISXDIGIT (c)
  50. #define isascii(c)  CTYPE_ISASCII (c)
  51. #define toascii(c)  CTYPE_TOASCII (c)
  52. #endif
  53.  
  54. #if !defined (_CTYPE_C) && !defined (_CTYPE_FUN)
  55. static __inline__ int _toupper (int c) { return (c-'a'+'A'); }
  56. static __inline__ int _tolower (int c) { return (c-'A'+'a'); }
  57. static __inline__ int toupper(int c) {return (islower(c) ? _toupper(c) : c);}
  58. static __inline__ int tolower(int c) {return (isupper(c) ? _tolower(c) : c);}
  59. #endif
  60.  
  61. #if defined (__cplusplus)
  62. }
  63. #endif
  64.  
  65. #endif /* !defined (_CTYPE_H) */
  66.