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
37 * $FreeBSD: src/usr.bin/window/tt.h,v 1.1.1.1.14.1 2001/05/17 09:45:01 obrien Exp $
38 * $DragonFly: src/usr.bin/window/tt.h,v 1.2 2003/06/17 04:29:34 dillon Exp $
42 * Interface structure for the terminal drivers.
45 /* startup and cleanup */
50 /* terminal functions */
57 int (*tt_write
)(); /* write a whole block */
58 int (*tt_putc
)(); /* write one character */
62 int (*tt_scroll_down
)();
63 int (*tt_scroll_up
)();
64 int (*tt_setscroll
)(); /* set scrolling region */
65 int (*tt_setmodes
)(); /* set display modes */
66 int (*tt_set_token
)(); /* define a token */
67 int (*tt_put_token
)(); /* refer to a defined token */
68 int (*tt_compress
)(); /* begin, end compression */
69 int (*tt_checksum
)(); /* compute checksum */
70 int (*tt_checkpoint
)(); /* checkpoint protocol */
71 int (*tt_rint
)(); /* input processing */
73 /* internal variables */
74 char tt_modes
; /* the current display modes */
75 char tt_nmodes
; /* the new modes for next write */
76 char tt_insert
; /* currently in insert mode */
77 int tt_row
; /* cursor row */
78 int tt_col
; /* cursor column */
79 int tt_scroll_top
; /* top of scrolling region */
80 int tt_scroll_bot
; /* bottom of scrolling region */
83 int tt_nrow
; /* number of display rows */
84 int tt_ncol
; /* number of display columns */
85 char tt_availmodes
; /* the display modes supported */
86 char tt_wrap
; /* has auto wrap around */
87 char tt_retain
; /* can retain below (db flag) */
88 short tt_padc
; /* the pad character */
89 int tt_ntoken
; /* number of compression tokens */
90 int tt_token_min
; /* minimun token size */
91 int tt_token_max
; /* maximum token size */
92 int tt_set_token_cost
; /* cost in addition to string */
93 int tt_put_token_cost
; /* constant cost */
94 int tt_ack
; /* checkpoint ack-nack flag */
96 /* the frame characters */
105 * tt_padc is used by the compression routine.
106 * It is a short to allow the driver to indicate that there is no padding.
108 #define TT_PADC_NONE 0x100
111 * List of terminal drivers.
118 extern struct tt_tab tt_tab
[];
121 * Clean interface to termcap routines.
124 char tt_strings
[1024]; /* string buffer */
125 char *tt_strp
; /* pointer for it */
132 struct tt_str
*tttgetstr();
133 struct tt_str
*ttxgetstr(); /* tgetstr() and expand delays */
136 #define tttputs(s, n) tputs((s)->ts_str, (n), tttputc)
137 #define ttxputs(s) ttwrite((s)->ts_str, (s)->ts_n)
140 * Buffered output without stdio.
141 * These variables have different meanings from the ww_ob* variables.
142 * But I'm too lazy to think up different names.
147 #define ttputc(c) (tt_obp < tt_obe ? (*tt_obp++ = (c)) \
148 : (ttflush(), *tt_obp++ = (c)))
151 * Convenience macros for the drivers
152 * They require char.h
154 #define ttctrl(c) ttputc(ctrl(c))
155 #define ttesc(c) (ttctrl('['), ttputc(c))