freebsd-dev/contrib/libreadline/keymaps.h

104 lines
3.4 KiB
C
Raw Normal View History

1997-01-04 22:09:20 +00:00
/* keymaps.h -- Manipulation of readline keymaps. */
/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
reading lines of text with interactive input and history editing.
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
2000-03-19 21:18:09 +00:00
as published by the Free Software Foundation; either version 2, or
1997-01-04 22:09:20 +00:00
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
2000-03-19 21:18:09 +00:00
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
1997-01-04 22:09:20 +00:00
#ifndef _KEYMAPS_H_
#define _KEYMAPS_H_
2000-03-19 21:18:09 +00:00
#ifdef __cplusplus
extern "C" {
#endif
1997-01-04 22:09:20 +00:00
#if defined (READLINE_LIBRARY)
1999-05-28 01:59:23 +00:00
# include "rlstdc.h"
1997-01-04 22:09:20 +00:00
# include "chardefs.h"
2001-04-11 02:33:07 +00:00
# include "rltypedefs.h"
1997-01-04 22:09:20 +00:00
#else
1999-05-28 01:59:23 +00:00
# include <readline/rlstdc.h>
1997-01-04 22:09:20 +00:00
# include <readline/chardefs.h>
2001-04-11 02:33:07 +00:00
# include <readline/rltypedefs.h>
1997-01-04 22:09:20 +00:00
#endif
/* A keymap contains one entry for each key in the ASCII set.
Each entry consists of a type and a pointer.
1998-04-28 06:22:20 +00:00
FUNCTION is the address of a function to run, or the
1997-01-04 22:09:20 +00:00
address of a keymap to indirect through.
1998-04-28 06:22:20 +00:00
TYPE says which kind of thing FUNCTION is. */
1997-01-04 22:09:20 +00:00
typedef struct _keymap_entry {
char type;
2001-04-11 02:33:07 +00:00
rl_command_func_t *function;
1997-01-04 22:09:20 +00:00
} KEYMAP_ENTRY;
/* This must be large enough to hold bindings for all of the characters
in a desired character set (e.g, 128 for ASCII, 256 for ISO Latin-x,
2003-08-31 17:55:46 +00:00
and so on) plus one for subsequence matching. */
#define KEYMAP_SIZE 257
#define ANYOTHERKEY KEYMAP_SIZE-1
1997-01-04 22:09:20 +00:00
/* I wanted to make the above structure contain a union of:
2001-04-11 02:33:07 +00:00
union { rl_command_func_t *function; struct _keymap_entry *keymap; } value;
1997-01-04 22:09:20 +00:00
but this made it impossible for me to create a static array.
Maybe I need C lessons. */
typedef KEYMAP_ENTRY KEYMAP_ENTRY_ARRAY[KEYMAP_SIZE];
typedef KEYMAP_ENTRY *Keymap;
/* The values that TYPE can have in a keymap entry. */
#define ISFUNC 0
#define ISKMAP 1
#define ISMACR 2
extern KEYMAP_ENTRY_ARRAY emacs_standard_keymap, emacs_meta_keymap, emacs_ctlx_keymap;
extern KEYMAP_ENTRY_ARRAY vi_insertion_keymap, vi_movement_keymap;
/* Return a new, empty keymap.
Free it with free() when you are done. */
2003-08-31 17:55:46 +00:00
extern Keymap rl_make_bare_keymap PARAMS((void));
1997-01-04 22:09:20 +00:00
/* Return a new keymap which is a copy of MAP. */
2003-08-31 17:55:46 +00:00
extern Keymap rl_copy_keymap PARAMS((Keymap));
1997-01-04 22:09:20 +00:00
/* Return a new keymap with the printing characters bound to rl_insert,
the lowercase Meta characters bound to run their equivalents, and
the Meta digits bound to produce numeric arguments. */
2003-08-31 17:55:46 +00:00
extern Keymap rl_make_keymap PARAMS((void));
1997-01-04 22:09:20 +00:00
1999-05-28 01:59:23 +00:00
/* Free the storage associated with a keymap. */
2003-08-31 17:55:46 +00:00
extern void rl_discard_keymap PARAMS((Keymap));
1999-05-28 01:59:23 +00:00
/* These functions actually appear in bind.c */
1997-01-04 22:09:20 +00:00
/* Return the keymap corresponding to a given name. Names look like
1999-05-28 01:59:23 +00:00
`emacs' or `emacs-meta' or `vi-insert'. */
2003-08-31 17:55:46 +00:00
extern Keymap rl_get_keymap_by_name PARAMS((const char *));
1997-01-04 22:09:20 +00:00
/* Return the current keymap. */
2003-08-31 17:55:46 +00:00
extern Keymap rl_get_keymap PARAMS((void));
1997-01-04 22:09:20 +00:00
/* Set the current keymap to MAP. */
2003-08-31 17:55:46 +00:00
extern void rl_set_keymap PARAMS((Keymap));
1997-01-04 22:09:20 +00:00
2000-03-19 21:18:09 +00:00
#ifdef __cplusplus
}
#endif
1997-01-04 22:09:20 +00:00
#endif /* _KEYMAPS_H_ */