4 * Copyright (c) Tuomo Valkonen 1999-2001.
5 * See the included file LICENSE for details.
8 #ifndef INCLUDED_MODULES_H
9 #define INCLUDED_MODULES_H
15 extern bool load_module(const char *name
);
16 extern void call_hooks(const char *hook
);
17 extern void call_hooks_p(const char *hook
, void *p
);
18 extern void unload_modules();
20 extern void *miter_begin(const char *sym
);
21 extern void *miter_next(const char *sym
);
22 extern void miter_end();
25 typedef bool AltHookB();
26 typedef void *AltHookP();
29 #define FOR_ALL_SYMBOLS(VAR, TYPE, SYM) \
30 for(VAR=(TYPE)miter_begin(SYM); \
32 VAR=(TYPE)miter_next(SYM))
35 #define CALL_HOOKS(HOOK) call_hooks(#HOOK)
36 #define CALL_HOOKS_P(HOOK, P) call_hooks_p(#HOOK, P)
39 #define CALL_HOOKS_ARG(NAME, ARGS) \
41 Hook *hook_tmp_do_not_use; \
42 FOR_ALL_SYMBOLS(hook_tmp_do_not_use, Hook*, #NAME){ \
43 althook_tmp_do_not_use ARGS; \
49 #define CALL_ALT_B_ARG(VAR, NAME, ARGS) \
51 AltHookB *althook_tmp_do_not_use; \
53 FOR_ALL_SYMBOLS(althook_tmp_do_not_use, AltHookB*, #NAME "_alt"){ \
54 VAR=althook_tmp_do_not_use ARGS; \
64 #define CALL_ALT_P_ARG(VAR, NAME, ARGS) \
66 AltHookP *althook_tmp_do_not_use; \
68 FOR_ALL_SYMBOLS(althook_tmp_do_not_use, AltHookP*, #NAME "_alt"){ \
69 VAR=althook_tmp_do_not_use ARGS; \
78 #endif /* INCLUDED_MODULES_H */