📄 edterm.c
字号:
/* CLIPS Version 6.05 04/09/97 */#include "setup.h"#if EMACS_EDITOR && ! RUN_TIME#define _EDTERM_SOURCE_#include "ed.h"#if ANSI_COMPILER#include <stdlib.h>#elseextern char *getenv();#endif#if ANSI#if ANSI_COMPILERstatic VOID ansimove(int,int);static VOID ansieeol(void);static VOID ansieeop(void);static VOID ansibeep(void);static VOID ansiparm(int);static VOID ansiopen(void);#elsestatic VOID ansimove();static VOID ansieeol();static VOID ansieeop();static VOID ansibeep();static VOID ansiparm();static VOID ansiopen();#endif#endif#if VT52#if ANSI_COMPILERstatic VOID vt52move(int,int);static VOID vt52eeol(void);static VOID vt52eeop(void);static VOID vt52beep(void);static VOID vt52parm(int);static VOID vt52open(void);#elsestatic VOID vt52move();static VOID vt52eeol();static VOID vt52eeop();static VOID vt52beep();static VOID vt52parm();static VOID vt52open();#endif#endif#if IBM_PC#if ANSI_COMPILERstatic VOID pc_open(void);static int scinit(int);static int getboard(void);static int pc_getc(void);static VOID pc_putc(int);static VOID pc_move(int,int);static VOID pc_eeol(void);static VOID pc_eeop(void);static VOID pc_beep(void);#elsestatic VOID pc_open();static int scinit();static int getboard();static int pc_getc();static VOID pc_putc();static VOID pc_move();static VOID pc_eeol();static VOID pc_eeop();static VOID pc_beep();#endif#endif#if TERMCAP#if ANSI_COMPILERextern int tgetent(char *,char *);extern char *tgoto(char *,int,int);extern int tputs(register char *,int,int (*)(int));static VOID tcapmove(int,int);static VOID tcapeeol(void);static VOID tcapeeop(void);static VOID tcapbeep(void);static VOID tcapopen(void);static VOID putpad(char *);#elseextern int tgetent();extern char *tgoto();extern int tputs();static VOID tcapmove();static VOID tcapeeol();static VOID tcapeeop();static VOID tcapbeep();static VOID tcapopen();static VOID putpad();#endif#endif/* ========================================================================== * ANSI Terminal * ========================================================================== */#if ANSI/* * The routines in this section provide support for ANSI style terminals * over a serial line. The serial I/O services are provided by routines in * "termio.c". It compiles into nothing if not an ANSI device. */#define NROW 23 /* Screen size. */#define NCOL 77 /* Edit if you want to. */#define BEL 0x07 /* BEL character. */#define ESC 0x1B /* ESC character. *//* * Standard terminal interface dispatch table. Most of the fields point into * "termio" code. */TERM term = { NROW-1, NCOL, ansiopen, ttclose, ttgetc, ttputc, ttflush, ansimove, ansieeol, ansieeop, ansibeep};static VOID ansimove(row, col)int row,col;{ ttputc(ESC); ttputc('['); ansiparm(row+1); ttputc(';'); ansiparm(col+1); ttputc('H');}static VOID ansieeol(){ ttputc(ESC); ttputc('['); ttputc('K');}static VOID ansieeop(){ ttputc(ESC); ttputc('['); ttputc('J');}static VOID ansibeep(){ ttputc(BEL); ttflush();}static VOID ansiparm(n)int n;{ register int q; q = n/10; if (q != 0) ansiparm(q); ttputc((n%10) + '0');}static VOID ansiopen(){#if UNIX_7 || UNIX_V register char *cp; if ((cp = getenv("TERM")) == NULL) { puts("Shell variable TERM not defined!"); exit(1); } if (strcmp(cp, "vt100") != 0) { puts("Terminal type not 'vt100'!"); exit(1); }#endif ttopen();}#endif/* ========================================================================== * VT52 Terminal * ========================================================================== */#if VT52/* * The routines in this section * provide support for VT52 style terminals * over a serial line. The serial I/O services are * provided by routines in "termio.c". It compiles * into nothing if not a VT52 style device. The * bell on the VT52 is terrible, so the "beep" * routine is conditionalized on defining BEL. */#define NROW 24 /* Screen size. */#define NCOL 80 /* Edit if you want to. */#define BIAS 0x20 /* Origin 0 coordinate bias. */#define ESC 0x1B /* ESC character. */#define BEL 0x07 /* ascii bell character *//* * Dispatch table. All the * hard fields just point into the * terminal I/O code. */globle TERM term = { NROW-1, NCOL, vt52open, ttclose, ttgetc, ttputc, ttflush, vt52move, vt52eeol, vt52eeop, vt52beep};static VOID vt52move(row, col)int row,col;{ ttputc(ESC); ttputc('Y'); ttputc(row+BIAS); ttputc(col+BIAS);}static VOID vt52eeol(){ ttputc(ESC); ttputc('K');}static VOID vt52eeop(){ ttputc(ESC); ttputc('J');}static VOID vt52beep(){#ifdef BEL ttputc(BEL); ttflush();#endif}static VOID vt52open(){#if UNIX_7 || UNIX_V register char *cp; if ((cp = getenv("TERM")) == NULL) { puts("Shell variable TERM not defined!"); exit(1); } if (strcmp(cp, "vt52") != 0 && strcmp(cp, "z19") != 0) { puts("Terminal type not 'vt52'or 'z19' !"); exit(1); }#endif ttopen();}#endif/* ========================================================================== * IBM PC Code * ========================================================================== */#if IBM_PC /* Should be an IBM PC using */ /* the Microsoft C compiler */ /* or the Turbo C compiler */ /* or the Zortech C compiler */ /* or the Intel C Code builder */#if IBM_MSC || IBM_TBC || IBM_ZTC || IBM_ICB || IBM_GCC#include <dos.h>#if IBM_MSC || IBM_ICB || IBM_GCC#include <conio.h>#endif#if IBM_ZTC#include <disp.h>#endif#define NROW 25 /* Screen size. rows */#define NCOL 80 /* Columns */#define BEL 0x07 /* BEL character. */#define ESC 0x1B /* ESC character. */#define SPACE 32#if IBM_ICB#define SCADC 0xb8000 /* CGA address of screen RAM */#define SCADM 0xb0000 /* MONO address of screen RAM */#else#define SCADC 0xb8000000L /* CGA address of screen RAM */#define SCADM 0xb0000000L /* MONO address of screen RAM */#endif#define MONOCRSR 0x0B0D /* monochrome cursor */#define CGACRSR 0x0607 /* CGA cursor */#define CDCGA 0 /* color graphics card */#define CDMONO 1 /* monochrome text card */#define CDSENSE 9 /* detect the card type */#define NDRIVE 3 /* number of screen drivers *//* * Standard terminal interface dispatch table. Most of the fields point into * "termio" code. */globle TERM term = { NROW-1, NCOL, pc_open, ttclose, pc_getc, pc_putc, ttflush, pc_move, pc_eeol, pc_eeop, pc_beep};static int dtype = -1; /* current display type */#if IBM_ICB
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -