term.h revision 63948
11573Srgrimes/*- 21573Srgrimes * Copyright (c) 1992, 1993 31573Srgrimes * The Regents of the University of California. All rights reserved. 41573Srgrimes * 51573Srgrimes * This code is derived from software contributed to Berkeley by 61573Srgrimes * Christos Zoulas of Cornell University. 71573Srgrimes * 81573Srgrimes * Redistribution and use in source and binary forms, with or without 91573Srgrimes * modification, are permitted provided that the following conditions 101573Srgrimes * are met: 111573Srgrimes * 1. Redistributions of source code must retain the above copyright 121573Srgrimes * notice, this list of conditions and the following disclaimer. 131573Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 141573Srgrimes * notice, this list of conditions and the following disclaimer in the 151573Srgrimes * documentation and/or other materials provided with the distribution. 161573Srgrimes * 3. All advertising materials mentioning features or use of this software 171573Srgrimes * must display the following acknowledgement: 181573Srgrimes * This product includes software developed by the University of 191573Srgrimes * California, Berkeley and its contributors. 201573Srgrimes * 4. Neither the name of the University nor the names of its contributors 211573Srgrimes * may be used to endorse or promote products derived from this software 221573Srgrimes * without specific prior written permission. 231573Srgrimes * 241573Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 251573Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 261573Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 271573Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 281573Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 291573Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 301573Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 311573Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 321573Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 331573Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 341573Srgrimes * SUCH DAMAGE. 351573Srgrimes * 361573Srgrimes * @(#)term.h 8.1 (Berkeley) 6/4/93 3763948Sache * 3863948Sache * $FreeBSD: head/lib/libedit/term.h 63948 2000-07-28 00:42:54Z ache $ 391573Srgrimes */ 401573Srgrimes 411573Srgrimes/* 421573Srgrimes * el.term.h: Termcap header 431573Srgrimes */ 441573Srgrimes#ifndef _h_el_term 451573Srgrimes#define _h_el_term 461573Srgrimes 471573Srgrimes#include "histedit.h" 481573Srgrimes 491573Srgrimestypedef struct { /* Symbolic function key bindings */ 501573Srgrimes char *name; /* name of the key */ 511573Srgrimes int key; /* Index in termcap table */ 521573Srgrimes key_value_t fun; /* Function bound to it */ 531573Srgrimes int type; /* Type of function */ 541573Srgrimes} fkey_t; 551573Srgrimes 561573Srgrimestypedef struct { 571573Srgrimes coord_t t_size; /* # lines and cols */ 581573Srgrimes bool_t t_flags; 591573Srgrimes#define TERM_CAN_INSERT 0x01 /* Has insert cap */ 601573Srgrimes#define TERM_CAN_DELETE 0x02 /* Has delete cap */ 611573Srgrimes#define TERM_CAN_CEOL 0x04 /* Has CEOL cap */ 621573Srgrimes#define TERM_CAN_TAB 0x08 /* Can use tabs */ 631573Srgrimes#define TERM_CAN_ME 0x10 /* Can turn all attrs. */ 641573Srgrimes#define TERM_CAN_UP 0x20 /* Can move up */ 651573Srgrimes#define TERM_HAS_META 0x40 /* Has a meta key */ 661573Srgrimes char *t_buf; /* Termcap buffer */ 671573Srgrimes int t_loc; /* location used */ 681573Srgrimes char **t_str; /* termcap strings */ 691573Srgrimes int *t_val; /* termcap values */ 701573Srgrimes char *t_cap; /* Termcap buffer */ 711573Srgrimes fkey_t *t_fkey; /* Array of keys */ 721573Srgrimes} el_term_t; 731573Srgrimes 741573Srgrimes/* 751573Srgrimes * fKey indexes 761573Srgrimes */ 771573Srgrimes#define A_K_DN 0 781573Srgrimes#define A_K_UP 1 791573Srgrimes#define A_K_LT 2 801573Srgrimes#define A_K_RT 3 8163948Sache#define A_K_HO 4 8263948Sache#define A_K_EN 5 8363948Sache#define A_K_NKEYS 6 841573Srgrimes 851573Srgrimesprotected void term_move_to_line __P((EditLine *, int)); 861573Srgrimesprotected void term_move_to_char __P((EditLine *, int)); 871573Srgrimesprotected void term_clear_EOL __P((EditLine *, int)); 881573Srgrimesprotected void term_overwrite __P((EditLine *, char *, int)); 891573Srgrimesprotected void term_insertwrite __P((EditLine *, char *, int)); 901573Srgrimesprotected void term_deletechars __P((EditLine *, int)); 911573Srgrimesprotected void term_clear_screen __P((EditLine *)); 921573Srgrimesprotected void term_beep __P((EditLine *)); 931573Srgrimesprotected void term_change_size __P((EditLine *, int, int)); 941573Srgrimesprotected int term_get_size __P((EditLine *, int *, int *)); 951573Srgrimesprotected int term_init __P((EditLine *)); 961573Srgrimesprotected void term_bind_arrow __P((EditLine *)); 971573Srgrimesprotected void term_print_arrow __P((EditLine *, char *)); 981573Srgrimesprotected int term_clear_arrow __P((EditLine *, char *)); 998870Srgrimesprotected int term_set_arrow __P((EditLine *, char *, 1001573Srgrimes key_value_t *, int)); 1011573Srgrimesprotected void term_end __P((EditLine *)); 1021573Srgrimesprotected int term_set __P((EditLine *, char *)); 1031573Srgrimesprotected int term_settc __P((EditLine *, int, char **)); 1041573Srgrimesprotected int term_telltc __P((EditLine *, int, char **)); 1051573Srgrimesprotected int term_echotc __P((EditLine *, int, char **)); 1061573Srgrimes 1079898Sacheprotected int term__putc __P((int)); 1081573Srgrimesprotected void term__flush __P((void)); 1091573Srgrimes 1101573Srgrimes/* 1111573Srgrimes * Easy access macros 1121573Srgrimes */ 1131573Srgrimes#define EL_FLAGS (el)->el_term.t_flags 1141573Srgrimes 1151573Srgrimes#define EL_CAN_INSERT (EL_FLAGS & TERM_CAN_INSERT) 1161573Srgrimes#define EL_CAN_DELETE (EL_FLAGS & TERM_CAN_DELETE) 1171573Srgrimes#define EL_CAN_CEOL (EL_FLAGS & TERM_CAN_CEOL) 1181573Srgrimes#define EL_CAN_TAB (EL_FLAGS & TERM_CAN_TAB) 1191573Srgrimes#define EL_CAN_ME (EL_FLAGS & TERM_CAN_ME) 1201573Srgrimes#define EL_HAS_META (EL_FLAGS & TERM_HAS_META) 1211573Srgrimes 1221573Srgrimes#endif /* _h_el_term */ 123