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