diff options
author | Mattias Andrée <m@maandree.se> | 2025-02-19 23:06:02 +0100 |
---|---|---|
committer | Mattias Andrée <m@maandree.se> | 2025-02-19 23:06:02 +0100 |
commit | 24ebd3c309c5d6cad63bbf1b40de8c17aead0366 (patch) | |
tree | 7deab3ddadf241ccfaefc31e65916b6036689285 /common.h | |
parent | Add tests for new escape sequences (diff) | |
download | libterminput-24ebd3c309c5d6cad63bbf1b40de8c17aead0366.tar.gz libterminput-24ebd3c309c5d6cad63bbf1b40de8c17aead0366.tar.bz2 libterminput-24ebd3c309c5d6cad63bbf1b40de8c17aead0366.tar.xz |
Add state marshalling and unmarshalling functions
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to '')
-rw-r--r-- | common.h | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -17,6 +17,19 @@ /** + * Mark that there is no input available or pending + * + * @param INPUT_OUT:union libterminput_input *input The input output + */ +#define NOTHING(INPUT_OUT)\ + do {\ + union libterminput_input *input__ = (INPUT_OUT);\ + input__->type = LIBTERMINPUT_NONE;\ + input__->keypress.key = LIBTERMINPUT_SYMBOL;\ + } while (0); + + +/** * Singlar read symbol */ struct input { @@ -130,5 +143,15 @@ HIDDEN void libterminput_parse_sequence__(union libterminput_input *input, struc */ HIDDEN int libterminput_read_symbol__(int fd, struct input *input, struct libterminput_state *ctx); +/* TODO doc, test */ +HIDDEN int libterminput_marshal_keypress__(struct libterminput_marshaller *how, const struct libterminput_keypress *what); +HIDDEN int libterminput_marshal_text__(struct libterminput_marshaller *how, const struct libterminput_text *what); +HIDDEN int libterminput_marshal_mouseevent__(struct libterminput_marshaller *how, const struct libterminput_mouseevent *what); +HIDDEN int libterminput_marshal_position__(struct libterminput_marshaller *how, const struct libterminput_position *what); +HIDDEN int libterminput_unmarshal_keypress__(struct libterminput_unmarshaller *how, struct libterminput_keypress *what); +HIDDEN int libterminput_unmarshal_text__(struct libterminput_unmarshaller *how, struct libterminput_text *what); +HIDDEN int libterminput_unmarshal_mouseevent__(struct libterminput_unmarshaller *how, struct libterminput_mouseevent *what); +HIDDEN int libterminput_unmarshal_position__(struct libterminput_unmarshaller *how, struct libterminput_position *what); + #undef HIDDEN |