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/kbdbind.h"
18 #include "config/timer.h"
19 #include "config/urlhist.h"
20 #include "cookies/cookies.h"
21 #include "dialogs/exmode.h"
22 #include "document/css/css.h"
23 #include "document/document.h"
24 #include "ecmascript/ecmascript.h"
25 #include "formhist/formhist.h"
26 #include "globhist/globhist.h"
27 #include "mime/mime.h"
28 #include "network/ssl/ssl.h"
29 #include "protocol/protocol.h"
30 #include "scripting/scripting.h"
31 #include "terminal/terminal.h"
32 #include "viewer/viewer.h"
35 struct module
*main_modules
[] = {
39 NULL
/* XXX: Keep this */
42 /* This is also used for version string composing so keep NULL terminated */
43 struct module
*builtin_modules
[] = {
44 &periodic_saving_module
,
57 #ifdef CONFIG_BOOKMARKS
63 #ifdef CONFIG_ECMASCRIPT
66 #ifdef CONFIG_FORMHIST
67 &forms_history_module
,
69 #ifdef CONFIG_GLOBHIST
70 &global_history_module
,
72 #ifdef CONFIG_SCRIPTING
78 &goto_url_history_module
,
82 /* Interface for handling single modules. */
85 register_module_options(struct module
*module
)
87 struct module
*submodule
;
90 if (module
->options
) register_options(module
->options
, config_options
);
92 foreach_module (submodule
, module
->submodules
, i
) {
93 register_module_options(submodule
);
98 unregister_module_options(struct module
*module
)
100 struct module
*submodule
;
103 /* First knock out the submodules if any. */
104 foreachback_module (submodule
, module
->submodules
, i
)
105 unregister_module_options(submodule
);
107 if (module
->options
) unregister_options(module
->options
, config_options
);
111 init_module(struct module
*module
)
113 struct module
*submodule
;
116 if (module
->init
) module
->init(module
);
117 if (module
->hooks
) register_event_hooks(module
->hooks
);
119 foreach_module (submodule
, module
->submodules
, i
) {
120 init_module(submodule
);
125 done_module(struct module
*module
)
127 struct module
*submodule
;
130 /* First knock out the submodules if any. */
131 foreachback_module (submodule
, module
->submodules
, i
)
132 done_module(submodule
);
134 if (module
->hooks
) unregister_event_hooks(module
->hooks
);
135 if (module
->done
) module
->done(module
);
138 /* Interface for handling builtin modules. */
141 register_modules_options(struct module
*modules
[])
143 struct module
*module
;
146 foreach_module (module
, modules
, i
) {
147 register_module_options(module
);
152 unregister_modules_options(struct module
*modules
[])
154 struct module
*module
;
157 /* Cleanups backward to initialization. */
158 foreachback_module (module
, modules
, i
)
159 unregister_module_options(module
);
162 /* TODO: We probably need to have two builtin module tables one for critical
163 * modules that should always be used and one for optional (the ones controlled
164 * by init_b in main.c */
167 init_modules(struct module
*modules
[])
169 struct module
*module
;
172 foreach_module (module
, modules
, i
) {
178 done_modules(struct module
*modules
[])
180 struct module
*module
;
183 /* Cleanups backward to initialization. */
184 foreachback_module (module
, modules
, i
)