keymaps.h revision 47558
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) 2747558Sache# include "rlstdc.h" 2821308Sache# include "chardefs.h" 2921308Sache#else 3047558Sache# include <readline/rlstdc.h> 3121308Sache# include <readline/chardefs.h> 3221308Sache#endif 3321308Sache 3421308Sache#if !defined (_FUNCTION_DEF) 3521308Sache# define _FUNCTION_DEF 3621308Sachetypedef int Function (); 3721308Sachetypedef void VFunction (); 3821308Sachetypedef char *CPFunction (); 3921308Sachetypedef char **CPPFunction (); 4021308Sache#endif 4121308Sache 4221308Sache/* A keymap contains one entry for each key in the ASCII set. 4321308Sache Each entry consists of a type and a pointer. 4435486Sache FUNCTION is the address of a function to run, or the 4521308Sache address of a keymap to indirect through. 4635486Sache TYPE says which kind of thing FUNCTION is. */ 4721308Sachetypedef struct _keymap_entry { 4821308Sache char type; 4921308Sache Function *function; 5021308Sache} KEYMAP_ENTRY; 5121308Sache 5221308Sache/* This must be large enough to hold bindings for all of the characters 5321308Sache in a desired character set (e.g, 128 for ASCII, 256 for ISO Latin-x, 5421308Sache and so on). */ 5521308Sache#define KEYMAP_SIZE 256 5621308Sache 5721308Sache/* I wanted to make the above structure contain a union of: 5821308Sache union { Function *function; struct _keymap_entry *keymap; } value; 5921308Sache but this made it impossible for me to create a static array. 6021308Sache Maybe I need C lessons. */ 6121308Sache 6221308Sachetypedef KEYMAP_ENTRY KEYMAP_ENTRY_ARRAY[KEYMAP_SIZE]; 6321308Sachetypedef KEYMAP_ENTRY *Keymap; 6421308Sache 6521308Sache/* The values that TYPE can have in a keymap entry. */ 6621308Sache#define ISFUNC 0 6721308Sache#define ISKMAP 1 6821308Sache#define ISMACR 2 6921308Sache 7021308Sacheextern KEYMAP_ENTRY_ARRAY emacs_standard_keymap, emacs_meta_keymap, emacs_ctlx_keymap; 7121308Sacheextern KEYMAP_ENTRY_ARRAY vi_insertion_keymap, vi_movement_keymap; 7221308Sache 7321308Sache/* Return a new, empty keymap. 7421308Sache Free it with free() when you are done. */ 7547558Sacheextern Keymap rl_make_bare_keymap __P((void)); 7621308Sache 7721308Sache/* Return a new keymap which is a copy of MAP. */ 7847558Sacheextern Keymap rl_copy_keymap __P((Keymap)); 7921308Sache 8021308Sache/* Return a new keymap with the printing characters bound to rl_insert, 8121308Sache the lowercase Meta characters bound to run their equivalents, and 8221308Sache the Meta digits bound to produce numeric arguments. */ 8347558Sacheextern Keymap rl_make_keymap __P((void)); 8421308Sache 8547558Sache/* Free the storage associated with a keymap. */ 8647558Sacheextern void rl_discard_keymap __P((Keymap)); 8721308Sache 8847558Sache/* These functions actually appear in bind.c */ 8947558Sache 9021308Sache/* Return the keymap corresponding to a given name. Names look like 9147558Sache `emacs' or `emacs-meta' or `vi-insert'. */ 9247558Sacheextern Keymap rl_get_keymap_by_name __P((char *)); 9321308Sache 9421308Sache/* Return the current keymap. */ 9547558Sacheextern Keymap rl_get_keymap __P((void)); 9621308Sache 9721308Sache/* Set the current keymap to MAP. */ 9847558Sacheextern void rl_set_keymap __P((Keymap)); 9921308Sache 10021308Sache#endif /* _KEYMAPS_H_ */ 101