Merge in changes from bash-1.13. The most obvious one is
[deliverable/binutils-gdb.git] / readline / chardefs.h
CommitLineData
bd5635a1
RP
1/* chardefs.h -- Character definitions for readline. */
2#ifndef _CHARDEFS_
5e98bbab
PB
3#define _CHARDEFS_
4
5#include <ctype.h>
6
7#if defined (HAVE_STRING_H)
8# include <string.h>
9#else
10# include <strings.h>
11#endif /* HAVE_STRING_H */
bd5635a1
RP
12
13#ifndef savestring
5e98bbab
PB
14extern char *xmalloc ();
15# ifndef strcpy
16extern char *strcpy ();
17# endif
18#define savestring(x) strcpy (xmalloc (1 + strlen (x)), (x))
bd5635a1
RP
19#endif
20
21#ifndef whitespace
22#define whitespace(c) (((c) == ' ') || ((c) == '\t'))
23#endif
24
25#ifdef CTRL
26#undef CTRL
27#endif
28
29/* Some character stuff. */
5e98bbab
PB
30#define control_character_threshold 0x020 /* Smaller than this is control. */
31#define meta_character_threshold 0x07f /* Larger than this is Meta. */
bd5635a1
RP
32#define control_character_bit 0x40 /* 0x000000, must be off. */
33#define meta_character_bit 0x080 /* x0000000, must be on. */
5e98bbab 34#define largest_char 255 /* Largest character value. */
bd5635a1 35
5e98bbab 36#define META_CHAR(c) ((c) > meta_character_threshold && (c) <= largest_char)
bd5635a1
RP
37#define CTRL(c) ((c) & (~control_character_bit))
38#define META(c) ((c) | meta_character_bit)
39
40#define UNMETA(c) ((c) & (~meta_character_bit))
41#define UNCTRL(c) to_upper(((c)|control_character_bit))
42
43#define lowercase_p(c) (((c) > ('a' - 1) && (c) < ('z' + 1)))
44#define uppercase_p(c) (((c) > ('A' - 1) && (c) < ('Z' + 1)))
45
46#define pure_alphabetic(c) (lowercase_p(c) || uppercase_p(c))
47
48#ifndef to_upper
49#define to_upper(c) (lowercase_p(c) ? ((c) - 32) : (c))
50#define to_lower(c) (uppercase_p(c) ? ((c) + 32) : (c))
51#endif
52
53#define CTRL_P(c) ((c) < control_character_threshold)
54#define META_P(c) ((c) > meta_character_threshold)
55
5e98bbab 56#ifndef NEWLINE
bd5635a1 57#define NEWLINE '\n'
5e98bbab
PB
58#endif
59
60#ifndef RETURN
bd5635a1 61#define RETURN CTRL('M')
5e98bbab
PB
62#endif
63
64#ifndef RUBOUT
bd5635a1 65#define RUBOUT 0x07f
5e98bbab
PB
66#endif
67
68#ifndef TAB
bd5635a1 69#define TAB '\t'
5e98bbab
PB
70#endif
71
72#ifdef ABORT_CHAR
73#undef ABORT_CHAR
74#endif
bd5635a1 75#define ABORT_CHAR CTRL('G')
5e98bbab
PB
76
77#ifdef PAGE
78#undef PAGE
79#endif
bd5635a1 80#define PAGE CTRL('L')
5e98bbab
PB
81
82#ifdef SPACE
83#undef SPACE
84#endif
bd5635a1 85#define SPACE 0x020
5e98bbab
PB
86
87#ifdef ESC
88#undef ESC
89#endif
90
bd5635a1
RP
91#define ESC CTRL('[')
92
93#endif /* _CHARDEFS_ */
This page took 0.102707 seconds and 4 git commands to generate.