4 #define MODULE_DATA_INIT(rec) \
5 (rec)->module_data = g_hash_table_new(g_str_hash, g_str_equal)
7 #define MODULE_DATA_DEINIT(rec) \
8 g_hash_table_destroy((rec)->module_data)
10 #define MODULE_DATA_SET(rec, data) \
11 g_hash_table_insert((rec)->module_data, MODULE_NAME, data)
13 #define MODULE_DATA(rec) \
14 g_hash_table_lookup((rec)->module_data, MODULE_NAME)
17 MODULE_ERROR_ALREADY_LOADED,
29 extern GSList *modules;
31 MODULE_REC *module_find(const char *name);
33 /* Load module - automatically tries to load also the related non-core
34 modules given in `prefixes' (like irc, fe, fe_text, ..) */
35 int module_load(const char *path, char **prefixes);
36 void module_unload(MODULE_REC *module);
38 #define MODULE_CHECK_CAST(object, cast, type_field, id) \
39 ((cast *) module_check_cast(object, offsetof(cast, type_field), id))
40 #define MODULE_CHECK_CAST_MODULE(object, cast, type_field, module, id) \
41 ((cast *) module_check_cast_module(object, \
42 offsetof(cast, type_field), module, id))
43 void *module_check_cast(void *object, int type_pos, const char *id);
44 void *module_check_cast_module(void *object, int type_pos,
45 const char *module, const char *id);
47 /* return unique number across all modules for `id' */
48 int module_get_uniq_id(const char *module, int id);
49 /* return unique number across all modules for `id'. */
50 int module_get_uniq_id_str(const char *module, const char *id);
52 /* returns the original module specific id, -1 = not found */
53 int module_find_id(const char *module, int uniqid);
54 /* returns the original module specific id, NULL = not found */
55 const char *module_find_id_str(const char *module, int uniqid);
57 /* Destroy unique IDs from `module'. This function is automatically called
58 when module is destroyed with module's name as the parameter. */
59 void module_uniq_destroy(const char *module);
61 void modules_init(void);
62 void modules_deinit(void);