jpayne@69
|
1 /* keymaps.h -- Manipulation of readline keymaps. */
|
jpayne@69
|
2
|
jpayne@69
|
3 /* Copyright (C) 1987, 1989, 1992-2021 Free Software Foundation, Inc.
|
jpayne@69
|
4
|
jpayne@69
|
5 This file is part of the GNU Readline Library (Readline), a library
|
jpayne@69
|
6 for reading lines of text with interactive input and history editing.
|
jpayne@69
|
7
|
jpayne@69
|
8 Readline is free software: you can redistribute it and/or modify
|
jpayne@69
|
9 it under the terms of the GNU General Public License as published by
|
jpayne@69
|
10 the Free Software Foundation, either version 3 of the License, or
|
jpayne@69
|
11 (at your option) any later version.
|
jpayne@69
|
12
|
jpayne@69
|
13 Readline is distributed in the hope that it will be useful,
|
jpayne@69
|
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
|
jpayne@69
|
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
jpayne@69
|
16 GNU General Public License for more details.
|
jpayne@69
|
17
|
jpayne@69
|
18 You should have received a copy of the GNU General Public License
|
jpayne@69
|
19 along with Readline. If not, see <http://www.gnu.org/licenses/>.
|
jpayne@69
|
20 */
|
jpayne@69
|
21
|
jpayne@69
|
22 #ifndef _KEYMAPS_H_
|
jpayne@69
|
23 #define _KEYMAPS_H_
|
jpayne@69
|
24
|
jpayne@69
|
25 #ifdef __cplusplus
|
jpayne@69
|
26 extern "C" {
|
jpayne@69
|
27 #endif
|
jpayne@69
|
28
|
jpayne@69
|
29 #if defined (READLINE_LIBRARY)
|
jpayne@69
|
30 # include "rlstdc.h"
|
jpayne@69
|
31 # include "chardefs.h"
|
jpayne@69
|
32 # include "rltypedefs.h"
|
jpayne@69
|
33 #else
|
jpayne@69
|
34 # include <readline/rlstdc.h>
|
jpayne@69
|
35 # include <readline/chardefs.h>
|
jpayne@69
|
36 # include <readline/rltypedefs.h>
|
jpayne@69
|
37 #endif
|
jpayne@69
|
38
|
jpayne@69
|
39 /* A keymap contains one entry for each key in the ASCII set.
|
jpayne@69
|
40 Each entry consists of a type and a pointer.
|
jpayne@69
|
41 FUNCTION is the address of a function to run, or the
|
jpayne@69
|
42 address of a keymap to indirect through.
|
jpayne@69
|
43 TYPE says which kind of thing FUNCTION is. */
|
jpayne@69
|
44 typedef struct _keymap_entry {
|
jpayne@69
|
45 char type;
|
jpayne@69
|
46 rl_command_func_t *function;
|
jpayne@69
|
47 } KEYMAP_ENTRY;
|
jpayne@69
|
48
|
jpayne@69
|
49 /* This must be large enough to hold bindings for all of the characters
|
jpayne@69
|
50 in a desired character set (e.g, 128 for ASCII, 256 for ISO Latin-x,
|
jpayne@69
|
51 and so on) plus one for subsequence matching. */
|
jpayne@69
|
52 #define KEYMAP_SIZE 257
|
jpayne@69
|
53 #define ANYOTHERKEY KEYMAP_SIZE-1
|
jpayne@69
|
54
|
jpayne@69
|
55 typedef KEYMAP_ENTRY KEYMAP_ENTRY_ARRAY[KEYMAP_SIZE];
|
jpayne@69
|
56 typedef KEYMAP_ENTRY *Keymap;
|
jpayne@69
|
57
|
jpayne@69
|
58 /* The values that TYPE can have in a keymap entry. */
|
jpayne@69
|
59 #define ISFUNC 0
|
jpayne@69
|
60 #define ISKMAP 1
|
jpayne@69
|
61 #define ISMACR 2
|
jpayne@69
|
62
|
jpayne@69
|
63 extern KEYMAP_ENTRY_ARRAY emacs_standard_keymap, emacs_meta_keymap, emacs_ctlx_keymap;
|
jpayne@69
|
64 extern KEYMAP_ENTRY_ARRAY vi_insertion_keymap, vi_movement_keymap;
|
jpayne@69
|
65
|
jpayne@69
|
66 /* Return a new, empty keymap.
|
jpayne@69
|
67 Free it with free() when you are done. */
|
jpayne@69
|
68 extern Keymap rl_make_bare_keymap (void);
|
jpayne@69
|
69
|
jpayne@69
|
70 /* Return a new keymap which is a copy of MAP. */
|
jpayne@69
|
71 extern Keymap rl_copy_keymap (Keymap);
|
jpayne@69
|
72
|
jpayne@69
|
73 /* Return a new keymap with the printing characters bound to rl_insert,
|
jpayne@69
|
74 the lowercase Meta characters bound to run their equivalents, and
|
jpayne@69
|
75 the Meta digits bound to produce numeric arguments. */
|
jpayne@69
|
76 extern Keymap rl_make_keymap (void);
|
jpayne@69
|
77
|
jpayne@69
|
78 /* Free the storage associated with a keymap. */
|
jpayne@69
|
79 extern void rl_discard_keymap (Keymap);
|
jpayne@69
|
80
|
jpayne@69
|
81 /* These functions actually appear in bind.c */
|
jpayne@69
|
82
|
jpayne@69
|
83 /* Return the keymap corresponding to a given name. Names look like
|
jpayne@69
|
84 `emacs' or `emacs-meta' or `vi-insert'. */
|
jpayne@69
|
85 extern Keymap rl_get_keymap_by_name (const char *);
|
jpayne@69
|
86
|
jpayne@69
|
87 /* Return the current keymap. */
|
jpayne@69
|
88 extern Keymap rl_get_keymap (void);
|
jpayne@69
|
89
|
jpayne@69
|
90 /* Set the current keymap to MAP. */
|
jpayne@69
|
91 extern void rl_set_keymap (Keymap);
|
jpayne@69
|
92
|
jpayne@69
|
93 /* Set the name of MAP to NAME */
|
jpayne@69
|
94 extern int rl_set_keymap_name (const char *, Keymap);
|
jpayne@69
|
95
|
jpayne@69
|
96 #ifdef __cplusplus
|
jpayne@69
|
97 }
|
jpayne@69
|
98 #endif
|
jpayne@69
|
99
|
jpayne@69
|
100 #endif /* _KEYMAPS_H_ */
|