Commit | Line | Data |
---|---|---|
17865084 | 1 | /* |
46e9ea25 KB |
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 | |
5e8b0e60 KB |
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. | |
46e9ea25 | 16 | * |
5e8b0e60 | 17 | * @(#)tt.h 3.20 (Berkeley) %G% |
17865084 EW |
18 | */ |
19 | ||
3130283e EW |
20 | /* |
21 | * Interface structure for the terminal drivers. | |
22 | */ | |
17865084 | 23 | struct tt { |
3130283e | 24 | /* startup and cleanup */ |
17865084 | 25 | int (*tt_init)(); |
e908bfac | 26 | int (*tt_end)(); |
3130283e EW |
27 | |
28 | /* terminal functions */ | |
e908bfac | 29 | int (*tt_move)(); |
17865084 EW |
30 | int (*tt_insline)(); |
31 | int (*tt_delline)(); | |
32 | int (*tt_delchar)(); | |
3130283e EW |
33 | int (*tt_write)(); /* write a whole block */ |
34 | int (*tt_putc)(); /* write one character */ | |
17865084 EW |
35 | int (*tt_clreol)(); |
36 | int (*tt_clreos)(); | |
37 | int (*tt_clear)(); | |
16ea9636 EW |
38 | int (*tt_scroll_down)(); |
39 | int (*tt_scroll_up)(); | |
40 | int (*tt_setscroll)(); /* set scrolling region */ | |
c1a57462 EW |
41 | int (*tt_setinsert)(); /* set insert mode */ |
42 | int (*tt_setmodes)(); /* set display modes */ | |
3130283e EW |
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 */ | |
16ea9636 EW |
51 | int tt_scroll_top; /* top of scrolling region */ |
52 | int tt_scroll_bot; /* bottom of scrolling region */ | |
3130283e EW |
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 */ | |
5e785082 | 59 | char tt_wrap; /* has auto wrap around */ |
377a2410 | 60 | char tt_retain; /* can retain below (db flag) */ |
3130283e EW |
61 | |
62 | /* the frame characters */ | |
a830e8bb | 63 | short *tt_frame; |
17865084 | 64 | }; |
17865084 EW |
65 | struct tt tt; |
66 | ||
3130283e EW |
67 | /* |
68 | * List of terminal drivers. | |
69 | */ | |
17865084 EW |
70 | struct tt_tab { |
71 | char *tt_name; | |
72 | int tt_len; | |
73 | int (*tt_func)(); | |
74 | }; | |
b15b4a3f | 75 | extern struct tt_tab tt_tab[]; |
c3f80cb5 EW |
76 | |
77 | /* | |
3130283e | 78 | * Clean interface to termcap routines. |
b1189050 | 79 | * Too may t's. |
c3f80cb5 EW |
80 | */ |
81 | char tt_strings[1024]; /* string buffer */ | |
82 | char *tt_strp; /* pointer for it */ | |
83 | ||
e1daf7d6 EW |
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 */ | |
c3f80cb5 | 91 | |
b1189050 | 92 | int tttputc(); |
e1daf7d6 EW |
93 | #define tttputs(s, n) tputs((s)->ts_str, (n), tttputc) |
94 | #define ttxputs(s) ttwrite((s)->ts_str, (s)->ts_n) | |
b1189050 EW |
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; | |
cc3bd200 | 104 | #define ttputc(c) (tt_obp < tt_obe ? (*tt_obp++ = (c)) \ |
b1189050 | 105 | : (ttflush(), *tt_obp++ = (c))) |