2 * Copyright Droids Corporation (2007)
3 * Olivier MATZ <zer0@droids-corp.org>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 * Revision : $Id: vt100.h,v 1.1.2.2 2009-04-07 20:01:16 zer0 Exp $
27 #define vt100_bell "\007"
28 #define vt100_bs "\010"
29 #define vt100_bs_clear "\010 \010"
30 #define vt100_tab "\011"
31 #define vt100_crnl "\012\015"
32 #define vt100_clear_right "\033[0K"
33 #define vt100_clear_left "\033[1K"
34 #define vt100_clear_down "\033[0J"
35 #define vt100_clear_up "\033[1J"
36 #define vt100_clear_line "\033[2K"
37 #define vt100_clear_screen "\033[2J"
38 #define vt100_up_arr "\033\133\101"
39 #define vt100_down_arr "\033\133\102"
40 #define vt100_right_arr "\033\133\103"
41 #define vt100_left_arr "\033\133\104"
42 #define vt100_multi_right "\033\133%uC"
43 #define vt100_multi_left "\033\133%uD"
44 #define vt100_suppr "\033\133\063\176"
45 #define vt100_home "\033M\033E"
46 #define vt100_word_left "\033\142"
47 #define vt100_word_right "\033\146"
50 /* Result of parsing : it must be synchronized with vt100_commands[]
53 #define KEY_DOWN_ARR 1
54 #define KEY_RIGHT_ARR 2
55 #define KEY_LEFT_ARR 3
69 #define KEY_RETURN2 17
70 #define KEY_META_BKSPACE 18
75 extern const char * const PROGMEM vt100_commands[];
77 enum vt100_parser_state {
83 #define VT100_BUF_SIZE 8
86 char buf[VT100_BUF_SIZE];
87 enum vt100_parser_state state;
93 void vt100_init(struct vt100 *vt);
96 * Input a new character.
97 * Return -1 if the character is not part of a control sequence
98 * Return -2 if c is not the last char of a control sequence
99 * Else return the index in vt100_commands[]
101 int8_t vt100_parser(struct vt100 *vt, char c);