home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / Source / GNU / debug / gdb / readline / chardefs.h < prev    next >
C/C++ Source or Header  |  1995-07-28  |  2KB  |  85 lines

  1. /* chardefs.h -- Character definitions for readline. */
  2. #ifndef _CHARDEFS_
  3. #define _CHARDEFS_
  4.  
  5. #include <ctype.h>
  6.  
  7. #ifndef savestring
  8. #define savestring(X) _rl_savestring(X)
  9. extern char * _rl_savestring ();
  10. #endif
  11.  
  12. #ifndef whitespace
  13. #define whitespace(c) (((c) == ' ') || ((c) == '\t'))
  14. #endif
  15.  
  16. #ifdef CTRL
  17. #undef CTRL
  18. #endif
  19.  
  20. /* Some character stuff. */
  21. #define control_character_threshold 0x020   /* Smaller than this is control. */
  22. #define meta_character_threshold 0x07f        /* Larger than this is Meta. */
  23. #define control_character_bit 0x40        /* 0x000000, must be off. */
  24. #define meta_character_bit 0x080        /* x0000000, must be on. */
  25. #define largest_char 255            /* Largest character value. */
  26.  
  27. #define META_CHAR(c) ((c) > meta_character_threshold && (c) <= largest_char)
  28. #define CTRL(c) ((c) & (~control_character_bit))
  29. #define META(c) ((c) | meta_character_bit)
  30.  
  31. #define UNMETA(c) ((c) & (~meta_character_bit))
  32. #define UNCTRL(c) to_upper(((c)|control_character_bit))
  33.  
  34. #define lowercase_p(c) (((c) > ('a' - 1) && (c) < ('z' + 1)))
  35. #define uppercase_p(c) (((c) > ('A' - 1) && (c) < ('Z' + 1)))
  36.  
  37. #define pure_alphabetic(c) (lowercase_p(c) || uppercase_p(c))
  38.  
  39. #ifndef to_upper
  40. #define to_upper(c) (lowercase_p(c) ? ((c) - 32) : (c))
  41. #define to_lower(c) (uppercase_p(c) ? ((c) + 32) : (c))
  42. #endif
  43.  
  44. #define CTRL_P(c) ((c) < control_character_threshold)
  45. #define META_P(c) ((c) > meta_character_threshold)
  46.  
  47. #ifndef NEWLINE
  48. #define NEWLINE '\n'
  49. #endif
  50.  
  51. #ifndef RETURN
  52. #define RETURN CTRL('M')
  53. #endif
  54.  
  55. #ifndef RUBOUT
  56. #define RUBOUT 0x07f
  57. #endif
  58.  
  59. #ifndef TAB
  60. #define TAB '\t'
  61. #endif
  62.  
  63. #ifdef ABORT_CHAR
  64. #undef ABORT_CHAR
  65. #endif
  66. #define ABORT_CHAR CTRL('G')
  67.  
  68. #ifdef PAGE
  69. #undef PAGE
  70. #endif
  71. #define PAGE CTRL('L')
  72.  
  73. #ifdef SPACE
  74. #undef SPACE
  75. #endif
  76. #define SPACE 0x020
  77.  
  78. #ifdef ESC
  79. #undef ESC
  80. #endif
  81.  
  82. #define ESC CTRL('[')
  83.  
  84. #endif  /* _CHARDEFS_ */
  85.