1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

Modularise src/terminal

This commit is contained in:
Miciah Dashiel Butler Masters 2006-05-20 12:59:40 +00:00 committed by Miciah Dashiel Butler Masters
parent 337958d4e4
commit a0bcf254ae
6 changed files with 36 additions and 4 deletions

View File

@ -287,7 +287,6 @@ terminate_all_subsystems(void)
#endif #endif
free_history_lists(); free_history_lists();
done_modules(builtin_modules); done_modules(builtin_modules);
done_screen_drivers();
done_saved_session_info(); done_saved_session_info();
} }

View File

@ -28,6 +28,7 @@
#include "network/ssl/ssl.h" #include "network/ssl/ssl.h"
#include "protocol/protocol.h" #include "protocol/protocol.h"
#include "scripting/scripting.h" #include "scripting/scripting.h"
#include "terminal/terminal.h"
#include "viewer/text/search.h" #include "viewer/text/search.h"
#include "viewer/timer.h" #include "viewer/timer.h"
@ -35,6 +36,7 @@
struct module *main_modules[] = { struct module *main_modules[] = {
&document_module, &document_module,
&kbdbind_module, &kbdbind_module,
&terminal_module,
NULL /* XXX: Keep this */ NULL /* XXX: Keep this */
}; };

View File

@ -11,6 +11,7 @@
#include "config/options.h" #include "config/options.h"
#include "intl/charsets.h" #include "intl/charsets.h"
#include "main/module.h"
#include "osdep/ascii.h" #include "osdep/ascii.h"
#include "osdep/osdep.h" #include "osdep/osdep.h"
#include "terminal/color.h" #include "terminal/color.h"
@ -305,8 +306,9 @@ get_screen_driver(struct terminal *term)
return add_screen_driver(type, term, len); return add_screen_driver(type, term, len);
} }
/* Release private screen drawing utilities. */
void void
done_screen_drivers(void) done_screen_drivers(struct module *xxx)
{ {
free_list(active_screen_drivers); free_list(active_screen_drivers);
} }
@ -776,3 +778,13 @@ done_screen(struct terminal_screen *screen)
mem_free_if(screen->image); mem_free_if(screen->image);
mem_free(screen); 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
);

View File

@ -2,6 +2,7 @@
#define EL__TERMINAL_SCREEN_H #define EL__TERMINAL_SCREEN_H
struct module;
struct screen_char; struct screen_char;
struct terminal; struct terminal;
@ -49,7 +50,6 @@ void erase_screen(struct terminal *term);
/* Meeep! */ /* Meeep! */
void beep_terminal(struct terminal *term); void beep_terminal(struct terminal *term);
/* Release private screen drawing utilities. */ extern struct module terminal_screen_module;
void done_screen_drivers(void);
#endif #endif

View File

@ -17,6 +17,7 @@
#include "config/options.h" #include "config/options.h"
#include "intl/gettext/libintl.h" #include "intl/gettext/libintl.h"
#include "main/main.h" #include "main/main.h"
#include "main/module.h"
#include "main/object.h" #include "main/object.h"
#include "main/select.h" #include "main/select.h"
#include "osdep/osdep.h" #include "osdep/osdep.h"
@ -370,3 +371,18 @@ attach_terminal(int in, int out, int ctl, void *info, int len)
return term; 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
);

View File

@ -5,6 +5,7 @@
#include "terminal/event.h" #include "terminal/event.h"
#include "util/lists.h" #include "util/lists.h"
struct module;
struct option; struct option;
struct terminal_screen; struct terminal_screen;
struct terminal_interlink; struct terminal_interlink;
@ -178,4 +179,6 @@ int check_terminal_pipes(void);
void close_terminal_pipes(void); void close_terminal_pipes(void);
struct terminal *attach_terminal(int in, int out, int ctl, void *info, int len); struct terminal *attach_terminal(int in, int out, int ctl, void *info, int len);
extern struct module terminal_module;
#endif /* EL__TERMINAL_TERMINAL_H */ #endif /* EL__TERMINAL_TERMINAL_H */