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
41 * Interface structure for the terminal drivers.
44 /* startup and cleanup */
49 /* terminal functions */
56 int (*tt_write)(); /* write a whole block */
57 int (*tt_putc)(); /* write one character */
61 int (*tt_scroll_down)();
62 int (*tt_scroll_up)();
63 int (*tt_setscroll)(); /* set scrolling region */
64 int (*tt_setmodes)(); /* set display modes */
65 int (*tt_set_token)(); /* define a token */
66 int (*tt_put_token)(); /* refer to a defined token */
67 int (*tt_compress)(); /* begin, end compression */
68 int (*tt_checksum)(); /* compute checksum */
69 int (*tt_checkpoint)(); /* checkpoint protocol */
70 int (*tt_rint)(); /* input processing */
72 /* internal variables */
73 char tt_modes; /* the current display modes */
74 char tt_nmodes; /* the new modes for next write */
75 char tt_insert; /* currently in insert mode */
76 int tt_row; /* cursor row */
77 int tt_col; /* cursor column */
78 int tt_scroll_top; /* top of scrolling region */
79 int tt_scroll_bot; /* bottom of scrolling region */
82 int tt_nrow; /* number of display rows */
83 int tt_ncol; /* number of display columns */
84 char tt_availmodes; /* the display modes supported */
85 char tt_wrap; /* has auto wrap around */
86 char tt_retain; /* can retain below (db flag) */
87 short tt_padc; /* the pad character */
88 int tt_ntoken; /* number of compression tokens */
89 int tt_token_min; /* minimun token size */
90 int tt_token_max; /* maximum token size */
91 int tt_set_token_cost; /* cost in addition to string */
92 int tt_put_token_cost; /* constant cost */
93 int tt_ack; /* checkpoint ack-nack flag */
95 /* the frame characters */
104 * tt_padc is used by the compression routine.
105 * It is a short to allow the driver to indicate that there is no padding.
107 #define TT_PADC_NONE 0x100
110 * List of terminal drivers.
117 extern struct tt_tab tt_tab[];
120 * Clean interface to termcap routines.
123 char tt_strings[1024]; /* string buffer */
124 char *tt_strp; /* pointer for it */
131 struct tt_str *tttgetstr();
132 struct tt_str *ttxgetstr(); /* tgetstr() and expand delays */
135 #define tttputs(s, n) tputs((s)->ts_str, (n), tttputc)
136 #define ttxputs(s) ttwrite((s)->ts_str, (s)->ts_n)
139 * Buffered output without stdio.
140 * These variables have different meanings from the ww_ob* variables.
141 * But I'm too lazy to think up different names.
146 #define ttputc(c) (tt_obp < tt_obe ? (*tt_obp++ = (c)) \
147 : (ttflush(), *tt_obp++ = (c)))
150 * Convenience macros for the drivers
151 * They require char.h
153 #define ttctrl(c) ttputc(ctrl(c))
154 #define ttesc(c) (ttctrl('['), ttputc(c))