summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCedric Bail <cedric.bail@samsung.com>2013-10-01 16:38:01 +0900
committerCedric Bail <cedric.bail@samsung.com>2013-10-01 16:38:44 +0900
commit83eaf14f32e3fb804b97906af6e0af70303bf24b (patch)
tree160a2c7d50249a7a9a7495c2a18cb2410e64c54c /src
parentbb84a01f7ce9d04b8d9ea9e14f8480f44b8449e1 (diff)
evas: make Evas_Loader.h a real public API.
Diffstat (limited to 'src')
-rw-r--r--src/lib/evas/Evas_Common.h11
-rw-r--r--src/lib/evas/Evas_Loader.h78
-rw-r--r--src/lib/evas/file/evas_module.h68
3 files changed, 77 insertions, 80 deletions
diff --git a/src/lib/evas/Evas_Common.h b/src/lib/evas/Evas_Common.h
index 77f65bd4d6..0c2d9b3655 100644
--- a/src/lib/evas/Evas_Common.h
+++ b/src/lib/evas/Evas_Common.h
@@ -400,17 +400,6 @@ typedef struct _Evas_Event_Key_Up Evas_Event_Key_Up; /**< Event structure
400typedef struct _Evas_Event_Hold Evas_Event_Hold; /**< Event structure for #EVAS_CALLBACK_HOLD event callbacks */ 400typedef struct _Evas_Event_Hold Evas_Event_Hold; /**< Event structure for #EVAS_CALLBACK_HOLD event callbacks */
401typedef struct _Evas_Event_Render_Post Evas_Event_Render_Post; /**< Event structure that may come with #EVAS_CALLBACK_RENDER_POST event callbacks @since 1.8 */ 401typedef struct _Evas_Event_Render_Post Evas_Event_Render_Post; /**< Event structure that may come with #EVAS_CALLBACK_RENDER_POST event callbacks @since 1.8 */
402 402
403typedef enum _Evas_Load_Error
404{
405 EVAS_LOAD_ERROR_NONE = 0, /**< No error on load */
406 EVAS_LOAD_ERROR_GENERIC = 1, /**< A non-specific error occurred */
407 EVAS_LOAD_ERROR_DOES_NOT_EXIST = 2, /**< File (or file path) does not exist */
408 EVAS_LOAD_ERROR_PERMISSION_DENIED = 3, /**< Permission denied to an existing file (or path) */
409 EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED = 4, /**< Allocation of resources failure prevented load */
410 EVAS_LOAD_ERROR_CORRUPT_FILE = 5, /**< File corrupt (but was detected as a known format) */
411 EVAS_LOAD_ERROR_UNKNOWN_FORMAT = 6 /**< File is not a known format */
412} Evas_Load_Error; /**< Evas image load error codes one can get - see evas_load_error_str() too. */
413
414typedef enum _Evas_Alloc_Error 403typedef enum _Evas_Alloc_Error
415{ 404{
416 EVAS_ALLOC_ERROR_NONE = 0, /**< No allocation error */ 405 EVAS_ALLOC_ERROR_NONE = 0, /**< No allocation error */
diff --git a/src/lib/evas/Evas_Loader.h b/src/lib/evas/Evas_Loader.h
index c0965655b6..258f92ad39 100644
--- a/src/lib/evas/Evas_Loader.h
+++ b/src/lib/evas/Evas_Loader.h
@@ -1,13 +1,72 @@
1#ifndef _EVAS_LOADER_H 1#ifndef _EVAS_LOADER_H
2#define _EVAS_LOADER_H 2#define _EVAS_LOADER_H
3 3
4#include "eina_stringshare.h" 4#include "Eina.h"
5
6/* the module api version */
7#define EVAS_MODULE_API_VERSION 2
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
18typedef struct _Evas_Module_Api Evas_Module_Api;
19typedef struct _Evas_Module Evas_Module;
20typedef struct _Evas_Module_Path Evas_Module_Path;
21typedef struct _Evas_Module_Engine Evas_Module_Engine;
22typedef struct _Evas_Module_Public Evas_Module_Public;
23
24/* the module api structure, all modules should define this struct */
25struct _Evas_Module_Api
26{
27 int version;
28 const char *name;
29 const char *author;
30
31 struct
32 {
33 int (*open)(Evas_Module *);
34 void (*close)(Evas_Module *);
35 } func;
36};
37
38/* the module structure */
39struct _Evas_Module
40{
41 const Evas_Module_Api *definition;
42
43 void *functions; /* this are the functions exported by the module */
44 int id_engine; /* some internal data for the module i.e the id for engines */
45
46 int ref; /* how many refs */
47 int last_used; /* the cycle count when it was last used */
48
49 Eina_Lock lock;
50
51 unsigned char loaded : 1;
52};
5 53
6typedef struct _Evas_Image_Load_Opts Evas_Image_Load_Opts; 54typedef struct _Evas_Image_Load_Opts Evas_Image_Load_Opts;
7typedef struct _Evas_Image_Animated Evas_Image_Animated; 55typedef struct _Evas_Image_Animated Evas_Image_Animated;
8typedef struct _Evas_Image_Property Evas_Image_Property; 56typedef struct _Evas_Image_Property Evas_Image_Property;
9typedef struct _Evas_Image_Load_Func Evas_Image_Load_Func; 57typedef struct _Evas_Image_Load_Func Evas_Image_Load_Func;
10 58
59typedef enum _Evas_Load_Error
60{
61 EVAS_LOAD_ERROR_NONE = 0, /**< No error on load */
62 EVAS_LOAD_ERROR_GENERIC = 1, /**< A non-specific error occurred */
63 EVAS_LOAD_ERROR_DOES_NOT_EXIST = 2, /**< File (or file path) does not exist */
64 EVAS_LOAD_ERROR_PERMISSION_DENIED = 3, /**< Permission denied to an existing file (or path) */
65 EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED = 4, /**< Allocation of resources failure prevented load */
66 EVAS_LOAD_ERROR_CORRUPT_FILE = 5, /**< File corrupt (but was detected as a known format) */
67 EVAS_LOAD_ERROR_UNKNOWN_FORMAT = 6 /**< File is not a known format */
68} Evas_Load_Error; /**< Evas image load error codes one can get - see evas_load_error_str() too. */
69
11typedef enum _Evas_Image_Animated_Loop_Hint 70typedef enum _Evas_Image_Animated_Loop_Hint
12{ 71{
13 EVAS_IMAGE_ANIMATED_HINT_NONE = 0, 72 EVAS_IMAGE_ANIMATED_HINT_NONE = 0,
@@ -88,4 +147,21 @@ struct _Evas_Image_Load_Func
88 Eina_Bool do_region; 147 Eina_Bool do_region;
89}; 148};
90 149
150EAPI Eina_Bool evas_module_register (const Evas_Module_Api *module, Evas_Module_Type type);
151EAPI Eina_Bool evas_module_unregister (const Evas_Module_Api *module, Evas_Module_Type type);
152
153#define EVAS_MODULE_DEFINE(Type, Tn, Name) \
154 Eina_Bool evas_##Tn##_##Name##_init(void) \
155 { \
156 return evas_module_register(&evas_modapi, Type); \
157 } \
158 void evas_##Tn##_##Name##_shutdown(void) \
159 { \
160 evas_module_unregister(&evas_modapi, Type); \
161 }
162
163#define EVAS_EINA_MODULE_DEFINE(Tn, Name) \
164 EINA_MODULE_INIT(evas_##Tn##_##Name##_init); \
165 EINA_MODULE_SHUTDOWN(evas_##Tn##_##Name##_shutdown);
166
91#endif 167#endif
diff --git a/src/lib/evas/file/evas_module.h b/src/lib/evas/file/evas_module.h
index 8699b6bcb6..c3ea5331ff 100644
--- a/src/lib/evas/file/evas_module.h
+++ b/src/lib/evas/file/evas_module.h
@@ -1,58 +1,6 @@
1#ifndef _EVAS_MODULE_H 1#ifndef _EVAS_MODULE_H
2#define _EVAS_MODULE_H 2#define _EVAS_MODULE_H
3 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 4/* 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. 5 * instead of deduce the type from the path.
58 * */ 6 * */
@@ -74,21 +22,5 @@ void evas_module_unref (Evas_Module *em);
74void evas_module_use (Evas_Module *em); 22void evas_module_use (Evas_Module *em);
75void evas_module_clean (void); 23void evas_module_clean (void);
76void evas_module_shutdown (void); 24void 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 25
94#endif /* _EVAS_MODULE_H */ 26#endif /* _EVAS_MODULE_H */