4187119d |
1 | /* keymaps.h -- Manipulation of readline keymaps. */ |
2 | |
3 | #ifndef _KEYMAPS_H_ |
4 | #define _KEYMAPS_H_ |
5 | |
6 | #include <readline/chardefs.h> |
7 | |
8 | #ifndef __FUNCTION_DEF |
9 | typedef int Function (); |
10 | #define __FUNCTION_DEF |
11 | #endif |
12 | |
13 | /* A keymap contains one entry for each key in the ASCII set. |
14 | Each entry consists of a type and a pointer. |
15 | POINTER is the address of a function to run, or the |
16 | address of a keymap to indirect through. |
17 | TYPE says which kind of thing POINTER is. */ |
18 | typedef struct _keymap_entry { |
19 | char type; |
20 | Function *function; |
21 | } KEYMAP_ENTRY; |
22 | |
23 | /* I wanted to make the above structure contain a union of: |
24 | union { Function *function; struct _keymap_entry *keymap; } value; |
25 | but this made it impossible for me to create a static array. |
26 | Maybe I need C lessons. */ |
27 | |
28 | typedef KEYMAP_ENTRY KEYMAP_ENTRY_ARRAY[128]; |
29 | typedef KEYMAP_ENTRY *Keymap; |
30 | |
31 | /* The values that TYPE can have in a keymap entry. */ |
32 | #define ISFUNC 0 |
33 | #define ISKMAP 1 |
34 | #define ISMACR 2 |
35 | |
36 | extern KEYMAP_ENTRY_ARRAY emacs_standard_keymap, emacs_meta_keymap, emacs_ctlx_keymap; |
37 | extern KEYMAP_ENTRY_ARRAY vi_insertion_keymap, vi_movement_keymap; |
38 | |
39 | /* Return a new, empty keymap. |
40 | Free it with free() when you are done. */ |
41 | Keymap rl_make_bare_keymap (); |
42 | |
43 | /* Return a new keymap which is a copy of MAP. */ |
44 | Keymap rl_copy_keymap (); |
45 | |
46 | /* Return a new keymap with the printing characters bound to rl_insert, |
47 | the lowercase Meta characters bound to run their equivalents, and |
48 | the Meta digits bound to produce numeric arguments. */ |
49 | Keymap rl_make_keymap (); |
50 | |
51 | #endif /* _KEYMAPS_H_ */ |
52 | |
53 | |