forked from enlightenment/efl
evas: make Evas_Loader.h a real public API.
This commit is contained in:
parent
bb84a01f7c
commit
83eaf14f32
|
@ -400,17 +400,6 @@ typedef struct _Evas_Event_Key_Up Evas_Event_Key_Up; /**< Event structure
|
||||||
typedef struct _Evas_Event_Hold Evas_Event_Hold; /**< Event structure for #EVAS_CALLBACK_HOLD event callbacks */
|
typedef struct _Evas_Event_Hold Evas_Event_Hold; /**< Event structure for #EVAS_CALLBACK_HOLD event callbacks */
|
||||||
typedef struct _Evas_Event_Render_Post Evas_Event_Render_Post; /**< Event structure that may come with #EVAS_CALLBACK_RENDER_POST event callbacks @since 1.8 */
|
typedef struct _Evas_Event_Render_Post Evas_Event_Render_Post; /**< Event structure that may come with #EVAS_CALLBACK_RENDER_POST event callbacks @since 1.8 */
|
||||||
|
|
||||||
typedef enum _Evas_Load_Error
|
|
||||||
{
|
|
||||||
EVAS_LOAD_ERROR_NONE = 0, /**< No error on load */
|
|
||||||
EVAS_LOAD_ERROR_GENERIC = 1, /**< A non-specific error occurred */
|
|
||||||
EVAS_LOAD_ERROR_DOES_NOT_EXIST = 2, /**< File (or file path) does not exist */
|
|
||||||
EVAS_LOAD_ERROR_PERMISSION_DENIED = 3, /**< Permission denied to an existing file (or path) */
|
|
||||||
EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED = 4, /**< Allocation of resources failure prevented load */
|
|
||||||
EVAS_LOAD_ERROR_CORRUPT_FILE = 5, /**< File corrupt (but was detected as a known format) */
|
|
||||||
EVAS_LOAD_ERROR_UNKNOWN_FORMAT = 6 /**< File is not a known format */
|
|
||||||
} Evas_Load_Error; /**< Evas image load error codes one can get - see evas_load_error_str() too. */
|
|
||||||
|
|
||||||
typedef enum _Evas_Alloc_Error
|
typedef enum _Evas_Alloc_Error
|
||||||
{
|
{
|
||||||
EVAS_ALLOC_ERROR_NONE = 0, /**< No allocation error */
|
EVAS_ALLOC_ERROR_NONE = 0, /**< No allocation error */
|
||||||
|
|
|
@ -1,13 +1,72 @@
|
||||||
#ifndef _EVAS_LOADER_H
|
#ifndef _EVAS_LOADER_H
|
||||||
#define _EVAS_LOADER_H
|
#define _EVAS_LOADER_H
|
||||||
|
|
||||||
#include "eina_stringshare.h"
|
#include "Eina.h"
|
||||||
|
|
||||||
|
/* the module api version */
|
||||||
|
#define EVAS_MODULE_API_VERSION 2
|
||||||
|
|
||||||
|
/* the module types */
|
||||||
|
typedef enum _Evas_Module_Type
|
||||||
|
{
|
||||||
|
EVAS_MODULE_TYPE_ENGINE = 0,
|
||||||
|
EVAS_MODULE_TYPE_IMAGE_LOADER = 1,
|
||||||
|
EVAS_MODULE_TYPE_IMAGE_SAVER = 2,
|
||||||
|
EVAS_MODULE_TYPE_OBJECT = 3
|
||||||
|
} Evas_Module_Type;
|
||||||
|
|
||||||
|
typedef struct _Evas_Module_Api Evas_Module_Api;
|
||||||
|
typedef struct _Evas_Module Evas_Module;
|
||||||
|
typedef struct _Evas_Module_Path Evas_Module_Path;
|
||||||
|
typedef struct _Evas_Module_Engine Evas_Module_Engine;
|
||||||
|
typedef struct _Evas_Module_Public Evas_Module_Public;
|
||||||
|
|
||||||
|
/* the module api structure, all modules should define this struct */
|
||||||
|
struct _Evas_Module_Api
|
||||||
|
{
|
||||||
|
int version;
|
||||||
|
const char *name;
|
||||||
|
const char *author;
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
int (*open)(Evas_Module *);
|
||||||
|
void (*close)(Evas_Module *);
|
||||||
|
} func;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* the module structure */
|
||||||
|
struct _Evas_Module
|
||||||
|
{
|
||||||
|
const Evas_Module_Api *definition;
|
||||||
|
|
||||||
|
void *functions; /* this are the functions exported by the module */
|
||||||
|
int id_engine; /* some internal data for the module i.e the id for engines */
|
||||||
|
|
||||||
|
int ref; /* how many refs */
|
||||||
|
int last_used; /* the cycle count when it was last used */
|
||||||
|
|
||||||
|
Eina_Lock lock;
|
||||||
|
|
||||||
|
unsigned char loaded : 1;
|
||||||
|
};
|
||||||
|
|
||||||
typedef struct _Evas_Image_Load_Opts Evas_Image_Load_Opts;
|
typedef struct _Evas_Image_Load_Opts Evas_Image_Load_Opts;
|
||||||
typedef struct _Evas_Image_Animated Evas_Image_Animated;
|
typedef struct _Evas_Image_Animated Evas_Image_Animated;
|
||||||
typedef struct _Evas_Image_Property Evas_Image_Property;
|
typedef struct _Evas_Image_Property Evas_Image_Property;
|
||||||
typedef struct _Evas_Image_Load_Func Evas_Image_Load_Func;
|
typedef struct _Evas_Image_Load_Func Evas_Image_Load_Func;
|
||||||
|
|
||||||
|
typedef enum _Evas_Load_Error
|
||||||
|
{
|
||||||
|
EVAS_LOAD_ERROR_NONE = 0, /**< No error on load */
|
||||||
|
EVAS_LOAD_ERROR_GENERIC = 1, /**< A non-specific error occurred */
|
||||||
|
EVAS_LOAD_ERROR_DOES_NOT_EXIST = 2, /**< File (or file path) does not exist */
|
||||||
|
EVAS_LOAD_ERROR_PERMISSION_DENIED = 3, /**< Permission denied to an existing file (or path) */
|
||||||
|
EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED = 4, /**< Allocation of resources failure prevented load */
|
||||||
|
EVAS_LOAD_ERROR_CORRUPT_FILE = 5, /**< File corrupt (but was detected as a known format) */
|
||||||
|
EVAS_LOAD_ERROR_UNKNOWN_FORMAT = 6 /**< File is not a known format */
|
||||||
|
} Evas_Load_Error; /**< Evas image load error codes one can get - see evas_load_error_str() too. */
|
||||||
|
|
||||||
typedef enum _Evas_Image_Animated_Loop_Hint
|
typedef enum _Evas_Image_Animated_Loop_Hint
|
||||||
{
|
{
|
||||||
EVAS_IMAGE_ANIMATED_HINT_NONE = 0,
|
EVAS_IMAGE_ANIMATED_HINT_NONE = 0,
|
||||||
|
@ -88,4 +147,21 @@ struct _Evas_Image_Load_Func
|
||||||
Eina_Bool do_region;
|
Eina_Bool do_region;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
EAPI Eina_Bool evas_module_register (const Evas_Module_Api *module, Evas_Module_Type type);
|
||||||
|
EAPI Eina_Bool evas_module_unregister (const Evas_Module_Api *module, Evas_Module_Type type);
|
||||||
|
|
||||||
|
#define EVAS_MODULE_DEFINE(Type, Tn, Name) \
|
||||||
|
Eina_Bool evas_##Tn##_##Name##_init(void) \
|
||||||
|
{ \
|
||||||
|
return evas_module_register(&evas_modapi, Type); \
|
||||||
|
} \
|
||||||
|
void evas_##Tn##_##Name##_shutdown(void) \
|
||||||
|
{ \
|
||||||
|
evas_module_unregister(&evas_modapi, Type); \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define EVAS_EINA_MODULE_DEFINE(Tn, Name) \
|
||||||
|
EINA_MODULE_INIT(evas_##Tn##_##Name##_init); \
|
||||||
|
EINA_MODULE_SHUTDOWN(evas_##Tn##_##Name##_shutdown);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,58 +1,6 @@
|
||||||
#ifndef _EVAS_MODULE_H
|
#ifndef _EVAS_MODULE_H
|
||||||
#define _EVAS_MODULE_H
|
#define _EVAS_MODULE_H
|
||||||
|
|
||||||
|
|
||||||
/* the module api version */
|
|
||||||
#define EVAS_MODULE_API_VERSION 2
|
|
||||||
|
|
||||||
|
|
||||||
/* the module types */
|
|
||||||
typedef enum _Evas_Module_Type
|
|
||||||
{
|
|
||||||
EVAS_MODULE_TYPE_ENGINE = 0,
|
|
||||||
EVAS_MODULE_TYPE_IMAGE_LOADER = 1,
|
|
||||||
EVAS_MODULE_TYPE_IMAGE_SAVER = 2,
|
|
||||||
EVAS_MODULE_TYPE_OBJECT = 3
|
|
||||||
} Evas_Module_Type;
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct _Evas_Module_Api Evas_Module_Api;
|
|
||||||
typedef struct _Evas_Module Evas_Module;
|
|
||||||
typedef struct _Evas_Module_Path Evas_Module_Path;
|
|
||||||
typedef struct _Evas_Module_Engine Evas_Module_Engine;
|
|
||||||
typedef struct _Evas_Module_Public Evas_Module_Public;
|
|
||||||
|
|
||||||
/* the module api structure, all modules should define this struct */
|
|
||||||
struct _Evas_Module_Api
|
|
||||||
{
|
|
||||||
int version;
|
|
||||||
const char *name;
|
|
||||||
const char *author;
|
|
||||||
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
int (*open)(Evas_Module *);
|
|
||||||
void (*close)(Evas_Module *);
|
|
||||||
} func;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* the module structure */
|
|
||||||
struct _Evas_Module
|
|
||||||
{
|
|
||||||
const Evas_Module_Api *definition;
|
|
||||||
|
|
||||||
void *functions; /* this are the functions exported by the module */
|
|
||||||
int id_engine; /* some internal data for the module i.e the id for engines */
|
|
||||||
|
|
||||||
int ref; /* how many refs */
|
|
||||||
int last_used; /* the cycle count when it was last used */
|
|
||||||
|
|
||||||
LK(lock);
|
|
||||||
|
|
||||||
unsigned char loaded : 1;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/* the internals of the module api use this struct to reference a path with a module type
|
/* the internals of the module api use this struct to reference a path with a module type
|
||||||
* instead of deduce the type from the path.
|
* instead of deduce the type from the path.
|
||||||
* */
|
* */
|
||||||
|
@ -74,21 +22,5 @@ void evas_module_unref (Evas_Module *em);
|
||||||
void evas_module_use (Evas_Module *em);
|
void evas_module_use (Evas_Module *em);
|
||||||
void evas_module_clean (void);
|
void evas_module_clean (void);
|
||||||
void evas_module_shutdown (void);
|
void evas_module_shutdown (void);
|
||||||
EAPI Eina_Bool evas_module_register (const Evas_Module_Api *module, Evas_Module_Type type);
|
|
||||||
EAPI Eina_Bool evas_module_unregister (const Evas_Module_Api *module, Evas_Module_Type type);
|
|
||||||
|
|
||||||
#define EVAS_MODULE_DEFINE(Type, Tn, Name) \
|
|
||||||
Eina_Bool evas_##Tn##_##Name##_init(void) \
|
|
||||||
{ \
|
|
||||||
return evas_module_register(&evas_modapi, Type); \
|
|
||||||
} \
|
|
||||||
void evas_##Tn##_##Name##_shutdown(void) \
|
|
||||||
{ \
|
|
||||||
evas_module_unregister(&evas_modapi, Type); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define EVAS_EINA_MODULE_DEFINE(Tn, Name) \
|
|
||||||
EINA_MODULE_INIT(evas_##Tn##_##Name##_init); \
|
|
||||||
EINA_MODULE_SHUTDOWN(evas_##Tn##_##Name##_shutdown);
|
|
||||||
|
|
||||||
#endif /* _EVAS_MODULE_H */
|
#endif /* _EVAS_MODULE_H */
|
||||||
|
|
Loading…
Reference in New Issue