keymacro.h revision 148859
1272343Sngie/*- 2272343Sngie * Copyright (c) 1992, 1993 3272343Sngie * The Regents of the University of California. All rights reserved. 4272343Sngie * 5272343Sngie * This code is derived from software contributed to Berkeley by 6272343Sngie * Christos Zoulas of Cornell University. 7272343Sngie * 8272343Sngie * Redistribution and use in source and binary forms, with or without 9272343Sngie * modification, are permitted provided that the following conditions 10272343Sngie * are met: 11272343Sngie * 1. Redistributions of source code must retain the above copyright 12272343Sngie * notice, this list of conditions and the following disclaimer. 13272343Sngie * 2. Redistributions in binary form must reproduce the above copyright 14272343Sngie * notice, this list of conditions and the following disclaimer in the 15272343Sngie * documentation and/or other materials provided with the distribution. 16272343Sngie * 3. Neither the name of the University nor the names of its contributors 17272343Sngie * may be used to endorse or promote products derived from this software 18272343Sngie * without specific prior written permission. 19272343Sngie * 20272343Sngie * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21272343Sngie * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22272343Sngie * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23272343Sngie * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24272343Sngie * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25272343Sngie * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26272343Sngie * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27272343Sngie * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28272343Sngie * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29272343Sngie * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30272343Sngie * SUCH DAMAGE. 31272343Sngie * 32272343Sngie * @(#)key.h 8.1 (Berkeley) 6/4/93 33272343Sngie * $NetBSD: key.h,v 1.8 2003/08/07 16:44:32 agc Exp $ 34272343Sngie * $FreeBSD: head/lib/libedit/key.h 148859 2005-08-08 17:17:56Z stefanf $ 35272343Sngie */ 36272343Sngie 37272343Sngie/* 38272343Sngie * el.key.h: Key macro header 39272343Sngie */ 40272343Sngie#ifndef _h_el_key 41272343Sngie#define _h_el_key 42272343Sngie 43272343Sngietypedef union key_value_t { 44272343Sngie el_action_t cmd; /* If it is a command the # */ 45272343Sngie char *str; /* If it is a string... */ 46272343Sngie} key_value_t; 47272343Sngie 48272343Sngietypedef struct key_node_t key_node_t; 49272343Sngie 50272343Sngietypedef struct el_key_t { 51272343Sngie char *buf; /* Key print buffer */ 52272343Sngie key_node_t *map; /* Key map */ 53272343Sngie key_value_t val; /* Local conversion buffer */ 54272343Sngie} el_key_t; 55272343Sngie 56272343Sngie#define XK_CMD 0 57272343Sngie#define XK_STR 1 58272343Sngie#define XK_NOD 2 59272343Sngie#define XK_EXE 3 60272343Sngie 61272343Sngie#include <term.h> 62272343Sngie 63272343Sngie#undef key_end 64272343Sngie#undef key_clear 65272343Sngie#undef key_print 66272343Sngie 67272343Sngieprotected int key_init(EditLine *); 68272343Sngieprotected void key_end(EditLine *); 69272343Sngieprotected key_value_t *key_map_cmd(EditLine *, int); 70272343Sngieprotected key_value_t *key_map_str(EditLine *, char *); 71272343Sngieprotected void key_reset(EditLine *); 72272343Sngieprotected int key_get(EditLine *, char *, key_value_t *); 73272343Sngieprotected void key_add(EditLine *, const char *, key_value_t *, int); 74272343Sngieprotected void key_clear(EditLine *, el_action_t *, const char *); 75272343Sngieprotected int key_delete(EditLine *, const char *); 76272343Sngieprotected void key_print(EditLine *, const char *); 77272343Sngieprotected void key_kprint(EditLine *, const char *, key_value_t *, 78272343Sngie int); 79272343Sngieprotected char *key__decode_str(const char *, char *, const char *); 80272343Sngie 81272343Sngie#endif /* _h_el_key */ 82272343Sngie