comparison readline/keymaps.h @ 3779:3001e15555e9

[project @ 2001-02-07 04:47:51 by jwe]
author jwe
date Wed, 07 Feb 2001 04:48:01 +0000
parents f7e4a95916f2
children
comparison
equal deleted inserted replaced
3778:594ead754542 3779:3001e15555e9
5 This file is part of the GNU Readline Library, a library for 5 This file is part of the GNU Readline Library, a library for
6 reading lines of text with interactive input and history editing. 6 reading lines of text with interactive input and history editing.
7 7
8 The GNU Readline Library is free software; you can redistribute it 8 The GNU Readline Library is free software; you can redistribute it
9 and/or modify it under the terms of the GNU General Public License 9 and/or modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 1, or 10 as published by the Free Software Foundation; either version 2, or
11 (at your option) any later version. 11 (at your option) any later version.
12 12
13 The GNU Readline Library is distributed in the hope that it will be 13 The GNU Readline Library is distributed in the hope that it will be
14 useful, but WITHOUT ANY WARRANTY; without even the implied warranty 14 useful, but WITHOUT ANY WARRANTY; without even the implied warranty
15 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ 21 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
22 22
23 #ifndef _KEYMAPS_H_ 23 #ifndef _KEYMAPS_H_
24 #define _KEYMAPS_H_ 24 #define _KEYMAPS_H_
25 25
26 #if defined (READLINE_LIBRARY) 26 #ifdef __cplusplus
27 # include "chardefs.h" 27 extern "C" {
28 #else
29 # include <readline/chardefs.h>
30 #endif 28 #endif
31 29
32 #if !defined (_FUNCTION_DEF) 30 #if defined (READLINE_LIBRARY)
33 # define _FUNCTION_DEF 31 # include "rlstdc.h"
34 typedef int Function (); 32 # include "chardefs.h"
35 typedef void VFunction (); 33 # include "rltypedefs.h"
36 typedef char *CPFunction (); 34 #else
37 typedef char **CPPFunction (); 35 # include <readline/rlstdc.h>
36 # include <readline/chardefs.h>
37 # include <readline/rltypedefs.h>
38 #endif 38 #endif
39 39
40 /* A keymap contains one entry for each key in the ASCII set. 40 /* A keymap contains one entry for each key in the ASCII set.
41 Each entry consists of a type and a pointer. 41 Each entry consists of a type and a pointer.
42 POINTER is the address of a function to run, or the 42 FUNCTION is the address of a function to run, or the
43 address of a keymap to indirect through. 43 address of a keymap to indirect through.
44 TYPE says which kind of thing POINTER is. */ 44 TYPE says which kind of thing FUNCTION is. */
45 typedef struct _keymap_entry { 45 typedef struct _keymap_entry {
46 char type; 46 char type;
47 Function *function; 47 rl_command_func_t *function;
48 } KEYMAP_ENTRY; 48 } KEYMAP_ENTRY;
49 49
50 /* This must be large enough to hold bindings for all of the characters 50 /* This must be large enough to hold bindings for all of the characters
51 in a desired character set (e.g, 128 for ASCII, 256 for ISO Latin-x, 51 in a desired character set (e.g, 128 for ASCII, 256 for ISO Latin-x,
52 and so on). */ 52 and so on). */
53 #define KEYMAP_SIZE 256 53 #define KEYMAP_SIZE 256
54 54
55 /* I wanted to make the above structure contain a union of: 55 /* I wanted to make the above structure contain a union of:
56 union { Function *function; struct _keymap_entry *keymap; } value; 56 union { rl_command_func_t *function; struct _keymap_entry *keymap; } value;
57 but this made it impossible for me to create a static array. 57 but this made it impossible for me to create a static array.
58 Maybe I need C lessons. */ 58 Maybe I need C lessons. */
59 59
60 typedef KEYMAP_ENTRY KEYMAP_ENTRY_ARRAY[KEYMAP_SIZE]; 60 typedef KEYMAP_ENTRY KEYMAP_ENTRY_ARRAY[KEYMAP_SIZE];
61 typedef KEYMAP_ENTRY *Keymap; 61 typedef KEYMAP_ENTRY *Keymap;
68 extern KEYMAP_ENTRY_ARRAY emacs_standard_keymap, emacs_meta_keymap, emacs_ctlx_keymap; 68 extern KEYMAP_ENTRY_ARRAY emacs_standard_keymap, emacs_meta_keymap, emacs_ctlx_keymap;
69 extern KEYMAP_ENTRY_ARRAY vi_insertion_keymap, vi_movement_keymap; 69 extern KEYMAP_ENTRY_ARRAY vi_insertion_keymap, vi_movement_keymap;
70 70
71 /* Return a new, empty keymap. 71 /* Return a new, empty keymap.
72 Free it with free() when you are done. */ 72 Free it with free() when you are done. */
73 extern Keymap rl_make_bare_keymap (); 73 extern Keymap rl_make_bare_keymap __P((void));
74 74
75 /* Return a new keymap which is a copy of MAP. */ 75 /* Return a new keymap which is a copy of MAP. */
76 extern Keymap rl_copy_keymap (); 76 extern Keymap rl_copy_keymap __P((Keymap));
77 77
78 /* Return a new keymap with the printing characters bound to rl_insert, 78 /* Return a new keymap with the printing characters bound to rl_insert,
79 the lowercase Meta characters bound to run their equivalents, and 79 the lowercase Meta characters bound to run their equivalents, and
80 the Meta digits bound to produce numeric arguments. */ 80 the Meta digits bound to produce numeric arguments. */
81 extern Keymap rl_make_keymap (); 81 extern Keymap rl_make_keymap __P((void));
82 82
83 extern void rl_discard_keymap (); 83 /* Free the storage associated with a keymap. */
84 extern void rl_discard_keymap __P((Keymap));
85
86 /* These functions actually appear in bind.c */
84 87
85 /* Return the keymap corresponding to a given name. Names look like 88 /* Return the keymap corresponding to a given name. Names look like
86 `emacs' or `emacs-meta' or `vi-insert'. */ 89 `emacs' or `emacs-meta' or `vi-insert'. */
87 extern Keymap rl_get_keymap_by_name (); 90 extern Keymap rl_get_keymap_by_name __P((const char *));
88 91
89 /* Return the current keymap. */ 92 /* Return the current keymap. */
90 extern Keymap rl_get_keymap (); 93 extern Keymap rl_get_keymap __P((void));
91 94
92 /* Set the current keymap to MAP. */ 95 /* Set the current keymap to MAP. */
93 extern void rl_set_keymap (); 96 extern void rl_set_keymap __P((Keymap));
97
98 #ifdef __cplusplus
99 }
100 #endif
94 101
95 #endif /* _KEYMAPS_H_ */ 102 #endif /* _KEYMAPS_H_ */