1*a2d6b270Schristos /* $NetBSD: keymacro.h,v 1.6 2016/05/09 21:46:56 christos Exp $ */ 2d47f9584Schristos 3d47f9584Schristos /*- 4d47f9584Schristos * Copyright (c) 1992, 1993 5d47f9584Schristos * The Regents of the University of California. All rights reserved. 6d47f9584Schristos * 7d47f9584Schristos * This code is derived from software contributed to Berkeley by 8d47f9584Schristos * Christos Zoulas of Cornell University. 9d47f9584Schristos * 10d47f9584Schristos * Redistribution and use in source and binary forms, with or without 11d47f9584Schristos * modification, are permitted provided that the following conditions 12d47f9584Schristos * are met: 13d47f9584Schristos * 1. Redistributions of source code must retain the above copyright 14d47f9584Schristos * notice, this list of conditions and the following disclaimer. 15d47f9584Schristos * 2. Redistributions in binary form must reproduce the above copyright 16d47f9584Schristos * notice, this list of conditions and the following disclaimer in the 17d47f9584Schristos * documentation and/or other materials provided with the distribution. 18d47f9584Schristos * 3. Neither the name of the University nor the names of its contributors 19d47f9584Schristos * may be used to endorse or promote products derived from this software 20d47f9584Schristos * without specific prior written permission. 21d47f9584Schristos * 22d47f9584Schristos * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23d47f9584Schristos * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24d47f9584Schristos * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25d47f9584Schristos * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26d47f9584Schristos * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27d47f9584Schristos * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28d47f9584Schristos * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29d47f9584Schristos * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30d47f9584Schristos * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31d47f9584Schristos * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32d47f9584Schristos * SUCH DAMAGE. 33d47f9584Schristos * 34d47f9584Schristos * @(#)key.h 8.1 (Berkeley) 6/4/93 35d47f9584Schristos */ 36d47f9584Schristos 37d47f9584Schristos /* 3847b4c27fSchristos * el.keymacro.h: Key macro header 39d47f9584Schristos */ 40d47f9584Schristos #ifndef _h_el_keymacro 41d47f9584Schristos #define _h_el_keymacro 42d47f9584Schristos 43d47f9584Schristos typedef union keymacro_value_t { 44d47f9584Schristos el_action_t cmd; /* If it is a command the # */ 450594af80Schristos wchar_t *str; /* If it is a string... */ 46d47f9584Schristos } keymacro_value_t; 47d47f9584Schristos 48d47f9584Schristos typedef struct keymacro_node_t keymacro_node_t; 49d47f9584Schristos 5065691b0eSchristos typedef struct el_keymacro_t { 510594af80Schristos wchar_t *buf; /* Key print buffer */ 52d47f9584Schristos keymacro_node_t *map; /* Key map */ 53d47f9584Schristos keymacro_value_t val; /* Local conversion buffer */ 54d47f9584Schristos } el_keymacro_t; 55d47f9584Schristos 56d47f9584Schristos #define XK_CMD 0 57d47f9584Schristos #define XK_STR 1 58d47f9584Schristos #define XK_NOD 2 59d47f9584Schristos 60*a2d6b270Schristos libedit_private int keymacro_init(EditLine *); 61*a2d6b270Schristos libedit_private void keymacro_end(EditLine *); 62*a2d6b270Schristos libedit_private keymacro_value_t *keymacro_map_cmd(EditLine *, int); 63*a2d6b270Schristos libedit_private keymacro_value_t *keymacro_map_str(EditLine *, wchar_t *); 64*a2d6b270Schristos libedit_private void keymacro_reset(EditLine *); 65*a2d6b270Schristos libedit_private int keymacro_get(EditLine *, wchar_t *, keymacro_value_t *); 66*a2d6b270Schristos libedit_private void keymacro_add(EditLine *, const wchar_t *, 670594af80Schristos keymacro_value_t *, int); 68*a2d6b270Schristos libedit_private void keymacro_clear(EditLine *, el_action_t *, const wchar_t *); 69*a2d6b270Schristos libedit_private int keymacro_delete(EditLine *, const wchar_t *); 70*a2d6b270Schristos libedit_private void keymacro_print(EditLine *, const wchar_t *); 71*a2d6b270Schristos libedit_private void keymacro_kprint(EditLine *, const wchar_t *, 720594af80Schristos keymacro_value_t *, int); 73*a2d6b270Schristos libedit_private size_t keymacro__decode_str(const wchar_t *, char *, size_t, 74d47f9584Schristos const char *); 75d47f9584Schristos 76d47f9584Schristos #endif /* _h_el_keymacro */ 77