keymaps.h revision 75406
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, 5221308Sache and so on). */ 5321308Sache#define KEYMAP_SIZE 256 5421308Sache 5521308Sache/* I wanted to make the above structure contain a union of: 5675406Sache union { rl_command_func_t *function; struct _keymap_entry *keymap; } value; 5721308Sache but this made it impossible for me to create a static array. 5821308Sache Maybe I need C lessons. */ 5921308Sache 6021308Sachetypedef KEYMAP_ENTRY KEYMAP_ENTRY_ARRAY[KEYMAP_SIZE]; 6121308Sachetypedef KEYMAP_ENTRY *Keymap; 6221308Sache 6321308Sache/* The values that TYPE can have in a keymap entry. */ 6421308Sache#define ISFUNC 0 6521308Sache#define ISKMAP 1 6621308Sache#define ISMACR 2 6721308Sache 6821308Sacheextern KEYMAP_ENTRY_ARRAY emacs_standard_keymap, emacs_meta_keymap, emacs_ctlx_keymap; 6921308Sacheextern KEYMAP_ENTRY_ARRAY vi_insertion_keymap, vi_movement_keymap; 7021308Sache 7121308Sache/* Return a new, empty keymap. 7221308Sache Free it with free() when you are done. */ 7347558Sacheextern Keymap rl_make_bare_keymap __P((void)); 7421308Sache 7521308Sache/* Return a new keymap which is a copy of MAP. */ 7647558Sacheextern Keymap rl_copy_keymap __P((Keymap)); 7721308Sache 7821308Sache/* Return a new keymap with the printing characters bound to rl_insert, 7921308Sache the lowercase Meta characters bound to run their equivalents, and 8021308Sache the Meta digits bound to produce numeric arguments. */ 8147558Sacheextern Keymap rl_make_keymap __P((void)); 8221308Sache 8347558Sache/* Free the storage associated with a keymap. */ 8447558Sacheextern void rl_discard_keymap __P((Keymap)); 8521308Sache 8647558Sache/* These functions actually appear in bind.c */ 8747558Sache 8821308Sache/* Return the keymap corresponding to a given name. Names look like 8947558Sache `emacs' or `emacs-meta' or `vi-insert'. */ 9075406Sacheextern Keymap rl_get_keymap_by_name __P((const char *)); 9121308Sache 9221308Sache/* Return the current keymap. */ 9347558Sacheextern Keymap rl_get_keymap __P((void)); 9421308Sache 9521308Sache/* Set the current keymap to MAP. */ 9647558Sacheextern void rl_set_keymap __P((Keymap)); 9721308Sache 9858310Sache#ifdef __cplusplus 9958310Sache} 10058310Sache#endif 10158310Sache 10221308Sache#endif /* _KEYMAPS_H_ */ 103