995
|
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 "ueed.h"
|
|
12
|
|
13 #ifdef VT52
|
|
14
|
|
15 #define NROW 24 /* Screen size. */
|
|
16 #define NCOL 80 /* Edit if you want to. */
|
|
17 #define BIAS 0x20 /* Origin 0 coordinate bias. */
|
|
18 #define ESC 0x1B /* ESC character. */
|
|
19 #define BEL 0x07 /* ascii bell character */
|
|
20
|
|
21 extern int ttopen(); /* Forward references. */
|
|
22 extern int ttgetc();
|
|
23 extern int ttputc();
|
|
24 extern int ttflush();
|
|
25 extern int ttclose();
|
|
26 extern int vt52move();
|
|
27 extern int vt52eeol();
|
|
28 extern int vt52eeop();
|
|
29 extern int vt52beep();
|
|
30 extern int vt52open();
|
|
31
|
|
32 /*
|
|
33 * Dispatch table. All the
|
|
34 * hard fields just point into the
|
|
35 * terminal I/O code.
|
|
36 */
|
|
37 TERM term = {
|
|
38 NROW-1,
|
|
39 NCOL,
|
|
40 vt52open,
|
|
41 ttclose,
|
|
42 ttgetc,
|
|
43 ttputc,
|
|
44 ttflush,
|
|
45 vt52move,
|
|
46 vt52eeol,
|
|
47 vt52eeop,
|
|
48 vt52beep
|
|
49 };
|
|
50
|
|
51 vt52move(row, col)
|
|
52 {
|
|
53 ttputc(ESC);
|
|
54 ttputc('Y');
|
|
55 ttputc(row+BIAS);
|
|
56 ttputc(col+BIAS);
|
|
57 }
|
|
58
|
|
59 vt52eeol()
|
|
60 {
|
|
61 ttputc(ESC);
|
|
62 ttputc('K');
|
|
63 }
|
|
64
|
|
65 vt52eeop()
|
|
66 {
|
|
67 ttputc(ESC);
|
|
68 ttputc('J');
|
|
69 }
|
|
70
|
|
71 vt52beep()
|
|
72 {
|
|
73 #ifdef BEL
|
|
74 ttputc(BEL);
|
|
75 ttflush();
|
|
76 #endif
|
|
77 }
|
|
78
|
|
79 #endif
|
|
80
|
|
81 vt52open()
|
|
82 {
|
|
83 #ifdef V7
|
|
84 register char *cp;
|
|
85 char *getenv();
|
|
86
|
|
87 if ((cp = getenv("TERM")) == NULL) {
|
|
88 puts("Shell variable TERM not defined!");
|
|
89 exit(1);
|
|
90 }
|
|
91 if (strcmp(cp, "vt52") != 0 && strcmp(cp, "z19") != 0) {
|
|
92 puts("Terminal type not 'vt52'or 'z19' !");
|
|
93 exit(1);
|
|
94 }
|
|
95 #endif
|
|
96 ttopen();
|
|
97 }
|
|
98
|
|
99
|