(root)/
texinfo-7.1/
info/
terminal.h
       1  /* terminal.h -- The external interface to terminal I/O.
       2  
       3     Copyright 1993-2023 Free Software Foundation, Inc.
       4  
       5     This program is free software: you can redistribute it and/or modify
       6     it under the terms of the GNU General Public License as published by
       7     the Free Software Foundation, either version 3 of the License, or
       8     (at your option) any later version.
       9  
      10     This program is distributed in the hope that it will be useful,
      11     but WITHOUT ANY WARRANTY; without even the implied warranty of
      12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      13     GNU General Public License for more details.
      14  
      15     You should have received a copy of the GNU General Public License
      16     along with this program.  If not, see <http://www.gnu.org/licenses/>.
      17  
      18     Originally uWritten by Brian Fox. */
      19  
      20  #if !defined (TERMINAL_H)
      21  #define TERMINAL_H
      22  
      23  #include "info.h"
      24  
      25  /* For almost every function externally visible from terminal.c, there is
      26     a corresponding "hook" function which can be bound in order to replace
      27     the functionality of the one found in terminal.c.  This is how we go
      28     about implemented X window display. */
      29  
      30  /* The width and height of the terminal. */
      31  extern int screenwidth, screenheight;
      32  
      33  /* Non-zero means this terminal can't really do anything. */
      34  extern int terminal_is_dumb_p;
      35  
      36  /* Non-zero means that this terminal can produce a visible bell. */
      37  extern int terminal_has_visible_bell_p;
      38  
      39  /* Non-zero means to use that visible bell if at all possible. */
      40  extern int terminal_use_visible_bell_p;
      41  
      42  /* Non-zero means that this terminal can scroll lines up and down. */
      43  extern int terminal_can_scroll;
      44  
      45  /* Non-zero means that this terminal can scroll within a restricted region. */
      46  extern int terminal_can_scroll_region;
      47  
      48  /* Initialize the terminal which is known as TERMINAL_NAME.  If this terminal
      49     doesn't have cursor addressability, TERMINAL_IS_DUMB_P becomes non-zero.
      50     The variables SCREENHEIGHT and SCREENWIDTH are set to the dimensions that
      51     this terminal actually has. */
      52  extern void terminal_initialize_terminal (char *terminal_name);
      53  extern VFunction *terminal_initialize_terminal_hook;
      54  
      55  /* Return the current screen width and height in the variables
      56     SCREENWIDTH and SCREENHEIGHT. */
      57  extern void terminal_get_screen_size (void);
      58  extern VFunction *terminal_get_screen_size_hook;
      59  
      60  /* Save and restore tty settings. */
      61  extern int terminal_prep_terminal (void);
      62  extern void terminal_unprep_terminal (void);
      63  
      64  extern VFunction *terminal_prep_terminal_hook;
      65  extern VFunction *terminal_unprep_terminal_hook;
      66  
      67  /* Re-initialize the terminal to TERMINAL_NAME. */
      68  extern void terminal_new_terminal (char *terminal_name);
      69  extern VFunction *terminal_new_terminal_hook;
      70  
      71  /* Move the cursor to the terminal location of X and Y. */
      72  extern void terminal_goto_xy (int x, int y);
      73  extern VFunction *terminal_goto_xy_hook;
      74  
      75  /* Print STRING to the terminal at the current position. */
      76  extern void terminal_put_text (char *string);
      77  extern VFunction *terminal_put_text_hook;
      78  
      79  /* Print NCHARS from STRING to the terminal at the current position. */
      80  extern void terminal_write_chars (char *string, int nchars);
      81  extern VFunction *terminal_write_chars_hook;
      82  
      83  /* Clear from the current position of the cursor to the end of the line. */
      84  extern void terminal_clear_to_eol (void);
      85  extern VFunction *terminal_clear_to_eol_hook;
      86  
      87  /* Clear the entire terminal screen. */
      88  extern void terminal_clear_screen (void);
      89  extern VFunction *terminal_clear_screen_hook;
      90  
      91  /* Move the cursor up one line. */
      92  extern void terminal_up_line (void);
      93  extern VFunction *terminal_up_line_hook;
      94  
      95  /* Move the cursor down one line. */
      96  extern void terminal_down_line (void);
      97  extern VFunction *terminal_down_line_hook;
      98  
      99  /* Turn on reverse video if possible. */
     100  extern void terminal_begin_inverse (void);
     101  extern VFunction *terminal_begin_inverse_hook;
     102  
     103  /* Turn off reverse video if possible. */
     104  extern void terminal_end_inverse (void);
     105  extern VFunction *terminal_end_inverse_hook;
     106  
     107  /* Turn on standout mode if possible. */
     108  extern void terminal_begin_standout (void);
     109  extern VFunction *terminal_begin_standout_hook;
     110  
     111  /* Turn off standout mode if possible. */
     112  extern void terminal_end_standout (void);
     113  extern VFunction *terminal_end_standout_hook;
     114  
     115  /* Turn on and off underline mode if possible. */
     116  void terminal_begin_underline (void);
     117  extern VFunction *terminal_begin_underline_hook;
     118  void terminal_end_underline (void);
     119  extern VFunction *terminal_end_underline_hook;
     120  
     121  /* Scroll an area of the terminal, starting with the region from START
     122     to END, AMOUNT lines.  If AMOUNT is negative, the lines are scrolled
     123     towards the top of the screen, else they are scrolled towards the
     124     bottom of the screen. */
     125  extern void terminal_scroll_terminal (int start, int end, int amount);
     126  extern VFunction *terminal_scroll_terminal_hook;
     127  
     128  extern void terminal_scroll_region (int start, int end, int amount);
     129  
     130  /* Ring the terminal bell.  The bell is run visibly if it both has one and
     131     terminal_use_visible_bell_p is non-zero. */
     132  extern void terminal_ring_bell (void);
     133  extern VFunction *terminal_ring_bell_hook;
     134  
     135  /* The key sequences output by special keys, if this terminal has any. */
     136  extern char *term_ku, *term_kd, *term_kr, *term_kl;
     137  extern char *term_kP, *term_kN;
     138  extern char *term_ke, *term_kh;
     139  extern char *term_kD, *term_ki;
     140  extern char *term_kB;
     141  
     142  extern char *term_so, *term_se;
     143  
     144  #define MP_NONE 0
     145  #define MP_NORMAL_TRACKING 1
     146  extern int mouse_protocol;
     147  
     148  #define COLOUR_MASK             000000000017
     149  #define COLOUR_BLACK    (8 + 0)
     150  #define COLOUR_RED      (8 + 1)
     151  #define COLOUR_GREEN    (8 + 2)
     152  #define COLOUR_YELLOW   (8 + 3)
     153  #define COLOUR_BLUE     (8 + 4)
     154  #define COLOUR_MAGENTA  (8 + 5)
     155  #define COLOUR_CYAN     (8 + 6)
     156  #define COLOUR_WHITE    (8 + 7)
     157  #define UNDERLINE_MASK          000000000020
     158  #define STANDOUT_MASK           000000000040
     159  #define BOLD_MASK               000000000100
     160  #define ZERO1_MASK              000000000200
     161  #define BLINK_MASK              000000000400
     162  #define BGCOLOUR_MASK           000000017000
     163  #define BGCOLOUR_BLACK    ((8 + 0) << 9)
     164  #define BGCOLOUR_RED      ((8 + 1) << 9)
     165  #define BGCOLOUR_GREEN    ((8 + 2) << 9)
     166  #define BGCOLOUR_YELLOW   ((8 + 3) << 9)
     167  #define BGCOLOUR_BLUE     ((8 + 4) << 9)
     168  #define BGCOLOUR_MAGENTA  ((8 + 5) << 9)
     169  #define BGCOLOUR_CYAN     ((8 + 6) << 9)
     170  #define BGCOLOUR_WHITE    ((8 + 7) << 9)
     171  #define ZERO2_MASK              000000100000
     172  #define ZERO3_MASK              000040000000
     173  #define ZERO4_MASK              020000000000
     174  
     175  /* ZEROi_MASK are always zero bits. */
     176  
     177  void terminal_switch_rendition (unsigned long desired_rendition);
     178  
     179  
     180  #endif /* !TERMINAL_H */