map.h revision 277931
126213Swpaul/*- 226213Swpaul * Copyright (c) 1992, 1993 326213Swpaul * The Regents of the University of California. All rights reserved. 426213Swpaul * 526213Swpaul * This code is derived from software contributed to Berkeley by 626213Swpaul * Christos Zoulas of Cornell University. 726213Swpaul * 826213Swpaul * Redistribution and use in source and binary forms, with or without 926213Swpaul * modification, are permitted provided that the following conditions 1026213Swpaul * are met: 1126213Swpaul * 1. Redistributions of source code must retain the above copyright 1226213Swpaul * notice, this list of conditions and the following disclaimer. 1326213Swpaul * 2. Redistributions in binary form must reproduce the above copyright 1426213Swpaul * notice, this list of conditions and the following disclaimer in the 1526213Swpaul * documentation and/or other materials provided with the distribution. 1626213Swpaul * 3. Neither the name of the University nor the names of its contributors 1726213Swpaul * may be used to endorse or promote products derived from this software 1826213Swpaul * without specific prior written permission. 1926213Swpaul * 2026213Swpaul * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2126213Swpaul * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2226213Swpaul * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2326213Swpaul * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2426213Swpaul * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2526213Swpaul * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2626213Swpaul * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2726213Swpaul * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2826213Swpaul * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2926213Swpaul * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3084220Sdillon * SUCH DAMAGE. 3184220Sdillon * 3284220Sdillon * @(#)map.h 8.1 (Berkeley) 6/4/93 3384220Sdillon * $NetBSD: map.h,v 1.8 2003/08/07 16:44:32 agc Exp $ 3426213Swpaul * $FreeBSD: stable/10/lib/libedit/map.h 277931 2015-01-30 14:22:15Z emaste $ 3526213Swpaul */ 3626213Swpaul 3726213Swpaul/* 3826213Swpaul * el.map.h: Editor maps 3926213Swpaul */ 4026213Swpaul#ifndef _h_el_map 4126213Swpaul#define _h_el_map 4226213Swpaul 4326213Swpaultypedef struct el_bindings_t { /* for the "bind" shell command */ 4426213Swpaul const char *name; /* function name for bind command */ 4526213Swpaul int func; /* function numeric value */ 4626213Swpaul const char *description; /* description of function */ 4726213Swpaul} el_bindings_t; 48104322Salfred 49189087Sed 5026213Swpaultypedef struct el_map_t { 5126213Swpaul el_action_t *alt; /* The current alternate key map */ 52121529Speter el_action_t *key; /* The current normal key map */ 53121529Speter el_action_t *current; /* The keymap we are using */ 5426213Swpaul const el_action_t *emacs; /* The default emacs key map */ 5526213Swpaul const el_action_t *vic; /* The vi command mode key map */ 5626213Swpaul const el_action_t *vii; /* The vi insert mode key map */ 57189087Sed int type; /* Emacs or vi */ 5826213Swpaul el_bindings_t *help; /* The help for the editor functions */ 5926213Swpaul el_func_t *func; /* List of available functions */ 6026213Swpaul size_t nfunc; /* The number of functions/help items */ 6126213Swpaul} el_map_t; 62121529Speter 63121529Speter#define MAP_EMACS 0 6426213Swpaul#define MAP_VI 1 6526213Swpaul 6626213Swpaulprotected int map_bind(EditLine *, int, const char **); 6726213Swpaulprotected int map_init(EditLine *); 6826213Swpaulprotected void map_end(EditLine *); 69protected void map_init_vi(EditLine *); 70protected void map_init_emacs(EditLine *); 71protected int map_set_editor(EditLine *, char *); 72protected int map_get_editor(EditLine *, const char **); 73protected int map_addfunc(EditLine *, const char *, const char *, el_func_t); 74 75#endif /* _h_el_map */ 76