00001 // @(#)root/editline:$Id: key.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: key.fH,v 1.5 2001/01/23 15:55:30 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. Neither the name of the University nor the names of its contributors 00030 * may be used to endorse or promote products derived from this software 00031 * without specific prior written permission. 00032 * 00033 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 00034 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00035 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00036 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 00037 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00038 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 00039 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00040 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00041 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 00042 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00043 * SUCH DAMAGE. 00044 */ 00045 00046 /* 00047 * el.fKey.fH: Key macro header 00048 */ 00049 #ifndef _h_el_key 00050 #define _h_el_key 00051 00052 typedef union KeyValue_t { 00053 ElAction_t fCmd; /* If it is a command the # */ 00054 char* fStr; /* If it is a string... */ 00055 } KeyValue_t; 00056 00057 typedef struct KeyNode_t KeyNode_t; 00058 00059 typedef struct ElKey_t { 00060 char* fBuf; /* Key print buffer */ 00061 KeyNode_t* fMap; /* Key map */ 00062 KeyValue_t fVal; /* Local conversion buffer */ 00063 } ElKey_t; 00064 00065 #define XK_CMD 0 00066 #define XK_STR 1 00067 #define XK_NOD 2 00068 #define XK_EXE 3 00069 00070 el_protected int key_init(EditLine_t*); 00071 el_protected void key_end(EditLine_t*); 00072 el_protected KeyValue_t* key_map_cmd(EditLine_t*, int); 00073 el_protected KeyValue_t* key_map_str(EditLine_t*, char*); 00074 el_protected void key_reset(EditLine_t*); 00075 el_protected int key_get(EditLine_t*, char*, KeyValue_t*); 00076 el_protected void key_add(EditLine_t*, const char*, KeyValue_t*, int); 00077 el_protected void key_clear(EditLine_t*, ElAction_t*, char*); 00078 el_protected int key_delete(EditLine_t*, char*); 00079 el_protected void key_print(EditLine_t*, const char*); 00080 el_protected void key_kprint(EditLine_t*, const char*, KeyValue_t*, int); 00081 el_protected char* key__decode_str(char*, char*, const char*); 00082 00083 #endif /* _h_el_key */