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 | * |
d9375810 | 17 | * @(#)tt.h 3.23 (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 */ |
ab8b3b31 | 25 | int (*tt_start)(); |
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)(); | |
2d152f42 | 32 | int (*tt_inschar)(); |
d9375810 | 33 | int (*tt_insspace)(); |
17865084 | 34 | int (*tt_delchar)(); |
3130283e EW |
35 | int (*tt_write)(); /* write a whole block */ |
36 | int (*tt_putc)(); /* write one character */ | |
17865084 EW |
37 | int (*tt_clreol)(); |
38 | int (*tt_clreos)(); | |
39 | int (*tt_clear)(); | |
16ea9636 EW |
40 | int (*tt_scroll_down)(); |
41 | int (*tt_scroll_up)(); | |
42 | int (*tt_setscroll)(); /* set scrolling region */ | |
c1a57462 | 43 | int (*tt_setmodes)(); /* set display modes */ |
ab8b3b31 EW |
44 | int (*tt_set_token)(); /* define a token */ |
45 | int (*tt_put_token)(); /* refer to a defined token */ | |
3130283e EW |
46 | |
47 | /* internal variables */ | |
48 | char tt_modes; /* the current display modes */ | |
49 | char tt_nmodes; /* the new modes for next write */ | |
50 | char tt_insert; /* currently in insert mode */ | |
3130283e EW |
51 | int tt_row; /* cursor row */ |
52 | int tt_col; /* cursor column */ | |
16ea9636 EW |
53 | int tt_scroll_top; /* top of scrolling region */ |
54 | int tt_scroll_bot; /* bottom of scrolling region */ | |
3130283e EW |
55 | |
56 | /* terminal info */ | |
57 | int tt_nrow; /* number of display rows */ | |
58 | int tt_ncol; /* number of display columns */ | |
3130283e | 59 | char tt_availmodes; /* the display modes supported */ |
5e785082 | 60 | char tt_wrap; /* has auto wrap around */ |
377a2410 | 61 | char tt_retain; /* can retain below (db flag) */ |
ab8b3b31 EW |
62 | int tt_ntoken; /* number of compression tokens */ |
63 | int tt_token_min; /* minimun token size */ | |
64 | int tt_token_max; /* maximum token size */ | |
65 | int tt_set_token_cost; /* cost in addition to string */ | |
66 | int tt_put_token_cost; /* constant cost */ | |
3130283e EW |
67 | |
68 | /* the frame characters */ | |
a830e8bb | 69 | short *tt_frame; |
17865084 | 70 | }; |
17865084 EW |
71 | struct tt tt; |
72 | ||
3130283e EW |
73 | /* |
74 | * List of terminal drivers. | |
75 | */ | |
17865084 EW |
76 | struct tt_tab { |
77 | char *tt_name; | |
78 | int tt_len; | |
79 | int (*tt_func)(); | |
80 | }; | |
b15b4a3f | 81 | extern struct tt_tab tt_tab[]; |
c3f80cb5 EW |
82 | |
83 | /* | |
3130283e | 84 | * Clean interface to termcap routines. |
b1189050 | 85 | * Too may t's. |
c3f80cb5 EW |
86 | */ |
87 | char tt_strings[1024]; /* string buffer */ | |
88 | char *tt_strp; /* pointer for it */ | |
89 | ||
e1daf7d6 EW |
90 | struct tt_str { |
91 | char *ts_str; | |
92 | int ts_n; | |
93 | }; | |
94 | ||
95 | struct tt_str *tttgetstr(); | |
96 | struct tt_str *ttxgetstr(); /* tgetstr() and expand delays */ | |
c3f80cb5 | 97 | |
b1189050 | 98 | int tttputc(); |
e1daf7d6 EW |
99 | #define tttputs(s, n) tputs((s)->ts_str, (n), tttputc) |
100 | #define ttxputs(s) ttwrite((s)->ts_str, (s)->ts_n) | |
b1189050 EW |
101 | |
102 | /* | |
103 | * Buffered output without stdio. | |
104 | * These variables have different meanings from the ww_ob* variabels. | |
105 | * But I'm too lazy to think up different names. | |
106 | */ | |
107 | char tt_ob[512]; | |
108 | char *tt_obp; | |
109 | char *tt_obe; | |
cc3bd200 | 110 | #define ttputc(c) (tt_obp < tt_obe ? (*tt_obp++ = (c)) \ |
b1189050 | 111 | : (ttflush(), *tt_obp++ = (c))) |