|
|
1.1 ! root 1: /* ! 2: * The routines in this file ! 3: * provide support for VT52 style terminals ! 4: * over a serial line. The serial I/O services are ! 5: * provided by routines in "termio.c". It compiles ! 6: * into nothing if not a VT52 style device. The ! 7: * bell on the VT52 is terrible, so the "beep" ! 8: * routine is conditionalized on defining BEL. ! 9: */ ! 10: #include <stdio.h> ! 11: #include "ed.h" ! 12: ! 13: #if VT52 ! 14: ! 15: #if GEM ! 16: #define NROW 25 /* Screen size. */ ! 17: #else ! 18: #define NROW 24 /* Screen size. */ ! 19: #endif ! 20: ! 21: #define NCOL 80 /* Edit if you want to. */ ! 22: #define BIAS 0x20 /* Origin 0 coordinate bias. */ ! 23: #define ESC 0x1B /* ESC character. */ ! 24: #define BEL 0x07 /* ascii bell character */ ! 25: ! 26: extern int ttopen(); /* Forward references. */ ! 27: extern int ttgetc(); ! 28: extern int ttputc(); ! 29: extern int ttflush(); ! 30: extern int ttclose(); ! 31: extern int vt52move(); ! 32: extern int vt52eeol(); ! 33: extern int vt52eeop(); ! 34: extern int vt52beep(); ! 35: extern int vt52open(); ! 36: extern int vt52stand(); ! 37: ! 38: /* ! 39: * Dispatch table. All the ! 40: * hard fields just point into the ! 41: * terminal I/O code. ! 42: */ ! 43: TERM term = { ! 44: NROW-1, ! 45: NCOL, ! 46: vt52open, ! 47: ttclose, ! 48: ttgetc, ! 49: ttputc, ! 50: ttflush, ! 51: vt52move, ! 52: vt52eeol, ! 53: vt52eeop, ! 54: vt52beep, ! 55: vt52stand ! 56: }; ! 57: ! 58: vt52move(row, col) ! 59: { ! 60: ttputc(ESC); ! 61: ttputc('Y'); ! 62: ttputc(row+BIAS); ! 63: ttputc(col+BIAS); ! 64: } ! 65: ! 66: vt52eeol() ! 67: { ! 68: ttputc(ESC); ! 69: ttputc('K'); ! 70: } ! 71: ! 72: vt52eeop() ! 73: { ! 74: ttputc(ESC); ! 75: ttputc('J'); ! 76: } ! 77: ! 78: vt52beep() ! 79: { ! 80: #ifdef BEL ! 81: ttputc(BEL); ! 82: ttflush(); ! 83: #endif ! 84: } ! 85: ! 86: vt52stand(f) /* Set/clear standout mode... */ ! 87: { /* Real VT52 doesn't have it. */ ! 88: ttputc(ESC); ! 89: ttputc((f == 0) ? 'q' : 'p'); /* Set or clear reverse video */ ! 90: } ! 91: ! 92: vt52open() ! 93: { ! 94: #if V7 ! 95: register uchar *cp; ! 96: char *getenv(); ! 97: ! 98: if ((cp = getenv("TERM")) == NULL) { ! 99: puts("Shell variable TERM not defined!"); ! 100: exit(1); ! 101: } ! 102: if (strcmp(cp, "vt52") != 0 && strcmp(cp, "z19") != 0) { ! 103: puts("Terminal type not 'vt52'or 'z19' !"); ! 104: exit(1); ! 105: } ! 106: #endif ! 107: ttopen(); ! 108: } ! 109: ! 110: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.