1 /* 2 * Copyright (c) 1983 Regents of the University of California. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms are permitted 6 * provided that the above copyright notice and this paragraph are 7 * duplicated in all such forms and that any documentation, 8 * advertising materials, and other materials related to such 9 * distribution and use acknowledge that the software was developed 10 * by the University of California, Berkeley. The name of the 11 * University may not be used to endorse or promote products derived 12 * from this software without specific prior written permission. 13 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 14 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 15 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 16 * 17 * @(#)tt.h 3.20 (Berkeley) 06/29/88 18 */ 19 20 /* 21 * Interface structure for the terminal drivers. 22 */ 23 struct tt { 24 /* startup and cleanup */ 25 int (*tt_init)(); 26 int (*tt_end)(); 27 28 /* terminal functions */ 29 int (*tt_move)(); 30 int (*tt_insline)(); 31 int (*tt_delline)(); 32 int (*tt_delchar)(); 33 int (*tt_write)(); /* write a whole block */ 34 int (*tt_putc)(); /* write one character */ 35 int (*tt_clreol)(); 36 int (*tt_clreos)(); 37 int (*tt_clear)(); 38 int (*tt_scroll_down)(); 39 int (*tt_scroll_up)(); 40 int (*tt_setscroll)(); /* set scrolling region */ 41 int (*tt_setinsert)(); /* set insert mode */ 42 int (*tt_setmodes)(); /* set display modes */ 43 44 /* internal variables */ 45 char tt_modes; /* the current display modes */ 46 char tt_nmodes; /* the new modes for next write */ 47 char tt_insert; /* currently in insert mode */ 48 char tt_ninsert; /* insert mode on next write */ 49 int tt_row; /* cursor row */ 50 int tt_col; /* cursor column */ 51 int tt_scroll_top; /* top of scrolling region */ 52 int tt_scroll_bot; /* bottom of scrolling region */ 53 54 /* terminal info */ 55 int tt_nrow; /* number of display rows */ 56 int tt_ncol; /* number of display columns */ 57 char tt_hasinsert; /* has insert character */ 58 char tt_availmodes; /* the display modes supported */ 59 char tt_wrap; /* has auto wrap around */ 60 char tt_retain; /* can retain below (db flag) */ 61 62 /* the frame characters */ 63 short *tt_frame; 64 }; 65 struct tt tt; 66 67 /* 68 * List of terminal drivers. 69 */ 70 struct tt_tab { 71 char *tt_name; 72 int tt_len; 73 int (*tt_func)(); 74 }; 75 extern struct tt_tab tt_tab[]; 76 77 /* 78 * Clean interface to termcap routines. 79 * Too may t's. 80 */ 81 char tt_strings[1024]; /* string buffer */ 82 char *tt_strp; /* pointer for it */ 83 84 struct tt_str { 85 char *ts_str; 86 int ts_n; 87 }; 88 89 struct tt_str *tttgetstr(); 90 struct tt_str *ttxgetstr(); /* tgetstr() and expand delays */ 91 92 int tttputc(); 93 #define tttputs(s, n) tputs((s)->ts_str, (n), tttputc) 94 #define ttxputs(s) ttwrite((s)->ts_str, (s)->ts_n) 95 96 /* 97 * Buffered output without stdio. 98 * These variables have different meanings from the ww_ob* variabels. 99 * But I'm too lazy to think up different names. 100 */ 101 char tt_ob[512]; 102 char *tt_obp; 103 char *tt_obe; 104 #define ttputc(c) (tt_obp < tt_obe ? (*tt_obp++ = (c)) \ 105 : (ttflush(), *tt_obp++ = (c))) 106