-
Notifications
You must be signed in to change notification settings - Fork 12
/
TrmMiniB.c
109 lines (96 loc) · 1.73 KB
/
TrmMiniB.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/* terminal control module for MiniBee's */
/* Copyright (c) 1981 James Gosling */
#include <stdio.h>
#include "display.h"
static
int curX, curY;
static
writechars (start, end)
register char *start,
*end; {
register char *p;
register int i;
while (start <= end) {
putchar (*start++);
curX++;
}
};
static
blanks (n) {
while (--n >= 0) {
putchar (' ');
curX++;
}
};
static
topos (row, column) register row, column; {
if (curY == row) {
if (curX == column)
return;
if (curX == column + 1) {
putchar (010);
goto done;
}
}
if (curY + 1 == row && (column == 1 || column==curX)) {
if(column!=curX) putchar (015);
putchar (012);
goto done;
}
if (row == 1 && column == 1) {
putchar (033);
putchar ('H');
goto done;
}
putchar (033);
putchar ('F');
putchar ((row-1) + (row-1)/10*6);
putchar ((column-1) + (column-1)/10*6);
done:
curX = column;
curY = row;
};
static
reset () {
curX = 1;
curY = 1;
printf ("\033H\033J");
};
static
null () {
};
static
wipeline () {
putchar (033);
putchar ('K');
};
static
wipescreen () {
printf("\033H\033J");
curX = curY = 1;
};
TrmMiniB () {
tt.t_INSmode = null;
tt.t_HLmode = null;
tt.t_inslines = null;
tt.t_dellines = null;
tt.t_blanks = blanks;
tt.t_init = null;
tt.t_cleanup = null;
tt.t_wipeline = wipeline;
tt.t_wipescreen = wipescreen;
tt.t_topos = topos;
tt.t_reset = reset;
tt.t_delchars = null;
tt.t_writechars = writechars;
tt.t_window = 0;
tt.t_ILmf = 0;
tt.t_ILov = MissingFeature;
tt.t_ICmf = 0;
tt.t_ICov = MissingFeature;
tt.t_DCmf = MissingFeature;
tt.t_DCov = MissingFeature;
tt.t_length = 24;
tt.t_width = 80;
tt.t_modeline = 0; /* no highlights anyway */
}