2021-08-12 23:06:58 -04:00
|
|
|
/* terminal.h -- */
|
2013-09-25 09:45:05 -04:00
|
|
|
#ifndef __TERMINAL_H__
|
|
|
|
#define __TERMINAL_H__
|
|
|
|
|
2021-08-12 23:06:58 -04:00
|
|
|
#include "defines.h" /* COLOR, SCROLLCODE */
|
2013-10-09 04:11:43 -04:00
|
|
|
#include "retcode.h"
|
2016-04-08 23:46:40 -04:00
|
|
|
#include "utf8.h"
|
2013-09-25 09:45:05 -04:00
|
|
|
|
2021-08-17 23:35:17 -04:00
|
|
|
/* The editor communicates with the display using a high level interface.
|
|
|
|
A "TERM" structure holds useful variables, and indirect pointers to
|
|
|
|
routines that do useful operations. The low level get and put routines
|
|
|
|
are here too. This lets a terminal, in addition to having non standard
|
|
|
|
commands, have funny get and put character code too. The calls might
|
|
|
|
get changed to "termp->t_field" style in the future, to make it possible
|
|
|
|
to run more than one terminal type.
|
2013-09-25 09:45:05 -04:00
|
|
|
*/
|
2021-08-17 23:35:17 -04:00
|
|
|
typedef struct {
|
|
|
|
const short t_maxrow ; /* max number of rows allowable */
|
|
|
|
const short t_maxcol ; /* max number of columns allowable */
|
|
|
|
short t_mrow ; /* max number of rows displayable */
|
|
|
|
short t_nrow ; /* current number of rows displayed */
|
|
|
|
short t_mcol ; /* max number of rows displayable */
|
|
|
|
short t_ncol ; /* current number of columns displayed */
|
|
|
|
short t_margin ; /* min margin for extended lines */
|
|
|
|
short t_scrsiz ; /* size of scroll region */
|
|
|
|
int t_pause ; /* # times thru update to pause */
|
|
|
|
void (*t_open)( void) ; /* Open terminal at the start */
|
|
|
|
void (*t_close)( void) ; /* Close terminal at end. */
|
|
|
|
void (*t_kopen)( void) ; /* Open keyboard */
|
|
|
|
void (*t_kclose)( void) ; /* close keyboard */
|
|
|
|
int (*t_getchar)( void) ; /* Get character from keyboard */
|
|
|
|
int (*t_putchar)( unicode_t) ; /* Put character to display */
|
|
|
|
void (*t_flush) (void) ; /* Flush output buffers */
|
|
|
|
void (*t_move)( int, int) ; /* Move the cursor, origin 0 */
|
|
|
|
void (*t_eeol)( void) ; /* Erase to end of line */
|
|
|
|
void (*t_eeop)( void) ; /* Erase to end of page */
|
|
|
|
void (*t_beep)( void) ; /* Beep */
|
|
|
|
void (*t_rev)( int) ; /* set reverse video state */
|
|
|
|
int (*t_rez)( char *) ; /* change screen resolution */
|
2021-08-12 23:06:58 -04:00
|
|
|
#if COLOR
|
2021-08-17 23:35:17 -04:00
|
|
|
int (*t_setfor)() ; /* set forground color */
|
|
|
|
int (*t_setback)() ; /* set background color */
|
2013-09-25 09:45:05 -04:00
|
|
|
#endif
|
2021-08-17 23:35:17 -04:00
|
|
|
#if SCROLLCODE
|
|
|
|
void (*t_scroll)( int, int,int) ; /* scroll a region of the screen */
|
2013-09-25 09:45:05 -04:00
|
|
|
#endif
|
2021-08-17 23:35:17 -04:00
|
|
|
} terminal_t ;
|
2013-09-25 09:45:05 -04:00
|
|
|
|
2021-08-12 23:06:58 -04:00
|
|
|
/* TEMPORARY macros for terminal I/O (to be placed in a machine dependant
|
|
|
|
place later)
|
|
|
|
*/
|
2013-09-25 09:45:05 -04:00
|
|
|
|
2021-08-12 23:06:58 -04:00
|
|
|
#define TTopen (*term.t_open)
|
|
|
|
#define TTclose (*term.t_close)
|
|
|
|
#define TTkopen (*term.t_kopen)
|
|
|
|
#define TTkclose (*term.t_kclose)
|
|
|
|
#define TTgetc (*term.t_getchar)
|
|
|
|
#define TTputc (*term.t_putchar)
|
|
|
|
#define TTflush (*term.t_flush)
|
|
|
|
#define TTmove (*term.t_move)
|
|
|
|
#define TTeeol (*term.t_eeol)
|
|
|
|
#define TTeeop (*term.t_eeop)
|
|
|
|
#define TTbeep (*term.t_beep)
|
|
|
|
#define TTrev (*term.t_rev)
|
|
|
|
#define TTrez (*term.t_rez)
|
|
|
|
#if COLOR
|
|
|
|
#define TTforg (*term.t_setfor)
|
|
|
|
#define TTbacg (*term.t_setback)
|
2013-09-25 09:45:05 -04:00
|
|
|
#endif
|
|
|
|
|
2021-08-17 23:35:17 -04:00
|
|
|
/* Terminal table defined only in tcap.c */
|
|
|
|
extern terminal_t term ;
|
2013-09-25 09:45:05 -04:00
|
|
|
|
2021-08-12 23:06:58 -04:00
|
|
|
extern boolean eolexist ; /* does clear to EOL exist? */
|
|
|
|
extern boolean revexist ; /* does reverse video exist? */
|
|
|
|
extern boolean sgarbf ; /* State of screen unknown */
|
2013-10-09 04:11:43 -04:00
|
|
|
|
2021-08-12 23:06:58 -04:00
|
|
|
extern char sres[] ; /* Current screen resolution. */
|
|
|
|
/* NORMAL, CGA, EGA, VGA */
|
2013-10-09 02:38:55 -04:00
|
|
|
|
2013-09-25 09:45:05 -04:00
|
|
|
#endif
|
2021-08-12 23:06:58 -04:00
|
|
|
/* end of terminal.h */
|