OSDN Git Service

First commitment for the BlackTank LPC1769.
[blacktank/blacktank.git] / vtparse_table.h
1 /**
2  * @file vtparse_table.h
3  * @brief VTParse
4  * @details
5  * An implementation of Paul Williams' DEC compatible state machine parser
6  * This code is in the public domain.
7  * @author Joshua Haberman <joshua@reverberate.org>
8  */
9
10 #ifndef VTPARSE_TABLE_H
11 #define VTPARSE_TABLE_H
12
13 typedef enum {
14    VTPARSE_STATE_ANYWHERE = 0,
15    VTPARSE_STATE_CSI_ENTRY = 1,
16    VTPARSE_STATE_CSI_IGNORE = 2,
17    VTPARSE_STATE_CSI_INTERMEDIATE = 3,
18    VTPARSE_STATE_CSI_PARAM = 4,
19    VTPARSE_STATE_DCS_ENTRY = 5,
20    VTPARSE_STATE_DCS_IGNORE = 6,
21    VTPARSE_STATE_DCS_INTERMEDIATE = 7,
22    VTPARSE_STATE_DCS_PARAM = 8,
23    VTPARSE_STATE_DCS_PASSTHROUGH = 9,
24    VTPARSE_STATE_ESCAPE = 10,
25    VTPARSE_STATE_ESCAPE_INTERMEDIATE = 11,
26    VTPARSE_STATE_GROUND = 12,
27    VTPARSE_STATE_OSC_STRING = 13,
28    VTPARSE_STATE_SOS_PM_APC_STRING = 14,
29 } vtparse_state_t;
30
31 typedef enum {
32    VTPARSE_ACTION_CLEAR = 1,
33    VTPARSE_ACTION_COLLECT = 2,
34    VTPARSE_ACTION_CSI_DISPATCH = 3,
35    VTPARSE_ACTION_ESC_DISPATCH = 4,
36    VTPARSE_ACTION_EXECUTE = 5,
37    VTPARSE_ACTION_HOOK = 6,
38    VTPARSE_ACTION_IGNORE = 7,
39    VTPARSE_ACTION_OSC_END = 8,
40    VTPARSE_ACTION_OSC_PUT = 9,
41    VTPARSE_ACTION_OSC_START = 10,
42    VTPARSE_ACTION_PARAM = 11,
43    VTPARSE_ACTION_PRINT = 12,
44    VTPARSE_ACTION_PUT = 13,
45    VTPARSE_ACTION_UNHOOK = 14,
46 } vtparse_action_t;
47
48 typedef unsigned char state_change_t;
49
50 state_change_t GET_STATE_TABLE(const int state, const int ch);
51 vtparse_action_t GET_ENTRY_ACTIONS(const int state);
52 vtparse_action_t GET_EXIT_ACTIONS(const int state);
53 const char *GET_ACTION_NAMES(const int n);
54 const char *GET_STATE_NAMES(const int n);
55
56 #endif
57