The world's most popular open source database
00001 /* $NetBSD: term.h,v 1.15 2003/09/14 21:48:55 christos Exp $ */ 00002 00003 /*- 00004 * Copyright (c) 1992, 1993 00005 * The Regents of the University of California. All rights reserved. 00006 * 00007 * This code is derived from software contributed to Berkeley by 00008 * Christos Zoulas of Cornell University. 00009 * 00010 * Redistribution and use in source and binary forms, with or without 00011 * modification, are permitted provided that the following conditions 00012 * are met: 00013 * 1. Redistributions of source code must retain the above copyright 00014 * notice, this list of conditions and the following disclaimer. 00015 * 2. Redistributions in binary form must reproduce the above copyright 00016 * notice, this list of conditions and the following disclaimer in the 00017 * documentation and/or other materials provided with the distribution. 00018 * 3. Neither the name of the University nor the names of its contributors 00019 * may be used to endorse or promote products derived from this software 00020 * without specific prior written permission. 00021 * 00022 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 00023 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00024 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00025 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 00026 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00027 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 00028 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00029 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00030 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 00031 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00032 * SUCH DAMAGE. 00033 * 00034 * @(#)term.h 8.1 (Berkeley) 6/4/93 00035 */ 00036 00037 /* 00038 * el.term.h: Termcap header 00039 */ 00040 #ifndef _h_el_term 00041 #define _h_el_term 00042 00043 #include "histedit.h" 00044 00045 typedef struct { /* Symbolic function key bindings */ 00046 const char *name; /* name of the key */ 00047 int key; /* Index in termcap table */ 00048 key_value_t fun; /* Function bound to it */ 00049 int type; /* Type of function */ 00050 } fkey_t; 00051 00052 typedef struct { 00053 const char *t_name; /* the terminal name */ 00054 coord_t t_size; /* # lines and cols */ 00055 int t_flags; 00056 #define TERM_CAN_INSERT 0x001 /* Has insert cap */ 00057 #define TERM_CAN_DELETE 0x002 /* Has delete cap */ 00058 #define TERM_CAN_CEOL 0x004 /* Has CEOL cap */ 00059 #define TERM_CAN_TAB 0x008 /* Can use tabs */ 00060 #define TERM_CAN_ME 0x010 /* Can turn all attrs. */ 00061 #define TERM_CAN_UP 0x020 /* Can move up */ 00062 #define TERM_HAS_META 0x040 /* Has a meta key */ 00063 #define TERM_HAS_AUTO_MARGINS 0x080 /* Has auto margins */ 00064 #define TERM_HAS_MAGIC_MARGINS 0x100 /* Has magic margins */ 00065 char *t_buf; /* Termcap buffer */ 00066 int t_loc; /* location used */ 00067 char **t_str; /* termcap strings */ 00068 int *t_val; /* termcap values */ 00069 char *t_cap; /* Termcap buffer */ 00070 fkey_t *t_fkey; /* Array of keys */ 00071 } el_term_t; 00072 00073 /* 00074 * fKey indexes 00075 */ 00076 #define A_K_DN 0 00077 #define A_K_UP 1 00078 #define A_K_LT 2 00079 #define A_K_RT 3 00080 #define A_K_HO 4 00081 #define A_K_EN 5 00082 #define A_K_NKEYS 6 00083 00084 #ifdef _SUNOS 00085 extern int tgetent(char *, const char *); 00086 extern int tgetflag(char *); 00087 extern int tgetnum(char *); 00088 extern int tputs(const char *, int, int (*)(int)); 00089 extern char* tgoto(const char*, int, int); 00090 extern char* tgetstr(char*, char**); 00091 #endif 00092 00093 protected void term_move_to_line(EditLine *, int); 00094 protected void term_move_to_char(EditLine *, int); 00095 protected void term_clear_EOL(EditLine *, int); 00096 protected void term_overwrite(EditLine *, const char *, int); 00097 protected void term_insertwrite(EditLine *, char *, int); 00098 protected void term_deletechars(EditLine *, int); 00099 protected void term_clear_screen(EditLine *); 00100 protected void term_beep(EditLine *); 00101 protected int term_change_size(EditLine *, int, int); 00102 protected int term_get_size(EditLine *, int *, int *); 00103 protected int term_init(EditLine *); 00104 protected void term_bind_arrow(EditLine *); 00105 protected void term_print_arrow(EditLine *, const char *); 00106 protected int term_clear_arrow(EditLine *, const char *); 00107 protected int term_set_arrow(EditLine *, const char *, key_value_t *, int); 00108 protected void term_end(EditLine *); 00109 protected void term_get(EditLine *, const char **); 00110 protected int term_set(EditLine *, const char *); 00111 protected int term_settc(EditLine *, int, const char **); 00112 protected int term_telltc(EditLine *, int, const char **); 00113 protected int term_echotc(EditLine *, int, const char **); 00114 protected int term__putc(int); 00115 protected void term__flush(void); 00116 00117 /* 00118 * Easy access macros 00119 */ 00120 #define EL_FLAGS (el)->el_term.t_flags 00121 00122 #define EL_CAN_INSERT (EL_FLAGS & TERM_CAN_INSERT) 00123 #define EL_CAN_DELETE (EL_FLAGS & TERM_CAN_DELETE) 00124 #define EL_CAN_CEOL (EL_FLAGS & TERM_CAN_CEOL) 00125 #define EL_CAN_TAB (EL_FLAGS & TERM_CAN_TAB) 00126 #define EL_CAN_ME (EL_FLAGS & TERM_CAN_ME) 00127 #define EL_HAS_META (EL_FLAGS & TERM_HAS_META) 00128 #define EL_HAS_AUTO_MARGINS (EL_FLAGS & TERM_HAS_AUTO_MARGINS) 00129 #define EL_HAS_MAGIC_MARGINS (EL_FLAGS & TERM_HAS_MAGIC_MARGINS) 00130 00131 #endif /* _h_el_term */
1.4.7

