home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / jove414s.zip / ctype.h < prev    next >
C/C++ Source or Header  |  1989-10-10  |  2KB  |  56 lines

  1. /***************************************************************************
  2.  * This program is Copyright (C) 1986, 1987, 1988 by Jonathan Payne.  JOVE *
  3.  * is 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. /* The code in this file was snarfed from ctype.h and modified for JOVE. */
  9.  
  10. #define    _U    01
  11. #define    _L    02
  12. #define    _N    04
  13. #define _P    010
  14. #define _C    020
  15. #define _W    040
  16. #define _Op    0100
  17. #define _Cl    0200
  18.  
  19. extern int    SyntaxTable;
  20. #define iswhite(c)    (isspace(c))
  21. #define isword(c)    ((CharTable[SyntaxTable])[c]&(_W))
  22. #define    isalpha(c)    ((CharTable[SyntaxTable])[c]&(_U|_L))
  23. #define    isupper(c)    ((CharTable[SyntaxTable])[c]&_U)
  24. #define    islower(c)    ((CharTable[SyntaxTable])[c]&_L)
  25. #define    isdigit(c)    ((CharTable[SyntaxTable])[c]&_N)
  26. #define    isspace(c)    ((c) == ' ' || (c) == '\t')
  27. #define ispunct(c)    ((CharTable[SyntaxTable])[c]&_P)
  28.  
  29.  
  30. #define toascii(c)    ((c)&CHARMASK)
  31. #define isctrl(c)    ((CharTable[0][c&CHARMASK])&_C)
  32. #define isopenp(c)    ((CharTable[0][c&CHARMASK])&_Op)
  33. #define isclosep(c)    ((CharTable[0][c&CHARMASK])&_Cl)
  34. #define has_syntax(c,s)    ((CharTable[SyntaxTable][(c)&CHARMASK])&(s))
  35.  
  36. #ifdef ASCII
  37. #define toupper(c)    ((c)&~040)
  38. #define tolower(c)    ((c)|040)
  39. #else /* IBMPC or MAC */
  40. #define toupper(c)    (CaseEquiv[c])
  41. /* #define tolower(c)    ((c)|040)    */
  42. #endif /* IBMPC */
  43.  
  44. #define WITH_TABLE(x) \
  45. { \
  46.     int    push = SyntaxTable; \
  47.     SyntaxTable = (x);
  48.  
  49. #define END_TABLE() \
  50.     SyntaxTable = push; \
  51. }
  52.  
  53. extern const unsigned char    CharTable[NMAJORS][NCHARS];
  54. extern const char    CaseEquiv[NCHARS];
  55. #define CharUpcase(c)    (CaseEquiv[c])
  56.