1 /* chardefs.h -- Character definitions for readline. */
7 #if defined (HAVE_STRING_H)
11 #endif /* HAVE_STRING_H */
14 extern char *xmalloc ();
16 extern char *strcpy ();
18 #define savestring(x) strcpy (xmalloc (1 + strlen (x)), (x))
22 #define whitespace(c) (((c) == ' ') || ((c) == '\t'))
29 /* Some character stuff. */
30 #define control_character_threshold 0x020 /* Smaller than this is control. */
31 #define meta_character_threshold 0x07f /* Larger than this is Meta. */
32 #define control_character_bit 0x40 /* 0x000000, must be off. */
33 #define meta_character_bit 0x080 /* x0000000, must be on. */
34 #define largest_char 255 /* Largest character value. */
36 #define META_CHAR(c) ((c) > meta_character_threshold && (c) <= largest_char)
37 #define CTRL(c) ((c) & (~control_character_bit))
38 #define META(c) ((c) | meta_character_bit)
40 #define UNMETA(c) ((c) & (~meta_character_bit))
41 #define UNCTRL(c) to_upper(((c)|control_character_bit))
43 #define lowercase_p(c) (((c) > ('a' - 1) && (c) < ('z' + 1)))
44 #define uppercase_p(c) (((c) > ('A' - 1) && (c) < ('Z' + 1)))
46 #define pure_alphabetic(c) (lowercase_p(c) || uppercase_p(c))
49 #define to_upper(c) (lowercase_p(c) ? ((c) - 32) : (c))
50 #define to_lower(c) (uppercase_p(c) ? ((c) + 32) : (c))
53 #define CTRL_P(c) ((c) < control_character_threshold)
54 #define META_P(c) ((c) > meta_character_threshold)
61 #define RETURN CTRL('M')
75 #define ABORT_CHAR CTRL('G')
80 #define PAGE CTRL('L')
93 #endif /* _CHARDEFS_ */