sbin/hammer: Make info command properly handle non HAMMER path
[dragonfly.git] / usr.bin / window / tt.h
blob72e71fe05e3b9bcb418728861b81154d31e059f6
1 /* $NetBSD: tt.h,v 1.9 2009/04/14 08:50:06 lukem Exp $ */
3 /*
4 * Copyright (c) 1983, 1993
5 * The Regents of the University of California. All rights reserved.
7 * This code is derived from software contributed to Berkeley by
8 * Edward Wang at The University of California, Berkeley.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. Neither the name of the University nor the names of its contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
34 * @(#)tt.h 8.1 (Berkeley) 6/6/93
37 #include <unistd.h>
39 #ifndef EXTERN
40 #define EXTERN extern
41 #endif
44 * Interface structure for the terminal drivers.
46 struct tt {
47 /* startup and cleanup */
48 void (*tt_start)(void);
49 void (*tt_reset)(void);
50 void (*tt_end)(void);
52 /* terminal functions */
53 void (*tt_move)(int, int);
54 void (*tt_insline)(int);
55 void (*tt_delline)(int);
56 void (*tt_inschar)(char);
57 void (*tt_insspace)(int);
58 void (*tt_delchar)(int);
59 void (*tt_write)(const char *, int); /* write a whole block */
60 void (*tt_putc)(char); /* write one character */
61 void (*tt_clreol)(void);
62 void (*tt_clreos)(void);
63 void (*tt_clear)(void);
64 void (*tt_scroll_down)(int);
65 void (*tt_scroll_up)(int);
66 void (*tt_setscroll)(int, int);/* set scrolling region */
67 void (*tt_setmodes)(int); /* set display modes */
68 void (*tt_set_token)(int, char *, int);
69 /* define a token */
70 void (*tt_put_token)(int, const char *, int);
71 /* refer to a defined token */
72 void (*tt_compress)(int); /* begin, end compression */
73 void (*tt_checksum)(char *, int);
74 /* compute checksum */
75 void (*tt_checkpoint)(void); /* checkpoint protocol */
76 int (*tt_rint)(char *, int); /* input processing */
78 /* internal variables */
79 char tt_modes; /* the current display modes */
80 char tt_nmodes; /* the new modes for next write */
81 char tt_insert; /* currently in insert mode */
82 int tt_row; /* cursor row */
83 int tt_col; /* cursor column */
84 int tt_scroll_top; /* top of scrolling region */
85 int tt_scroll_bot; /* bottom of scrolling region */
87 /* terminal info */
88 int tt_nrow; /* number of display rows */
89 int tt_ncol; /* number of display columns */
90 char tt_availmodes; /* the display modes supported */
91 char tt_wrap; /* has auto wrap around */
92 char tt_retain; /* can retain below (db flag) */
93 short tt_padc; /* the pad character */
94 int tt_ntoken; /* number of compression tokens */
95 int tt_token_min; /* minimun token size */
96 int tt_token_max; /* maximum token size */
97 int tt_set_token_cost; /* cost in addition to string */
98 int tt_put_token_cost; /* constant cost */
99 int tt_ack; /* checkpoint ack-nack flag */
101 /* the frame characters */
102 short *tt_frame;
104 /* ttflush() hook */
105 void (*tt_flush)(void);
107 EXTERN struct tt tt;
110 * tt_padc is used by the compression routine.
111 * It is a short to allow the driver to indicate that there is no padding.
113 #define TT_PADC_NONE 0x100
116 * List of terminal drivers.
118 struct tt_tab {
119 const char *tt_name;
120 int tt_len;
121 int (*tt_func)(void);
123 EXTERN struct tt_tab tt_tab[];
126 * Clean interface to termcap routines.
127 * Too may t's.
129 EXTERN char tt_strings[1024]; /* string buffer */
130 EXTERN char *tt_strp; /* pointer for it */
132 struct tt_str {
133 const char *ts_str;
134 int ts_n;
137 struct tt_str *tttgetstr(const char *);
138 struct tt_str *ttxgetstr(const char *); /* tgetstr() and expand delays */
140 int tt_f100(void);
141 int tt_generic(void);
142 int tt_h19(void);
143 int tt_h29(void);
144 int tt_tvi925(void);
145 int tt_wyse60(void);
146 int tt_wyse75(void);
147 int tt_zapple(void);
148 int tt_zentec(void);
149 void ttflush(void);
150 int ttinit(void);
151 void ttpgoto(struct tt_str *, int, int, int);
152 void ttputs(const char *);
153 int ttstrcmp(struct tt_str *, struct tt_str *);
154 void tttgoto(struct tt_str *, int, int);
155 int tttputc(int);
156 void ttwrite(const char *, int);
157 int ttxputc(int);
159 #define tttputs(s, n) tputs((s)->ts_str, (n), tttputc)
160 #define ttxputs(s) ttwrite((s)->ts_str, (s)->ts_n)
163 * Buffered output without stdio.
164 * These variables have different meanings from the ww_ob* variables.
165 * But I'm too lazy to think up different names.
167 EXTERN char *tt_ob;
168 EXTERN char *tt_obp;
169 EXTERN char *tt_obe;
170 #define ttputc(c) (tt_obp < tt_obe ? (*tt_obp++ = (c)) \
171 : (ttflush(), *tt_obp++ = (c)))
174 * Convenience macros for the drivers
175 * They require char.h
177 #define ttctrl(c) ttputc(ctrl(c))
178 #define ttesc(c) (ttctrl('['), ttputc(c))