eolian: refactoring step two

Move from all instances of Eolian_Class to Eolian_Class*.
This commit is contained in:
Daniel Kolesa 2014-07-09 16:33:07 +01:00
parent ca82befa8a
commit 96eaaaf074
19 changed files with 162 additions and 191 deletions

View File

@ -3,10 +3,10 @@
int _eolian_gen_log_dom = -1; int _eolian_gen_log_dom = -1;
Eolian_Class current_class; Eolian_Class *current_class;
static void static void
_class_name_concatenate(const Eolian_Class class, char *buffer) _class_name_concatenate(const Eolian_Class *class, char *buffer)
{ {
const Eina_List *list = eolian_class_namespaces_list_get(class), *itr; const Eina_List *list = eolian_class_namespaces_list_get(class), *itr;
const char *name; const char *name;
@ -20,7 +20,7 @@ _class_name_concatenate(const Eolian_Class class, char *buffer)
} }
void void
_class_env_create(const Eolian_Class class, const char *over_classname, _eolian_class_vars *env) _class_env_create(const Eolian_Class *class, const char *over_classname, _eolian_class_vars *env)
{ {
if (!env) return; if (!env) return;
@ -68,7 +68,7 @@ _class_env_create(const Eolian_Class class, const char *over_classname, _eolian_
} }
void void
_class_func_env_create(const Eolian_Class class, const char *funcname, Eolian_Function_Type ftype, _eolian_class_func_vars *env) _class_func_env_create(const Eolian_Class *class, const char *funcname, Eolian_Function_Type ftype, _eolian_class_func_vars *env)
{ {
char *p; char *p;
const char *ret; const char *ret;
@ -121,7 +121,7 @@ end:
} }
void void
_template_fill(Eina_Strbuf *buf, const char *templ, const Eolian_Class class, const char *classname, const char *funcname, Eina_Bool reset) _template_fill(Eina_Strbuf *buf, const char *templ, const Eolian_Class *class, const char *classname, const char *funcname, Eina_Bool reset)
{ {
_eolian_class_vars tmp_env; _eolian_class_vars tmp_env;
_eolian_class_func_vars tmp_func_env; _eolian_class_func_vars tmp_func_env;

View File

@ -57,7 +57,7 @@ typedef struct
char legacy_func[PATH_MAX]; char legacy_func[PATH_MAX];
}_eolian_class_func_vars; }_eolian_class_func_vars;
void _template_fill(Eina_Strbuf *buf, const char *templ, const Eolian_Class class, const char *classname, const char *funcname, Eina_Bool reset); void _template_fill(Eina_Strbuf *buf, const char *templ, const Eolian_Class *class, const char *classname, const char *funcname, Eina_Bool reset);
char *_nextline(char *str, unsigned int lines); char *_nextline(char *str, unsigned int lines);
@ -65,8 +65,8 @@ char *_startline(char *str, char *pos);
char *_source_desc_get(const char *str); char *_source_desc_get(const char *str);
void _class_env_create(const Eolian_Class class, const char *over_classname, _eolian_class_vars *env); void _class_env_create(const Eolian_Class *class, const char *over_classname, _eolian_class_vars *env);
void _class_func_env_create(const Eolian_Class class, const char *funcname, Eolian_Function_Type ftype EINA_UNUSED, _eolian_class_func_vars *env); void _class_func_env_create(const Eolian_Class *class, const char *funcname, Eolian_Function_Type ftype EINA_UNUSED, _eolian_class_func_vars *env);
#endif #endif

View File

@ -79,7 +79,7 @@ tmpl_eo_retdesc[] =" * @return %s\n";
#endif #endif
static Eina_Bool static Eina_Bool
eo_fundef_generate(const Eolian_Class class, Eolian_Function func, Eolian_Function_Type ftype, Eina_Strbuf *functext) eo_fundef_generate(const Eolian_Class *class, Eolian_Function func, Eolian_Function_Type ftype, Eina_Strbuf *functext)
{ {
_eolian_class_func_vars func_env; _eolian_class_func_vars func_env;
const char *str_dir[] = {"in", "out", "inout"}; const char *str_dir[] = {"in", "out", "inout"};
@ -234,7 +234,7 @@ eo_fundef_generate(const Eolian_Class class, Eolian_Function func, Eolian_Functi
} }
Eina_Bool Eina_Bool
eo_header_generate(const Eolian_Class class, Eina_Strbuf *buf) eo_header_generate(const Eolian_Class *class, Eina_Strbuf *buf)
{ {
const Eolian_Function_Type ftype_order[] = {EOLIAN_CTOR, EOLIAN_PROPERTY, EOLIAN_METHOD}; const Eolian_Function_Type ftype_order[] = {EOLIAN_CTOR, EOLIAN_PROPERTY, EOLIAN_METHOD};
const Eina_List *itr; const Eina_List *itr;
@ -326,7 +326,7 @@ eo_header_generate(const Eolian_Class class, Eina_Strbuf *buf)
} }
static Eina_Bool static Eina_Bool
eo_bind_func_generate(const Eolian_Class class, Eolian_Function funcid, Eolian_Function_Type ftype, Eina_Strbuf *buf, _eolian_class_vars *impl_env) eo_bind_func_generate(const Eolian_Class *class, Eolian_Function funcid, Eolian_Function_Type ftype, Eina_Strbuf *buf, _eolian_class_vars *impl_env)
{ {
_eolian_class_func_vars func_env; _eolian_class_func_vars func_env;
const char *suffix = ""; const char *suffix = "";
@ -488,7 +488,7 @@ eo_bind_func_generate(const Eolian_Class class, Eolian_Function funcid, Eolian_F
} }
static Eina_Bool static Eina_Bool
eo_op_desc_generate(const Eolian_Class class, Eolian_Function fid, Eolian_Function_Type ftype, eo_op_desc_generate(const Eolian_Class *class, Eolian_Function fid, Eolian_Function_Type ftype,
const char *desc, Eina_Strbuf *buf) const char *desc, Eina_Strbuf *buf)
{ {
_eolian_class_func_vars func_env; _eolian_class_func_vars func_env;
@ -510,7 +510,7 @@ eo_op_desc_generate(const Eolian_Class class, Eolian_Function fid, Eolian_Functi
} }
static Eina_Bool static Eina_Bool
eo_source_beginning_generate(const Eolian_Class class, Eina_Strbuf *buf) eo_source_beginning_generate(const Eolian_Class *class, Eina_Strbuf *buf)
{ {
const Eina_List *itr; const Eina_List *itr;
@ -547,7 +547,7 @@ eo_source_beginning_generate(const Eolian_Class class, Eina_Strbuf *buf)
} }
static Eina_Bool static Eina_Bool
eo_source_end_generate(const Eolian_Class class, Eina_Strbuf *buf) eo_source_end_generate(const Eolian_Class *class, Eina_Strbuf *buf)
{ {
Eina_Bool ret = EINA_FALSE; Eina_Bool ret = EINA_FALSE;
const Eina_List *itr; const Eina_List *itr;
@ -622,7 +622,7 @@ eo_source_end_generate(const Eolian_Class class, Eina_Strbuf *buf)
{ {
_eolian_class_vars impl_env; _eolian_class_vars impl_env;
char implname[0xFF]; char implname[0xFF];
Eolian_Class impl_class = NULL; Eolian_Class *impl_class = NULL;
Eolian_Function_Type ftype; Eolian_Function_Type ftype;
Eolian_Function fnid = NULL; Eolian_Function fnid = NULL;
const char *funcname = NULL; const char *funcname = NULL;
@ -758,7 +758,7 @@ eo_source_end_generate(const Eolian_Class class, Eina_Strbuf *buf)
eina_strbuf_reset(tmpbuf); eina_strbuf_reset(tmpbuf);
EINA_LIST_FOREACH(eolian_class_inherits_list_get(class), itr, inherit_name) EINA_LIST_FOREACH(eolian_class_inherits_list_get(class), itr, inherit_name)
{ {
Eolian_Class inherit_class = eolian_class_find_by_name(inherit_name); Eolian_Class *inherit_class = eolian_class_find_by_name(inherit_name);
_eolian_class_vars inherit_env; _eolian_class_vars inherit_env;
_class_env_create(inherit_class, NULL, &inherit_env); _class_env_create(inherit_class, NULL, &inherit_env);
eina_strbuf_append_printf(tmpbuf, "%s_%s, ", inherit_env.upper_classname, eina_strbuf_append_printf(tmpbuf, "%s_%s, ", inherit_env.upper_classname,
@ -815,7 +815,7 @@ end:
} }
Eina_Bool Eina_Bool
eo_source_generate(const Eolian_Class class, Eina_Strbuf *buf) eo_source_generate(const Eolian_Class *class, Eina_Strbuf *buf)
{ {
Eina_Bool ret = EINA_FALSE; Eina_Bool ret = EINA_FALSE;
const Eina_List *itr; const Eina_List *itr;

View File

@ -15,7 +15,7 @@
* *
*/ */
Eina_Bool Eina_Bool
eo_source_generate(const Eolian_Class class, Eina_Strbuf *buf); eo_source_generate(const Eolian_Class *class, Eina_Strbuf *buf);
/* /*
* @brief Generate the header code for a specific Eo class. * @brief Generate the header code for a specific Eo class.
@ -28,7 +28,7 @@ eo_source_generate(const Eolian_Class class, Eina_Strbuf *buf);
* @return EINA_TRUE on success, EINA_FALSE on error. * @return EINA_TRUE on success, EINA_FALSE on error.
* *
*/ */
Eina_Bool eo_header_generate(const Eolian_Class class, Eina_Strbuf *buf); Eina_Bool eo_header_generate(const Eolian_Class *class, Eina_Strbuf *buf);
#endif #endif

View File

@ -125,7 +125,7 @@ _prototype_generate(Eolian_Function foo, Eolian_Function_Type ftype, Eina_Strbuf
super_invok = eina_strbuf_new(); super_invok = eina_strbuf_new();
if (impl_desc) if (impl_desc)
{ {
Eolian_Class impl_class; Eolian_Class *impl_class;
eolian_implement_information_get(impl_desc, &impl_class, NULL, NULL); eolian_implement_information_get(impl_desc, &impl_class, NULL, NULL);
_class_env_create(impl_class, NULL, &impl_env); _class_env_create(impl_class, NULL, &impl_env);
@ -194,7 +194,7 @@ end:
} }
Eina_Bool Eina_Bool
impl_source_generate(const Eolian_Class class, Eina_Strbuf *buffer) impl_source_generate(const Eolian_Class *class, Eina_Strbuf *buffer)
{ {
Eina_Bool ret = EINA_FALSE; Eina_Bool ret = EINA_FALSE;
Eina_Strbuf *data_type_buf = eina_strbuf_new(); Eina_Strbuf *data_type_buf = eina_strbuf_new();
@ -267,7 +267,7 @@ impl_source_generate(const Eolian_Class class, Eina_Strbuf *buffer)
Eolian_Implement impl_desc; Eolian_Implement impl_desc;
EINA_LIST_FOREACH(eolian_class_implements_list_get(class), itr_funcs, impl_desc) EINA_LIST_FOREACH(eolian_class_implements_list_get(class), itr_funcs, impl_desc)
{ {
Eolian_Class impl_class = NULL; Eolian_Class *impl_class = NULL;
Eolian_Function_Type ftype; Eolian_Function_Type ftype;
foo = NULL; foo = NULL;

View File

@ -15,7 +15,7 @@
* *
*/ */
Eina_Bool Eina_Bool
impl_source_generate(const Eolian_Class class, Eina_Strbuf *buf); impl_source_generate(const Eolian_Class *class, Eina_Strbuf *buf);
#endif #endif

View File

@ -42,7 +42,7 @@ EAPI void\n\
"; ";
static void static void
_eapi_decl_func_generate(Eolian_Class class, Eolian_Function funcid, Eolian_Function_Type ftype, Eina_Strbuf *buf) _eapi_decl_func_generate(const Eolian_Class *class, Eolian_Function funcid, Eolian_Function_Type ftype, Eina_Strbuf *buf)
{ {
_eolian_class_func_vars func_env; _eolian_class_func_vars func_env;
const char *funcname = eolian_function_name_get(funcid); const char *funcname = eolian_function_name_get(funcid);
@ -198,7 +198,7 @@ end:
} }
static void static void
_eapi_func_generate(const Eolian_Class class, Eolian_Function funcid, Eolian_Function_Type ftype, Eina_Strbuf *buf) _eapi_func_generate(const Eolian_Class *class, Eolian_Function funcid, Eolian_Function_Type ftype, Eina_Strbuf *buf)
{ {
_eolian_class_func_vars func_env; _eolian_class_func_vars func_env;
char tmpstr[0xFF]; char tmpstr[0xFF];
@ -322,7 +322,7 @@ end:
} }
Eina_Bool Eina_Bool
legacy_header_generate(const Eolian_Class class, Eina_Strbuf *buf) legacy_header_generate(const Eolian_Class *class, Eina_Strbuf *buf)
{ {
const Eolian_Function_Type ftype_order[] = {EOLIAN_PROPERTY, EOLIAN_METHOD}; const Eolian_Function_Type ftype_order[] = {EOLIAN_PROPERTY, EOLIAN_METHOD};
const Eina_List *l; const Eina_List *l;
@ -368,7 +368,7 @@ legacy_header_generate(const Eolian_Class class, Eina_Strbuf *buf)
} }
Eina_Bool Eina_Bool
legacy_source_generate(const Eolian_Class class, Eina_Strbuf *buf) legacy_source_generate(const Eolian_Class *class, Eina_Strbuf *buf)
{ {
Eina_Bool ret = EINA_FALSE; Eina_Bool ret = EINA_FALSE;
const Eina_List *itr; const Eina_List *itr;

View File

@ -16,7 +16,7 @@
* @return EINA_TRUE on success, EINA_FALSE on error. * @return EINA_TRUE on success, EINA_FALSE on error.
* *
*/ */
Eina_Bool legacy_header_generate(const Eolian_Class class, Eina_Strbuf *buf); Eina_Bool legacy_header_generate(const Eolian_Class *class, Eina_Strbuf *buf);
/* /*
* @brief Generate C source code for Eo class * @brief Generate C source code for Eo class
@ -30,7 +30,7 @@ Eina_Bool legacy_header_generate(const Eolian_Class class, Eina_Strbuf *buf);
* @return EINA_TRUE on success, EINA_FALSE on error. * @return EINA_TRUE on success, EINA_FALSE on error.
* *
*/ */
Eina_Bool legacy_source_generate(const Eolian_Class class, Eina_Strbuf *buf); Eina_Bool legacy_source_generate(const Eolian_Class *class, Eina_Strbuf *buf);
#endif #endif

View File

@ -41,7 +41,7 @@ _filename_get(const char *path)
} }
static Eina_Bool static Eina_Bool
_generate_eo_h_file(char *filename, const Eolian_Class class) _generate_eo_h_file(char *filename, const Eolian_Class *class)
{ {
Eina_Bool ret = EINA_FALSE; Eina_Bool ret = EINA_FALSE;
Eina_Strbuf *hfile = eina_strbuf_new(); Eina_Strbuf *hfile = eina_strbuf_new();
@ -78,7 +78,7 @@ end:
} }
static Eina_Bool static Eina_Bool
_generate_c_file(char *filename, const Eolian_Class class, Eina_Bool legacy_support) _generate_c_file(char *filename, const Eolian_Class *class, Eina_Bool legacy_support)
{ {
Eina_Bool ret = EINA_FALSE; Eina_Bool ret = EINA_FALSE;
@ -120,7 +120,7 @@ end:
} }
static Eina_Bool static Eina_Bool
_generate_impl_c_file(char *filename, const Eolian_Class class) _generate_impl_c_file(char *filename, const Eolian_Class *class)
{ {
Eina_Bool ret = EINA_FALSE; Eina_Bool ret = EINA_FALSE;
long file_size = 0; long file_size = 0;
@ -187,7 +187,7 @@ end:
// TODO join with header gen. // TODO join with header gen.
static Eina_Bool static Eina_Bool
_generate_legacy_header_file(char *filename, const Eolian_Class class) _generate_legacy_header_file(char *filename, const Eolian_Class *class)
{ {
Eina_Bool ret = EINA_FALSE; Eina_Bool ret = EINA_FALSE;
@ -240,7 +240,7 @@ int main(int argc, char **argv)
Eina_Bool help = EINA_FALSE, show = EINA_FALSE; Eina_Bool help = EINA_FALSE, show = EINA_FALSE;
Eina_List *itr; Eina_List *itr;
Eina_List *files4gen = NULL; Eina_List *files4gen = NULL;
Eolian_Class class; Eolian_Class *class;
char *output_filename = NULL; /* if NULL, have to generate, otherwise use the name stored there */ char *output_filename = NULL; /* if NULL, have to generate, otherwise use the name stored there */
eina_init(); eina_init();

View File

@ -73,7 +73,7 @@ convert_eolian_parameters(Eolian_Function const& func)
} }
static efl::eolian::functions_container_type static efl::eolian::functions_container_type
convert_eolian_property_to_functions(Eolian_Class const& klass) convert_eolian_property_to_functions(Eolian_Class const *& klass)
{ {
efl::eolian::functions_container_type container; efl::eolian::functions_container_type container;
std::string cxx_classname = safe_lower(class_name(klass)); std::string cxx_classname = safe_lower(class_name(klass));
@ -156,7 +156,7 @@ convert_eolian_property_to_functions(Eolian_Class const& klass)
} }
void void
convert_eolian_inheritances(efl::eolian::eo_class& cls, Eolian_Class const& klass) convert_eolian_inheritances(efl::eolian::eo_class& cls, Eolian_Class const *& klass)
{ {
const Eina_List *inheritances = const Eina_List *inheritances =
::eolian_class_inherits_list_get(klass); ::eolian_class_inherits_list_get(klass);
@ -190,7 +190,7 @@ convert_eolian_inheritances(efl::eolian::eo_class& cls, Eolian_Class const& klas
} }
void void
convert_eolian_implements(efl::eolian::eo_class& cls, Eolian_Class const& klass) convert_eolian_implements(efl::eolian::eo_class& cls, Eolian_Class const *& klass)
{ {
const Eina_List *it; const Eina_List *it;
std::string prefix(class_prefix(klass)); std::string prefix(class_prefix(klass));
@ -199,7 +199,7 @@ convert_eolian_implements(efl::eolian::eo_class& cls, Eolian_Class const& klass)
EINA_LIST_FOREACH(eolian_class_implements_list_get(klass), it, impl_desc_) EINA_LIST_FOREACH(eolian_class_implements_list_get(klass), it, impl_desc_)
{ {
Eolian_Implement impl_desc = static_cast<Eolian_Implement>(impl_desc_); Eolian_Implement impl_desc = static_cast<Eolian_Implement>(impl_desc_);
Eolian_Class impl_class; Eolian_Class *impl_class;
Eolian_Function impl_func; Eolian_Function impl_func;
Eolian_Function_Type impl_type; Eolian_Function_Type impl_type;
eolian_implement_information_get eolian_implement_information_get
@ -218,7 +218,7 @@ convert_eolian_implements(efl::eolian::eo_class& cls, Eolian_Class const& klass)
} }
void void
convert_eolian_constructors(efl::eolian::eo_class& cls, Eolian_Class const& klass) convert_eolian_constructors(efl::eolian::eo_class& cls, Eolian_Class const *& klass)
{ {
const Eina_List *it; const Eina_List *it;
void *curr; void *curr;
@ -237,7 +237,7 @@ convert_eolian_constructors(efl::eolian::eo_class& cls, Eolian_Class const& klas
} }
void void
convert_eolian_functions(efl::eolian::eo_class& cls, Eolian_Class const& klass) convert_eolian_functions(efl::eolian::eo_class& cls, Eolian_Class const *& klass)
{ {
const Eina_List *it; const Eina_List *it;
void *curr; void *curr;
@ -260,7 +260,7 @@ convert_eolian_functions(efl::eolian::eo_class& cls, Eolian_Class const& klass)
} }
void void
convert_eolian_properties(efl::eolian::eo_class& cls, Eolian_Class const& klass) convert_eolian_properties(efl::eolian::eo_class& cls, Eolian_Class const *& klass)
{ {
efl::eolian::functions_container_type properties efl::eolian::functions_container_type properties
= convert_eolian_property_to_functions(klass); = convert_eolian_property_to_functions(klass);
@ -269,7 +269,7 @@ convert_eolian_properties(efl::eolian::eo_class& cls, Eolian_Class const& klass)
} }
void void
convert_eolian_events(efl::eolian::eo_class& cls, Eolian_Class const& klass) convert_eolian_events(efl::eolian::eo_class& cls, Eolian_Class const *& klass)
{ {
efl::eolian::events_container_type events = event_list(klass); efl::eolian::events_container_type events = event_list(klass);
cls.events.reserve(cls.events.size() + events.size()); cls.events.reserve(cls.events.size() + events.size());
@ -277,7 +277,7 @@ convert_eolian_events(efl::eolian::eo_class& cls, Eolian_Class const& klass)
} }
efl::eolian::eo_class efl::eolian::eo_class
convert_eolian_class_new(Eolian_Class const& klass) convert_eolian_class_new(Eolian_Class const *& klass)
{ {
efl::eolian::eo_class cls; efl::eolian::eo_class cls;
cls.type = class_type(klass); cls.type = class_type(klass);
@ -289,7 +289,7 @@ convert_eolian_class_new(Eolian_Class const& klass)
} }
efl::eolian::eo_class efl::eolian::eo_class
convert_eolian_class(const Eolian_Class klass) convert_eolian_class(const Eolian_Class *klass)
{ {
assert(klass != NULL); assert(klass != NULL);
efl::eolian::eo_class cls(eolian_cxx::convert_eolian_class_new(klass)); efl::eolian::eo_class cls(eolian_cxx::convert_eolian_class_new(klass));

View File

@ -8,11 +8,11 @@ namespace eolian_cxx
{ {
/// ///
/// @brief Retrieve a efl::eolian::eo_class from an Eolian_Class name. /// @brief Retrieve a efl::eolian::eo_class from an Eolian_Class* name.
/// @param cls The Eolian class. /// @param cls The Eolian class.
/// @return The @p eo_class describing @p classname. /// @return The @p eo_class describing @p classname.
/// ///
efl::eolian::eo_class convert_eolian_class(Eolian_Class klass); efl::eolian::eo_class convert_eolian_class(const Eolian_Class *klass);
} }

View File

@ -77,7 +77,7 @@ _comment_return(Eolian_Function function,
} }
std::string std::string
convert_comments_class(Eolian_Class const& klass) convert_comments_class(Eolian_Class const *& klass)
{ {
return safe_str(eolian_class_description_get(klass)); return safe_str(eolian_class_description_get(klass));
} }

View File

@ -11,7 +11,7 @@
namespace eolian_cxx { namespace eolian_cxx {
std::string convert_comments_class(Eolian_Class const& kls); std::string convert_comments_class(Eolian_Class const *& kls);
std::string convert_comments_function(Eolian_Function const& function, std::string convert_comments_function(Eolian_Function const& function,
Eolian_Function_Type func_type); Eolian_Function_Type func_type);

View File

@ -88,7 +88,7 @@ opts_check(eolian_cxx::options_type const& opts)
} }
efl::eolian::eo_generator_options efl::eolian::eo_generator_options
generator_options(const Eolian_Class klass) generator_options(const Eolian_Class *klass)
{ {
efl::eolian::eo_generator_options gen_opts; efl::eolian::eo_generator_options gen_opts;
gen_opts.c_headers.push_back(class_base_file(klass) + ".h"); gen_opts.c_headers.push_back(class_base_file(klass) + ".h");
@ -97,7 +97,7 @@ generator_options(const Eolian_Class klass)
const Eina_List *itr, *inheritances = eolian_class_inherits_list_get(klass); const Eina_List *itr, *inheritances = eolian_class_inherits_list_get(klass);
EINA_LIST_FOREACH(inheritances, itr, cur) EINA_LIST_FOREACH(inheritances, itr, cur)
{ {
Eolian_Class ext = eolian_class_find_by_name(static_cast<const char*>(cur)); const Eolian_Class *ext = eolian_class_find_by_name(static_cast<const char*>(cur));
std::string eo_parent_file = class_base_file(ext); std::string eo_parent_file = class_base_file(ext);
if (!eo_parent_file.empty()) if (!eo_parent_file.empty())
{ {
@ -121,7 +121,7 @@ generator_options(const Eolian_Class klass)
} }
static bool static bool
generate(const Eolian_Class klass, eolian_cxx::options_type const& opts) generate(const Eolian_Class *klass, eolian_cxx::options_type const& opts)
{ {
assert(!!klass); assert(!!klass);
efl::eolian::eo_class cls = eolian_cxx::convert_eolian_class(klass); efl::eolian::eo_class cls = eolian_cxx::convert_eolian_class(klass);
@ -157,7 +157,7 @@ generate(const Eolian_Class klass, eolian_cxx::options_type const& opts)
static void static void
run(options_type const& opts) run(options_type const& opts)
{ {
Eolian_Class klass = NULL; const Eolian_Class *klass = NULL;
if (!opts.classname.empty()) if (!opts.classname.empty())
klass = class_from_name(opts.classname); klass = class_from_name(opts.classname);
else if (!opts.in_file.empty()) else if (!opts.in_file.empty())
@ -170,7 +170,7 @@ run(options_type const& opts)
else else
{ {
auto classes = class_list_all(); auto classes = class_list_all();
for (const Eolian_Class c : classes) for (const Eolian_Class *c : classes)
{ {
if (!generate(c, opts)) if (!generate(c, opts))
{ {

View File

@ -27,44 +27,44 @@ method_t const method = {};
struct ctor_t { static constexpr ::Eolian_Function_Type value = ::EOLIAN_CTOR; }; struct ctor_t { static constexpr ::Eolian_Function_Type value = ::EOLIAN_CTOR; };
ctor_t const ctor = {}; ctor_t const ctor = {};
inline Eolian_Class inline Eolian_Class *
class_from_file(std::string const& file) class_from_file(std::string const& file)
{ {
return ::eolian_class_find_by_file(file.c_str()); return ::eolian_class_find_by_file(file.c_str());
} }
inline std::string inline std::string
class_file(Eolian_Class const& klass) class_file(Eolian_Class const *& klass)
{ {
return safe_str(::eolian_class_file_get(klass)); return safe_str(::eolian_class_file_get(klass));
} }
inline std::string inline std::string
class_base_file(Eolian_Class const& klass) class_base_file(Eolian_Class const *& klass)
{ {
return path_base(safe_str(::eolian_class_file_get(klass))); return path_base(safe_str(::eolian_class_file_get(klass)));
} }
inline std::string inline std::string
class_name(Eolian_Class const& klass) class_name(Eolian_Class const *& klass)
{ {
return safe_str(::eolian_class_name_get(klass)); return safe_str(::eolian_class_name_get(klass));
} }
inline std::string inline std::string
class_full_name(Eolian_Class const& klass) class_full_name(Eolian_Class const *& klass)
{ {
return safe_str(::eolian_class_full_name_get(klass)); return safe_str(::eolian_class_full_name_get(klass));
} }
inline Eolian_Class inline Eolian_Class *
class_from_name(std::string const& classname) class_from_name(std::string const& classname)
{ {
return ::eolian_class_find_by_name(classname.c_str()); return ::eolian_class_find_by_name(classname.c_str());
} }
inline std::string inline std::string
class_eo_name(Eolian_Class const& klass) class_eo_name(Eolian_Class const *& klass)
{ {
std::string suffix; std::string suffix;
switch (eolian_class_type_get(klass)) switch (eolian_class_type_get(klass))
@ -105,7 +105,7 @@ class_format_cxx(std::string const& fullname)
} }
inline std::string inline std::string
class_prefix(Eolian_Class const& klass) class_prefix(Eolian_Class const *& klass)
{ {
std::string prefix = safe_lower(::eolian_class_eo_prefix_get(klass)); std::string prefix = safe_lower(::eolian_class_eo_prefix_get(klass));
if (prefix.empty()) if (prefix.empty())
@ -115,7 +115,7 @@ class_prefix(Eolian_Class const& klass)
} }
inline efl::eolian::eo_class::eo_class_type inline efl::eolian::eo_class::eo_class_type
class_type(Eolian_Class const& klass) class_type(Eolian_Class const *& klass)
{ {
assert(klass != NULL); assert(klass != NULL);
efl::eolian::eo_class::eo_class_type type; efl::eolian::eo_class::eo_class_type type;
@ -135,7 +135,7 @@ class_type(Eolian_Class const& klass)
} }
inline std::string inline std::string
class_namespace_full(Eolian_Class const& klass) class_namespace_full(Eolian_Class const *& klass)
{ {
std::string s; std::string s;
const Eina_List* list = const Eina_List* list =
@ -151,10 +151,10 @@ class_namespace_full(Eolian_Class const& klass)
return safe_lower(s); return safe_lower(s);
} }
inline efl::eina::range_ptr_list<const Eolian_Class> inline efl::eina::range_ptr_list<const Eolian_Class *>
class_list_all() class_list_all()
{ {
return ::eolian_all_classes_list_get(); return (Eina_List*)::eolian_all_classes_list_get();
} }
inline std::string inline std::string
@ -308,7 +308,7 @@ parameter_type(Eolian_Function_Parameter const& parameter, setter_t func_type)
} }
inline efl::eolian::eo_event inline efl::eolian::eo_event
event_create(Eolian_Class const& klass, const Eolian_Event event_) event_create(Eolian_Class const *& klass, const Eolian_Event event_)
{ {
efl::eolian::eo_event event; efl::eolian::eo_event event;
const char *name, *type, *comment; const char *name, *type, *comment;
@ -325,7 +325,7 @@ event_create(Eolian_Class const& klass, const Eolian_Event event_)
} }
inline efl::eolian::events_container_type inline efl::eolian::events_container_type
event_list(Eolian_Class const& klass) event_list(Eolian_Class const *& klass)
{ {
efl::eolian::events_container_type events; efl::eolian::events_container_type events;
const Eina_List* list = eolian_class_events_list_get(klass); const Eina_List* list = eolian_class_events_list_get(klass);

View File

@ -42,7 +42,7 @@ extern "C" {
* *
* @ingroup Eolian * @ingroup Eolian
*/ */
typedef struct _Eolian_Class* Eolian_Class; typedef struct _Eolian_Class Eolian_Class;
/* Function Id used to extract information on class functions /* Function Id used to extract information on class functions
* *
@ -224,7 +224,7 @@ EAPI Eina_Bool eolian_all_eot_files_parse();
* *
* @ingroup Eolian * @ingroup Eolian
*/ */
EAPI Eina_Bool eolian_show(const Eolian_Class klass); EAPI Eina_Bool eolian_show(const Eolian_Class *klass);
/* /*
* @brief Finds a class by its name * @brief Finds a class by its name
@ -234,7 +234,7 @@ EAPI Eina_Bool eolian_show(const Eolian_Class klass);
* *
* @ingroup Eolian * @ingroup Eolian
*/ */
EAPI Eolian_Class EAPI Eolian_Class *
eolian_class_find_by_name(const char *class_name); eolian_class_find_by_name(const char *class_name);
/* /*
@ -245,7 +245,7 @@ eolian_class_find_by_name(const char *class_name);
* *
* @ingroup Eolian * @ingroup Eolian
*/ */
EAPI Eolian_Class EAPI Eolian_Class *
eolian_class_find_by_file(const char *file_name); eolian_class_find_by_file(const char *file_name);
/* /*
@ -257,7 +257,7 @@ eolian_class_find_by_file(const char *file_name);
* @ingroup Eolian * @ingroup Eolian
*/ */
EAPI const char * EAPI const char *
eolian_class_file_get(const Eolian_Class klass); eolian_class_file_get(const Eolian_Class *klass);
/* /*
* @brief Returns the full name of the given class. * @brief Returns the full name of the given class.
@ -271,7 +271,7 @@ eolian_class_file_get(const Eolian_Class klass);
* @ingroup Eolian * @ingroup Eolian
*/ */
EAPI const char * EAPI const char *
eolian_class_full_name_get(const Eolian_Class klass); eolian_class_full_name_get(const Eolian_Class *klass);
/* /*
* @brief Returns the name of the given class. * @brief Returns the name of the given class.
@ -282,7 +282,7 @@ eolian_class_full_name_get(const Eolian_Class klass);
* @ingroup Eolian * @ingroup Eolian
*/ */
EAPI const char * EAPI const char *
eolian_class_name_get(const Eolian_Class klass); eolian_class_name_get(const Eolian_Class *klass);
/* /*
* @brief Returns the namespaces list of the given class. * @brief Returns the namespaces list of the given class.
@ -293,7 +293,7 @@ eolian_class_name_get(const Eolian_Class klass);
* @ingroup Eolian * @ingroup Eolian
*/ */
EAPI const Eina_List * EAPI const Eina_List *
eolian_class_namespaces_list_get(const Eolian_Class klass); eolian_class_namespaces_list_get(const Eolian_Class *klass);
/* /*
* @brief Returns the class type of the given class * @brief Returns the class type of the given class
@ -303,7 +303,7 @@ eolian_class_namespaces_list_get(const Eolian_Class klass);
* *
* @ingroup Eolian * @ingroup Eolian
*/ */
EAPI Eolian_Class_Type eolian_class_type_get(const Eolian_Class klass); EAPI Eolian_Class_Type eolian_class_type_get(const Eolian_Class *klass);
/* /*
* @brief Returns a list of all the classes stored into the database. * @brief Returns a list of all the classes stored into the database.
@ -322,7 +322,7 @@ EAPI const Eina_List *eolian_all_classes_list_get(void);
* *
* @ingroup Eolian * @ingroup Eolian
*/ */
EAPI const char *eolian_class_description_get(const Eolian_Class klass); EAPI const char *eolian_class_description_get(const Eolian_Class *klass);
/* /*
* @brief Returns the legacy prefix of a class * @brief Returns the legacy prefix of a class
@ -332,7 +332,7 @@ EAPI const char *eolian_class_description_get(const Eolian_Class klass);
* *
* @ingroup Eolian * @ingroup Eolian
*/ */
EAPI const char *eolian_class_legacy_prefix_get(const Eolian_Class klass); EAPI const char *eolian_class_legacy_prefix_get(const Eolian_Class *klass);
/* /*
* @brief Returns the eo prefix of a class * @brief Returns the eo prefix of a class
@ -342,7 +342,7 @@ EAPI const char *eolian_class_legacy_prefix_get(const Eolian_Class klass);
* *
* @ingroup Eolian * @ingroup Eolian
*/ */
EAPI const char* eolian_class_eo_prefix_get(const Eolian_Class klass); EAPI const char* eolian_class_eo_prefix_get(const Eolian_Class *klass);
/* /*
* @brief Returns the data type of a class * @brief Returns the data type of a class
@ -353,7 +353,7 @@ EAPI const char* eolian_class_eo_prefix_get(const Eolian_Class klass);
* @ingroup Eolian * @ingroup Eolian
*/ */
EAPI const char* EAPI const char*
eolian_class_data_type_get(const Eolian_Class klass); eolian_class_data_type_get(const Eolian_Class *klass);
/* /*
* @brief Returns the names list of the inherit classes of a class * @brief Returns the names list of the inherit classes of a class
@ -363,7 +363,7 @@ eolian_class_data_type_get(const Eolian_Class klass);
* *
* @ingroup Eolian * @ingroup Eolian
*/ */
EAPI const Eina_List *eolian_class_inherits_list_get(const Eolian_Class klass); EAPI const Eina_List *eolian_class_inherits_list_get(const Eolian_Class *klass);
/* /*
* @brief Returns a list of functions of a class. * @brief Returns a list of functions of a class.
@ -374,7 +374,7 @@ EAPI const Eina_List *eolian_class_inherits_list_get(const Eolian_Class klass);
* *
* @ingroup Eolian * @ingroup Eolian
*/ */
EAPI const Eina_List *eolian_class_functions_list_get(const Eolian_Class klass, Eolian_Function_Type func_type); EAPI const Eina_List *eolian_class_functions_list_get(const Eolian_Class *klass, Eolian_Function_Type func_type);
/* /*
* @brief Returns the type of a function * @brief Returns the type of a function
@ -429,7 +429,7 @@ EAPI const char *eolian_function_full_c_name_get(Eolian_Function function_id, co
* *
* @ingroup Eolian * @ingroup Eolian
*/ */
EAPI Eolian_Function eolian_class_function_find_by_name(const Eolian_Class klass, const char *func_name, Eolian_Function_Type f_type); EAPI Eolian_Function eolian_class_function_find_by_name(const Eolian_Class *klass, const char *func_name, Eolian_Function_Type f_type);
/* /*
* @brief Returns a specific data for a function. * @brief Returns a specific data for a function.
@ -652,7 +652,7 @@ EAPI Eina_Stringshare * eolian_implement_full_name_get(const Eolian_Implement im
* @ingroup Eolian * @ingroup Eolian
*/ */
EAPI Eina_Bool eolian_implement_information_get(const Eolian_Implement impl, EAPI Eina_Bool eolian_implement_information_get(const Eolian_Implement impl,
Eolian_Class *klass, Eolian_Function *function, Eolian_Function_Type *type); Eolian_Class **klass, Eolian_Function *function, Eolian_Function_Type *type);
/* /*
* @brief Get the list of overriding functions defined in a class. * @brief Get the list of overriding functions defined in a class.
@ -662,7 +662,7 @@ EAPI Eina_Bool eolian_implement_information_get(const Eolian_Implement impl,
* *
* @ingroup Eolian * @ingroup Eolian
*/ */
EAPI const Eina_List *eolian_class_implements_list_get(const Eolian_Class klass); EAPI const Eina_List *eolian_class_implements_list_get(const Eolian_Class *klass);
/* /*
* @brief Get the list of events defined in a class. * @brief Get the list of events defined in a class.
@ -672,7 +672,7 @@ EAPI const Eina_List *eolian_class_implements_list_get(const Eolian_Class klass)
* *
* @ingroup Eolian * @ingroup Eolian
*/ */
EAPI const Eina_List *eolian_class_events_list_get(const Eolian_Class klass); EAPI const Eina_List *eolian_class_events_list_get(const Eolian_Class *klass);
/* /*
* @brief Get information about an event. * @brief Get information about an event.
@ -695,7 +695,7 @@ EAPI Eina_Bool eolian_class_event_information_get(Eolian_Event event, const char
* *
* @ingroup Eolian * @ingroup Eolian
*/ */
EAPI Eina_Bool eolian_class_ctor_enable_get(const Eolian_Class klass); EAPI Eina_Bool eolian_class_ctor_enable_get(const Eolian_Class *klass);
/* /*
* @brief Indicates if the class destructor has to invoke * @brief Indicates if the class destructor has to invoke
@ -706,7 +706,7 @@ EAPI Eina_Bool eolian_class_ctor_enable_get(const Eolian_Class klass);
* *
* @ingroup Eolian * @ingroup Eolian
*/ */
EAPI Eina_Bool eolian_class_dtor_enable_get(const Eolian_Class klass); EAPI Eina_Bool eolian_class_dtor_enable_get(const Eolian_Class *klass);
/* /*
* @brief Find the type for a certain alias * @brief Find the type for a certain alias

View File

@ -1204,7 +1204,7 @@ _db_fill_class(Eo_Class_Def *kls, const char *filename)
Eo_Event_Def *event; Eo_Event_Def *event;
Eo_Implement_Def *impl; Eo_Implement_Def *impl;
Eolian_Class class = database_class_add(kls->name, kls->type); Eolian_Class *class = database_class_add(kls->name, kls->type);
Eina_Bool is_iface = (kls->type == EOLIAN_CLASS_INTERFACE); Eina_Bool is_iface = (kls->type == EOLIAN_CLASS_INTERFACE);
database_class_file_set(class, filename); database_class_file_set(class, filename);

View File

@ -21,7 +21,7 @@ static Eina_Hash *_filenames = NULL; /* Hash: filename without extension -> full
static Eina_Hash *_tfilenames = NULL; static Eina_Hash *_tfilenames = NULL;
static int _database_init_count = 0; static int _database_init_count = 0;
typedef struct typedef struct _Eolian_Class
{ {
Eina_Stringshare *full_name; Eina_Stringshare *full_name;
Eina_List *namespaces; /* List Eina_Stringshare * */ Eina_List *namespaces; /* List Eina_Stringshare * */
@ -40,7 +40,7 @@ typedef struct
Eina_List *events; /* List event_name -> _Eolian_Event */ Eina_List *events; /* List event_name -> _Eolian_Event */
Eina_Bool class_ctor_enable:1; Eina_Bool class_ctor_enable:1;
Eina_Bool class_dtor_enable:1; Eina_Bool class_dtor_enable:1;
} _Eolian_Class; } Eolian_Class;
typedef struct typedef struct
{ {
@ -150,7 +150,7 @@ _fid_del(_Eolian_Function *fid)
} }
static void static void
_class_del(_Eolian_Class *class) _class_del(Eolian_Class *class)
{ {
Eina_Stringshare *inherit_name; Eina_Stringshare *inherit_name;
Eina_List *inherits = class->inherits; Eina_List *inherits = class->inherits;
@ -214,9 +214,9 @@ database_shutdown()
if (_database_init_count == 0) if (_database_init_count == 0)
{ {
Eolian_Class class; Eolian_Class *class;
EINA_LIST_FREE(_classes, class) EINA_LIST_FREE(_classes, class)
_class_del((_Eolian_Class *)class); _class_del(class);
eina_hash_free(_types); eina_hash_free(_types);
eina_hash_free(_structs); eina_hash_free(_structs);
eina_hash_free(_filenames); eina_hash_free(_filenames);
@ -271,13 +271,13 @@ eolian_type_struct_find_by_name(const char *name)
return tp; return tp;
} }
Eolian_Class Eolian_Class *
database_class_add(const char *class_name, Eolian_Class_Type type) database_class_add(const char *class_name, Eolian_Class_Type type)
{ {
char *full_name = strdup(class_name); char *full_name = strdup(class_name);
char *name = full_name; char *name = full_name;
char *colon = full_name; char *colon = full_name;
_Eolian_Class *cl = calloc(1, sizeof(*cl)); Eolian_Class *cl = calloc(1, sizeof(*cl));
cl->full_name = eina_stringshare_add(class_name); cl->full_name = eina_stringshare_add(class_name);
cl->type = type; cl->type = type;
do do
@ -295,58 +295,53 @@ database_class_add(const char *class_name, Eolian_Class_Type type)
cl->name = eina_stringshare_add(name); cl->name = eina_stringshare_add(name);
_classes = eina_list_append(_classes, cl); _classes = eina_list_append(_classes, cl);
free(full_name); free(full_name);
return (Eolian_Class)cl; return cl;
} }
Eina_Bool Eina_Bool
database_class_file_set(Eolian_Class class, const char *file_name) database_class_file_set(Eolian_Class *class, const char *file_name)
{ {
_Eolian_Class *cl = (_Eolian_Class *)class; EINA_SAFETY_ON_NULL_RETURN_VAL(class, EINA_FALSE);
EINA_SAFETY_ON_NULL_RETURN_VAL(cl, EINA_FALSE); class->file = eina_stringshare_add(file_name);
cl->file = eina_stringshare_add(file_name);
return EINA_TRUE; return EINA_TRUE;
} }
EAPI const char * EAPI const char *
eolian_class_file_get(const Eolian_Class class) eolian_class_file_get(const Eolian_Class *cl)
{ {
_Eolian_Class *cl = (_Eolian_Class *)class;
return cl ? cl->file : NULL; return cl ? cl->file : NULL;
} }
EAPI const char * EAPI const char *
eolian_class_full_name_get(const Eolian_Class class) eolian_class_full_name_get(const Eolian_Class *cl)
{ {
_Eolian_Class *cl = (_Eolian_Class *)class;
return cl ? cl->full_name : NULL; return cl ? cl->full_name : NULL;
} }
EAPI const char * EAPI const char *
eolian_class_name_get(const Eolian_Class class) eolian_class_name_get(const Eolian_Class *cl)
{ {
_Eolian_Class *cl = (_Eolian_Class *)class;
return cl ? cl->name : NULL; return cl ? cl->name : NULL;
} }
EAPI const Eina_List * EAPI const Eina_List *
eolian_class_namespaces_list_get(const Eolian_Class class) eolian_class_namespaces_list_get(const Eolian_Class *cl)
{ {
_Eolian_Class *cl = (_Eolian_Class *)class;
return cl ? cl->namespaces : NULL; return cl ? cl->namespaces : NULL;
} }
EAPI Eolian_Class EAPI Eolian_Class *
eolian_class_find_by_name(const char *class_name) eolian_class_find_by_name(const char *class_name)
{ {
Eina_List *itr; Eina_List *itr;
_Eolian_Class *cl; Eolian_Class *cl;
Eina_Stringshare *shr_name = eina_stringshare_add(class_name); Eina_Stringshare *shr_name = eina_stringshare_add(class_name);
EINA_LIST_FOREACH(_classes, itr, cl) EINA_LIST_FOREACH(_classes, itr, cl)
if (cl->full_name == shr_name) goto end; if (cl->full_name == shr_name) goto end;
cl = NULL; cl = NULL;
end: end:
eina_stringshare_del(shr_name); eina_stringshare_del(shr_name);
return (Eolian_Class)cl; return cl;
} }
/* /*
@ -354,12 +349,12 @@ end:
* ret true && class -> only one class corresponding * ret true && class -> only one class corresponding
* ret true && !class -> no class corresponding * ret true && !class -> no class corresponding
*/ */
Eina_Bool database_class_name_validate(const char *class_name, Eolian_Class *class) Eina_Bool database_class_name_validate(const char *class_name, Eolian_Class **class)
{ {
char *name = strdup(class_name); char *name = strdup(class_name);
char *colon = name + 1; char *colon = name + 1;
Eolian_Class found_class = NULL; Eolian_Class *found_class = NULL;
Eolian_Class candidate; Eolian_Class *candidate;
if (class) *class = NULL; if (class) *class = NULL;
do do
{ {
@ -371,8 +366,8 @@ Eina_Bool database_class_name_validate(const char *class_name, Eolian_Class *cla
if (found_class) if (found_class)
{ {
ERR("Name clash between class %s and class %s", ERR("Name clash between class %s and class %s",
((_Eolian_Class *)candidate)->full_name, candidate->full_name,
((_Eolian_Class *)found_class)->full_name); found_class->full_name);
free(name); free(name);
return EINA_FALSE; // Names clash return EINA_FALSE; // Names clash
} }
@ -386,34 +381,32 @@ Eina_Bool database_class_name_validate(const char *class_name, Eolian_Class *cla
return EINA_TRUE; return EINA_TRUE;
} }
EAPI Eolian_Class EAPI Eolian_Class *
eolian_class_find_by_file(const char *file_name) eolian_class_find_by_file(const char *file_name)
{ {
Eina_List *itr; Eina_List *itr;
_Eolian_Class *cl; Eolian_Class *cl;
Eina_Stringshare *shr_file = eina_stringshare_add(file_name); Eina_Stringshare *shr_file = eina_stringshare_add(file_name);
EINA_LIST_FOREACH(_classes, itr, cl) EINA_LIST_FOREACH(_classes, itr, cl)
if (cl->file == shr_file) goto end; if (cl->file == shr_file) goto end;
cl = NULL; cl = NULL;
end: end:
eina_stringshare_del(shr_file); eina_stringshare_del(shr_file);
return (Eolian_Class)cl; return cl;
} }
EAPI Eolian_Class_Type EAPI Eolian_Class_Type
eolian_class_type_get(const Eolian_Class class) eolian_class_type_get(const Eolian_Class *cl)
{ {
_Eolian_Class *cl = (_Eolian_Class *)class;
EINA_SAFETY_ON_NULL_RETURN_VAL(cl, EOLIAN_CLASS_UNKNOWN_TYPE); EINA_SAFETY_ON_NULL_RETURN_VAL(cl, EOLIAN_CLASS_UNKNOWN_TYPE);
return cl->type; return cl->type;
} }
Eina_Bool Eina_Bool
database_class_del(Eolian_Class class) database_class_del(Eolian_Class *cl)
{ {
_Eolian_Class *cl = (_Eolian_Class *)class;
EINA_SAFETY_ON_NULL_RETURN_VAL(cl, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(cl, EINA_FALSE);
_classes = eina_list_remove(_classes, class); _classes = eina_list_remove(_classes, cl);
_class_del(cl); _class_del(cl);
return EINA_TRUE; return EINA_TRUE;
} }
@ -425,91 +418,80 @@ eolian_all_classes_list_get(void)
} }
Eina_Bool Eina_Bool
database_class_inherit_add(Eolian_Class class, const char *inherit_class_name) database_class_inherit_add(Eolian_Class *cl, const char *inherit_class_name)
{ {
_Eolian_Class *cl = (_Eolian_Class *)class;
EINA_SAFETY_ON_NULL_RETURN_VAL(cl, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(cl, EINA_FALSE);
cl->inherits = eina_list_append(cl->inherits, eina_stringshare_add(inherit_class_name)); cl->inherits = eina_list_append(cl->inherits, eina_stringshare_add(inherit_class_name));
return EINA_TRUE; return EINA_TRUE;
} }
EAPI const char * EAPI const char *
eolian_class_description_get(const Eolian_Class class) eolian_class_description_get(const Eolian_Class *cl)
{ {
_Eolian_Class *cl = (_Eolian_Class *)class;
EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL); EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL);
return cl->description; return cl->description;
} }
void void
database_class_description_set(Eolian_Class class, const char *description) database_class_description_set(Eolian_Class *cl, const char *description)
{ {
_Eolian_Class *cl = (_Eolian_Class *)class;
EINA_SAFETY_ON_NULL_RETURN(cl); EINA_SAFETY_ON_NULL_RETURN(cl);
cl->description = eina_stringshare_add(description); cl->description = eina_stringshare_add(description);
} }
EAPI const char* EAPI const char*
eolian_class_legacy_prefix_get(const Eolian_Class class) eolian_class_legacy_prefix_get(const Eolian_Class *cl)
{ {
_Eolian_Class *cl = (_Eolian_Class *)class;
EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL); EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL);
return cl->legacy_prefix; return cl->legacy_prefix;
} }
void void
database_class_legacy_prefix_set(Eolian_Class class, const char *legacy_prefix) database_class_legacy_prefix_set(Eolian_Class *cl, const char *legacy_prefix)
{ {
_Eolian_Class *cl = (_Eolian_Class *)class;
EINA_SAFETY_ON_NULL_RETURN(cl); EINA_SAFETY_ON_NULL_RETURN(cl);
cl->legacy_prefix = eina_stringshare_add(legacy_prefix); cl->legacy_prefix = eina_stringshare_add(legacy_prefix);
} }
EAPI const char* EAPI const char*
eolian_class_eo_prefix_get(const Eolian_Class class) eolian_class_eo_prefix_get(const Eolian_Class *cl)
{ {
_Eolian_Class *cl = (_Eolian_Class *)class;
EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL); EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL);
return cl->eo_prefix; return cl->eo_prefix;
} }
void void
database_class_eo_prefix_set(Eolian_Class class, const char *eo_prefix) database_class_eo_prefix_set(Eolian_Class *cl, const char *eo_prefix)
{ {
_Eolian_Class *cl = (_Eolian_Class *)class;
EINA_SAFETY_ON_NULL_RETURN(cl); EINA_SAFETY_ON_NULL_RETURN(cl);
cl->eo_prefix = eina_stringshare_add(eo_prefix); cl->eo_prefix = eina_stringshare_add(eo_prefix);
} }
EAPI const char* EAPI const char*
eolian_class_data_type_get(const Eolian_Class class) eolian_class_data_type_get(const Eolian_Class *cl)
{ {
_Eolian_Class *cl = (_Eolian_Class *)class;
EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL); EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL);
return cl->data_type; return cl->data_type;
} }
void void
database_class_data_type_set(Eolian_Class class, const char *data_type) database_class_data_type_set(Eolian_Class *cl, const char *data_type)
{ {
_Eolian_Class *cl = (_Eolian_Class *)class;
EINA_SAFETY_ON_NULL_RETURN(cl); EINA_SAFETY_ON_NULL_RETURN(cl);
cl->data_type= eina_stringshare_add(data_type); cl->data_type = eina_stringshare_add(data_type);
} }
EAPI const Eina_List * EAPI const Eina_List *
eolian_class_inherits_list_get(const Eolian_Class class) eolian_class_inherits_list_get(const Eolian_Class *cl)
{ {
_Eolian_Class *cl = (_Eolian_Class *)class;
EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL); EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL);
//FIXME: create list here //FIXME: create list here
return cl->inherits; return cl->inherits;
} }
EAPI const Eina_List* EAPI const Eina_List*
eolian_class_implements_list_get(const Eolian_Class class) eolian_class_implements_list_get(const Eolian_Class *cl)
{ {
_Eolian_Class *cl = (_Eolian_Class *)class;
EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL); EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL);
return cl->implements; return cl->implements;
} }
@ -559,9 +541,8 @@ database_function_type_set(Eolian_Function function_id, Eolian_Function_Type foo
fid->type = foo_type; fid->type = foo_type;
} }
Eina_Bool database_class_function_add(Eolian_Class class, Eolian_Function foo_id) Eina_Bool database_class_function_add(Eolian_Class *cl, Eolian_Function foo_id)
{ {
_Eolian_Class *cl = (_Eolian_Class *)class;
EINA_SAFETY_ON_NULL_RETURN_VAL(cl, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(cl, EINA_FALSE);
EINA_SAFETY_ON_FALSE_RETURN_VAL(foo_id && cl, EINA_FALSE); EINA_SAFETY_ON_FALSE_RETURN_VAL(foo_id && cl, EINA_FALSE);
_Eolian_Function *fid = (_Eolian_Function *) foo_id; _Eolian_Function *fid = (_Eolian_Function *) foo_id;
@ -595,10 +576,9 @@ database_implement_new(const char *impl_name)
} }
Eina_Bool Eina_Bool
database_class_implement_add(Eolian_Class class, Eolian_Implement impl_desc) database_class_implement_add(Eolian_Class *cl, Eolian_Implement impl_desc)
{ {
EINA_SAFETY_ON_NULL_RETURN_VAL(impl_desc, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(impl_desc, EINA_FALSE);
_Eolian_Class *cl = (_Eolian_Class *)class;
EINA_SAFETY_ON_NULL_RETURN_VAL(cl, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(cl, EINA_FALSE);
cl->implements = eina_list_append(cl->implements, impl_desc); cl->implements = eina_list_append(cl->implements, impl_desc);
return EINA_TRUE; return EINA_TRUE;
@ -613,13 +593,13 @@ eolian_implement_full_name_get(const Eolian_Implement impl)
} }
EAPI Eina_Bool EAPI Eina_Bool
eolian_implement_information_get(const Eolian_Implement impl, Eolian_Class *class_out, Eolian_Function *func_out, Eolian_Function_Type *type_out) eolian_implement_information_get(const Eolian_Implement impl, Eolian_Class **class_out, Eolian_Function *func_out, Eolian_Function_Type *type_out)
{ {
_Eolian_Implement *_impl = (_Eolian_Implement *)impl; _Eolian_Implement *_impl = (_Eolian_Implement *)impl;
EINA_SAFETY_ON_NULL_RETURN_VAL(_impl, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(_impl, EINA_FALSE);
Eolian_Class class; Eolian_Class *class;
if (!database_class_name_validate(_impl->full_name, &class) || !class) return EINA_FALSE; if (!database_class_name_validate(_impl->full_name, &class) || !class) return EINA_FALSE;
const char *class_name = ((_Eolian_Class *)class)->full_name; const char *class_name = class->full_name;
if (class_out) *class_out = class; if (class_out) *class_out = class;
char *func_name = strdup(_impl->full_name + strlen(class_name) + 1); char *func_name = strdup(_impl->full_name + strlen(class_name) + 1);
@ -641,11 +621,10 @@ eolian_implement_information_get(const Eolian_Implement impl, Eolian_Class *clas
} }
EAPI Eolian_Function EAPI Eolian_Function
eolian_class_function_find_by_name(const Eolian_Class class, const char *func_name, Eolian_Function_Type f_type) eolian_class_function_find_by_name(const Eolian_Class *cl, const char *func_name, Eolian_Function_Type f_type)
{ {
Eina_List *itr; Eina_List *itr;
Eolian_Function foo_id; Eolian_Function foo_id;
_Eolian_Class *cl = (_Eolian_Class *)class;
if (!cl) return NULL; if (!cl) return NULL;
if (f_type == EOLIAN_UNRESOLVED || f_type == EOLIAN_METHOD) if (f_type == EOLIAN_UNRESOLVED || f_type == EOLIAN_METHOD)
@ -682,9 +661,8 @@ eolian_class_function_find_by_name(const Eolian_Class class, const char *func_na
} }
EAPI const Eina_List * EAPI const Eina_List *
eolian_class_functions_list_get(const Eolian_Class class, Eolian_Function_Type foo_type) eolian_class_functions_list_get(const Eolian_Class *cl, Eolian_Function_Type foo_type)
{ {
_Eolian_Class *cl = (_Eolian_Class *)class;
EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL); EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL);
switch (foo_type) switch (foo_type)
{ {
@ -1093,18 +1071,16 @@ database_event_free(Eolian_Event event)
} }
Eina_Bool Eina_Bool
database_class_event_add(Eolian_Class class, Eolian_Event event_desc) database_class_event_add(Eolian_Class *cl, Eolian_Event event_desc)
{ {
_Eolian_Class *cl = (_Eolian_Class *)class;
EINA_SAFETY_ON_FALSE_RETURN_VAL(event_desc && cl, EINA_FALSE); EINA_SAFETY_ON_FALSE_RETURN_VAL(event_desc && cl, EINA_FALSE);
cl->events = eina_list_append(cl->events, event_desc); cl->events = eina_list_append(cl->events, event_desc);
return EINA_TRUE; return EINA_TRUE;
} }
EAPI const Eina_List* EAPI const Eina_List*
eolian_class_events_list_get(const Eolian_Class class) eolian_class_events_list_get(const Eolian_Class *cl)
{ {
_Eolian_Class *cl = (_Eolian_Class *)class;
EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL); EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL);
return cl->events; return cl->events;
} }
@ -1121,35 +1097,31 @@ eolian_class_event_information_get(Eolian_Event event, const char **event_name,
} }
Eina_Bool Eina_Bool
database_class_ctor_enable_set(Eolian_Class class, Eina_Bool enable) database_class_ctor_enable_set(Eolian_Class *cl, Eina_Bool enable)
{ {
_Eolian_Class *cl = (_Eolian_Class *)class;
EINA_SAFETY_ON_NULL_RETURN_VAL(cl, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(cl, EINA_FALSE);
cl->class_ctor_enable = enable; cl->class_ctor_enable = enable;
return EINA_TRUE; return EINA_TRUE;
} }
Eina_Bool Eina_Bool
database_class_dtor_enable_set(Eolian_Class class, Eina_Bool enable) database_class_dtor_enable_set(Eolian_Class *cl, Eina_Bool enable)
{ {
_Eolian_Class *cl = (_Eolian_Class *)class;
EINA_SAFETY_ON_NULL_RETURN_VAL(cl, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(cl, EINA_FALSE);
cl->class_dtor_enable = enable; cl->class_dtor_enable = enable;
return EINA_TRUE; return EINA_TRUE;
} }
EAPI Eina_Bool EAPI Eina_Bool
eolian_class_ctor_enable_get(const Eolian_Class class) eolian_class_ctor_enable_get(const Eolian_Class *cl)
{ {
_Eolian_Class *cl = (_Eolian_Class *)class;
EINA_SAFETY_ON_NULL_RETURN_VAL(cl, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(cl, EINA_FALSE);
return cl->class_ctor_enable; return cl->class_ctor_enable;
} }
EAPI Eina_Bool EAPI Eina_Bool
eolian_class_dtor_enable_get(const Eolian_Class class) eolian_class_dtor_enable_get(const Eolian_Class *cl)
{ {
_Eolian_Class *cl = (_Eolian_Class *)class;
EINA_SAFETY_ON_NULL_RETURN_VAL(cl, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(cl, EINA_FALSE);
return cl->class_dtor_enable; return cl->class_dtor_enable;
} }
@ -1454,7 +1426,7 @@ database_type_print(Eolian_Type type)
static void static void
_implements_print(Eolian_Implement impl, int nb_spaces) _implements_print(Eolian_Implement impl, int nb_spaces)
{ {
Eolian_Class class; Eolian_Class *class;
Eolian_Function func; Eolian_Function func;
const char *t; const char *t;
Eolian_Function_Type ft; Eolian_Function_Type ft;
@ -1582,13 +1554,12 @@ static Eina_Bool _function_print(const _Eolian_Function *fid, int nb_spaces)
} }
static Eina_Bool static Eina_Bool
_class_print(const Eolian_Class class) _class_print(const Eolian_Class *cl)
{ {
Eina_List *itr; Eina_List *itr;
_Eolian_Function *function; _Eolian_Function *function;
const char *types[5] = {"", "Regular", "Regular Non Instantiable", "Mixin", "Interface"}; const char *types[5] = {"", "Regular", "Regular Non Instantiable", "Mixin", "Interface"};
_Eolian_Class *cl = (_Eolian_Class *)class;
EINA_SAFETY_ON_NULL_RETURN_VAL(cl, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(cl, EINA_FALSE);
printf("Class %s:\n", cl->name); printf("Class %s:\n", cl->name);
if (cl->description) if (cl->description)
@ -1666,12 +1637,12 @@ _class_print(const Eolian_Class class)
} }
EAPI Eina_Bool EAPI Eina_Bool
eolian_show(const Eolian_Class class) eolian_show(const Eolian_Class *class)
{ {
if (!class) if (!class)
{ {
Eina_List *itr; Eina_List *itr;
Eolian_Class cl; Eolian_Class *cl;
EINA_LIST_FOREACH(_classes, itr, cl) EINA_LIST_FOREACH(_classes, itr, cl)
_class_print(cl); _class_print(cl);
} }
@ -1757,7 +1728,7 @@ EAPI Eina_Bool
eolian_eo_file_parse(const char *filepath) eolian_eo_file_parse(const char *filepath)
{ {
const Eina_List *itr; const Eina_List *itr;
Eolian_Class class = eolian_class_find_by_file(filepath); Eolian_Class *class = eolian_class_find_by_file(filepath);
const char *inherit_name; const char *inherit_name;
Eolian_Implement impl; Eolian_Implement impl;
if (!class) if (!class)
@ -1792,7 +1763,7 @@ eolian_eo_file_parse(const char *filepath)
} }
EINA_LIST_FOREACH(eolian_class_implements_list_get(class), itr, impl) EINA_LIST_FOREACH(eolian_class_implements_list_get(class), itr, impl)
{ {
Eolian_Class impl_class; Eolian_Class *impl_class;
Eolian_Function impl_func; Eolian_Function impl_func;
Eolian_Function_Type impl_type = EOLIAN_UNRESOLVED; Eolian_Function_Type impl_type = EOLIAN_UNRESOLVED;
eolian_implement_information_get(impl, &impl_class, &impl_func, &impl_type); eolian_implement_information_get(impl, &impl_class, &impl_func, &impl_type);

View File

@ -41,34 +41,34 @@ Eina_Bool database_type_add(const char *alias, Eolian_Type type);
Eina_Bool database_struct_add(Eolian_Type type); Eina_Bool database_struct_add(Eolian_Type type);
/* Add a class in the database */ /* Add a class in the database */
Eolian_Class database_class_add(const char *class_name, Eolian_Class_Type type); Eolian_Class *database_class_add(const char *class_name, Eolian_Class_Type type);
/* Add a class from the database */ /* Add a class from the database */
Eina_Bool Eina_Bool
database_class_del(Eolian_Class class); database_class_del(Eolian_Class *class);
/* Add an inherit class name to a class */ /* Add an inherit class name to a class */
Eina_Bool database_class_inherit_add(Eolian_Class class, const char *inherit_class_name); Eina_Bool database_class_inherit_add(Eolian_Class *class, const char *inherit_class_name);
/* Set description of class. */ /* Set description of class. */
void void
database_class_description_set(Eolian_Class class, const char *description); database_class_description_set(Eolian_Class *class, const char *description);
/* Set legacy of class. */ /* Set legacy of class. */
void void
database_class_legacy_prefix_set(Eolian_Class class, const char *legacy_prefix); database_class_legacy_prefix_set(Eolian_Class *class, const char *legacy_prefix);
/* Set eo prefix of class. */ /* Set eo prefix of class. */
void void
database_class_eo_prefix_set(Eolian_Class class, const char *eo_prefix); database_class_eo_prefix_set(Eolian_Class *class, const char *eo_prefix);
/* Set data of class. */ /* Set data of class. */
void void
database_class_data_type_set(Eolian_Class class, const char *data_type); database_class_data_type_set(Eolian_Class *class, const char *data_type);
/* Set file of class */ /* Set file of class */
Eina_Bool Eina_Bool
database_class_file_set(Eolian_Class class, const char *file_name); database_class_file_set(Eolian_Class *class, const char *file_name);
/* Create a function */ /* Create a function */
Eolian_Function database_function_new(const char *function_name, Eolian_Function_Type foo_type); Eolian_Function database_function_new(const char *function_name, Eolian_Function_Type foo_type);
@ -77,7 +77,7 @@ Eolian_Function database_function_new(const char *function_name, Eolian_Function
void database_function_type_set(Eolian_Function function_id, Eolian_Function_Type foo_type); void database_function_type_set(Eolian_Function function_id, Eolian_Function_Type foo_type);
/* Add a function to a class */ /* Add a function to a class */
Eina_Bool database_class_function_add(Eolian_Class class, Eolian_Function foo_id); Eina_Bool database_class_function_add(Eolian_Class *class, Eolian_Function foo_id);
void database_function_data_set(Eolian_Function function_id, const char *key, const char *description); void database_function_data_set(Eolian_Function function_id, const char *key, const char *description);
@ -122,13 +122,13 @@ Eolian_Implement
database_implement_new(const char *impl_name); database_implement_new(const char *impl_name);
Eina_Bool Eina_Bool
database_class_implement_add(Eolian_Class class, Eolian_Implement impl_id); database_class_implement_add(Eolian_Class *class, Eolian_Implement impl_id);
Eina_Bool Eina_Bool
database_class_ctor_enable_set(Eolian_Class class, Eina_Bool enable); database_class_ctor_enable_set(Eolian_Class *class, Eina_Bool enable);
Eina_Bool Eina_Bool
database_class_dtor_enable_set(Eolian_Class class, Eina_Bool enable); database_class_dtor_enable_set(Eolian_Class *class, Eina_Bool enable);
Eolian_Event Eolian_Event
database_event_new(const char *event_name, const char *event_type, const char *event_desc); database_event_new(const char *event_name, const char *event_type, const char *event_desc);
@ -137,7 +137,7 @@ void
database_event_free(Eolian_Event event); database_event_free(Eolian_Event event);
Eina_Bool Eina_Bool
database_class_event_add(Eolian_Class class, Eolian_Event event_desc); database_class_event_add(Eolian_Class *class, Eolian_Event event_desc);
void void
database_type_print(Eolian_Type type); database_type_print(Eolian_Type type);