Extract Struct terminal from estruct to terminal.h implemented by tcap.

This commit is contained in:
Renaud 2013-09-25 21:45:05 +08:00
parent e97f234607
commit 9780b4ce16
20 changed files with 123 additions and 88 deletions

View File

@ -128,28 +128,31 @@ depend: ${SRC}
ansi.o: ansi.c estruct.h retcode.h edef.h buffer.h crypt.h line.h utf8.h
basic.o: basic.c basic.h buffer.h crypt.h line.h utf8.h display.h \
estruct.h retcode.h edef.h input.h random.h window.h defines.h
estruct.h retcode.h edef.h input.h random.h terminal.h defines.h \
window.h
bind.o: bind.c bind.h edef.h buffer.h crypt.h line.h utf8.h estruct.h \
retcode.h bindable.h display.h ebind.h exec.h file.h flook.h input.h \
names.h window.h defines.h
bindable.o: bindable.c bindable.h defines.h buffer.h crypt.h line.h \
utf8.h display.h edef.h estruct.h retcode.h file.h input.h lock.h
utf8.h display.h edef.h estruct.h retcode.h file.h input.h lock.h \
terminal.h
buffer.o: buffer.c buffer.h crypt.h line.h utf8.h defines.h display.h \
edef.h estruct.h retcode.h file.h input.h window.h
crypt.o: crypt.c crypt.h
display.o: display.c display.h buffer.h crypt.h line.h utf8.h estruct.h \
retcode.h edef.h termio.h version.h wrapper.h window.h defines.h
retcode.h edef.h termio.h terminal.h defines.h version.h wrapper.h \
window.h
ebind.o: ebind.c ebind.h basic.h bind.h edef.h buffer.h crypt.h line.h \
utf8.h estruct.h retcode.h bindable.h eval.h exec.h file.h isearch.h \
random.h region.h search.h spawn.h window.h defines.h word.h
eval.o: eval.c eval.h basic.h bind.h edef.h buffer.h crypt.h line.h \
utf8.h estruct.h retcode.h display.h exec.h flook.h input.h random.h \
search.h termio.h version.h window.h defines.h
search.h terminal.h defines.h termio.h version.h window.h
exec.o: exec.c exec.h buffer.h crypt.h line.h utf8.h bind.h edef.h \
estruct.h retcode.h display.h eval.h file.h flook.h input.h window.h \
defines.h
execute.o: execute.c edef.h buffer.h crypt.h line.h utf8.h estruct.h \
retcode.h bind.h random.h display.h file.h window.h defines.h
retcode.h bind.h random.h display.h file.h terminal.h defines.h window.h
file.o: file.c file.h crypt.h retcode.h buffer.h line.h utf8.h defines.h \
estruct.h edef.h execute.h fileio.h input.h lock.h log.h window.h
fileio.o: fileio.c fileio.h crypt.h retcode.h defines.h
@ -159,9 +162,11 @@ globals.o: globals.c crypt.h defines.h edef.h buffer.h line.h utf8.h \
ibmpc.o: ibmpc.c estruct.h retcode.h edef.h buffer.h crypt.h line.h \
utf8.h
input.o: input.c input.h edef.h buffer.h crypt.h line.h utf8.h estruct.h \
retcode.h bind.h bindable.h display.h exec.h names.h wrapper.h
retcode.h bind.h bindable.h display.h exec.h names.h terminal.h \
defines.h wrapper.h
isearch.o: isearch.c isearch.h basic.h buffer.h crypt.h line.h utf8.h \
display.h estruct.h retcode.h edef.h input.h search.h window.h defines.h
display.h estruct.h retcode.h edef.h input.h search.h terminal.h \
defines.h window.h
line.o: line.c line.h utf8.h buffer.h crypt.h edef.h estruct.h retcode.h \
log.h window.h defines.h
lock.o: lock.c lock.h estruct.h retcode.h display.h edef.h buffer.h \
@ -169,7 +174,8 @@ lock.o: lock.c lock.h estruct.h retcode.h display.h edef.h buffer.h \
log.o: log.c log.h retcode.h
main.o: main.c basic.h bind.h edef.h buffer.h crypt.h line.h utf8.h \
estruct.h retcode.h bindable.h display.h eval.h execute.h file.h input.h \
lock.h log.h random.h search.h termio.h version.h window.h defines.h
lock.h log.h random.h search.h terminal.h defines.h termio.h version.h \
window.h
names.o: names.c names.h basic.h bind.h edef.h buffer.h crypt.h line.h \
utf8.h estruct.h retcode.h bindable.h display.h eval.h exec.h file.h \
isearch.h region.h random.h search.h spawn.h window.h defines.h word.h
@ -178,24 +184,25 @@ pklock.o: pklock.c pklock.h estruct.h retcode.h edef.h buffer.h crypt.h \
posix.o: posix.c termio.h
random.o: random.c random.h basic.h buffer.h crypt.h line.h utf8.h \
display.h estruct.h retcode.h edef.h execute.h input.h log.h search.h \
window.h defines.h
terminal.h defines.h window.h
region.o: region.c region.h line.h utf8.h buffer.h crypt.h estruct.h \
retcode.h edef.h log.h window.h defines.h
search.o: search.c search.h line.h utf8.h basic.h buffer.h crypt.h \
display.h edef.h estruct.h retcode.h input.h log.h window.h defines.h
display.h edef.h estruct.h retcode.h input.h log.h terminal.h defines.h \
window.h
spawn.o: spawn.c spawn.h defines.h buffer.h crypt.h line.h utf8.h \
display.h estruct.h retcode.h edef.h file.h flook.h input.h log.h \
window.h
tcap.o: tcap.c display.h estruct.h retcode.h edef.h buffer.h crypt.h \
line.h utf8.h termio.h
termio.o: termio.c termio.h estruct.h retcode.h edef.h buffer.h crypt.h \
line.h utf8.h
terminal.h window.h
tcap.o: tcap.c terminal.h defines.h display.h estruct.h retcode.h edef.h \
buffer.h crypt.h line.h utf8.h termio.h
termio.o: termio.c termio.h estruct.h retcode.h utf8.h
utf8.o: utf8.c utf8.h
vmsvt.o: vmsvt.c estruct.h retcode.h edef.h buffer.h crypt.h line.h \
utf8.h
vt52.o: vt52.c estruct.h retcode.h edef.h buffer.h crypt.h line.h utf8.h
window.o: window.c window.h defines.h buffer.h crypt.h line.h utf8.h \
basic.h display.h edef.h estruct.h retcode.h execute.h wrapper.h
basic.h display.h edef.h estruct.h retcode.h execute.h terminal.h \
wrapper.h
word.o: word.c word.h basic.h buffer.h crypt.h line.h utf8.h estruct.h \
retcode.h edef.h log.h random.h region.h window.h defines.h
wrapper.o: wrapper.c wrapper.h

