Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(310)

Side by Side Diff: third_party/libteken/teken/teken_state.h

Issue 1127823002: Add libteken (from FreeBSD) to third_party. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: removed unused stuff Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/libteken/teken/teken_scs.h ('k') | third_party/libteken/teken/teken_subr.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /* Generated file. Do not edit. */
2
3 static teken_state_t teken_state_2;
4 static teken_state_t teken_state_6;
5 static teken_state_t teken_state_1;
6 static teken_state_t teken_state_7;
7 static teken_state_t teken_state_8;
8 static teken_state_t teken_state_3;
9 static teken_state_t teken_state_5;
10 static teken_state_t teken_state_4;
11
12 /* '' */
13 static void
14 teken_state_init(teken_t *t, teken_char_t c)
15 {
16
17 switch (c) {
18 case '\x1B':
19 teken_state_switch(t, teken_state_1);
20 return;
21 default:
22 teken_subr_regular_character(t, c);
23 break;
24 }
25 }
26
27 /* '^[[' */
28 static void
29 teken_state_2(teken_t *t, teken_char_t c)
30 {
31
32 if (teken_state_numbers(t, c))
33 return;
34
35 switch (c) {
36 case 'X': /* ECH: Erase character */
37 teken_subr_erase_character(t, (t->t_curnum < 1 || t->t_nums[0] = = 0) ? 1 : t->t_nums[0]);
38 break;
39 case 'Z': /* CBT: Cursor Backward Tabulation */
40 teken_subr_cursor_backward_tabulation(t, (t->t_curnum < 1 || t-> t_nums[0] == 0) ? 1 : t->t_nums[0]);
41 break;
42 case '`': /* HPA: Horizontal Position Absolute */
43 teken_subr_horizontal_position_absolute(t, (t->t_curnum < 1 || t ->t_nums[0] == 0) ? 1 : t->t_nums[0]);
44 break;
45 case 'a': /* CUF: Cursor Forward */
46 teken_subr_cursor_forward(t, (t->t_curnum < 1 || t->t_nums[0] == 0) ? 1 : t->t_nums[0]);
47 break;
48 case 'c': /* DA1: Primary Device Attributes */
49 teken_subr_primary_device_attributes(t, t->t_curnum < 1 ? 0 : t- >t_nums[0]);
50 break;
51 case 'd': /* VPA: Vertical Position Absolute */
52 teken_subr_vertical_position_absolute(t, (t->t_curnum < 1 || t-> t_nums[0] == 0) ? 1 : t->t_nums[0]);
53 break;
54 case 'e': /* CUD: Cursor Down */
55 teken_subr_cursor_down(t, (t->t_curnum < 1 || t->t_nums[0] == 0) ? 1 : t->t_nums[0]);
56 break;
57 case 'f': /* CUP: Cursor Position */
58 teken_subr_cursor_position(t, (t->t_curnum < 1 || t->t_nums[0] = = 0) ? 1 : t->t_nums[0], (t->t_curnum < 2 || t->t_nums[1] == 0) ? 1 : t->t_nums[ 1]);
59 break;
60 case 'g': /* TBC: Tab Clear */
61 teken_subr_tab_clear(t, t->t_curnum < 1 ? 0 : t->t_nums[0]);
62 break;
63 case 'h': /* SM: Set Mode */
64 teken_subr_set_mode(t, t->t_curnum < 1 ? 0 : t->t_nums[0]);
65 break;
66 case 'l': /* RM: Reset Mode */
67 teken_subr_reset_mode(t, t->t_curnum < 1 ? 0 : t->t_nums[0]);
68 break;
69 case 'm': /* SGR: Set Graphic Rendition */
70 teken_subr_set_graphic_rendition(t, t->t_curnum, t->t_nums);
71 break;
72 case 'n': /* CPR: Cursor Position Report */
73 teken_subr_cursor_position_report(t, t->t_curnum < 1 ? 0 : t->t_ nums[0]);
74 break;
75 case 'r': /* DECSTBM: Set top and bottom margins */
76 teken_subr_set_top_and_bottom_margins(t, t->t_curnum < 1 ? 0 : t ->t_nums[0], t->t_curnum < 2 ? 0 : t->t_nums[1]);
77 break;
78 case 's': /* DECSC: Save cursor */
79 teken_subr_save_cursor(t);
80 break;
81 case 'u': /* DECRC: Restore cursor */
82 teken_subr_restore_cursor(t);
83 break;
84 case 'x': /* C25SGR: Cons25 set graphic rendition */
85 teken_subr_cons25_set_graphic_rendition(t, t->t_curnum < 1 ? 0 : t->t_nums[0], t->t_curnum < 2 ? 0 : t->t_nums[1]);
86 break;
87 case 'z': /* C25VTSW: Cons25 switch virtual terminal */
88 teken_subr_cons25_switch_virtual_terminal(t, t->t_curnum < 1 ? 0 : t->t_nums[0]);
89 break;
90 case '@': /* ICH: Insert character */
91 teken_subr_insert_character(t, (t->t_curnum < 1 || t->t_nums[0] == 0) ? 1 : t->t_nums[0]);
92 break;
93 case 'A': /* CUU: Cursor Up */
94 teken_subr_cursor_up(t, (t->t_curnum < 1 || t->t_nums[0] == 0) ? 1 : t->t_nums[0]);
95 break;
96 case 'B': /* CUD: Cursor Down */
97 teken_subr_cursor_down(t, (t->t_curnum < 1 || t->t_nums[0] == 0) ? 1 : t->t_nums[0]);
98 break;
99 case 'C': /* CUF: Cursor Forward */
100 teken_subr_cursor_forward(t, (t->t_curnum < 1 || t->t_nums[0] == 0) ? 1 : t->t_nums[0]);
101 break;
102 case 'D': /* CUB: Cursor Backward */
103 teken_subr_cursor_backward(t, (t->t_curnum < 1 || t->t_nums[0] = = 0) ? 1 : t->t_nums[0]);
104 break;
105 case 'E': /* CNL: Cursor Next Line */
106 teken_subr_cursor_next_line(t, (t->t_curnum < 1 || t->t_nums[0] == 0) ? 1 : t->t_nums[0]);
107 break;
108 case 'F': /* CPL: Cursor Previous Line */
109 teken_subr_cursor_previous_line(t, (t->t_curnum < 1 || t->t_nums [0] == 0) ? 1 : t->t_nums[0]);
110 break;
111 case 'G': /* HPA: Horizontal Position Absolute */
112 teken_subr_horizontal_position_absolute(t, (t->t_curnum < 1 || t ->t_nums[0] == 0) ? 1 : t->t_nums[0]);
113 break;
114 case 'H': /* CUP: Cursor Position */
115 teken_subr_cursor_position(t, (t->t_curnum < 1 || t->t_nums[0] = = 0) ? 1 : t->t_nums[0], (t->t_curnum < 2 || t->t_nums[1] == 0) ? 1 : t->t_nums[ 1]);
116 break;
117 case 'I': /* CHT: Cursor Forward Tabulation */
118 teken_subr_cursor_forward_tabulation(t, (t->t_curnum < 1 || t->t _nums[0] == 0) ? 1 : t->t_nums[0]);
119 break;
120 case 'J': /* ED: Erase display */
121 teken_subr_erase_display(t, t->t_curnum < 1 ? 0 : t->t_nums[0]);
122 break;
123 case 'K': /* EL: Erase line */
124 teken_subr_erase_line(t, t->t_curnum < 1 ? 0 : t->t_nums[0]);
125 break;
126 case 'L': /* IL: Insert line */
127 teken_subr_insert_line(t, (t->t_curnum < 1 || t->t_nums[0] == 0) ? 1 : t->t_nums[0]);
128 break;
129 case 'M': /* DL: Delete line */
130 teken_subr_delete_line(t, (t->t_curnum < 1 || t->t_nums[0] == 0) ? 1 : t->t_nums[0]);
131 break;
132 case 'P': /* DC: Delete character */
133 teken_subr_delete_character(t, (t->t_curnum < 1 || t->t_nums[0] == 0) ? 1 : t->t_nums[0]);
134 break;
135 case 'S': /* SU: Pan Down */
136 teken_subr_pan_down(t, (t->t_curnum < 1 || t->t_nums[0] == 0) ? 1 : t->t_nums[0]);
137 break;
138 case 'T': /* SD: Pan Up */
139 teken_subr_pan_up(t, (t->t_curnum < 1 || t->t_nums[0] == 0) ? 1 : t->t_nums[0]);
140 break;
141 case '=':
142 teken_state_switch(t, teken_state_8);
143 return;
144 case '>':
145 teken_state_switch(t, teken_state_3);
146 return;
147 case '?':
148 teken_state_switch(t, teken_state_5);
149 return;
150 default:
151 teken_printf("Unsupported sequence in teken_state_2: %u\n", (uns igned int)c);
152 break;
153 }
154
155 teken_state_switch(t, teken_state_init);
156 }
157
158 /* '^[(' */
159 static void
160 teken_state_6(teken_t *t, teken_char_t c)
161 {
162
163 switch (c) {
164 case '0': /* G0SCS0: G0 SCS Special Graphics */
165 teken_subr_g0_scs_special_graphics(t);
166 break;
167 case '1': /* G0SCS1: G0 SCS US ASCII */
168 teken_subr_g0_scs_us_ascii(t);
169 break;
170 case '2': /* G0SCS2: G0 SCS Special Graphics */
171 teken_subr_g0_scs_special_graphics(t);
172 break;
173 case 'A': /* G0SCSA: G0 SCS UK National */
174 teken_subr_g0_scs_uk_national(t);
175 break;
176 case 'B': /* G0SCSB: G0 SCS US ASCII */
177 teken_subr_g0_scs_us_ascii(t);
178 break;
179 default:
180 teken_printf("Unsupported sequence in teken_state_6: %u\n", (uns igned int)c);
181 break;
182 }
183
184 teken_state_switch(t, teken_state_init);
185 }
186
187 /* '^[' */
188 static void
189 teken_state_1(teken_t *t, teken_char_t c)
190 {
191
192 switch (c) {
193 case '7': /* DECSC: Save cursor */
194 teken_subr_save_cursor(t);
195 break;
196 case '8': /* DECRC: Restore cursor */
197 teken_subr_restore_cursor(t);
198 break;
199 case '=': /* DECKPAM: Keypad application mode */
200 teken_subr_keypad_application_mode(t);
201 break;
202 case '>': /* DECKPNM: Keypad numeric mode */
203 teken_subr_keypad_numeric_mode(t);
204 break;
205 case 'D': /* IND: Index */
206 teken_subr_index(t);
207 break;
208 case 'E': /* NEL: Next line */
209 teken_subr_next_line(t);
210 break;
211 case 'H': /* HTS: Horizontal Tab Set */
212 teken_subr_horizontal_tab_set(t);
213 break;
214 case 'M': /* RI: Reverse index */
215 teken_subr_reverse_index(t);
216 break;
217 case 'P': /* DCS: Device Control String */
218 teken_subr_device_control_string(t);
219 break;
220 case ']': /* OSC: Operating System Command */
221 teken_subr_operating_system_command(t);
222 break;
223 case 'c': /* RIS: Reset to Initial State */
224 teken_subr_reset_to_initial_state(t);
225 break;
226 case '\\': /* ST: String Terminator */
227 teken_subr_string_terminator(t);
228 break;
229 case '[':
230 teken_state_switch(t, teken_state_2);
231 return;
232 case '(':
233 teken_state_switch(t, teken_state_6);
234 return;
235 case ')':
236 teken_state_switch(t, teken_state_7);
237 return;
238 case '#':
239 teken_state_switch(t, teken_state_4);
240 return;
241 default:
242 teken_printf("Unsupported sequence in teken_state_1: %u\n", (uns igned int)c);
243 break;
244 }
245
246 teken_state_switch(t, teken_state_init);
247 }
248
249 /* '^[)' */
250 static void
251 teken_state_7(teken_t *t, teken_char_t c)
252 {
253
254 switch (c) {
255 case '0': /* G1SCS0: G1 SCS Special Graphics */
256 teken_subr_g1_scs_special_graphics(t);
257 break;
258 case '1': /* G1SCS1: G1 SCS US ASCII */
259 teken_subr_g1_scs_us_ascii(t);
260 break;
261 case '2': /* G1SCS2: G1 SCS Special Graphics */
262 teken_subr_g1_scs_special_graphics(t);
263 break;
264 case 'A': /* G1SCSA: G1 SCS UK National */
265 teken_subr_g1_scs_uk_national(t);
266 break;
267 case 'B': /* G1SCSB: G1 SCS US ASCII */
268 teken_subr_g1_scs_us_ascii(t);
269 break;
270 default:
271 teken_printf("Unsupported sequence in teken_state_7: %u\n", (uns igned int)c);
272 break;
273 }
274
275 teken_state_switch(t, teken_state_init);
276 }
277
278 /* '^[[=' */
279 static void
280 teken_state_8(teken_t *t, teken_char_t c)
281 {
282
283 if (teken_state_numbers(t, c))
284 return;
285
286 switch (c) {
287 case 'B': /* C25BLPD: Cons25 set bell pitch duration */
288 teken_subr_cons25_set_bell_pitch_duration(t, t->t_curnum < 1 ? 0 : t->t_nums[0], t->t_curnum < 2 ? 0 : t->t_nums[1]);
289 break;
290 case 'F': /* C25ADFG: Cons25 set adapter foreground */
291 teken_subr_cons25_set_adapter_foreground(t, t->t_curnum < 1 ? 0 : t->t_nums[0]);
292 break;
293 case 'G': /* C25ADBG: Cons25 set adapter background */
294 teken_subr_cons25_set_adapter_background(t, t->t_curnum < 1 ? 0 : t->t_nums[0]);
295 break;
296 case 'S': /* C25CURS: Cons25 set cursor type */
297 teken_subr_cons25_set_cursor_type(t, t->t_curnum < 1 ? 0 : t->t_ nums[0]);
298 break;
299 case 'T': /* C25MODE: Cons25 set terminal mode */
300 teken_subr_cons25_set_terminal_mode(t, t->t_curnum < 1 ? 0 : t-> t_nums[0]);
301 break;
302 default:
303 teken_printf("Unsupported sequence in teken_state_8: %u\n", (uns igned int)c);
304 break;
305 }
306
307 teken_state_switch(t, teken_state_init);
308 }
309
310 /* '^[[>' */
311 static void
312 teken_state_3(teken_t *t, teken_char_t c)
313 {
314
315 if (teken_state_numbers(t, c))
316 return;
317
318 switch (c) {
319 case 'c': /* DA2: Secondary Device Attributes */
320 teken_subr_secondary_device_attributes(t, t->t_curnum < 1 ? 0 : t->t_nums[0]);
321 break;
322 default:
323 teken_printf("Unsupported sequence in teken_state_3: %u\n", (uns igned int)c);
324 break;
325 }
326
327 teken_state_switch(t, teken_state_init);
328 }
329
330 /* '^[[?' */
331 static void
332 teken_state_5(teken_t *t, teken_char_t c)
333 {
334
335 if (teken_state_numbers(t, c))
336 return;
337
338 switch (c) {
339 case 'h': /* DECSM: Set DEC mode */
340 teken_subr_set_dec_mode(t, t->t_curnum < 1 ? 0 : t->t_nums[0]);
341 break;
342 case 'l': /* DECRM: Reset DEC mode */
343 teken_subr_reset_dec_mode(t, t->t_curnum < 1 ? 0 : t->t_nums[0]) ;
344 break;
345 case 'n': /* DSR: Device Status Report */
346 teken_subr_device_status_report(t, t->t_curnum < 1 ? 0 : t->t_nu ms[0]);
347 break;
348 default:
349 teken_printf("Unsupported sequence in teken_state_5: %u\n", (uns igned int)c);
350 break;
351 }
352
353 teken_state_switch(t, teken_state_init);
354 }
355
356 /* '^[#' */
357 static void
358 teken_state_4(teken_t *t, teken_char_t c)
359 {
360
361 switch (c) {
362 case '3': /* DECDHL: Double Height Double Width Line Top */
363 teken_subr_double_height_double_width_line_top(t);
364 break;
365 case '4': /* DECDHL: Double Height Double Width Line Bottom */
366 teken_subr_double_height_double_width_line_bottom(t);
367 break;
368 case '5': /* DECSWL: Single Height Single Width Line */
369 teken_subr_single_height_single_width_line(t);
370 break;
371 case '6': /* DECDWL: Single Height Double Width Line */
372 teken_subr_single_height_double_width_line(t);
373 break;
374 case '8': /* DECALN: Alignment test */
375 teken_subr_alignment_test(t);
376 break;
377 default:
378 teken_printf("Unsupported sequence in teken_state_4: %u\n", (uns igned int)c);
379 break;
380 }
381
382 teken_state_switch(t, teken_state_init);
383 }
OLDNEW
« no previous file with comments | « third_party/libteken/teken/teken_scs.h ('k') | third_party/libteken/teken/teken_subr.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698