1*0a6a1f1dSLionel Sambuc /* $NetBSD: map.h,v 1.10 2014/07/06 18:15:34 christos Exp $ */ 23e1db26aSLionel Sambuc 33e1db26aSLionel Sambuc /*- 43e1db26aSLionel Sambuc * Copyright (c) 1992, 1993 53e1db26aSLionel Sambuc * The Regents of the University of California. All rights reserved. 63e1db26aSLionel Sambuc * 73e1db26aSLionel Sambuc * This code is derived from software contributed to Berkeley by 83e1db26aSLionel Sambuc * Christos Zoulas of Cornell University. 93e1db26aSLionel Sambuc * 103e1db26aSLionel Sambuc * Redistribution and use in source and binary forms, with or without 113e1db26aSLionel Sambuc * modification, are permitted provided that the following conditions 123e1db26aSLionel Sambuc * are met: 133e1db26aSLionel Sambuc * 1. Redistributions of source code must retain the above copyright 143e1db26aSLionel Sambuc * notice, this list of conditions and the following disclaimer. 153e1db26aSLionel Sambuc * 2. Redistributions in binary form must reproduce the above copyright 163e1db26aSLionel Sambuc * notice, this list of conditions and the following disclaimer in the 173e1db26aSLionel Sambuc * documentation and/or other materials provided with the distribution. 183e1db26aSLionel Sambuc * 3. Neither the name of the University nor the names of its contributors 193e1db26aSLionel Sambuc * may be used to endorse or promote products derived from this software 203e1db26aSLionel Sambuc * without specific prior written permission. 213e1db26aSLionel Sambuc * 223e1db26aSLionel Sambuc * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 233e1db26aSLionel Sambuc * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 243e1db26aSLionel Sambuc * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 253e1db26aSLionel Sambuc * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 263e1db26aSLionel Sambuc * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 273e1db26aSLionel Sambuc * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 283e1db26aSLionel Sambuc * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 293e1db26aSLionel Sambuc * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 303e1db26aSLionel Sambuc * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 313e1db26aSLionel Sambuc * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 323e1db26aSLionel Sambuc * SUCH DAMAGE. 333e1db26aSLionel Sambuc * 343e1db26aSLionel Sambuc * @(#)map.h 8.1 (Berkeley) 6/4/93 353e1db26aSLionel Sambuc */ 363e1db26aSLionel Sambuc 373e1db26aSLionel Sambuc /* 383e1db26aSLionel Sambuc * el.map.h: Editor maps 393e1db26aSLionel Sambuc */ 403e1db26aSLionel Sambuc #ifndef _h_el_map 413e1db26aSLionel Sambuc #define _h_el_map 423e1db26aSLionel Sambuc 433e1db26aSLionel Sambuc typedef struct el_bindings_t { /* for the "bind" shell command */ 443e1db26aSLionel Sambuc const Char *name; /* function name for bind command */ 453e1db26aSLionel Sambuc int func; /* function numeric value */ 463e1db26aSLionel Sambuc const Char *description; /* description of function */ 473e1db26aSLionel Sambuc } el_bindings_t; 483e1db26aSLionel Sambuc 493e1db26aSLionel Sambuc 503e1db26aSLionel Sambuc typedef struct el_map_t { 513e1db26aSLionel Sambuc el_action_t *alt; /* The current alternate key map */ 523e1db26aSLionel Sambuc el_action_t *key; /* The current normal key map */ 533e1db26aSLionel Sambuc el_action_t *current; /* The keymap we are using */ 543e1db26aSLionel Sambuc const el_action_t *emacs; /* The default emacs key map */ 553e1db26aSLionel Sambuc const el_action_t *vic; /* The vi command mode key map */ 563e1db26aSLionel Sambuc const el_action_t *vii; /* The vi insert mode key map */ 573e1db26aSLionel Sambuc int type; /* Emacs or vi */ 583e1db26aSLionel Sambuc el_bindings_t *help; /* The help for the editor functions */ 593e1db26aSLionel Sambuc el_func_t *func; /* List of available functions */ 60*0a6a1f1dSLionel Sambuc size_t nfunc; /* The number of functions/help items */ 613e1db26aSLionel Sambuc } el_map_t; 623e1db26aSLionel Sambuc 633e1db26aSLionel Sambuc #define MAP_EMACS 0 643e1db26aSLionel Sambuc #define MAP_VI 1 653e1db26aSLionel Sambuc 663e1db26aSLionel Sambuc #define N_KEYS 256 673e1db26aSLionel Sambuc 683e1db26aSLionel Sambuc protected int map_bind(EditLine *, int, const Char **); 693e1db26aSLionel Sambuc protected int map_init(EditLine *); 703e1db26aSLionel Sambuc protected void map_end(EditLine *); 713e1db26aSLionel Sambuc protected void map_init_vi(EditLine *); 723e1db26aSLionel Sambuc protected void map_init_emacs(EditLine *); 733e1db26aSLionel Sambuc protected int map_set_editor(EditLine *, Char *); 743e1db26aSLionel Sambuc protected int map_get_editor(EditLine *, const Char **); 753e1db26aSLionel Sambuc protected int map_addfunc(EditLine *, const Char *, const Char *, el_func_t); 763e1db26aSLionel Sambuc 773e1db26aSLionel Sambuc #endif /* _h_el_map */ 78