-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstates.cpp
More file actions
169 lines (152 loc) · 6.85 KB
/
states.cpp
File metadata and controls
169 lines (152 loc) · 6.85 KB
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
// Copyright Timothy Miller, 1999
#include "gterm.hpp"
// state machine transition tables
StateOption GTerm::normal_state[] = {
{0007 , >erm::bell , normal_state},
{0010 , >erm::bs , normal_state},
{0011 , >erm::tab , normal_state},
{0012 , >erm::lf , normal_state},
{0013 , >erm::lf , normal_state},
//0014, >erm::ff , normal_state},
{0014 , >erm::lf , normal_state},
{0015 , >erm::cr , normal_state},
{0016 , >erm::charset_g1 , normal_state},
{0017 , >erm::charset_g0 , normal_state},
{0033 , 0 , esc_state },
{-1 , >erm::normal_input, normal_state}
};
StateOption GTerm::esc_state[] = {
{'[', >erm::clear_param , bracket_state },
//{']', >erm::clear_param , nonstd_state },
{'>', >erm::keypad_numeric , normal_state },
{'=', >erm::keypad_application, normal_state },
{'7', >erm::save_cursor , normal_state },
{'8', >erm::restore_cursor , normal_state },
{'H', >erm::set_tab , normal_state },
{'D', >erm::index_down , normal_state },
{'M', >erm::index_up , normal_state },
{'T', >erm::index_up , normal_state }, //FreeBSD cons25 ???
{'E', >erm::next_line , normal_state },
{'c', >erm::reset , normal_state },
{'(', 0 , cset_shiftin_state },
{')', 0 , cset_shiftout_state},
{'#', 0 , hash_state },
{0007 , >erm::bell , esc_state},
{0010 , >erm::bs , esc_state},
{0011 , >erm::tab , esc_state},
{0012 , >erm::lf , esc_state},
{0013 , >erm::lf , esc_state},
//{0014, >erm::ff , esc_state},
{0014 , >erm::lf , esc_state},
{0015 , >erm::cr , esc_state},
{-1, 0 , normal_state}
};
StateOption GTerm::bracket_state[] = {
{'?', >erm::set_q_mode , q_bracket_state },
{'"', >erm::set_quote_mode , bracket_state }, //???
{'0', >erm::param_digit , bracket_state },
{'1', >erm::param_digit , bracket_state },
{'2', >erm::param_digit , bracket_state },
{'3', >erm::param_digit , bracket_state },
{'4', >erm::param_digit , bracket_state },
{'5', >erm::param_digit , bracket_state },
{'6', >erm::param_digit , bracket_state },
{'7', >erm::param_digit , bracket_state },
{'8', >erm::param_digit , bracket_state },
{'9', >erm::param_digit , bracket_state },
{';', >erm::next_param , bracket_state },
{'D', >erm::cursor_left , normal_state },
{'B', >erm::cursor_down , normal_state },
//{'e', >erm::cursor_down , normal_state },//just added
{'C', >erm::cursor_right , normal_state },//just added
//{'a', >erm::cursor_right , normal_state },
{'A', >erm::cursor_up , normal_state },
{'H', >erm::cursor_position, normal_state },
{'f', >erm::cursor_position, normal_state },
{'d', >erm::cursor_ypos , normal_state }, //???
{'c', >erm::device_attrib , normal_state },
{'P', >erm::delete_char , normal_state },
{'h', >erm::set_mode , normal_state },
{'l', >erm::clear_mode , normal_state },
{'s', >erm::save_cursor , normal_state },
{'u', >erm::restore_cursor , normal_state },
{'x', >erm::request_param , normal_state },
{'r', >erm::set_margins , normal_state },
{'M', >erm::delete_line , normal_state },
{'n', >erm::status_report , normal_state },
{'J', >erm::erase_display , normal_state },
{'K', >erm::erase_line , normal_state },
{'L', >erm::insert_line , normal_state },
{'m', >erm::set_colors , normal_state },
{'g', >erm::clear_tab , normal_state },
{'@', >erm::insert_char , normal_state },
{'X', >erm::erase_char , normal_state },
{'p', 0 , normal_state }, // something to do with levels,???
//cursor control char inside CSI
{0007 , >erm::bell , bracket_state},
{0010 , >erm::bs , bracket_state},
{0011 , >erm::tab , bracket_state},
{0012 , >erm::lf , bracket_state},
{0013 , >erm::lf , bracket_state},
//{0014, >erm::ff , bracket_state},
{0014 , >erm::lf , bracket_state},
{0015 , >erm::cr , bracket_state},
{-1 , 0 , normal_state }
};
// Should put cursor control characters in these groups as well.
// Maybe later.
StateOption GTerm::q_bracket_state[] = {
{'0', >erm::param_digit , q_bracket_state },
{'1', >erm::param_digit , q_bracket_state },
{'2', >erm::param_digit , q_bracket_state },
{'3', >erm::param_digit , q_bracket_state },
{'4', >erm::param_digit , q_bracket_state },
{'5', >erm::param_digit , q_bracket_state },
{'6', >erm::param_digit , q_bracket_state },
{'7', >erm::param_digit , q_bracket_state },
{'8', >erm::param_digit , q_bracket_state },
{'9', >erm::param_digit , q_bracket_state },
{';', >erm::next_param , q_bracket_state },
{'h', >erm::set_mode , normal_state },
{'l', >erm::clear_mode , normal_state },
{-1 , 0 , normal_state}
};
StateOption GTerm::cset_shiftin_state[] = {
{'A', >erm::cset_g0_a, normal_state},
{'B', >erm::cset_g0_b, normal_state},
{'0', >erm::cset_g0_0, normal_state},
{'1', >erm::cset_g0_1, normal_state},
{'2', >erm::cset_g0_2, normal_state},
{-1 , 0, normal_state},
};
StateOption GTerm::cset_shiftout_state[] = {
{'A', >erm::cset_g1_a, normal_state},
{'B', >erm::cset_g1_b, normal_state},
{'0', >erm::cset_g1_0, normal_state},
{'1', >erm::cset_g1_1, normal_state},
{'2', >erm::cset_g1_2, normal_state},
{-1 , 0, normal_state},
};
//???
StateOption GTerm::hash_state[] = {
{'3', 0 , normal_state },
{'4', 0 , normal_state },
{'5', 0 , normal_state },
{'6', 0 , normal_state },
{'8', >erm::screen_align, normal_state },
{-1 , 0 , normal_state}
};
StateOption GTerm::nonstd_state[] = {
{'0', >erm::param_digit , nonstd_state },
{'1', >erm::param_digit , nonstd_state },
{'2', >erm::param_digit , nonstd_state },
{'3', >erm::param_digit , nonstd_state },
{'4', >erm::param_digit , nonstd_state },
{'5', >erm::param_digit , nonstd_state },
{'6', >erm::param_digit , nonstd_state },
{'7', >erm::param_digit , nonstd_state },
{'8', >erm::param_digit , nonstd_state },
{'9', >erm::param_digit , nonstd_state },
{';', >erm::next_param , normal_state },
{-1, 0, normal_state}
};