121308Sache/* keymaps.h -- Manipulation of readline keymaps. */ 221308Sache 321308Sache/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc. 421308Sache 521308Sache This file is part of the GNU Readline Library, a library for 621308Sache reading lines of text with interactive input and history editing. 721308Sache 821308Sache The GNU Readline Library is free software; you can redistribute it 921308Sache and/or modify it under the terms of the GNU General Public License 1058310Sache as published by the Free Software Foundation; either version 2, or 1121308Sache (at your option) any later version. 1221308Sache 1321308Sache The GNU Readline Library is distributed in the hope that it will be 1421308Sache useful, but WITHOUT ANY WARRANTY; without even the implied warranty 1521308Sache of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1621308Sache GNU General Public License for more details. 1721308Sache 1821308Sache The GNU General Public License is often shipped with GNU software, and 1921308Sache is generally kept in a file called COPYING or LICENSE. If you do not 2021308Sache have a copy of the license, write to the Free Software Foundation, 2158310Sache 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ 2221308Sache 2321308Sache#ifndef _KEYMAPS_H_ 2421308Sache#define _KEYMAPS_H_ 2521308Sache 2658310Sache#ifdef __cplusplus 2758310Sacheextern "C" { 2858310Sache#endif 2958310Sache 3021308Sache#if defined (READLINE_LIBRARY) 3147558Sache# include "rlstdc.h" 3221308Sache# include "chardefs.h" 3375406Sache# include "rltypedefs.h" 3421308Sache#else 3547558Sache# include <readline/rlstdc.h> 3621308Sache# include <readline/chardefs.h> 3775406Sache# include <readline/rltypedefs.h> 3821308Sache#endif 3921308Sache 4021308Sache/* A keymap contains one entry for each key in the ASCII set. 4121308Sache Each entry consists of a type and a pointer. 4235486Sache FUNCTION is the address of a function to run, or the 4321308Sache address of a keymap to indirect through. 4435486Sache TYPE says which kind of thing FUNCTION is. */ 4521308Sachetypedef struct _keymap_entry { 4621308Sache char type; 4775406Sache rl_command_func_t *function; 4821308Sache} KEYMAP_ENTRY; 4921308Sache 5021308Sache/* This must be large enough to hold bindings for all of the characters 5121308Sache in a desired character set (e.g, 128 for ASCII, 256 for ISO Latin-x, 52119610Sache and so on) plus one for subsequence matching. */ 53119610Sache#define KEYMAP_SIZE 257 54119610Sache#define ANYOTHERKEY KEYMAP_SIZE-1 5521308Sache 5621308Sache/* I wanted to make the above structure contain a union of: 5775406Sache union { rl_command_func_t *function; struct _keymap_entry *keymap; } value; 5821308Sache but this made it impossible for me to create a static array. 5921308Sache Maybe I need C lessons. */ 6021308Sache 6121308Sachetypedef KEYMAP_ENTRY KEYMAP_ENTRY_ARRAY[KEYMAP_SIZE]; 6221308Sachetypedef KEYMAP_ENTRY *Keymap; 6321308Sache 6421308Sache/* The values that TYPE can have in a keymap entry. */ 6521308Sache#define ISFUNC 0 6621308Sache#define ISKMAP 1 6721308Sache#define ISMACR 2 6821308Sache 6921308Sacheextern KEYMAP_ENTRY_ARRAY emacs_standard_keymap, emacs_meta_keymap, emacs_ctlx_keymap; 7021308Sacheextern KEYMAP_ENTRY_ARRAY vi_insertion_keymap, vi_movement_keymap; 7121308Sache 7221308Sache/* Return a new, empty keymap. 7321308Sache Free it with free() when you are done. */ 74119610Sacheextern Keymap rl_make_bare_keymap PARAMS((void)); 7521308Sache 7621308Sache/* Return a new keymap which is a copy of MAP. */ 77119610Sacheextern Keymap rl_copy_keymap PARAMS((Keymap)); 7821308Sache 7921308Sache/* Return a new keymap with the printing characters bound to rl_insert, 8021308Sache the lowercase Meta characters bound to run their equivalents, and 8121308Sache the Meta digits bound to produce numeric arguments. */ 82119610Sacheextern Keymap rl_make_keymap PARAMS((void)); 8321308Sache 8447558Sache/* Free the storage associated with a keymap. */ 85119610Sacheextern void rl_discard_keymap PARAMS((Keymap)); 8621308Sache 8747558Sache/* These functions actually appear in bind.c */ 8847558Sache 8921308Sache/* Return the keymap corresponding to a given name. Names look like 9047558Sache `emacs' or `emacs-meta' or `vi-insert'. */ 91119610Sacheextern Keymap rl_get_keymap_by_name PARAMS((const char *)); 9221308Sache 9321308Sache/* Return the current keymap. */ 94119610Sacheextern Keymap rl_get_keymap PARAMS((void)); 9521308Sache 9621308Sache/* Set the current keymap to MAP. */ 97119610Sacheextern void rl_set_keymap PARAMS((Keymap)); 9821308Sache 9958310Sache#ifdef __cplusplus 10058310Sache} 10158310Sache#endif 10258310Sache 10321308Sache#endif /* _KEYMAPS_H_ */ 104