mirror of
https://github.com/rfivet/uemacs.git
synced 2024-09-30 01:05:54 -04:00
Revise terminal interfaces.
This commit is contained in:
parent
5f3b42f448
commit
d99b7fcbac
15
posix.c
15
posix.c
@ -26,12 +26,11 @@
|
|||||||
#include "retcode.h"
|
#include "retcode.h"
|
||||||
#include "utf8.h"
|
#include "utf8.h"
|
||||||
|
|
||||||
int ttrow = HUGE ; /* Row location of HW cursor */
|
int ttrow = -1 ; /* Row location of HW cursor */
|
||||||
int ttcol = HUGE ; /* Column location of HW cursor */
|
int ttcol = -1 ; /* Column location of HW cursor */
|
||||||
|
|
||||||
/* Since Mac OS X's termios.h doesn't have the following 2 macros, define them.
|
/* Define missing macroes for BSD and CYGWIN environment */
|
||||||
*/
|
#if BSD
|
||||||
#if BSD || defined(SYSV) && (defined(_DARWIN_C_SOURCE) || defined(_FREEBSD_C_SOURCE))
|
|
||||||
#define OLCUC 0000002
|
#define OLCUC 0000002
|
||||||
#define XCASE 0000004
|
#define XCASE 0000004
|
||||||
#endif
|
#endif
|
||||||
@ -94,10 +93,8 @@ void ttopen(void)
|
|||||||
kbdflgs = fcntl(0, F_GETFL, 0);
|
kbdflgs = fcntl(0, F_GETFL, 0);
|
||||||
kbdpoll = FALSE;
|
kbdpoll = FALSE;
|
||||||
|
|
||||||
/* on all screens we are not sure of the initial position
|
/* on all screens we are not sure of the initial position of the cursor */
|
||||||
of the cursor */
|
ttrow = ttcol = -1 ;
|
||||||
ttrow = 999;
|
|
||||||
ttcol = 999;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
8
tcap.c
8
tcap.c
@ -83,7 +83,7 @@ static char *_UP, _PC, *CM, *CE, *CL, *SO, *SE;
|
|||||||
static char *CS, *DL, *AL, *SF, *SR;
|
static char *CS, *DL, *AL, *SF, *SR;
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
struct terminal term = {
|
terminal_t term = {
|
||||||
480, /* actual 479 on 2560x1440 landscape terminal window */
|
480, /* actual 479 on 2560x1440 landscape terminal window */
|
||||||
2550, /* actual 2541 */
|
2550, /* actual 2541 */
|
||||||
0, /* These four values are set dynamically at open time. */
|
0, /* These four values are set dynamically at open time. */
|
||||||
@ -231,13 +231,11 @@ static void tcapclose(void)
|
|||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
static void tcapkopen(void)
|
static void tcapkopen( void) {
|
||||||
{
|
|
||||||
# if PKCODE
|
# if PKCODE
|
||||||
putpad( TI) ;
|
putpad( TI) ;
|
||||||
ttflush() ;
|
ttflush() ;
|
||||||
ttrow = 999;
|
ttrow = ttcol = -1 ;
|
||||||
ttcol = 999;
|
|
||||||
sgarbf = TRUE ;
|
sgarbf = TRUE ;
|
||||||
# endif
|
# endif
|
||||||
strcpy(sres, "NORMAL") ;
|
strcpy(sres, "NORMAL") ;
|
||||||
|
43
terminal.h
43
terminal.h
@ -6,15 +6,15 @@
|
|||||||
#include "retcode.h"
|
#include "retcode.h"
|
||||||
#include "utf8.h"
|
#include "utf8.h"
|
||||||
|
|
||||||
/* The editor communicates with the display using a high level interface. A
|
/* The editor communicates with the display using a high level interface.
|
||||||
* "TERM" structure holds useful variables, and indirect pointers to routines
|
A "TERM" structure holds useful variables, and indirect pointers to
|
||||||
* that do useful operations. The low level get and put routines are here too.
|
routines that do useful operations. The low level get and put routines
|
||||||
* This lets a terminal, in addition to having non standard commands, have
|
are here too. This lets a terminal, in addition to having non standard
|
||||||
* funny get and put character code too. The calls might get changed to
|
commands, have funny get and put character code too. The calls might
|
||||||
* "termp->t_field" style in the future, to make it possible to run more than
|
get changed to "termp->t_field" style in the future, to make it possible
|
||||||
* one terminal type.
|
to run more than one terminal type.
|
||||||
*/
|
*/
|
||||||
struct terminal {
|
typedef struct {
|
||||||
const short t_maxrow ; /* max number of rows allowable */
|
const short t_maxrow ; /* max number of rows allowable */
|
||||||
const short t_maxcol ; /* max number of columns allowable */
|
const short t_maxcol ; /* max number of columns allowable */
|
||||||
short t_mrow ; /* max number of rows displayable */
|
short t_mrow ; /* max number of rows displayable */
|
||||||
@ -22,19 +22,19 @@ struct terminal {
|
|||||||
short t_mcol ; /* max number of rows displayable */
|
short t_mcol ; /* max number of rows displayable */
|
||||||
short t_ncol ; /* current number of columns displayed */
|
short t_ncol ; /* current number of columns displayed */
|
||||||
short t_margin ; /* min margin for extended lines */
|
short t_margin ; /* min margin for extended lines */
|
||||||
short t_scrsiz; /* size of scroll region " */
|
short t_scrsiz ; /* size of scroll region */
|
||||||
int t_pause ; /* # times thru update to pause */
|
int t_pause ; /* # times thru update to pause */
|
||||||
void (*t_open)(void); /* Open terminal at the start. */
|
void (*t_open)( void) ; /* Open terminal at the start */
|
||||||
void (*t_close)( void) ; /* Close terminal at end. */
|
void (*t_close)( void) ; /* Close terminal at end. */
|
||||||
void (*t_kopen)( void) ; /* Open keyboard */
|
void (*t_kopen)( void) ; /* Open keyboard */
|
||||||
void (*t_kclose)( void) ; /* close keyboard */
|
void (*t_kclose)( void) ; /* close keyboard */
|
||||||
int (*t_getchar)(void); /* Get character from keyboard. */
|
int (*t_getchar)( void) ; /* Get character from keyboard */
|
||||||
int (*t_putchar)( unicode_t) ; /* Put character to display. */
|
int (*t_putchar)( unicode_t) ; /* Put character to display */
|
||||||
void (*t_flush) (void); /* Flush output buffers. */
|
void (*t_flush) (void) ; /* Flush output buffers */
|
||||||
void (*t_move)(int, int);/* Move the cursor, origin 0. */
|
void (*t_move)( int, int) ; /* Move the cursor, origin 0 */
|
||||||
void (*t_eeol)(void); /* Erase to end of line. */
|
void (*t_eeol)( void) ; /* Erase to end of line */
|
||||||
void (*t_eeop)(void); /* Erase to end of page. */
|
void (*t_eeop)( void) ; /* Erase to end of page */
|
||||||
void (*t_beep)(void); /* Beep. */
|
void (*t_beep)( void) ; /* Beep */
|
||||||
void (*t_rev)( int) ; /* set reverse video state */
|
void (*t_rev)( int) ; /* set reverse video state */
|
||||||
int (*t_rez)( char *) ; /* change screen resolution */
|
int (*t_rez)( char *) ; /* change screen resolution */
|
||||||
#if COLOR
|
#if COLOR
|
||||||
@ -44,7 +44,7 @@ struct terminal {
|
|||||||
#if SCROLLCODE
|
#if SCROLLCODE
|
||||||
void (*t_scroll)( int, int,int) ; /* scroll a region of the screen */
|
void (*t_scroll)( int, int,int) ; /* scroll a region of the screen */
|
||||||
#endif
|
#endif
|
||||||
};
|
} terminal_t ;
|
||||||
|
|
||||||
/* TEMPORARY macros for terminal I/O (to be placed in a machine dependant
|
/* TEMPORARY macros for terminal I/O (to be placed in a machine dependant
|
||||||
place later)
|
place later)
|
||||||
@ -68,11 +68,8 @@ struct terminal {
|
|||||||
#define TTbacg (*term.t_setback)
|
#define TTbacg (*term.t_setback)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Terminal table defined only in term.c */
|
/* Terminal table defined only in tcap.c */
|
||||||
extern struct terminal term ;
|
extern terminal_t term ;
|
||||||
|
|
||||||
extern int ttrow ; /* Row location of HW cursor */
|
|
||||||
extern int ttcol ; /* Column location of HW cursor */
|
|
||||||
|
|
||||||
extern boolean eolexist ; /* does clear to EOL exist? */
|
extern boolean eolexist ; /* does clear to EOL exist? */
|
||||||
extern boolean revexist ; /* does reverse video exist? */
|
extern boolean revexist ; /* does reverse video exist? */
|
||||||
|
7
termio.c
7
termio.c
@ -21,8 +21,8 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
|
||||||
int ttrow = HUGE ; /* Row location of HW cursor */
|
int ttrow = -1 ; /* Row location of HW cursor */
|
||||||
int ttcol = HUGE ; /* Column location of HW cursor */
|
int ttcol = -1 ; /* Column location of HW cursor */
|
||||||
|
|
||||||
|
|
||||||
#if USG /* System V */
|
#if USG /* System V */
|
||||||
@ -139,8 +139,7 @@ void ttopen(void)
|
|||||||
|
|
||||||
/* on all screens we are not sure of the initial position
|
/* on all screens we are not sure of the initial position
|
||||||
of the cursor */
|
of the cursor */
|
||||||
ttrow = 999;
|
ttrow = ttcol = -1 ;
|
||||||
ttcol = 999;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
2
termio.h
2
termio.h
@ -6,8 +6,6 @@
|
|||||||
|
|
||||||
#define TYPEAH 1 /* type ahead causes update to be skipped */
|
#define TYPEAH 1 /* type ahead causes update to be skipped */
|
||||||
|
|
||||||
#define HUGE 1000 /* Huge number (for row/col) */
|
|
||||||
|
|
||||||
extern int ttrow ; /* Row location of HW cursor */
|
extern int ttrow ; /* Row location of HW cursor */
|
||||||
extern int ttcol ; /* Column location of HW cursor */
|
extern int ttcol ; /* Column location of HW cursor */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user