home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / jove-4.16-src.tgz / tar.out / bsd / jove / jctype.h < prev    next >
C/C++ Source or Header  |  1996-09-28  |  2KB  |  66 lines

  1. /************************************************************************
  2.  * This program is Copyright (C) 1986-1996 by Jonathan Payne.  JOVE is  *
  3.  * provided to you without charge, and with no warranty.  You may give  *
  4.  * away copies of JOVE, including sources, provided that this notice is *
  5.  * included in all the files.                                           *
  6.  ************************************************************************/
  7.  
  8. /* NOTE: unlike standard is* routines, these must not be applied
  9.  * to EOF.  On the other hand, they may safely be applied to
  10.  * sign-extended values.
  11.  */
  12.  
  13. #define    C_UPPER    0001    /* UPPER case */
  14. #define    C_LOWER    0002    /* LOWER case */
  15. #define    C_DIGIT    0004    /* DIGIT */
  16. #define    C_PUNCT    0010    /* PUNCTuation */
  17. #define    C_PRINT    0020    /* PRINTable */
  18. #define    C_WORD    0040    /* WORD */
  19. #define    C_BRA    0100    /* open BRAket */
  20. #define    C_KET    0200    /* close braKET */
  21.  
  22. extern const unsigned char    CharTable[NCHARS];
  23.  
  24. #define    has_syntax(c,s)    ((CharTable[ZXC(c)]&(s)) != 0)
  25. #define    jisdigit(c)    has_syntax(c, C_DIGIT)
  26. #define    jisopenp(c)    has_syntax(c, C_BRA)
  27. #define    jisclosep(c)    has_syntax(c, C_KET)
  28.  
  29. #define    jiswhite(c)    ((c) == ' ' || (c) == '\t')    /* NOT isspace! */
  30.  
  31. extern bool    jisident proto((DAPchar));
  32.  
  33. #ifdef USE_CTYPE
  34.  
  35. # include <ctype.h>
  36. # define    jisprint(c)    isprint(ZXC(c))
  37. # define    jisword(c)    isalnum(ZXC(c))
  38. # define    jisupper(c)    isupper(ZXC(c))
  39. # define    jislower(c)    islower(ZXC(c))
  40.  
  41. # define    CharUpcase(c)    toupper(ZXC(c))
  42. # define    CharDowncase(c)    tolower(ZXC(c))
  43.  
  44. #ifndef NO_SETLOCALE
  45. extern char    LcCtype[32];        /* VAR: lc-ctype, for use in setlocale */
  46. extern void        locale_adjust proto ((void));
  47. #endif
  48.  
  49. #else /* !USE_CTYPE */
  50.  
  51. # define    jisprint(c)    has_syntax(c, C_PRINT)
  52. # define    jisword(c)    has_syntax(c, C_WORD)
  53. # define    jisupper(c)    has_syntax(c, C_UPPER)
  54. # define    jislower(c)    has_syntax(c, C_LOWER)
  55.  
  56.   extern const char
  57.     RaiseTable[NCHARS],
  58.     LowerTable[NCHARS];
  59.  
  60. # define    CharUpcase(c)    ZXC(RaiseTable[ZXC(c)])
  61. # define    CharDowncase(c)    ZXC(LowerTable[ZXC(c)])
  62.  
  63. #endif /* !USE_CTYPE */
  64.  
  65. #define cind_eq(a, b)    (CharUpcase(a) == CharUpcase(b))
  66.