Blame src/internal/ptycon_bridge_impl.h

f26f14
#ifndef PTYCON_BRIDGE_IMPL_H
f26f14
#define PTYCON_BRIDGE_IMPL_H
f26f14
f26f14
#include <psxtypes/psxtypes.h>
029664
#include <ntcon/ntcon.h>
f26f14
f26f14
enum ptyc_ctrl_state {
f26f14
	PTYC_CTRL_STATE_ESI,
f26f14
	PTYC_CTRL_STATE_PARAM_HANDLERS,
f26f14
	PTYC_CTRL_STATE_COMMAND_HANDLERS,
f26f14
	PTYC_CTRL_STATE_CAP
f26f14
};
f26f14
f26f14
#define PTYC_BUFFER_ELEMENTS	0x8000
029664
#define PTYC_RAW_EVENTS		0x400
f26f14
#define PTYC_CTRL_PARAMS	0x20
f26f14
f26f14
#define PTYC_ESI_ARRAY_SIZE	0x5F
f26f14
#define PTYC_CSI_ARRAY_SIZE	0x6F
f26f14
#define PTYC_SGR_ARRAY_SIZE	0x6D
f26f14
f26f14
f26f14
struct ptyc_term_data {
640ed3
	uintptr_t	in	[PTYC_BUFFER_ELEMENTS/sizeof(uintptr_t)];
f26f14
	wchar16_t	out	[PTYC_BUFFER_ELEMENTS];
f26f14
	wchar16_t	screen	[PTYC_BUFFER_ELEMENTS];
f26f14
};
f26f14
029664
struct ptyc_term_input {
029664
	nt_input_record	events	[PTYC_RAW_EVENTS];
029664
	unsigned char	stream	[PTYC_RAW_EVENTS*4];
029664
};
029664
92a510
struct ptyc_vkcode {
92a510
	const unsigned char const *	mbstr;
92a510
	uint16_t			mblen;
92a510
};
92a510
f26f14
struct ptyc_term_ctx;
f26f14
f26f14
typedef void * __fastcall ptyc_term_handler (struct ptyc_term_ctx *);
f26f14
f26f14
struct ptyc_term_ctx {
f26f14
	void *				hin;
f26f14
	void *				hout;
f26f14
	wchar16_t *			wch_pty;
f26f14
	wchar16_t *			wch_con;
f26f14
	unsigned char *			ctrl;
f26f14
	uint32_t			ctrl_cap;
f26f14
	uint32_t *			ctrl_mark;
f26f14
	uint32_t			ctrl_state;
f26f14
	uint32_t *			ctrl_param;
f26f14
	uint32_t			ctrl_params[PTYC_CTRL_PARAMS];
f26f14
	ptyc_term_handler *		handler;
f26f14
	ptyc_term_handler *		char_handler;
f26f14
	ptyc_term_handler *		ctrl_handler;
f26f14
	ptyc_term_handler * const *	ctrl_handlers[PTYC_CTRL_STATE_CAP];
f26f14
	ptyc_term_handler *		ctrl_command;
79c2fe
	uint64_t			drvflags;
e4c2ac
	uint16_t			foreground;
e4c2ac
	uint16_t			background;
f7f963
	nt_coord			screen_size;
f7f963
	nt_coord			window_size;
e73fb6
	nt_console_screen_buffer_info	screen_info;
62462a
	nt_console_cursor_info		cursor_info;
f26f14
	struct ptyc_term_data		data;
029664
	struct ptyc_term_input		input;
f26f14
};
f26f14
f26f14
extern ptyc_term_handler * const ptyc_esi_handlers[];
f26f14
extern ptyc_term_handler * const ptyc_cmd_handlers[];
f26f14
extern ptyc_term_handler * const ptyc_csi_handlers[];
f26f14
extern ptyc_term_handler * const ptyc_sgr_handlers[];
f26f14
f26f14
#endif