1 /*- 2 * Copyright (c) 1992, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Christos Zoulas of Cornell University. 7 * 8 * %sccs.include.redist.c% 9 * 10 * @(#)term.h 8.1 (Berkeley) 06/04/93 11 */ 12 13 /* 14 * el.term.h: Termcap header 15 */ 16 #ifndef _h_el_term 17 #define _h_el_term 18 19 #include "histedit.h" 20 21 typedef struct { /* Symbolic function key bindings */ 22 char *name; /* name of the key */ 23 int key; /* Index in termcap table */ 24 key_value_t fun; /* Function bound to it */ 25 int type; /* Type of function */ 26 } fkey_t; 27 28 typedef struct { 29 coord_t t_size; /* # lines and cols */ 30 bool_t t_flags; 31 #define TERM_CAN_INSERT 0x01 /* Has insert cap */ 32 #define TERM_CAN_DELETE 0x02 /* Has delete cap */ 33 #define TERM_CAN_CEOL 0x04 /* Has CEOL cap */ 34 #define TERM_CAN_TAB 0x08 /* Can use tabs */ 35 #define TERM_CAN_ME 0x10 /* Can turn all attrs. */ 36 #define TERM_CAN_UP 0x20 /* Can move up */ 37 #define TERM_HAS_META 0x40 /* Has a meta key */ 38 char *t_buf; /* Termcap buffer */ 39 int t_loc; /* location used */ 40 char **t_str; /* termcap strings */ 41 int *t_val; /* termcap values */ 42 char *t_cap; /* Termcap buffer */ 43 fkey_t *t_fkey; /* Array of keys */ 44 } el_term_t; 45 46 /* 47 * fKey indexes 48 */ 49 #define A_K_DN 0 50 #define A_K_UP 1 51 #define A_K_LT 2 52 #define A_K_RT 3 53 #define A_K_NKEYS 4 54 55 protected void term_move_to_line __P((EditLine *, int)); 56 protected void term_move_to_char __P((EditLine *, int)); 57 protected void term_clear_EOL __P((EditLine *, int)); 58 protected void term_overwrite __P((EditLine *, char *, int)); 59 protected void term_insertwrite __P((EditLine *, char *, int)); 60 protected void term_deletechars __P((EditLine *, int)); 61 protected void term_clear_screen __P((EditLine *)); 62 protected void term_beep __P((EditLine *)); 63 protected void term_change_size __P((EditLine *, int, int)); 64 protected int term_get_size __P((EditLine *, int *, int *)); 65 protected int term_init __P((EditLine *)); 66 protected void term_bind_arrow __P((EditLine *)); 67 protected void term_print_arrow __P((EditLine *, char *)); 68 protected int term_clear_arrow __P((EditLine *, char *)); 69 protected int term_set_arrow __P((EditLine *, char *, 70 key_value_t *, int)); 71 protected void term_end __P((EditLine *)); 72 protected int term_set __P((EditLine *, char *)); 73 protected int term_settc __P((EditLine *, int, char **)); 74 protected int term_telltc __P((EditLine *, int, char **)); 75 protected int term_echotc __P((EditLine *, int, char **)); 76 77 protected void term__putc __P((int)); 78 protected void term__flush __P((void)); 79 80 /* 81 * Easy access macros 82 */ 83 #define EL_FLAGS (el)->el_term.t_flags 84 85 #define EL_CAN_INSERT (EL_FLAGS & TERM_CAN_INSERT) 86 #define EL_CAN_DELETE (EL_FLAGS & TERM_CAN_DELETE) 87 #define EL_CAN_CEOL (EL_FLAGS & TERM_CAN_CEOL) 88 #define EL_CAN_TAB (EL_FLAGS & TERM_CAN_TAB) 89 #define EL_CAN_ME (EL_FLAGS & TERM_CAN_ME) 90 #define EL_HAS_META (EL_FLAGS & TERM_HAS_META) 91 92 #endif /* _h_el_term */ 93