keymaps.h revision 21308
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 1021308Sache as published by the Free Software Foundation; either version 1, 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, 2121308Sache 675 Mass Ave, Cambridge, MA 02139, USA. */ 2221308Sache 2321308Sache#ifndef _KEYMAPS_H_ 2421308Sache#define _KEYMAPS_H_ 2521308Sache 2621308Sache#if defined (READLINE_LIBRARY) 2721308Sache# include "chardefs.h" 2821308Sache#else 2921308Sache# include <readline/chardefs.h> 3021308Sache#endif 3121308Sache 3221308Sache#if !defined (_FUNCTION_DEF) 3321308Sache# define _FUNCTION_DEF 3421308Sachetypedef int Function (); 3521308Sachetypedef void VFunction (); 3621308Sachetypedef char *CPFunction (); 3721308Sachetypedef char **CPPFunction (); 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. 4221308Sache POINTER is the address of a function to run, or the 4321308Sache address of a keymap to indirect through. 4421308Sache TYPE says which kind of thing POINTER is. */ 4521308Sachetypedef struct _keymap_entry { 4621308Sache char type; 4721308Sache Function *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: 5621308Sache union { Function *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. */ 7321308Sacheextern Keymap rl_make_bare_keymap (); 7421308Sache 7521308Sache/* Return a new keymap which is a copy of MAP. */ 7621308Sacheextern Keymap rl_copy_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. */ 8121308Sacheextern Keymap rl_make_keymap (); 8221308Sache 8321308Sacheextern void rl_discard_keymap (); 8421308Sache 8521308Sache/* Return the keymap corresponding to a given name. Names look like 8621308Sache `emacs' or `emacs-meta' or `vi-insert'. */ 8721308Sacheextern Keymap rl_get_keymap_by_name (); 8821308Sache 8921308Sache/* Return the current keymap. */ 9021308Sacheextern Keymap rl_get_keymap (); 9121308Sache 9221308Sache/* Set the current keymap to MAP. */ 9321308Sacheextern void rl_set_keymap (); 9421308Sache 9521308Sache#endif /* _KEYMAPS_H_ */ 96