home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / p / plbin.zip / pl / src / pl-ctype.h < prev    next >
C/C++ Source or Header  |  1992-05-26  |  1KB  |  39 lines

  1. /*  pl-ctype.h,v 1.1.1.1 1992/05/26 11:52:16 jan Exp
  2.  
  3.     Copyright (c) 1990 Jan Wielemaker. All rights reserved.
  4.     See ../LICENCE to find out about your rights.
  5.     jan@swi.psy.uva.nl
  6.  
  7.     Purpose: Character types
  8. */
  9.  
  10. extern char char_type[];    /* array of character types */
  11.  
  12. #define SP  0            /* space */
  13. #define SO  1            /* solo character */
  14. #define SY  2            /* symbol character */
  15. #define PU  3            /* Punctuation character */
  16. #define DQ  4            /* Double quote */
  17. #define SQ  5            /* Single quote */
  18. #define UC  6            /* Uppercase character */
  19. #define LC  7            /* Lowercase character */
  20. #define DI  8            /* Digit */
  21.  
  22. #define isBlank(c)    (char_type[(unsigned)(c) & 0xff] == SP)
  23. #define isDigit(c)    (char_type[(unsigned)(c) & 0xff] == DI)
  24. #define isLower(c)    (char_type[(unsigned)(c) & 0xff] == LC)
  25. #define isUpper(c)    (char_type[(unsigned)(c) & 0xff] == UC)
  26. #define isSymbol(c)    (char_type[(unsigned)(c) & 0xff] == SY)
  27. #define isPunct(c)    (char_type[(unsigned)(c) & 0xff] == PU)
  28. #define isSolo(c)    (char_type[(unsigned)(c) & 0xff] == SO)
  29. #define isAlpha(c)    (char_type[(unsigned)(c) & 0xff] >= UC)
  30. #define isLetter(c)    (isLower(c) || isUpper(c))
  31.  
  32. #define toLower(c)    ((c) + 'a' - 'A')
  33. #define makeLower(c)    ((c) >= 'A' && (c) <= 'Z' ? toLower(c) : (c))
  34.  
  35. #define matchingBracket(c)    ((c) == '[' ? ']' :\
  36.                         '{' ? '}' :\
  37.                         '(' ? ')' : EOS)
  38. #define Control(c)        ((c) == '?' ? 127 : (c) - '@')
  39.