View File

@ -22,6 +22,7 @@
#include "input.h"
#include "line.h"
#include "random.h"
#include "terminal.h"
#include "utf8.h"
#include "window.h"

View File

@ -8,6 +8,7 @@
#include "file.h"
#include "input.h"
#include "lock.h"
#include "terminal.h"
#if VMS
#include <ssdef.h>

View File

@ -22,6 +22,7 @@
#include "edef.h"
#include "line.h"
#include "termio.h"
#include "terminal.h"
#include "version.h"
#include "wrapper.h"
#include "utf8.h"

5
edef.h
View File

@ -49,8 +49,6 @@ extern int disinp; /* display input characters */
extern struct buffer *bstore; /* buffer to store macro text to */
extern int vtrow; /* Row location of SW cursor */
extern int vtcol; /* Column location of SW cursor */
extern int ttrow; /* Row location of HW cursor */
extern int ttcol; /* Column location of HW cursor */
extern int lbound; /* leftmost column of current line
being displayed */
extern int taboff; /* tab offset for display */
@ -125,7 +123,4 @@ extern int matchoff;
extern char outline[]; /* Global string to hold debug line text. */
#endif
/* Terminal table defined only in term.c */
extern struct terminal term;
#endif /* EDEF_H_ */

View File

@ -349,64 +349,4 @@
int cexit( int status) ;
#endif
/*
* 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.
*/
struct terminal {
short t_mrow; /* max number of rows allowable */
short t_nrow; /* current number of rows used */
short t_mcol; /* max Number of columns. */
short t_ncol; /* current Number of columns. */
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)(int); /* 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 */
#if COLOR
int (*t_setfor) (); /* set forground color */
int (*t_setback) (); /* set background color */
#endif
#if SCROLLCODE
void (*t_scroll)(int, int,int); /* scroll a region of the screen */
#endif
};
/* TEMPORARY macros for terminal I/O (to be placed in a machine
dependant place later) */
#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)
#endif
#endif

