2014-02-11 05:42:59 -08:00
|
|
|
#ifndef __EOLIAN_DATABASE_H
|
|
|
|
#define __EOLIAN_DATABASE_H
|
|
|
|
|
|
|
|
#include <Eolian.h>
|
|
|
|
|
2014-02-19 04:09:36 -08:00
|
|
|
extern int _eolian_log_dom;
|
2014-07-07 08:46:12 -07:00
|
|
|
extern Eina_Prefix *_eolian_prefix;
|
2014-02-19 04:09:36 -08:00
|
|
|
|
|
|
|
#ifdef CRI
|
|
|
|
#undef CRI
|
|
|
|
#endif
|
|
|
|
#define CRI(...) EINA_LOG_DOM_CRIT(_eolian_log_dom, __VA_ARGS__)
|
|
|
|
|
|
|
|
#ifdef ERR
|
|
|
|
#undef ERR
|
|
|
|
#endif
|
|
|
|
#define ERR(...) EINA_LOG_DOM_ERR(_eolian_log_dom, __VA_ARGS__)
|
|
|
|
|
|
|
|
#ifdef WRN
|
|
|
|
#undef WRN
|
|
|
|
#endif
|
|
|
|
#define WRN(...) EINA_LOG_DOM_WARN(_eolian_log_dom, __VA_ARGS__)
|
|
|
|
|
|
|
|
#ifdef INF
|
|
|
|
#undef INF
|
|
|
|
#endif
|
|
|
|
#define INF(...) EINA_LOG_DOM_INFO(_eolian_log_dom, __VA_ARGS__)
|
|
|
|
|
|
|
|
#ifdef DBG
|
|
|
|
#undef DBG
|
|
|
|
#endif
|
|
|
|
#define DBG(...) EINA_LOG_DOM_DBG(_eolian_log_dom, __VA_ARGS__)
|
|
|
|
|
2014-07-10 04:15:29 -07:00
|
|
|
#define EOLIAN_METHOD_RETURN_COMMENT "method_return_comment"
|
|
|
|
#define EOLIAN_PROP_GET_RETURN_COMMENT "property_get_return_comment"
|
|
|
|
#define EOLIAN_PROP_SET_RETURN_COMMENT "property_set_return_comment"
|
|
|
|
|
2014-07-30 03:57:11 -07:00
|
|
|
extern Eina_Hash *_classes;
|
2014-07-21 08:57:45 -07:00
|
|
|
extern Eina_Hash *_aliases;
|
2014-07-10 04:15:29 -07:00
|
|
|
extern Eina_Hash *_structs;
|
2014-08-11 06:56:50 -07:00
|
|
|
extern Eina_Hash *_enums;
|
2014-08-08 07:19:52 -07:00
|
|
|
extern Eina_Hash *_globals;
|
|
|
|
extern Eina_Hash *_constants;
|
2014-07-30 03:57:11 -07:00
|
|
|
extern Eina_Hash *_classesf;
|
2014-07-22 05:14:44 -07:00
|
|
|
extern Eina_Hash *_aliasesf;
|
|
|
|
extern Eina_Hash *_structsf;
|
2014-08-11 06:56:50 -07:00
|
|
|
extern Eina_Hash *_enumsf;
|
2014-08-08 07:19:52 -07:00
|
|
|
extern Eina_Hash *_globalsf;
|
|
|
|
extern Eina_Hash *_constantsf;
|
2014-07-10 04:15:29 -07:00
|
|
|
extern Eina_Hash *_filenames; /* Hash: filename without extension -> full path */
|
|
|
|
extern Eina_Hash *_tfilenames;
|
|
|
|
|
2014-08-04 06:29:13 -07:00
|
|
|
typedef struct _Eolian_Object
|
|
|
|
{
|
2014-08-06 08:30:42 -07:00
|
|
|
const char *file;
|
2014-08-04 06:29:13 -07:00
|
|
|
int line;
|
|
|
|
int column;
|
|
|
|
} Eolian_Object;
|
|
|
|
|
2014-07-10 04:15:29 -07:00
|
|
|
struct _Eolian_Class
|
|
|
|
{
|
2014-08-04 06:29:13 -07:00
|
|
|
Eolian_Object base;
|
2014-07-10 04:15:29 -07:00
|
|
|
Eina_Stringshare *full_name;
|
|
|
|
Eina_List *namespaces; /* List Eina_Stringshare * */
|
|
|
|
Eina_Stringshare *name;
|
|
|
|
Eolian_Class_Type type;
|
|
|
|
Eina_Stringshare *description;
|
|
|
|
Eina_Stringshare *legacy_prefix;
|
|
|
|
Eina_Stringshare *eo_prefix;
|
|
|
|
Eina_Stringshare *data_type;
|
|
|
|
Eina_List *inherits; /* List Eina_Stringshare * */
|
|
|
|
Eina_List *properties; /* List prop_name -> Eolian_Function */
|
|
|
|
Eina_List *methods; /* List meth_name -> Eolian_Function */
|
|
|
|
Eina_List *constructors; /* List constructor_name -> Eolian_Function */
|
|
|
|
Eina_List *implements; /* List implements name -> Eolian_Implement */
|
|
|
|
Eina_List *events; /* List event_name -> Eolian_Event */
|
|
|
|
Eina_Bool class_ctor_enable:1;
|
|
|
|
Eina_Bool class_dtor_enable:1;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _Eolian_Function
|
|
|
|
{
|
2014-08-04 06:29:13 -07:00
|
|
|
Eolian_Object base;
|
|
|
|
Eolian_Object set_base;
|
2014-07-10 04:15:29 -07:00
|
|
|
Eina_Stringshare *name;
|
|
|
|
Eina_List *keys; /* list of Eolian_Function_Parameter */
|
|
|
|
Eina_List *params; /* list of Eolian_Function_Parameter */
|
|
|
|
Eolian_Function_Type type;
|
|
|
|
Eolian_Function_Scope scope;
|
|
|
|
Eolian_Type *get_ret_type;
|
|
|
|
Eolian_Type *set_ret_type;
|
2014-08-07 07:15:07 -07:00
|
|
|
Eolian_Expression *get_ret_val;
|
|
|
|
Eolian_Expression *set_ret_val;
|
2014-07-10 04:15:29 -07:00
|
|
|
Eina_Hash *data;
|
|
|
|
Eina_Bool obj_is_const :1; /* True if the object has to be const. Useful for a few methods. */
|
|
|
|
Eina_Bool get_virtual_pure :1;
|
|
|
|
Eina_Bool set_virtual_pure :1;
|
|
|
|
Eina_Bool get_return_warn_unused :1; /* also used for methods */
|
|
|
|
Eina_Bool set_return_warn_unused :1;
|
2014-07-24 04:05:12 -07:00
|
|
|
Eina_Bool is_class :1;
|
2014-07-10 04:15:29 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _Eolian_Function_Parameter
|
|
|
|
{
|
2014-08-04 06:29:13 -07:00
|
|
|
Eolian_Object base;
|
2014-07-10 04:15:29 -07:00
|
|
|
Eina_Stringshare *name;
|
|
|
|
Eolian_Type *type;
|
|
|
|
Eina_Stringshare *description;
|
|
|
|
Eolian_Parameter_Dir param_dir;
|
|
|
|
Eina_Bool is_const_on_get :1; /* True if const in this the get property */
|
|
|
|
Eina_Bool is_const_on_set :1; /* True if const in this the set property */
|
|
|
|
Eina_Bool nonull :1; /* True if this argument cannot be NULL */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _Eolian_Type
|
|
|
|
{
|
2014-08-04 06:29:13 -07:00
|
|
|
Eolian_Object base;
|
2014-07-21 05:56:20 -07:00
|
|
|
Eolian_Type_Type type;
|
2014-07-10 04:15:29 -07:00
|
|
|
union {
|
2014-07-21 05:56:20 -07:00
|
|
|
/* functions */
|
2014-07-10 04:15:29 -07:00
|
|
|
struct {
|
|
|
|
Eina_List *arguments;
|
|
|
|
Eolian_Type *ret_type;
|
|
|
|
};
|
2014-07-21 08:53:25 -07:00
|
|
|
/* everything else */
|
2014-07-10 04:15:29 -07:00
|
|
|
struct {
|
2014-07-21 08:53:25 -07:00
|
|
|
Eina_List *subtypes;
|
|
|
|
Eolian_Type *base_type;
|
|
|
|
Eina_Stringshare *name;
|
|
|
|
Eina_Stringshare *full_name;
|
|
|
|
Eina_List *namespaces;
|
|
|
|
Eina_Hash *fields;
|
2014-08-12 07:07:46 -07:00
|
|
|
Eina_List *field_names;
|
2014-07-21 08:53:25 -07:00
|
|
|
Eina_Stringshare *comment;
|
2014-08-11 06:56:50 -07:00
|
|
|
Eina_Stringshare *legacy;
|
2014-07-10 04:15:29 -07:00
|
|
|
};
|
|
|
|
};
|
|
|
|
Eina_Bool is_const :1;
|
|
|
|
Eina_Bool is_own :1;
|
2014-07-15 07:33:22 -07:00
|
|
|
Eina_Bool is_extern :1;
|
2014-07-10 04:15:29 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _Eolian_Implement
|
|
|
|
{
|
2014-08-04 06:29:13 -07:00
|
|
|
Eolian_Object base;
|
2014-07-10 04:15:29 -07:00
|
|
|
Eina_Stringshare *full_name;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _Eolian_Event
|
|
|
|
{
|
2014-08-04 06:29:13 -07:00
|
|
|
Eolian_Object base;
|
2014-07-10 04:15:29 -07:00
|
|
|
Eina_Stringshare *name;
|
|
|
|
Eina_Stringshare *comment;
|
2014-07-11 03:47:37 -07:00
|
|
|
Eolian_Type *type;
|
2014-07-10 04:15:29 -07:00
|
|
|
};
|
|
|
|
|
2014-07-10 06:19:06 -07:00
|
|
|
typedef struct _Eolian_Struct_Field
|
|
|
|
{
|
2014-08-04 06:29:13 -07:00
|
|
|
Eolian_Object base;
|
2014-07-10 06:19:06 -07:00
|
|
|
Eolian_Type *type;
|
|
|
|
Eina_Stringshare *comment;
|
|
|
|
} Eolian_Struct_Field;
|
|
|
|
|
2014-08-11 06:56:50 -07:00
|
|
|
typedef struct _Eolian_Enum_Field
|
|
|
|
{
|
|
|
|
Eolian_Object base;
|
|
|
|
Eolian_Expression *value;
|
|
|
|
Eina_Stringshare *comment;
|
|
|
|
} Eolian_Enum_Field;
|
|
|
|
|
2014-07-17 09:16:31 -07:00
|
|
|
typedef union
|
|
|
|
{
|
2014-08-07 07:15:07 -07:00
|
|
|
char c;
|
2014-07-17 09:16:31 -07:00
|
|
|
Eina_Bool b;
|
|
|
|
const char *s;
|
|
|
|
signed int i;
|
|
|
|
unsigned int u;
|
|
|
|
signed long l;
|
|
|
|
unsigned long ul;
|
|
|
|
signed long long ll;
|
|
|
|
unsigned long long ull;
|
|
|
|
float f;
|
|
|
|
double d;
|
|
|
|
long double ld;
|
|
|
|
} Eolian_Value;
|
|
|
|
|
2014-08-06 08:30:42 -07:00
|
|
|
typedef enum
|
|
|
|
{
|
2014-08-07 07:15:07 -07:00
|
|
|
EOLIAN_BINOP_INVALID = -1,
|
|
|
|
|
2014-08-06 08:30:42 -07:00
|
|
|
EOLIAN_BINOP_ADD, /* + int, float */
|
|
|
|
EOLIAN_BINOP_SUB, /* - int, float */
|
|
|
|
EOLIAN_BINOP_MUL, /* * int, float */
|
|
|
|
EOLIAN_BINOP_DIV, /* / int, float */
|
|
|
|
EOLIAN_BINOP_MOD, /* % int */
|
|
|
|
|
|
|
|
EOLIAN_BINOP_EQ, /* == all types */
|
|
|
|
EOLIAN_BINOP_NQ, /* != all types */
|
|
|
|
EOLIAN_BINOP_GT, /* > int, float */
|
|
|
|
EOLIAN_BINOP_LT, /* < int, float */
|
|
|
|
EOLIAN_BINOP_GE, /* >= int, float */
|
|
|
|
EOLIAN_BINOP_LE, /* <= int, float */
|
|
|
|
|
|
|
|
EOLIAN_BINOP_AND, /* && all types */
|
|
|
|
EOLIAN_BINOP_OR, /* || all types */
|
|
|
|
|
|
|
|
EOLIAN_BINOP_BAND, /* & int */
|
|
|
|
EOLIAN_BINOP_BOR, /* | int */
|
|
|
|
EOLIAN_BINOP_BXOR, /* ^ int */
|
|
|
|
EOLIAN_BINOP_LSH, /* << int */
|
|
|
|
EOLIAN_BINOP_RSH /* >> int */
|
|
|
|
} Eolian_Binary_Operator;
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
2014-08-07 07:15:07 -07:00
|
|
|
EOLIAN_UNOP_INVALID = -1,
|
|
|
|
|
2014-08-06 08:30:42 -07:00
|
|
|
EOLIAN_UNOP_UNM, /* - sint */
|
|
|
|
EOLIAN_UNOP_UNP, /* + sint */
|
|
|
|
|
|
|
|
EOLIAN_UNOP_NOT, /* ! int, float, bool */
|
|
|
|
EOLIAN_UNOP_BNOT, /* ~ int */
|
|
|
|
} Eolian_Unary_Operator;
|
|
|
|
|
2014-07-17 09:16:31 -07:00
|
|
|
struct _Eolian_Expression
|
|
|
|
{
|
2014-08-06 08:30:42 -07:00
|
|
|
Eolian_Object base;
|
2014-07-17 09:16:31 -07:00
|
|
|
Eolian_Expression_Type type;
|
|
|
|
union
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
Eolian_Binary_Operator binop;
|
|
|
|
Eolian_Expression *lhs;
|
|
|
|
Eolian_Expression *rhs;
|
|
|
|
};
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
Eolian_Unary_Operator unop;
|
|
|
|
Eolian_Expression *expr;
|
|
|
|
};
|
|
|
|
Eolian_Value value;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2014-08-08 07:19:52 -07:00
|
|
|
struct _Eolian_Variable
|
|
|
|
{
|
|
|
|
Eolian_Object base;
|
|
|
|
Eolian_Variable_Type type;
|
|
|
|
Eina_Stringshare *name;
|
|
|
|
Eina_Stringshare *full_name;
|
|
|
|
Eina_List *namespaces;
|
|
|
|
Eolian_Type *base_type;
|
|
|
|
Eolian_Expression *value;
|
|
|
|
Eina_Stringshare *comment;
|
2014-08-08 07:57:39 -07:00
|
|
|
Eina_Bool is_extern :1;
|
2014-08-08 07:19:52 -07:00
|
|
|
};
|
|
|
|
|
2014-02-16 01:41:38 -08:00
|
|
|
int database_init();
|
|
|
|
int database_shutdown();
|
2014-02-11 05:42:59 -08:00
|
|
|
|
2014-07-10 06:30:34 -07:00
|
|
|
/* types */
|
2014-04-30 02:03:09 -07:00
|
|
|
|
2014-07-21 08:53:25 -07:00
|
|
|
Eina_Bool database_type_add(Eolian_Type *def);
|
2014-07-22 02:39:34 -07:00
|
|
|
Eina_Bool database_struct_add(Eolian_Type *tp);
|
2014-08-11 06:56:50 -07:00
|
|
|
Eina_Bool database_enum_add(Eolian_Type *tp);
|
2014-07-22 02:39:34 -07:00
|
|
|
void database_type_del(Eolian_Type *tp);
|
|
|
|
void database_typedef_del(Eolian_Type *tp);
|
2014-07-08 08:42:33 -07:00
|
|
|
|
2014-07-10 06:30:34 -07:00
|
|
|
void database_type_print(Eolian_Type *type);
|
|
|
|
void database_type_to_str(const Eolian_Type *tp, Eina_Strbuf *buf, const char *name);
|
2014-02-11 05:42:59 -08:00
|
|
|
|
2014-08-07 03:13:40 -07:00
|
|
|
/* expressions */
|
|
|
|
|
2014-08-13 02:38:04 -07:00
|
|
|
Eolian_Expression_Type database_expr_eval(const Eolian_Expression *expr, Eolian_Expression_Mask mask, Eina_Value *out);
|
2014-08-07 07:15:07 -07:00
|
|
|
void database_expr_del(Eolian_Expression *expr);
|
2014-08-12 07:26:48 -07:00
|
|
|
void database_expr_print(Eolian_Expression *expr);
|
2014-08-07 03:13:40 -07:00
|
|
|
|
2014-08-08 07:19:52 -07:00
|
|
|
/* variables */
|
|
|
|
|
|
|
|
void database_var_del(Eolian_Variable *var);
|
2014-08-08 07:57:39 -07:00
|
|
|
Eina_Bool database_var_add(Eolian_Variable *var);
|
2014-08-08 07:19:52 -07:00
|
|
|
|
2014-07-10 06:30:34 -07:00
|
|
|
/* classes */
|
2014-02-11 05:42:59 -08:00
|
|
|
|
2014-07-10 06:30:34 -07:00
|
|
|
Eolian_Class *database_class_add(const char *class_name, Eolian_Class_Type type);
|
|
|
|
void database_class_del(Eolian_Class *cl);
|
2014-02-11 05:42:59 -08:00
|
|
|
|
2014-07-30 03:57:11 -07:00
|
|
|
char *database_class_to_filename(const char *cname);
|
|
|
|
|
2014-07-10 06:30:34 -07:00
|
|
|
Eina_Bool database_class_inherit_add(Eolian_Class *cl, const char *inherit_class_name);
|
|
|
|
Eina_Bool database_class_function_add(Eolian_Class *cl, Eolian_Function *foo_id);
|
|
|
|
Eina_Bool database_class_implement_add(Eolian_Class *cl, Eolian_Implement *impl_id);
|
|
|
|
Eina_Bool database_class_event_add(Eolian_Class *cl, Eolian_Event *event_desc);
|
2014-02-11 05:42:59 -08:00
|
|
|
|
2014-07-10 06:30:34 -07:00
|
|
|
void database_class_description_set(Eolian_Class *cl, const char *description);
|
|
|
|
void database_class_legacy_prefix_set(Eolian_Class *cl, const char *legacy_prefix);
|
|
|
|
void database_class_eo_prefix_set(Eolian_Class *cl, const char *eo_prefix);
|
|
|
|
void database_class_data_type_set(Eolian_Class *cl, const char *data_type);
|
|
|
|
Eina_Bool database_class_ctor_enable_set(Eolian_Class *cl, Eina_Bool enable);
|
|
|
|
Eina_Bool database_class_dtor_enable_set(Eolian_Class *cl, Eina_Bool enable);
|
2014-03-10 02:52:46 -07:00
|
|
|
|
2014-07-10 06:30:34 -07:00
|
|
|
Eina_Bool database_class_name_validate(const char *class_name, const Eolian_Class **cl);
|
2014-03-10 02:52:46 -07:00
|
|
|
|
2014-07-10 06:30:34 -07:00
|
|
|
/* functions */
|
2014-02-16 06:09:06 -08:00
|
|
|
|
2014-07-09 12:59:31 -07:00
|
|
|
Eolian_Function *database_function_new(const char *function_name, Eolian_Function_Type foo_type);
|
2014-07-10 04:15:29 -07:00
|
|
|
void database_function_del(Eolian_Function *fid);
|
|
|
|
|
2014-07-09 12:59:31 -07:00
|
|
|
void database_function_type_set(Eolian_Function *function_id, Eolian_Function_Type foo_type);
|
|
|
|
void database_function_data_set(Eolian_Function *function_id, const char *key, const char *description);
|
2014-02-11 05:42:59 -08:00
|
|
|
#define database_function_description_set(foo_id, key, desc) database_function_data_set((foo_id), (key), (desc))
|
|
|
|
|
2014-07-09 12:59:31 -07:00
|
|
|
void database_function_return_type_set(Eolian_Function *foo_id, Eolian_Function_Type ftype, Eolian_Type *ret_type);
|
|
|
|
void database_function_return_comment_set(Eolian_Function *foo_id, Eolian_Function_Type ftype, const char *ret_comment);
|
2014-08-07 07:15:07 -07:00
|
|
|
void database_function_return_default_val_set(Eolian_Function *foo_id, Eolian_Function_Type ftype, Eolian_Expression *ret_default_value);
|
2014-07-10 06:30:34 -07:00
|
|
|
void database_function_return_flag_set_as_warn_unused(Eolian_Function *foo_id, Eolian_Function_Type ftype, Eina_Bool warn_unused);
|
2014-02-20 06:18:49 -08:00
|
|
|
|
2014-07-09 12:59:31 -07:00
|
|
|
void database_function_object_set_as_const(Eolian_Function *foo_id, Eina_Bool is_const);
|
2014-07-24 04:05:12 -07:00
|
|
|
void database_function_set_as_class(Eolian_Function *foo_id, Eina_Bool is_class);
|
2014-07-10 06:30:34 -07:00
|
|
|
Eina_Bool database_function_set_as_virtual_pure(Eolian_Function *function_id, Eolian_Function_Type type);
|
|
|
|
void database_function_scope_set(Eolian_Function *function_id, Eolian_Function_Scope scope);
|
2014-02-11 05:42:59 -08:00
|
|
|
|
2014-07-10 06:30:34 -07:00
|
|
|
Eolian_Function_Parameter *database_property_key_add(Eolian_Function *foo_id, Eolian_Type *type, const char *name, const char *description);
|
|
|
|
Eolian_Function_Parameter *database_property_value_add(Eolian_Function *foo_id, Eolian_Type *type, const char *name, const char *description);
|
|
|
|
Eolian_Function_Parameter *database_method_parameter_add(Eolian_Function *foo_id, Eolian_Parameter_Dir param_dir, Eolian_Type *type, const char *name, const char *description);
|
2014-02-11 05:42:59 -08:00
|
|
|
|
2014-07-10 06:30:34 -07:00
|
|
|
/* func parameters */
|
2014-02-11 05:42:59 -08:00
|
|
|
|
2014-07-10 06:30:34 -07:00
|
|
|
Eolian_Function_Parameter *database_parameter_add(Eolian_Type *type, const char *name, const char *description);
|
|
|
|
void database_parameter_del(Eolian_Function_Parameter *pdesc);
|
2014-02-18 05:16:51 -08:00
|
|
|
|
2014-07-10 06:30:34 -07:00
|
|
|
void database_parameter_const_attribute_set(Eolian_Function_Parameter *param, Eina_Bool is_get, Eina_Bool is_const);
|
|
|
|
void database_parameter_nonull_set(Eolian_Function_Parameter *param, Eina_Bool nonull);
|
2014-02-18 05:16:51 -08:00
|
|
|
|
2014-07-10 06:30:34 -07:00
|
|
|
/* implements */
|
2014-02-11 05:42:59 -08:00
|
|
|
|
2014-07-10 07:23:06 -07:00
|
|
|
void database_implement_del(Eolian_Implement *impl);
|
2014-02-11 05:42:59 -08:00
|
|
|
|
2014-07-10 06:30:34 -07:00
|
|
|
/* events */
|
2014-02-11 05:42:59 -08:00
|
|
|
|
2014-07-10 06:30:34 -07:00
|
|
|
Eolian_Event *database_event_new(const char *event_name, const char *event_type, const char *event_desc);
|
|
|
|
void database_event_del(Eolian_Event *event);
|
2014-07-09 05:26:00 -07:00
|
|
|
|
2014-07-10 05:13:46 -07:00
|
|
|
|
2014-02-11 05:42:59 -08:00
|
|
|
#endif
|