forgotten commit. disabled until egl is adapted.
[AROS-Contrib.git] / fish / microemacs / vt52.c
blobcb45598a74a36f1f0b19fd655418874733a8e9a2
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"
13 #if VT52
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 */
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();
33 * Dispatch table. All the
34 * hard fields just point into the
35 * terminal I/O code.
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
51 vt52move(row, col)
53 ttputc(ESC);
54 ttputc('Y');
55 ttputc(row+BIAS);
56 ttputc(col+BIAS);
59 vt52eeol()
61 ttputc(ESC);
62 ttputc('K');
65 vt52eeop()
67 ttputc(ESC);
68 ttputc('J');
71 vt52beep()
73 #ifdef BEL
74 ttputc(BEL);
75 ttflush();
76 #endif
79 #endif
81 int vt52open(void)
83 #if V7
84 register char *cp;
85 char *getenv();
87 if ((cp = getenv("TERM")) == NULL) {
88 puts("Shell variable TERM not defined!");
89 exit(1);
91 if (strcmp(cp, "vt52") != 0 && strcmp(cp, "z19") != 0) {
92 puts("Terminal type not 'vt52'or 'z19' !");
93 exit(1);
95 #endif
96 return ttopen();