|
|
1.1 root 1: /* chardefs.h -- Character definitions for readline. */
2: #ifndef _CHARDEFS_
3:
4: #ifndef savestring
5: #ifdef NeXT
6: #define savestring(x) (char *)strcpy ((char *)malloc (1 + strlen (x)), (x))
7: #else
8: #define savestring(x) (char *)strcpy (xmalloc (1 + strlen (x)), (x))
9: #endif /* NeXT */
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:
26: #define CTRL(c) ((c) & (~control_character_bit))
27: #define META(c) ((c) | meta_character_bit)
28:
29: #define UNMETA(c) ((c) & (~meta_character_bit))
30: #define UNCTRL(c) to_upper(((c)|control_character_bit))
31:
32: #define lowercase_p(c) (((c) > ('a' - 1) && (c) < ('z' + 1)))
33: #define uppercase_p(c) (((c) > ('A' - 1) && (c) < ('Z' + 1)))
34:
35: #define pure_alphabetic(c) (lowercase_p(c) || uppercase_p(c))
36:
37: #ifndef to_upper
38: #define to_upper(c) (lowercase_p(c) ? ((c) - 32) : (c))
39: #define to_lower(c) (uppercase_p(c) ? ((c) + 32) : (c))
40: #endif
41:
42: #define CTRL_P(c) ((c) < control_character_threshold)
43: #define META_P(c) ((c) > meta_character_threshold)
44:
45: #define NEWLINE '\n'
46: #define RETURN CTRL('M')
47: #define RUBOUT 0x07f
48: #define TAB '\t'
49: #define ABORT_CHAR CTRL('G')
50: #define PAGE CTRL('L')
51: #define SPACE 0x020
52: #define ESC CTRL('[')
53:
54: #endif /* _CHARDEFS_ */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.