2 * Copyright (c) 1983, 1993
3 * The Regents of the University of California. All rights reserved.
5 * This code is derived from software contributed to Berkeley by
6 * Edward Wang at The University of California, Berkeley.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This product includes software developed by the University of
19 * California, Berkeley and its contributors.
20 * 4. Neither the name of the University nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * @(#)tt.h 8.1 (Berkeley) 6/6/93
40 * Interface structure for the terminal drivers.
43 /* startup and cleanup */
48 /* terminal functions */
55 int (*tt_write)(); /* write a whole block */
56 int (*tt_putc)(); /* write one character */
60 int (*tt_scroll_down)();
61 int (*tt_scroll_up)();
62 int (*tt_setscroll)(); /* set scrolling region */
63 int (*tt_setmodes)(); /* set display modes */
64 int (*tt_set_token)(); /* define a token */
65 int (*tt_put_token)(); /* refer to a defined token */
66 int (*tt_compress)(); /* begin, end compression */
67 int (*tt_checksum)(); /* compute checksum */
68 int (*tt_checkpoint)(); /* checkpoint protocol */
69 int (*tt_rint)(); /* input processing */
71 /* internal variables */
72 char tt_modes; /* the current display modes */
73 char tt_nmodes; /* the new modes for next write */
74 char tt_insert; /* currently in insert mode */
75 int tt_row; /* cursor row */
76 int tt_col; /* cursor column */
77 int tt_scroll_top; /* top of scrolling region */
78 int tt_scroll_bot; /* bottom of scrolling region */
81 int tt_nrow; /* number of display rows */
82 int tt_ncol; /* number of display columns */
83 char tt_availmodes; /* the display modes supported */
84 char tt_wrap; /* has auto wrap around */
85 char tt_retain; /* can retain below (db flag) */
86 short tt_padc; /* the pad character */
87 int tt_ntoken; /* number of compression tokens */
88 int tt_token_min; /* minimun token size */
89 int tt_token_max; /* maximum token size */
90 int tt_set_token_cost; /* cost in addition to string */
91 int tt_put_token_cost; /* constant cost */
92 int tt_ack; /* checkpoint ack-nack flag */
94 /* the frame characters */
103 * tt_padc is used by the compression routine.
104 * It is a short to allow the driver to indicate that there is no padding.
106 #define TT_PADC_NONE 0x100
109 * List of terminal drivers.
116 extern struct tt_tab tt_tab[];
119 * Clean interface to termcap routines.
122 char tt_strings[1024]; /* string buffer */
123 char *tt_strp; /* pointer for it */
130 struct tt_str *tttgetstr();
131 struct tt_str *ttxgetstr(); /* tgetstr() and expand delays */
134 #define tttputs(s, n) tputs((s)->ts_str, (n), tttputc)
135 #define ttxputs(s) ttwrite((s)->ts_str, (s)->ts_n)
138 * Buffered output without stdio.
139 * These variables have different meanings from the ww_ob* variables.
140 * But I'm too lazy to think up different names.
145 #define ttputc(c) (tt_obp < tt_obe ? (*tt_obp++ = (c)) \
146 : (ttflush(), *tt_obp++ = (c)))
149 * Convenience macros for the drivers
150 * They require char.h
152 #define ttctrl(c) ttputc(ctrl(c))
153 #define ttesc(c) (ttctrl('['), ttputc(c))