move around - flatter.
[profile/ivi/evas.git] / src / lib / file / evas_module.h
1 #ifndef _EVAS_MODULE_H
2 #define _EVAS_MODULE_H
3
4
5 /* the module api version */
6 #define EVAS_MODULE_API_VERSION 1
7
8
9 /* the module types */
10 typedef enum _Evas_Module_Type
11 {
12    EVAS_MODULE_TYPE_ENGINE,
13    EVAS_MODULE_TYPE_IMAGE_LOADER,
14    EVAS_MODULE_TYPE_IMAGE_SAVER,
15      EVAS_MODULE_TYPE_OBJECT
16 } Evas_Module_Type;
17
18
19 typedef struct _Evas_Module_Api    Evas_Module_Api;
20 typedef struct _Evas_Module        Evas_Module;
21 typedef struct _Evas_Module_Path   Evas_Module_Path;
22 typedef struct _Evas_Module_Engine Evas_Module_Engine;
23
24 /* the module api structure, all modules should define this struct */
25 struct _Evas_Module_Api
26 {
27    int                  version;
28    Evas_Module_Type     type;
29    const char           *name;
30    const char           *author;
31 };
32
33 /* the module structure */
34 struct _Evas_Module
35 {
36    Evas_Module_Api      *api;
37    void                 *handle;        /* the dlopen handle */
38    char                 *path;          /* the path where this modules is */
39    char                 *name;          /* the name of the dir where this module is */
40    struct
41      {
42         int (*open)(Evas_Module *);
43         void (*close)(Evas_Module *);
44      } func;
45    void         *functions;     /* this are the functions exported by the module */
46    void         *data;          /* some internal data for the module i.e the id for engines */
47
48    Evas_Module_Type     type;           /* the type detected by the path */
49
50    int           ref; /* how many refs */
51    int           last_used; /* the cycle count when it was last used */
52
53    unsigned char        loaded : 1;
54 };
55
56
57 /* the internals of the module api use this struct to reference a path with a module type
58  * instead of deduce the type from the path.
59  * */
60 struct _Evas_Module_Path
61 {
62    Evas_Module_Type     type;
63    char                *path;
64 };
65
66 struct _Evas_Module_Engine
67 {
68    int                  id;
69 };
70
71 void         evas_module_paths_init (void);
72 void         evas_module_init       (void);
73 Evas_Module *evas_module_find_type  (Evas_Module_Type type, const char *name);
74 int          evas_module_load       (Evas_Module *em);
75 void         evas_module_unload     (Evas_Module *em);
76 void         evas_module_ref        (Evas_Module *em);
77 void         evas_module_unref      (Evas_Module *em);
78 void         evas_module_use        (Evas_Module *em);
79 void         evas_module_clean      (void);
80 void         evas_module_shutdown   (void);
81
82
83 #endif /* _EVAS_MODULE_H */