Rev 4061 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4061 | Rev 4113 | ||
---|---|---|---|
Line 38... | Line 38... | ||
38 | #define KBD_GSP_H_ |
38 | #define KBD_GSP_H_ |
39 | 39 | ||
40 | #include <libadt/hash_table.h> |
40 | #include <libadt/hash_table.h> |
41 | 41 | ||
42 | enum { |
42 | enum { |
43 | GSP_END = -1, |
43 | GSP_END = -1, /**< Terminates a sequence. */ |
44 | GSP_DEFAULT = -2 |
44 | GSP_DEFAULT = -2 /**< Wildcard, catches unhandled cases. */ |
45 | }; |
45 | }; |
46 | 46 | ||
- | 47 | /** Scancode parser description */ |
|
47 | typedef struct { |
48 | typedef struct { |
48 | /** Transition table, (state, input) -> (state, output). */ |
49 | /** Transition table, (state, input) -> (state, output) */ |
49 | hash_table_t trans; |
50 | hash_table_t trans; |
50 | 51 | ||
51 | /** Current number of states. */ |
52 | /** Number of states */ |
52 | int states; |
53 | int states; |
53 | } gsp_t; |
54 | } gsp_t; |
54 | 55 | ||
- | 56 | /** Scancode parser transition. */ |
|
55 | typedef struct { |
57 | typedef struct { |
56 | link_t link; |
58 | link_t link; /**< Link to hash table in @c gsp_t */ |
57 | 59 | ||
58 | int old_state; |
60 | /* Preconditions */ |
59 | int input; |
- | |
60 | 61 | ||
61 | int new_state; |
62 | int old_state; /**< State before transition */ |
- | 63 | int input; /**< Input symbol (scancode) */ |
|
62 | 64 | ||
- | 65 | /* Effects */ |
|
- | 66 | ||
- | 67 | int new_state; /**< State after transition */ |
|
- | 68 | ||
- | 69 | /* Output emitted during transition */ |
|
- | 70 | ||
63 | unsigned out_mods; |
71 | unsigned out_mods; /**< Modifier to emit */ |
64 | unsigned out_key; |
72 | unsigned out_key; /**< Keycode to emit */ |
65 | } gsp_trans_t; |
73 | } gsp_trans_t; |
66 | 74 | ||
67 | extern void gsp_init(gsp_t *); |
75 | extern void gsp_init(gsp_t *); |
68 | extern int gsp_insert_defs(gsp_t *, const int *); |
76 | extern int gsp_insert_defs(gsp_t *, const int *); |
69 | extern int gsp_insert_seq(gsp_t *, const int *, unsigned, unsigned); |
77 | extern int gsp_insert_seq(gsp_t *, const int *, unsigned, unsigned); |
70 | extern int gsp_step(gsp_t *, int, int, unsigned *, unsigned *); |
78 | extern int gsp_step(gsp_t *, int, int, unsigned *, unsigned *); |
71 | 79 | ||
72 | - | ||
73 | #endif |
80 | #endif |
74 | 81 | ||
75 | /** |
82 | /** |
76 | * @} |
83 | * @} |
77 | */ |
84 | */ |
78 | - |