diff options
Diffstat (limited to 'src/internal')
-rw-r--r-- | src/internal/ptycon_bridge_impl.h | 55 | ||||
-rw-r--r-- | src/internal/ptycon_driver_impl.h | 6 |
2 files changed, 56 insertions, 5 deletions
diff --git a/src/internal/ptycon_bridge_impl.h b/src/internal/ptycon_bridge_impl.h new file mode 100644 index 0000000..b70497e --- /dev/null +++ b/src/internal/ptycon_bridge_impl.h @@ -0,0 +1,55 @@ +#ifndef PTYCON_BRIDGE_IMPL_H +#define PTYCON_BRIDGE_IMPL_H + +#include <psxtypes/psxtypes.h> + +enum ptyc_ctrl_state { + PTYC_CTRL_STATE_ESI, + PTYC_CTRL_STATE_PARAM_HANDLERS, + PTYC_CTRL_STATE_COMMAND_HANDLERS, + PTYC_CTRL_STATE_CAP +}; + +#define PTYC_BUFFER_ELEMENTS 0x8000 +#define PTYC_CTRL_PARAMS 0x20 + +#define PTYC_ESI_ARRAY_SIZE 0x5F +#define PTYC_CSI_ARRAY_SIZE 0x6F +#define PTYC_SGR_ARRAY_SIZE 0x6D + + +struct ptyc_term_data { + unsigned char in [PTYC_BUFFER_ELEMENTS]; + wchar16_t out [PTYC_BUFFER_ELEMENTS]; + wchar16_t screen [PTYC_BUFFER_ELEMENTS]; +}; + +struct ptyc_term_ctx; + +typedef void * __fastcall ptyc_term_handler (struct ptyc_term_ctx *); + +struct ptyc_term_ctx { + void * hin; + void * hout; + wchar16_t * wch_pty; + wchar16_t * wch_con; + unsigned char * ctrl; + uint32_t ctrl_cap; + uint32_t * ctrl_mark; + uint32_t ctrl_state; + uint32_t * ctrl_param; + uint32_t ctrl_params[PTYC_CTRL_PARAMS]; + ptyc_term_handler * handler; + ptyc_term_handler * char_handler; + ptyc_term_handler * ctrl_handler; + ptyc_term_handler * const * ctrl_handlers[PTYC_CTRL_STATE_CAP]; + ptyc_term_handler * ctrl_command; + struct ptyc_term_data data; +}; + +extern ptyc_term_handler * const ptyc_esi_handlers[]; +extern ptyc_term_handler * const ptyc_cmd_handlers[]; +extern ptyc_term_handler * const ptyc_csi_handlers[]; +extern ptyc_term_handler * const ptyc_sgr_handlers[]; + +#endif diff --git a/src/internal/ptycon_driver_impl.h b/src/internal/ptycon_driver_impl.h index 22b4409..13a2e35 100644 --- a/src/internal/ptycon_driver_impl.h +++ b/src/internal/ptycon_driver_impl.h @@ -9,6 +9,7 @@ #include <stdio.h> #include <ptycon/ptycon.h> +#include "ptycon_bridge_impl.h" #include "argv/argv.h" extern const struct argv_option ptyc_default_options[]; @@ -28,11 +29,6 @@ enum app_tags { TAG_WAIT, }; -struct ptyc_term_ctx { - void * hin; - void * hout; -}; - struct ptyc_loop_ctx { nt_thread_params treader; nt_thread_params twriter; |