00001 // @(#)root/editline:$Id: map.h 30194 2009-09-16 12:19:46Z axel $ 00002 // Author: Mary-Louise Gill, 2009 00003 00004 /************************************************************************* 00005 * Copyright (C) 1995-2009, Rene Brun and Fons Rademakers. * 00006 * All rights reserved. * 00007 * * 00008 * For the licensing terms see $ROOTSYS/LICENSE. * 00009 * For the list of contributors see $ROOTSYS/README/CREDITS. * 00010 *************************************************************************/ 00011 00012 /* $NetBSD: map.fH,v 1.6 2001/01/09 17:22:09 jdolecek Exp $ */ 00013 00014 /*- 00015 * Copyright (c) 1992, 1993 00016 * The Regents of the University of California. All rights reserved. 00017 * 00018 * This code is derived from software contributed to Berkeley by 00019 * Christos Zoulas of Cornell University. 00020 * 00021 * Redistribution and use in source and binary forms, with or without 00022 * modification, are permitted provided that the following conditions 00023 * are met: 00024 * 1. Redistributions of source code must retain the above copyright 00025 * notice, this list of conditions and the following disclaimer. 00026 * 2. Redistributions in binary form must reproduce the above copyright 00027 * notice, this list of conditions and the following disclaimer in the 00028 * documentation and/or other materials provided with the distribution. 00029 * 3. All advertising materials mentioning features or use of this software 00030 * must display the following acknowledgement: 00031 * This product includes software developed by the University of 00032 * California, Berkeley and its contributors. 00033 * 4. Neither the name of the University nor the names of its contributors 00034 * may be used to endorse or promote products derived from this software 00035 * without specific prior written permission. 00036 * 00037 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 00038 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00039 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00040 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 00041 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00042 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 00043 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00044 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00045 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 00046 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00047 * SUCH DAMAGE. 00048 */ 00049 00050 /* 00051 * el.fMap.fH: Editor maps 00052 */ 00053 #ifndef _h_el_map 00054 #define _h_el_map 00055 00056 typedef struct ElBindings_t { /* for the "bind" shell command */ 00057 const char* fName; /* function name for bind command */ 00058 int fFunc; /* function numeric value */ 00059 const char* fDescription; /* description of function */ 00060 } ElBindings_t; 00061 00062 00063 typedef struct ElMap_t { 00064 ElAction_t* fAlt; /* The current alternate key map */ 00065 ElAction_t* fKey; /* The current normal key map */ 00066 ElAction_t* fCurrent; /* The keymap we are using */ 00067 const ElAction_t* fEmacs; /* The default emacs key map */ 00068 const ElAction_t* fVic; /* The vi command mode key map */ 00069 const ElAction_t* fVii; /* The vi insert mode key map */ 00070 int fType; /* Emacs or vi */ 00071 ElBindings_t* fHelp; /* The help for the editor functions */ 00072 ElFunc_t* fFunc; /* List of available functions */ 00073 int fNFunc; /* The number of functions/help items */ 00074 } ElMap_t; 00075 00076 #define MAP_EMACS 0 00077 #define MAP_VI 1 00078 00079 el_protected int map_bind(EditLine_t*, int, const char**); 00080 el_protected int map_init(EditLine_t*); 00081 el_protected void map_end(EditLine_t*); 00082 el_protected void map_init_vi(EditLine_t*); 00083 el_protected void map_init_emacs(EditLine_t*); 00084 el_protected int map_set_editor(EditLine_t*, char*); 00085 el_protected int map_get_editor(EditLine_t*, const char**); 00086 el_protected int map_addfunc(EditLine_t *, const char*, const char*, ElFunc_t); 00087 00088 #endif /* _h_el_map */