From 7119092665e1b771b04b305813be81e9892dfc1b Mon Sep 17 00:00:00 2001 From: Tristan Riehs Date: Sat, 22 Jun 2024 16:19:05 +0900 Subject: Improve disp API and implement dynamic reload --- src/disp.h | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'src/disp.h') diff --git a/src/disp.h b/src/disp.h index d0b2d19..454378d 100644 --- a/src/disp.h +++ b/src/disp.h @@ -18,11 +18,19 @@ #define DISP_H #include +#include /* Available display types. */ #define DISP_CLI "cli" #define DISP_RAY "ray" +/* Reserved return values for the read_input function. */ +#ifndef NDEBUG +# define DISP_RELOAD INT_MAX +#endif +#define DISP_QUIT (INT_MAX - 1) +#define DISP_ERR (INT_MAX - 2) + struct disp { void *dl_handle; void (*init)(void); @@ -30,13 +38,19 @@ struct disp { int (*read_input)(void); void (*display_res)(bool, int); void (*destroy)(void); +#ifndef NDEBUG + char *so_path; void *(*pre_reload)(void); void (*post_reload)(void *); +#endif }; /* Get a display handler for the given display type. */ -struct disp *get_disp(char *disp_name); +struct disp *get_disp(char *); +void destroy_disp(struct disp *); -void destroy_disp(void); +#ifndef NDEBUG +void disp_reload(struct disp *); +#endif /* NDEBUG */ -#endif +#endif /* DISP_H */ -- cgit v1.2.3