Commit | Line | Data |
---|---|---|
17865084 | 1 | /* |
e1daf7d6 | 2 | * @(#)tt.h 3.15 %G% |
60de5df9 EW |
3 | */ |
4 | ||
5 | /* | |
6 | * Copyright (c) 1983 Regents of the University of California, | |
7 | * All rights reserved. Redistribution permitted subject to | |
8 | * the terms of the Berkeley Software License Agreement. | |
17865084 EW |
9 | */ |
10 | ||
3130283e EW |
11 | /* |
12 | * Interface structure for the terminal drivers. | |
13 | */ | |
17865084 | 14 | struct tt { |
3130283e | 15 | /* startup and cleanup */ |
17865084 | 16 | int (*tt_init)(); |
e908bfac | 17 | int (*tt_end)(); |
3130283e EW |
18 | |
19 | /* terminal functions */ | |
e908bfac | 20 | int (*tt_move)(); |
17865084 EW |
21 | int (*tt_insline)(); |
22 | int (*tt_delline)(); | |
23 | int (*tt_delchar)(); | |
3130283e EW |
24 | int (*tt_write)(); /* write a whole block */ |
25 | int (*tt_putc)(); /* write one character */ | |
17865084 EW |
26 | int (*tt_clreol)(); |
27 | int (*tt_clreos)(); | |
28 | int (*tt_clear)(); | |
c1a57462 EW |
29 | int (*tt_setinsert)(); /* set insert mode */ |
30 | int (*tt_setmodes)(); /* set display modes */ | |
3130283e EW |
31 | |
32 | /* internal variables */ | |
33 | char tt_modes; /* the current display modes */ | |
34 | char tt_nmodes; /* the new modes for next write */ | |
35 | char tt_insert; /* currently in insert mode */ | |
36 | char tt_ninsert; /* insert mode on next write */ | |
37 | int tt_row; /* cursor row */ | |
38 | int tt_col; /* cursor column */ | |
39 | ||
40 | /* terminal info */ | |
41 | int tt_nrow; /* number of display rows */ | |
42 | int tt_ncol; /* number of display columns */ | |
43 | char tt_hasinsert; /* has insert character */ | |
44 | char tt_availmodes; /* the display modes supported */ | |
5e785082 | 45 | char tt_wrap; /* has auto wrap around */ |
377a2410 | 46 | char tt_retain; /* can retain below (db flag) */ |
3130283e EW |
47 | |
48 | /* the frame characters */ | |
a830e8bb | 49 | short *tt_frame; |
17865084 | 50 | }; |
17865084 EW |
51 | struct tt tt; |
52 | ||
3130283e EW |
53 | /* |
54 | * List of terminal drivers. | |
55 | */ | |
17865084 EW |
56 | struct tt_tab { |
57 | char *tt_name; | |
58 | int tt_len; | |
59 | int (*tt_func)(); | |
60 | }; | |
17865084 | 61 | struct tt_tab tt_tab[]; |
c3f80cb5 EW |
62 | |
63 | /* | |
3130283e | 64 | * Clean interface to termcap routines. |
b1189050 | 65 | * Too may t's. |
c3f80cb5 EW |
66 | */ |
67 | char tt_strings[1024]; /* string buffer */ | |
68 | char *tt_strp; /* pointer for it */ | |
69 | ||
e1daf7d6 EW |
70 | struct tt_str { |
71 | char *ts_str; | |
72 | int ts_n; | |
73 | }; | |
74 | ||
75 | struct tt_str *tttgetstr(); | |
76 | struct tt_str *ttxgetstr(); /* tgetstr() and expand delays */ | |
c3f80cb5 | 77 | |
b1189050 | 78 | int tttputc(); |
e1daf7d6 EW |
79 | #define tttputs(s, n) tputs((s)->ts_str, (n), tttputc) |
80 | #define ttxputs(s) ttwrite((s)->ts_str, (s)->ts_n) | |
b1189050 EW |
81 | |
82 | /* | |
83 | * Buffered output without stdio. | |
84 | * These variables have different meanings from the ww_ob* variabels. | |
85 | * But I'm too lazy to think up different names. | |
86 | */ | |
87 | char tt_ob[512]; | |
88 | char *tt_obp; | |
89 | char *tt_obe; | |
cc3bd200 | 90 | #define ttputc(c) (tt_obp < tt_obe ? (*tt_obp++ = (c)) \ |
b1189050 | 91 | : (ttflush(), *tt_obp++ = (c))) |