40,36 → 40,28 |
#include <libadt/hash_table.h> |
|
enum { |
GSP_END = -1, /**< Terminates a sequence. */ |
GSP_DEFAULT = -2 /**< Wildcard, catches unhandled cases. */ |
GSP_END = -1, |
GSP_DEFAULT = -2 |
}; |
|
/** Scancode parser description */ |
typedef struct { |
/** Transition table, (state, input) -> (state, output) */ |
/** Transition table, (state, input) -> (state, output). */ |
hash_table_t trans; |
|
/** Number of states */ |
/** Current number of states. */ |
int states; |
} gsp_t; |
|
/** Scancode parser transition. */ |
typedef struct { |
link_t link; /**< Link to hash table in @c gsp_t */ |
link_t link; |
|
/* Preconditions */ |
int old_state; |
int input; |
|
int old_state; /**< State before transition */ |
int input; /**< Input symbol (scancode) */ |
int new_state; |
|
/* Effects */ |
|
int new_state; /**< State after transition */ |
|
/* Output emitted during transition */ |
|
unsigned out_mods; /**< Modifier to emit */ |
unsigned out_key; /**< Keycode to emit */ |
unsigned out_mods; |
unsigned out_key; |
} gsp_trans_t; |
|
extern void gsp_init(gsp_t *); |
77,8 → 69,10 |
extern int gsp_insert_seq(gsp_t *, const int *, unsigned, unsigned); |
extern int gsp_step(gsp_t *, int, int, unsigned *, unsigned *); |
|
|
#endif |
|
/** |
* @} |
*/ |
|