1 /* General module system functionality */
9 #include "config/options.h"
10 #include "main/module.h"
15 #include "bfu/dialog.h"
16 #include "bookmarks/bookmarks.h"
17 #include "config/timer.h"
18 #include "config/urlhist.h"
19 #include "cookies/cookies.h"
20 #include "dialogs/exmode.h"
21 #include "document/css/css.h"
22 #include "document/document.h"
23 #include "ecmascript/ecmascript.h"
24 #include "formhist/formhist.h"
25 #include "globhist/globhist.h"
26 #include "mime/mime.h"
27 #include "network/ssl/ssl.h"
28 #include "protocol/protocol.h"
29 #include "scripting/scripting.h"
30 #include "viewer/text/search.h"
31 #include "viewer/timer.h"
34 struct module
*main_modules
[] = {
36 NULL
/* XXX: Keep this */
39 /* This is also used for version string composing so keep NULL terminated */
40 struct module
*builtin_modules
[] = {
41 &periodic_saving_module
,
54 #ifdef CONFIG_BOOKMARKS
60 #ifdef CONFIG_ECMASCRIPT
63 #ifdef CONFIG_FORMHIST
64 &forms_history_module
,
66 #ifdef CONFIG_GLOBHIST
67 &global_history_module
,
69 #ifdef CONFIG_SCRIPTING
75 &goto_url_history_module
,
76 &search_history_module
,
80 /* Interface for handling single modules. */
83 register_module_options(struct module
*module
)
85 struct module
*submodule
;
88 if (module
->options
) register_options(module
->options
, config_options
);
90 foreach_module (submodule
, module
->submodules
, i
) {
91 register_module_options(submodule
);
96 unregister_module_options(struct module
*module
)
98 struct module
*submodule
;
101 /* First knock out the submodules if any. */
102 foreachback_module (submodule
, module
->submodules
, i
)
103 unregister_module_options(submodule
);
105 if (module
->options
) unregister_options(module
->options
, config_options
);
109 init_module(struct module
*module
)
111 struct module
*submodule
;
114 if (module
->init
) module
->init(module
);
115 if (module
->hooks
) register_event_hooks(module
->hooks
);
117 foreach_module (submodule
, module
->submodules
, i
) {
118 init_module(submodule
);
123 done_module(struct module
*module
)
125 struct module
*submodule
;
128 /* First knock out the submodules if any. */
129 foreachback_module (submodule
, module
->submodules
, i
)
130 done_module(submodule
);
132 if (module
->hooks
) unregister_event_hooks(module
->hooks
);
133 if (module
->done
) module
->done(module
);
136 /* Interface for handling builtin modules. */
139 register_modules_options(struct module
*modules
[])
141 struct module
*module
;
144 foreach_module (module
, modules
, i
) {
145 register_module_options(module
);
150 unregister_modules_options(struct module
*modules
[])
152 struct module
*module
;
155 /* Cleanups backward to initialization. */
156 foreachback_module (module
, modules
, i
)
157 unregister_module_options(module
);
160 /* TODO: We probably need to have two builtin module tables one for critical
161 * modules that should always be used and one for optional (the ones controlled
162 * by init_b in main.c */
165 init_modules(struct module
*modules
[])
167 struct module
*module
;
170 foreach_module (module
, modules
, i
) {
176 done_modules(struct module
*modules
[])
178 struct module
*module
;
181 /* Cleanups backward to initialization. */
182 foreachback_module (module
, modules
, i
)