This commit was generated by cvs2svn to track changes on a CVS vendor
[deliverable/binutils-gdb.git] / readline / keymaps.h
CommitLineData
d60d9f65
SS
1/* keymaps.h -- Manipulation of readline keymaps. */
2
3/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
4
5 This file is part of the GNU Readline Library, a library for
6 reading lines of text with interactive input and history editing.
7
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
10 as published by the Free Software Foundation; either version 1, or
11 (at your option) any later version.
12
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
15 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 The GNU General Public License is often shipped with GNU software, and
19 is generally kept in a file called COPYING or LICENSE. If you do not
20 have a copy of the license, write to the Free Software Foundation,
21 675 Mass Ave, Cambridge, MA 02139, USA. */
22
23#ifndef _KEYMAPS_H_
24#define _KEYMAPS_H_
25
26#if defined (READLINE_LIBRARY)
c862e87b 27# include "rlstdc.h"
d60d9f65
SS
28# include "chardefs.h"
29#else
c862e87b 30# include <readline/rlstdc.h>
d60d9f65
SS
31# include <readline/chardefs.h>
32#endif
33
34#if !defined (_FUNCTION_DEF)
35# define _FUNCTION_DEF
36typedef int Function ();
37typedef void VFunction ();
38typedef char *CPFunction ();
39typedef char **CPPFunction ();
40#endif
41
42/* A keymap contains one entry for each key in the ASCII set.
43 Each entry consists of a type and a pointer.
44 FUNCTION is the address of a function to run, or the
45 address of a keymap to indirect through.
46 TYPE says which kind of thing FUNCTION is. */
47typedef struct _keymap_entry {
48 char type;
49 Function *function;
50} KEYMAP_ENTRY;
51
52/* This must be large enough to hold bindings for all of the characters
53 in a desired character set (e.g, 128 for ASCII, 256 for ISO Latin-x,
54 and so on). */
55#define KEYMAP_SIZE 256
56
57/* I wanted to make the above structure contain a union of:
58 union { Function *function; struct _keymap_entry *keymap; } value;
59 but this made it impossible for me to create a static array.
60 Maybe I need C lessons. */
61
62typedef KEYMAP_ENTRY KEYMAP_ENTRY_ARRAY[KEYMAP_SIZE];
63typedef KEYMAP_ENTRY *Keymap;
64
65/* The values that TYPE can have in a keymap entry. */
66#define ISFUNC 0
67#define ISKMAP 1
68#define ISMACR 2
69
70extern KEYMAP_ENTRY_ARRAY emacs_standard_keymap, emacs_meta_keymap, emacs_ctlx_keymap;
71extern KEYMAP_ENTRY_ARRAY vi_insertion_keymap, vi_movement_keymap;
72
73/* Return a new, empty keymap.
74 Free it with free() when you are done. */
c862e87b 75extern Keymap rl_make_bare_keymap __P((void));
d60d9f65
SS
76
77/* Return a new keymap which is a copy of MAP. */
c862e87b 78extern Keymap rl_copy_keymap __P((Keymap));
d60d9f65
SS
79
80/* Return a new keymap with the printing characters bound to rl_insert,
81 the lowercase Meta characters bound to run their equivalents, and
82 the Meta digits bound to produce numeric arguments. */
c862e87b 83extern Keymap rl_make_keymap __P((void));
d60d9f65 84
c862e87b
JM
85/* Free the storage associated with a keymap. */
86extern void rl_discard_keymap __P((Keymap));
87
88/* These functions actually appear in bind.c */
d60d9f65
SS
89
90/* Return the keymap corresponding to a given name. Names look like
c862e87b
JM
91 `emacs' or `emacs-meta' or `vi-insert'. */
92extern Keymap rl_get_keymap_by_name __P((char *));
d60d9f65
SS
93
94/* Return the current keymap. */
c862e87b 95extern Keymap rl_get_keymap __P((void));
d60d9f65
SS
96
97/* Set the current keymap to MAP. */
c862e87b 98extern void rl_set_keymap __P((Keymap));
d60d9f65
SS
99
100#endif /* _KEYMAPS_H_ */
This page took 0.046631 seconds and 4 git commands to generate.