aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/evas/src/lib/file/evas_module.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--libraries/evas/src/lib/file/evas_module.h94
1 files changed, 94 insertions, 0 deletions
diff --git a/libraries/evas/src/lib/file/evas_module.h b/libraries/evas/src/lib/file/evas_module.h
new file mode 100644
index 0000000..8699b6b
--- /dev/null
+++ b/libraries/evas/src/lib/file/evas_module.h
@@ -0,0 +1,94 @@
1#ifndef _EVAS_MODULE_H
2#define _EVAS_MODULE_H
3
4
5/* the module api version */
6#define EVAS_MODULE_API_VERSION 2
7
8
9/* the module types */
10typedef enum _Evas_Module_Type
11{
12 EVAS_MODULE_TYPE_ENGINE = 0,
13 EVAS_MODULE_TYPE_IMAGE_LOADER = 1,
14 EVAS_MODULE_TYPE_IMAGE_SAVER = 2,
15 EVAS_MODULE_TYPE_OBJECT = 3
16} Evas_Module_Type;
17
18
19typedef struct _Evas_Module_Api Evas_Module_Api;
20typedef struct _Evas_Module Evas_Module;
21typedef struct _Evas_Module_Path Evas_Module_Path;
22typedef struct _Evas_Module_Engine Evas_Module_Engine;
23typedef struct _Evas_Module_Public Evas_Module_Public;
24
25/* the module api structure, all modules should define this struct */
26struct _Evas_Module_Api
27{
28 int version;
29 const char *name;
30 const char *author;
31
32 struct
33 {
34 int (*open)(Evas_Module *);
35 void (*close)(Evas_Module *);
36 } func;
37};
38
39/* the module structure */
40struct _Evas_Module
41{
42 const Evas_Module_Api *definition;
43
44 void *functions; /* this are the functions exported by the module */
45 int id_engine; /* some internal data for the module i.e the id for engines */
46
47 int ref; /* how many refs */
48 int last_used; /* the cycle count when it was last used */
49
50 LK(lock);
51
52 unsigned char loaded : 1;
53};
54
55
56/* the internals of the module api use this struct to reference a path with a module type
57 * instead of deduce the type from the path.
58 * */
59struct _Evas_Module_Path
60{
61 Evas_Module_Type type;
62 char *path;
63};
64
65void evas_module_paths_init (void);
66void evas_module_init (void);
67Evas_Module *evas_module_find_type (Evas_Module_Type type, const char *name);
68Evas_Module *evas_module_engine_get(int render_method);
69void evas_module_foreach_image_loader(Eina_Hash_Foreach cb, const void *fdata);
70int evas_module_load (Evas_Module *em);
71void evas_module_unload (Evas_Module *em);
72void evas_module_ref (Evas_Module *em);
73void evas_module_unref (Evas_Module *em);
74void evas_module_use (Evas_Module *em);
75void evas_module_clean (void);
76void evas_module_shutdown (void);
77EAPI Eina_Bool evas_module_register (const Evas_Module_Api *module, Evas_Module_Type type);
78EAPI Eina_Bool evas_module_unregister (const Evas_Module_Api *module, Evas_Module_Type type);
79
80#define EVAS_MODULE_DEFINE(Type, Tn, Name) \
81 Eina_Bool evas_##Tn##_##Name##_init(void) \
82 { \
83 return evas_module_register(&evas_modapi, Type); \
84 } \
85 void evas_##Tn##_##Name##_shutdown(void) \
86 { \
87 evas_module_unregister(&evas_modapi, Type); \
88 }
89
90#define EVAS_EINA_MODULE_DEFINE(Tn, Name) \
91 EINA_MODULE_INIT(evas_##Tn##_##Name##_init); \
92 EINA_MODULE_SHUTDOWN(evas_##Tn##_##Name##_shutdown);
93
94#endif /* _EVAS_MODULE_H */