diff --git a/src/main/main.c b/src/main/main.c index 5c38251b4..95e730ed1 100644 --- a/src/main/main.c +++ b/src/main/main.c @@ -287,7 +287,6 @@ terminate_all_subsystems(void) #endif free_history_lists(); done_modules(builtin_modules); - done_screen_drivers(); done_saved_session_info(); } diff --git a/src/main/module.c b/src/main/module.c index cbaf60e1a..4bee1459f 100644 --- a/src/main/module.c +++ b/src/main/module.c @@ -28,6 +28,7 @@ #include "network/ssl/ssl.h" #include "protocol/protocol.h" #include "scripting/scripting.h" +#include "terminal/terminal.h" #include "viewer/text/search.h" #include "viewer/timer.h" @@ -35,6 +36,7 @@ struct module *main_modules[] = { &document_module, &kbdbind_module, + &terminal_module, NULL /* XXX: Keep this */ }; diff --git a/src/terminal/screen.c b/src/terminal/screen.c index 1d44f5951..352dc4045 100644 --- a/src/terminal/screen.c +++ b/src/terminal/screen.c @@ -11,6 +11,7 @@ #include "config/options.h" #include "intl/charsets.h" +#include "main/module.h" #include "osdep/ascii.h" #include "osdep/osdep.h" #include "terminal/color.h" @@ -305,8 +306,9 @@ get_screen_driver(struct terminal *term) return add_screen_driver(type, term, len); } +/* Release private screen drawing utilities. */ void -done_screen_drivers(void) +done_screen_drivers(struct module *xxx) { free_list(active_screen_drivers); } @@ -776,3 +778,13 @@ done_screen(struct terminal_screen *screen) mem_free_if(screen->image); mem_free(screen); } + +struct module terminal_screen_module = struct_module( + /* name: */ "Terminal Screen", + /* options: */ NULL, + /* hooks: */ NULL, + /* submodules: */ NULL, + /* data: */ NULL, + /* init: */ NULL, + /* done: */ done_screen_drivers +); diff --git a/src/terminal/screen.h b/src/terminal/screen.h index 5608a0e38..35cd43510 100644 --- a/src/terminal/screen.h +++ b/src/terminal/screen.h @@ -2,6 +2,7 @@ #define EL__TERMINAL_SCREEN_H +struct module; struct screen_char; struct terminal; @@ -49,7 +50,6 @@ void erase_screen(struct terminal *term); /* Meeep! */ void beep_terminal(struct terminal *term); -/* Release private screen drawing utilities. */ -void done_screen_drivers(void); +extern struct module terminal_screen_module; #endif diff --git a/src/terminal/terminal.c b/src/terminal/terminal.c index 26943835e..d5aab281d 100644 --- a/src/terminal/terminal.c +++ b/src/terminal/terminal.c @@ -17,6 +17,7 @@ #include "config/options.h" #include "intl/gettext/libintl.h" #include "main/main.h" +#include "main/module.h" #include "main/object.h" #include "main/select.h" #include "osdep/osdep.h" @@ -370,3 +371,18 @@ attach_terminal(int in, int out, int ctl, void *info, int len) return term; } + +static struct module *terminal_submodules[] = { + &terminal_screen_module, + NULL +}; + +struct module terminal_module = struct_module( + /* name: */ "Terminal", + /* options: */ NULL, + /* hooks: */ NULL, + /* submodules: */ terminal_submodules, + /* data: */ NULL, + /* init: */ NULL, + /* done: */ NULL +); diff --git a/src/terminal/terminal.h b/src/terminal/terminal.h index d6a46d3dc..9570260c3 100644 --- a/src/terminal/terminal.h +++ b/src/terminal/terminal.h @@ -5,6 +5,7 @@ #include "terminal/event.h" #include "util/lists.h" +struct module; struct option; struct terminal_screen; struct terminal_interlink; @@ -178,4 +179,6 @@ int check_terminal_pipes(void); void close_terminal_pipes(void); struct terminal *attach_terminal(int in, int out, int ctl, void *info, int len); +extern struct module terminal_module; + #endif /* EL__TERMINAL_TERMINAL_H */