1
eval.c
View File

@ -23,6 +23,7 @@
#include "line.h"
#include "random.h"
#include "search.h"
#include "terminal.h"
#include "termio.h"
#include "version.h"
#include "window.h"

View File

@ -3,6 +3,7 @@
#include "random.h"
#include "display.h"
#include "file.h"
#include "terminal.h"
#include "window.h"
/*

View File

@ -57,8 +57,6 @@ int disinp = TRUE; /* display input characters */
struct buffer *bstore = NULL; /* buffer to store macro text to */
int vtrow = 0; /* Row location of SW cursor */
int vtcol = 0; /* Column location of SW cursor */
int ttrow = HUGE; /* Row location of HW cursor */
int ttcol = HUGE; /* Column location of HW cursor */
int lbound = 0; /* leftmost column of current line
being displayed */
int taboff = 0; /* tab offset for display */

View File

@ -18,6 +18,7 @@
#include "display.h"
#include "exec.h"
#include "names.h"
#include "terminal.h"
#include "wrapper.h"
#if PKCODE

View File

@ -34,6 +34,7 @@
#include "input.h"
#include "line.h"
#include "search.h"
#include "terminal.h"
#include "window.h"
/*

1
main.c
View File

@ -72,6 +72,7 @@
#include "log.h"
#include "random.h"
#include "search.h"
#include "terminal.h"
#include "termio.h"
#include "version.h"
#include "window.h"

View File

@ -21,6 +21,7 @@
#include "line.h"
#include "log.h"
#include "search.h"
#include "terminal.h"
#include "window.h"
int tabsize; /* Tab size (0: use real tabs) */

View File

@ -69,6 +69,7 @@
#include "input.h"
#include "line.h"
#include "log.h"
#include "terminal.h"
#include "window.h"
#if defined(MAGIC)

View File

@ -21,6 +21,7 @@
#include "flook.h"
#include "input.h"
#include "log.h"
#include "terminal.h"
#include "window.h"
#if VMS

5
tcap.c
View File

@ -1,3 +1,6 @@
/* tcap.c -- implements terminal.h */
#include "terminal.h"
/* tcap.c
*
* Unix V7 SysV and BS4 Termcap video driver
@ -21,8 +24,6 @@
#include <term.h>
#endif
#include <stdio.h>
#include "display.h"
#include "estruct.h"
#include "edef.h"

73
terminal.h Normal file
View File

@ -0,0 +1,73 @@
#ifndef __TERMINAL_H__
#define __TERMINAL_H__
#include "defines.h" /* COLOR, SCROLLCODE */
/*
* 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.
*/
struct terminal {
short t_mrow; /* max number of rows allowable */
short t_nrow; /* current number of rows used */
short t_mcol; /* max Number of columns. */
short t_ncol; /* current Number of columns. */
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)(int); /* 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 */
#if COLOR
int (*t_setfor) (); /* set forground color */
int (*t_setback) (); /* set background color */
#endif
#if SCROLLCODE
void (*t_scroll)(int, int,int); /* scroll a region of the screen */
#endif
};
/* TEMPORARY macros for terminal I/O (to be placed in a machine
dependant place later) */
#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)
#endif
/* Terminal table defined only in term.c */
extern struct terminal term ;
extern int ttrow ; /* Row location of HW cursor */
extern int ttcol ; /* Column location of HW cursor */
#endif

View File

@ -11,14 +11,20 @@
#ifndef POSIX
#include <stdio.h>
#include "estruct.h"
#include "edef.h"
#include <stdio.h>
#include <stdlib.h>
#include "estruct.h"
#include "utf8.h"
/* rfi */
#include <unistd.h>
#include <sys/ioctl.h>
int ttrow = HUGE ; /* Row location of HW cursor */
int ttcol = HUGE ; /* Column location of HW cursor */
#if VMS
#include <stsdef.h>
#include <ssdef.h>

View File

@ -1,6 +1,9 @@
#ifndef _TERMIO_H_
#define _TERMIO_H_
extern int ttrow ; /* Row location of HW cursor */
extern int ttcol ; /* Column location of HW cursor */
void ttopen( void) ;
void ttclose( void) ;
int ttputc( int c) ;

View File

@ -18,6 +18,7 @@
#include "edef.h"
#include "execute.h"
#include "line.h"
#include "terminal.h"
#include "wrapper.h"
/*