1295369Spfg/* $NetBSD: keymacro.h,v 1.3 2016/01/29 19:59:11 christos Exp $ */ 2276881Sbapt 31573Srgrimes/*- 41573Srgrimes * Copyright (c) 1992, 1993 51573Srgrimes * The Regents of the University of California. All rights reserved. 61573Srgrimes * 71573Srgrimes * This code is derived from software contributed to Berkeley by 81573Srgrimes * Christos Zoulas of Cornell University. 91573Srgrimes * 101573Srgrimes * Redistribution and use in source and binary forms, with or without 111573Srgrimes * modification, are permitted provided that the following conditions 121573Srgrimes * are met: 131573Srgrimes * 1. Redistributions of source code must retain the above copyright 141573Srgrimes * notice, this list of conditions and the following disclaimer. 151573Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 161573Srgrimes * notice, this list of conditions and the following disclaimer in the 171573Srgrimes * documentation and/or other materials provided with the distribution. 18148834Sstefanf * 3. Neither the name of the University nor the names of its contributors 191573Srgrimes * may be used to endorse or promote products derived from this software 201573Srgrimes * without specific prior written permission. 211573Srgrimes * 221573Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 231573Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 241573Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 251573Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 261573Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 271573Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 281573Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 291573Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 301573Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 311573Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 321573Srgrimes * SUCH DAMAGE. 331573Srgrimes * 341573Srgrimes * @(#)key.h 8.1 (Berkeley) 6/4/93 3584260Sobrien * $FreeBSD$ 361573Srgrimes */ 371573Srgrimes 381573Srgrimes/* 39276881Sbapt * el.keymacro.h: Key macro header 401573Srgrimes */ 41276881Sbapt#ifndef _h_el_keymacro 42276881Sbapt#define _h_el_keymacro 431573Srgrimes 44276881Sbapttypedef union keymacro_value_t { 4584260Sobrien el_action_t cmd; /* If it is a command the # */ 46276881Sbapt Char *str; /* If it is a string... */ 47276881Sbapt} keymacro_value_t; 481573Srgrimes 49276881Sbapttypedef struct keymacro_node_t keymacro_node_t; 501573Srgrimes 51295369Spfgtypedef struct el_keymacro_t { 52276881Sbapt Char *buf; /* Key print buffer */ 53276881Sbapt keymacro_node_t *map; /* Key map */ 54276881Sbapt keymacro_value_t val; /* Local conversion buffer */ 55276881Sbapt} el_keymacro_t; 561573Srgrimes 5784260Sobrien#define XK_CMD 0 5884260Sobrien#define XK_STR 1 5984260Sobrien#define XK_NOD 2 6084260Sobrien#define XK_EXE 3 611573Srgrimes 62276881Sbaptprotected int keymacro_init(EditLine *); 63276881Sbaptprotected void keymacro_end(EditLine *); 64276881Sbaptprotected keymacro_value_t *keymacro_map_cmd(EditLine *, int); 65276881Sbaptprotected keymacro_value_t *keymacro_map_str(EditLine *, Char *); 66276881Sbaptprotected void keymacro_reset(EditLine *); 67276881Sbaptprotected int keymacro_get(EditLine *, Char *, keymacro_value_t *); 68276881Sbaptprotected void keymacro_add(EditLine *, const Char *, keymacro_value_t *, int); 69276881Sbaptprotected void keymacro_clear(EditLine *, el_action_t *, const Char *); 70276881Sbaptprotected int keymacro_delete(EditLine *, const Char *); 71276881Sbaptprotected void keymacro_print(EditLine *, const Char *); 72276881Sbaptprotected void keymacro_kprint(EditLine *, const Char *, keymacro_value_t *, 73148834Sstefanf int); 74276881Sbaptprotected size_t keymacro__decode_str(const Char *, char *, size_t, 75167457Sstefanf const char *); 761573Srgrimes 77276881Sbapt#endif /* _h_el_keymacro */ 78