1 /* terminal.h -- The external interface to terminal I/O.
2 $Id: terminal.h,v 1.6 2007/07/01 21:20:31 karl Exp $
4 Copyright (C) 1993, 1996, 1997, 2001, 2002, 2004, 2007
5 Free Software Foundation, Inc.
7 This program is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 Written by Brian Fox (bfox@ai.mit.edu). */
22 #if !defined (TERMINAL_H)
27 /* For almost every function externally visible from terminal.c, there is
28 a corresponding "hook" function which can be bound in order to replace
29 the functionality of the one found in terminal.c. This is how we go
30 about implemented X window display. */
32 /* The width and height of the terminal. */
33 extern int screenwidth, screenheight;
35 /* Non-zero means this terminal can't really do anything. */
36 extern int terminal_is_dumb_p;
38 /* Non-zero means that this terminal has a meta key. */
39 extern int terminal_has_meta_p;
41 /* Non-zero means that this terminal can produce a visible bell. */
42 extern int terminal_has_visible_bell_p;
44 /* Non-zero means to use that visible bell if at all possible. */
45 extern int terminal_use_visible_bell_p;
47 /* Non-zero means that this terminal can scroll lines up and down. */
48 extern int terminal_can_scroll;
50 /* Initialize the terminal which is known as TERMINAL_NAME. If this terminal
51 doesn't have cursor addressability, TERMINAL_IS_DUMB_P becomes non-zero.
52 The variables SCREENHEIGHT and SCREENWIDTH are set to the dimensions that
53 this terminal actually has. The variable TERMINAL_HAS_META_P becomes non-
54 zero if this terminal supports a Meta key. */
55 extern void terminal_initialize_terminal (char *terminal_name);
56 extern VFunction *terminal_initialize_terminal_hook;
58 /* Return the current screen width and height in the variables
59 SCREENWIDTH and SCREENHEIGHT. */
60 extern void terminal_get_screen_size (void);
61 extern VFunction *terminal_get_screen_size_hook;
63 /* Save and restore tty settings. */
64 extern void terminal_prep_terminal (void);
65 extern void terminal_unprep_terminal (void);
67 extern VFunction *terminal_prep_terminal_hook;
68 extern VFunction *terminal_unprep_terminal_hook;
70 /* Re-initialize the terminal to TERMINAL_NAME. */
71 extern void terminal_new_terminal (char *terminal_name);
72 extern VFunction *terminal_new_terminal_hook;
74 /* Move the cursor to the terminal location of X and Y. */
75 extern void terminal_goto_xy (int x, int y);
76 extern VFunction *terminal_goto_xy_hook;
78 /* Print STRING to the terminal at the current position. */
79 extern void terminal_put_text (char *string);
80 extern VFunction *terminal_put_text_hook;
82 /* Print NCHARS from STRING to the terminal at the current position. */
83 extern void terminal_write_chars (char *string, int nchars);
84 extern VFunction *terminal_write_chars_hook;
86 /* Clear from the current position of the cursor to the end of the line. */
87 extern void terminal_clear_to_eol (void);
88 extern VFunction *terminal_clear_to_eol_hook;
90 /* Clear the entire terminal screen. */
91 extern void terminal_clear_screen (void);
92 extern VFunction *terminal_clear_screen_hook;
94 /* Move the cursor up one line. */
95 extern void terminal_up_line (void);
96 extern VFunction *terminal_up_line_hook;
98 /* Move the cursor down one line. */
99 extern void terminal_down_line (void);
100 extern VFunction *terminal_down_line_hook;
102 /* Turn on reverse video if possible. */
103 extern void terminal_begin_inverse (void);
104 extern VFunction *terminal_begin_inverse_hook;
106 /* Turn off reverse video if possible. */
107 extern void terminal_end_inverse (void);
108 extern VFunction *terminal_end_inverse_hook;
110 /* Scroll an area of the terminal, starting with the region from START
111 to END, AMOUNT lines. If AMOUNT is negative, the lines are scrolled
112 towards the top of the screen, else they are scrolled towards the
113 bottom of the screen. */
114 extern void terminal_scroll_terminal (int start, int end, int amount);
115 extern VFunction *terminal_scroll_terminal_hook;
117 /* Ring the terminal bell. The bell is run visibly if it both has one and
118 terminal_use_visible_bell_p is non-zero. */
119 extern void terminal_ring_bell (void);
120 extern VFunction *terminal_ring_bell_hook;
122 /* The key sequences output by special keys, if this terminal has any. */
123 extern char *term_ku, *term_kd, *term_kr, *term_kl;
124 extern char *term_kP, *term_kN;
125 extern char *term_ke, *term_kh;
126 extern char *term_kx, *term_ki;
127 extern char *term_kD;
129 #endif /* !TERMINAL_H */