1193326Sed/*- 2193326Sed * Copyright (c) 1992, 1993 3193326Sed * The Regents of the University of California. All rights reserved. 4193326Sed * 5193326Sed * This code is derived from software contributed to Berkeley by 6193326Sed * Christos Zoulas of Cornell University. 7193326Sed * 8193326Sed * Redistribution and use in source and binary forms, with or without 9193326Sed * modification, are permitted provided that the following conditions 10193326Sed * are met: 11193326Sed * 1. Redistributions of source code must retain the above copyright 12193326Sed * notice, this list of conditions and the following disclaimer. 13193326Sed * 2. Redistributions in binary form must reproduce the above copyright 14218893Sdim * notice, this list of conditions and the following disclaimer in the 15193326Sed * documentation and/or other materials provided with the distribution. 16212904Sdim * 3. Neither the name of the University nor the names of its contributors 17198092Srdivacky * may be used to endorse or promote products derived from this software 18193326Sed * without specific prior written permission. 19218893Sdim * 20193326Sed * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21193326Sed * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22193326Sed * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23193326Sed * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24193326Sed * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25193326Sed * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26193326Sed * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27193326Sed * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28193326Sed * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29193326Sed * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30193326Sed * SUCH DAMAGE. 31193326Sed * 32193326Sed * @(#)map.h 8.1 (Berkeley) 6/4/93 33193326Sed * $NetBSD: map.h,v 1.8 2003/08/07 16:44:32 agc Exp $ 34193326Sed * $FreeBSD$ 35193326Sed */ 36193326Sed 37193326Sed/* 38193326Sed * el.map.h: Editor maps 39193326Sed */ 40193326Sed#ifndef _h_el_map 41193326Sed#define _h_el_map 42218893Sdim 43193326Sedtypedef struct el_bindings_t { /* for the "bind" shell command */ 44193326Sed const char *name; /* function name for bind command */ 45193326Sed int func; /* function numeric value */ 46193326Sed const char *description; /* description of function */ 47210299Sed} el_bindings_t; 48210299Sed 49193326Sed 50193326Sedtypedef struct el_map_t { 51218893Sdim el_action_t *alt; /* The current alternate key map */ 52218893Sdim el_action_t *key; /* The current normal key map */ 53218893Sdim el_action_t *current; /* The keymap we are using */ 54218893Sdim const el_action_t *emacs; /* The default emacs key map */ 55218893Sdim const el_action_t *vic; /* The vi command mode key map */ 56218893Sdim const el_action_t *vii; /* The vi insert mode key map */ 57218893Sdim int type; /* Emacs or vi */ 58199990Srdivacky el_bindings_t *help; /* The help for the editor functions */ 59193326Sed el_func_t *func; /* List of available functions */ 60193326Sed int nfunc; /* The number of functions/help items */ 61193326Sed} el_map_t; 62193326Sed 63198092Srdivacky#define MAP_EMACS 0 64193326Sed#define MAP_VI 1 65193326Sed 66193326Sedprotected int map_bind(EditLine *, int, const char **); 67198092Srdivackyprotected int map_init(EditLine *); 68198092Srdivackyprotected void map_end(EditLine *); 69193326Sedprotected void map_init_vi(EditLine *); 70198092Srdivackyprotected void map_init_emacs(EditLine *); 71193326Sedprotected int map_set_editor(EditLine *, char *); 72193326Sedprotected int map_get_editor(EditLine *, const char **); 73193326Sedprotected int map_addfunc(EditLine *, const char *, const char *, el_func_t); 74193326Sed 75193326Sed#endif /* _h_el_map */ 76198092Srdivacky