From d47610a7323dd357e57f26ca83014c7b39dd48e9 Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Tue, 16 Jan 2018 16:36:45 +0100 Subject: [PATCH] eolian: do not require unit when stringifying types As it is no longer necessary to pass unit when evaluating exprs, it is not necessary to pass it here either. Convert all the APIs to the new style and update all instances in our tree. --- src/bin/eolian/docs.c | 2 +- src/bin/eolian/headers.c | 16 +++--- src/bin/eolian/headers.h | 2 +- src/bin/eolian/main.c | 6 +-- src/bin/eolian/sources.c | 69 +++++++++++------------- src/bin/eolian/sources.h | 4 +- src/bin/eolian/types.c | 15 +++--- src/bin/eolian/types.h | 2 +- src/bindings/luajit/eolian.lua | 12 ++--- src/lib/eolian/Eolian.h | 6 +-- src/lib/eolian/database_type.c | 28 +++++----- src/lib/eolian/database_type_api.c | 9 ++-- src/lib/eolian/eolian_database.h | 4 +- src/lib/eolian_cxx/grammar/klass_def.hpp | 2 +- src/scripts/elua/apps/docgen/doctree.lua | 5 +- src/scripts/elua/modules/lualian.lua | 16 +++--- src/scripts/pyolian/eolian.py | 15 +++--- src/scripts/pyolian/eolian_lib.py | 14 +++-- src/tests/eolian/eolian_parsing.c | 38 ++++++------- 19 files changed, 123 insertions(+), 142 deletions(-) diff --git a/src/bin/eolian/docs.c b/src/bin/eolian/docs.c index a38ac19ff7..09e63bf9ac 100644 --- a/src/bin/eolian/docs.c +++ b/src/bin/eolian/docs.c @@ -377,7 +377,7 @@ eo_gen_docs_event_gen(const Eolian_Unit *src, const Eolian_Event *ev, if (rt) { p = buf; - Eina_Stringshare *rts = eolian_type_c_type_get(src, rt, EOLIAN_C_TYPE_DEFAULT); + Eina_Stringshare *rts = eolian_type_c_type_get(rt, EOLIAN_C_TYPE_DEFAULT); snprintf(buf, sizeof(buf), "@return %s", rts); eina_stringshare_del(rts); } diff --git a/src/bin/eolian/headers.c b/src/bin/eolian/headers.c index 8ed0c8e675..319dffd50c 100644 --- a/src/bin/eolian/headers.c +++ b/src/bin/eolian/headers.c @@ -12,13 +12,13 @@ _get_add_star(Eolian_Function_Type ftype, Eolian_Parameter_Dir pdir) } static int -_gen_param(const Eolian_Unit *src, Eina_Strbuf *buf, - Eolian_Function_Parameter *pr, Eolian_Function_Type ftype, int *rpid) +_gen_param(Eina_Strbuf *buf, Eolian_Function_Parameter *pr, + Eolian_Function_Type ftype, int *rpid) { const Eolian_Type *prt = eolian_parameter_type_get(pr); const Eolian_Typedecl *ptd = eolian_type_typedecl_get(prt); const char *prn = eolian_parameter_name_get(pr); - Eina_Stringshare *prtn = eolian_type_c_type_get(src, prt, EOLIAN_C_TYPE_PARAM); + Eina_Stringshare *prtn = eolian_type_c_type_get(prt, EOLIAN_C_TYPE_PARAM); if (ptd && (eolian_typedecl_type_get(ptd) == EOLIAN_TYPEDECL_FUNCTION_POINTER)) { @@ -40,7 +40,7 @@ _gen_param(const Eolian_Unit *src, Eina_Strbuf *buf, } void -eo_gen_params(const Eolian_Unit *src, Eina_Iterator *itr, Eina_Strbuf *buf, +eo_gen_params(Eina_Iterator *itr, Eina_Strbuf *buf, Eina_Strbuf **flagbuf, int *nidx, Eolian_Function_Type ftype) { Eolian_Function_Parameter *pr; @@ -49,7 +49,7 @@ eo_gen_params(const Eolian_Unit *src, Eina_Iterator *itr, Eina_Strbuf *buf, int rpid = 0; if (*nidx) eina_strbuf_append(buf, ", "); - *nidx += _gen_param(src, buf, pr, ftype, &rpid); + *nidx += _gen_param(buf, pr, ftype, &rpid); if (!eolian_parameter_is_nonull(pr) || !flagbuf) continue; @@ -112,7 +112,7 @@ _gen_func(const Eolian_Unit *src, const Eolian_Function *fid, eina_strbuf_append(buf, legacy ? "EAPI " : "EOAPI "); if (rtp) { - Eina_Stringshare *rtps = eolian_type_c_type_get(src, rtp, EOLIAN_C_TYPE_RETURN); + Eina_Stringshare *rtps = eolian_type_c_type_get(rtp, EOLIAN_C_TYPE_RETURN); eina_strbuf_append(buf, rtps); if (rtps[strlen(rtps) - 1] != '*') eina_strbuf_append_char(buf, ' '); @@ -141,7 +141,7 @@ _gen_func(const Eolian_Unit *src, const Eolian_Function *fid, eina_strbuf_append(buf, "Eo *obj"); } - eo_gen_params(src, eolian_property_keys_get(fid, ftype), buf, &flagbuf, &nidx, EOLIAN_PROPERTY); + eo_gen_params(eolian_property_keys_get(fid, ftype), buf, &flagbuf, &nidx, EOLIAN_PROPERTY); if (!var_as_ret) { @@ -150,7 +150,7 @@ _gen_func(const Eolian_Unit *src, const Eolian_Function *fid, itr = eolian_property_values_get(fid, ftype); else itr = eolian_function_parameters_get(fid); - eo_gen_params(src, itr, buf, &flagbuf, &nidx, ftype); + eo_gen_params(itr, buf, &flagbuf, &nidx, ftype); } if (flagbuf) diff --git a/src/bin/eolian/headers.h b/src/bin/eolian/headers.h index 41c7658b96..56e4b4ffdf 100644 --- a/src/bin/eolian/headers.h +++ b/src/bin/eolian/headers.h @@ -3,7 +3,7 @@ #include "main.h" -void eo_gen_params(const Eolian_Unit *src, Eina_Iterator *itr, Eina_Strbuf *buf, Eina_Strbuf **flagbuf, int *nidx, Eolian_Function_Type ftype); +void eo_gen_params(Eina_Iterator *itr, Eina_Strbuf *buf, Eina_Strbuf **flagbuf, int *nidx, Eolian_Function_Type ftype); void eo_gen_header_gen(const Eolian_Unit *src, const Eolian_Class *cl, Eina_Strbuf *buf, Eina_Bool legacy); #endif diff --git a/src/bin/eolian/main.c b/src/bin/eolian/main.c index 4c51e18d17..63c9e7d67a 100644 --- a/src/bin/eolian/main.c +++ b/src/bin/eolian/main.c @@ -386,8 +386,8 @@ _write_source(const Eolian *eos, const Eolian_Unit *src, const char *ofname, Eina_Strbuf *buf = eina_strbuf_new(); const Eolian_Class *cl = eolian_class_get_by_file(src, ifname); - eo_gen_types_source_gen(src, eolian_declarations_get_by_file(eos, ifname), buf); - eo_gen_source_gen(src, cl, buf); + eo_gen_types_source_gen(eolian_declarations_get_by_file(eos, ifname), buf); + eo_gen_source_gen(cl, buf); if (cl || (eot && eina_strbuf_length_get(buf))) { if (_write_file(ofname, buf)) @@ -414,7 +414,7 @@ _write_impl(const Eolian_Unit *src, const char *ofname, const char *ifname) if (!_read_file(ofname, &buf)) return EINA_FALSE; - eo_gen_impl_gen(src, cl, buf); + eo_gen_impl_gen(cl, buf); Eina_Bool ret = _write_file(ofname, buf); eina_strbuf_free(buf); return ret; diff --git a/src/bin/eolian/sources.c b/src/bin/eolian/sources.c index c430eb70df..d590ae5812 100644 --- a/src/bin/eolian/sources.c +++ b/src/bin/eolian/sources.c @@ -103,8 +103,7 @@ _gen_func_pointer_param(const char *name, Eina_Stringshare *c_type, } static void -_append_defval(const Eolian_Unit *src, Eina_Strbuf *buf, - const Eolian_Expression *exp, const Eolian_Type *tp) +_append_defval(Eina_Strbuf *buf, const Eolian_Expression *exp, const Eolian_Type *tp) { if (exp) { @@ -140,7 +139,7 @@ _append_defval(const Eolian_Unit *src, Eina_Strbuf *buf, free(sn); return; } - Eina_Stringshare *ctp = eolian_type_c_type_get(src, btp, EOLIAN_C_TYPE_DEFAULT); + Eina_Stringshare *ctp = eolian_type_c_type_get(btp, EOLIAN_C_TYPE_DEFAULT); if (strchr(ctp, '*')) { eina_strbuf_append(buf, "NULL"); @@ -182,7 +181,7 @@ _generate_loop_content(Eina_Strbuf **buf, const Eolian_Type *inner_type, const E } static void -_generate_iterative_free(const Eolian_Unit *src, Eina_Strbuf **buf, const Eolian_Type *type, const Eolian_Type *inner_type, Eolian_Function_Parameter *parameter, Eina_Strbuf *param) +_generate_iterative_free(Eina_Strbuf **buf, const Eolian_Type *type, const Eolian_Type *inner_type, Eolian_Function_Parameter *parameter, Eina_Strbuf *param) { Eina_Strbuf *iterator_header, *iter_param; @@ -194,7 +193,7 @@ _generate_iterative_free(const Eolian_Unit *src, Eina_Strbuf **buf, const Eolian eina_strbuf_append_printf(iter_param, "%s_iter", eolian_parameter_name_get(parameter)); //generate the field definition - eina_strbuf_append_printf(*buf, " %s", eolian_type_c_type_get(src, inner_type, EOLIAN_C_TYPE_DEFAULT)); + eina_strbuf_append_printf(*buf, " %s", eolian_type_c_type_get(inner_type, EOLIAN_C_TYPE_DEFAULT)); if(t == EOLIAN_TYPE_BUILTIN_INARRAY || t == EOLIAN_TYPE_BUILTIN_INLIST) { @@ -269,9 +268,9 @@ _generate_iterative_free(const Eolian_Unit *src, Eina_Strbuf **buf, const Eolian } static void -_gen_func(const Eolian_Unit *src, const Eolian_Class *cl, - const Eolian_Function *fid, Eolian_Function_Type ftype, - Eina_Strbuf *buf, const Eolian_Implement *impl, Eina_Strbuf *lbuf) +_gen_func(const Eolian_Class *cl, const Eolian_Function *fid, + Eolian_Function_Type ftype, Eina_Strbuf *buf, + const Eolian_Implement *impl, Eina_Strbuf *lbuf) { Eina_Bool is_empty = eolian_implement_is_empty(impl, ftype); Eina_Bool is_auto = eolian_implement_is_auto(impl, ftype); @@ -328,7 +327,7 @@ _gen_func(const Eolian_Unit *src, const Eolian_Class *cl, { const char *prn = eolian_parameter_name_get(pr); const Eolian_Type *pt = eolian_parameter_type_get(pr); - Eina_Stringshare *ptn = eolian_type_c_type_get(src, pt, EOLIAN_C_TYPE_PARAM); + Eina_Stringshare *ptn = eolian_type_c_type_get(pt, EOLIAN_C_TYPE_PARAM); if (eina_strbuf_length_get(params)) eina_strbuf_append(params, ", "); @@ -400,7 +399,7 @@ _gen_func(const Eolian_Unit *src, const Eolian_Class *cl, } else if (inner_type && eolian_type_is_owned(inner_type)) { - _generate_iterative_free(src, &fallback_free_ownership, type, inner_type, pr, param_call); + _generate_iterative_free(&fallback_free_ownership, type, inner_type, pr, param_call); } } eina_iterator_free(itr); @@ -429,7 +428,7 @@ _gen_func(const Eolian_Unit *src, const Eolian_Class *cl, const Eolian_Expression *dfv = eolian_parameter_default_value_get(pr); const char *prn = eolian_parameter_name_get(pr); const Eolian_Type *pt = eolian_parameter_type_get(pr); - Eina_Stringshare *ptn = eolian_type_c_type_get(src, pt, EOLIAN_C_TYPE_PARAM); + Eina_Stringshare *ptn = eolian_type_c_type_get(pt, EOLIAN_C_TYPE_PARAM); const Eolian_Typedecl *ptd = eolian_type_typedecl_get(pt); Eina_Bool had_star = ptn[strlen(ptn) - 1] == '*'; @@ -501,7 +500,7 @@ _gen_func(const Eolian_Unit *src, const Eolian_Class *cl, if (impl_same_class && eolian_implement_is_pure_virtual(impl, ftype)) impl_need = EINA_FALSE; - Eina_Stringshare *rtpn = rtp ? eolian_type_c_type_get(src, rtp, EOLIAN_C_TYPE_RETURN) + Eina_Stringshare *rtpn = rtp ? eolian_type_c_type_get(rtp, EOLIAN_C_TYPE_RETURN) : eina_stringshare_add("void"); char *cname = NULL, *cnamel = NULL, *ocnamel = NULL; @@ -585,7 +584,7 @@ _gen_func(const Eolian_Unit *src, const Eolian_Class *cl, if (rtp) { eina_strbuf_append(buf, " return "); - _append_defval(src, buf, def_ret, rtp); + _append_defval(buf, def_ret, rtp); eina_strbuf_append(buf, ";\n"); } eina_strbuf_append(buf, "}\n\n"); @@ -660,7 +659,7 @@ _gen_func(const Eolian_Unit *src, const Eolian_Class *cl, if (strcmp(rtpn, "void")) { eina_strbuf_append_printf(buf, ", %s, ", rtpn); - _append_defval(src, buf, def_ret, rtp); + _append_defval(buf, def_ret, rtp); } if (fallback_free_ownership) @@ -872,8 +871,7 @@ _gen_initializer(const Eolian_Class *cl, Eina_Strbuf *buf) } void -eo_gen_source_gen(const Eolian_Unit *src, - const Eolian_Class *cl, Eina_Strbuf *buf) +eo_gen_source_gen(const Eolian_Class *cl, Eina_Strbuf *buf) { if (!cl) return; @@ -918,14 +916,14 @@ eo_gen_source_gen(const Eolian_Unit *src, { case EOLIAN_PROP_GET: case EOLIAN_PROP_SET: - _gen_func(src, cl, fid, ftype, buf, imp, lbuf); + _gen_func(cl, fid, ftype, buf, imp, lbuf); break; case EOLIAN_PROPERTY: - _gen_func(src, cl, fid, EOLIAN_PROP_SET, buf, imp, lbuf); - _gen_func(src, cl, fid, EOLIAN_PROP_GET, buf, imp, lbuf); + _gen_func(cl, fid, EOLIAN_PROP_SET, buf, imp, lbuf); + _gen_func(cl, fid, EOLIAN_PROP_GET, buf, imp, lbuf); break; default: - _gen_func(src, cl, fid, EOLIAN_METHOD, buf, imp, lbuf); + _gen_func(cl, fid, EOLIAN_METHOD, buf, imp, lbuf); } } eina_iterator_free(itr); @@ -1018,9 +1016,8 @@ eo_gen_source_gen(const Eolian_Unit *src, } static void -_gen_params(const Eolian_Unit *src, const Eolian_Function *fid, - Eolian_Function_Type ftype, Eina_Bool var_as_ret, - Eina_Strbuf *params, Eina_Strbuf *params_full) +_gen_params(const Eolian_Function *fid, Eolian_Function_Type ftype, + Eina_Bool var_as_ret, Eina_Strbuf *params, Eina_Strbuf *params_full) { Eina_Bool is_prop = (ftype == EOLIAN_PROP_GET || ftype == EOLIAN_PROP_SET); @@ -1032,7 +1029,7 @@ _gen_params(const Eolian_Unit *src, const Eolian_Function *fid, { const char *prn = eolian_parameter_name_get(pr); const Eolian_Type *pt = eolian_parameter_type_get(pr); - Eina_Stringshare *ptn = eolian_type_c_type_get(src, pt, EOLIAN_C_TYPE_PARAM); + Eina_Stringshare *ptn = eolian_type_c_type_get(pt, EOLIAN_C_TYPE_PARAM); eina_strbuf_append(params, ", "); eina_strbuf_append(params, prn); @@ -1062,7 +1059,7 @@ _gen_params(const Eolian_Unit *src, const Eolian_Function *fid, const char *prn = eolian_parameter_name_get(pr); const Eolian_Type *pt = eolian_parameter_type_get(pr); const Eolian_Typedecl *ptd = eolian_type_typedecl_get(pt); - Eina_Stringshare *ptn = eolian_type_c_type_get(src, pt, EOLIAN_C_TYPE_PARAM); + Eina_Stringshare *ptn = eolian_type_c_type_get(pt, EOLIAN_C_TYPE_PARAM); if (ptd && eolian_typedecl_type_get(ptd) == EOLIAN_TYPEDECL_FUNCTION_POINTER) { @@ -1093,10 +1090,9 @@ _gen_params(const Eolian_Unit *src, const Eolian_Function *fid, } static void -_gen_proto(const Eolian_Unit *src, const Eolian_Class *cl, - const Eolian_Function *fid, Eolian_Function_Type ftype, - Eina_Strbuf *buf, const Eolian_Implement *impl, const char *dtype, - const char *cnamel) +_gen_proto(const Eolian_Class *cl, const Eolian_Function *fid, + Eolian_Function_Type ftype, Eina_Strbuf *buf, + const Eolian_Implement *impl, const char *dtype, const char *cnamel) { Eina_Bool impl_same_class = (eolian_implement_class_get(impl) == cl); if (impl_same_class && eolian_implement_is_pure_virtual(impl, ftype)) @@ -1142,7 +1138,7 @@ _gen_proto(const Eolian_Unit *src, const Eolian_Class *cl, eina_strbuf_append(buf, "EOLIAN static "); if (rtp) { - Eina_Stringshare *rtpn = eolian_type_c_type_get(src, rtp, EOLIAN_C_TYPE_RETURN); + Eina_Stringshare *rtpn = eolian_type_c_type_get(rtp, EOLIAN_C_TYPE_RETURN); eina_strbuf_append(buf, rtpn); eina_stringshare_del(rtpn); } @@ -1163,7 +1159,7 @@ _gen_proto(const Eolian_Unit *src, const Eolian_Class *cl, /* gen params here */ Eina_Strbuf *params = eina_strbuf_new(); Eina_Strbuf *params_full = eina_strbuf_new(); - _gen_params(src, fid, ftype, var_as_ret, params, params_full); + _gen_params(fid, ftype, var_as_ret, params, params_full); if (eina_strbuf_length_get(params_full)) eina_strbuf_append(buf, eina_strbuf_string_get(params_full)); @@ -1193,8 +1189,7 @@ _gen_proto(const Eolian_Unit *src, const Eolian_Class *cl, } void -eo_gen_impl_gen(const Eolian_Unit *src, - const Eolian_Class *cl, Eina_Strbuf *buf) +eo_gen_impl_gen(const Eolian_Class *cl, Eina_Strbuf *buf) { if (!cl) return; @@ -1244,14 +1239,14 @@ eo_gen_impl_gen(const Eolian_Unit *src, { case EOLIAN_PROP_GET: case EOLIAN_PROP_SET: - _gen_proto(src, cl, fid, ftype, buf, imp, dt, cnamel); + _gen_proto(cl, fid, ftype, buf, imp, dt, cnamel); break; case EOLIAN_PROPERTY: - _gen_proto(src, cl, fid, EOLIAN_PROP_SET, buf, imp, dt, cnamel); - _gen_proto(src, cl, fid, EOLIAN_PROP_GET, buf, imp, dt, cnamel); + _gen_proto(cl, fid, EOLIAN_PROP_SET, buf, imp, dt, cnamel); + _gen_proto(cl, fid, EOLIAN_PROP_GET, buf, imp, dt, cnamel); break; default: - _gen_proto(src, cl, fid, EOLIAN_METHOD, buf, imp, dt, cnamel); + _gen_proto(cl, fid, EOLIAN_METHOD, buf, imp, dt, cnamel); } } eina_iterator_free(itr); diff --git a/src/bin/eolian/sources.h b/src/bin/eolian/sources.h index 7d2e8d3db0..05d711458b 100644 --- a/src/bin/eolian/sources.h +++ b/src/bin/eolian/sources.h @@ -3,7 +3,7 @@ #include "main.h" -void eo_gen_source_gen(const Eolian_Unit *src, const Eolian_Class *cl, Eina_Strbuf *buf); -void eo_gen_impl_gen(const Eolian_Unit *src, const Eolian_Class *cl, Eina_Strbuf *buf); +void eo_gen_source_gen(const Eolian_Class *cl, Eina_Strbuf *buf); +void eo_gen_impl_gen(const Eolian_Class *cl, Eina_Strbuf *buf); #endif diff --git a/src/bin/eolian/types.c b/src/bin/eolian/types.c index fc57ba0d37..8040911a87 100644 --- a/src/bin/eolian/types.c +++ b/src/bin/eolian/types.c @@ -19,7 +19,7 @@ _type_generate(const Eolian_Unit *src, const Eolian_Typedecl *tp, { case EOLIAN_TYPEDECL_ALIAS: { - Eina_Stringshare *tn = eolian_typedecl_c_type_get(src, tp); + Eina_Stringshare *tn = eolian_typedecl_c_type_get(tp); eina_strbuf_append(buf, tn); eina_stringshare_del(tn); break; @@ -41,7 +41,7 @@ _type_generate(const Eolian_Unit *src, const Eolian_Typedecl *tp, { const Eolian_Type *mtp = eolian_typedecl_struct_field_type_get(memb); Eina_Stringshare *ct = NULL; - ct = eolian_type_c_type_get(src, mtp, EOLIAN_C_TYPE_DEFAULT); + ct = eolian_type_c_type_get(mtp, EOLIAN_C_TYPE_DEFAULT); eina_strbuf_append_printf(buf, " %s%s%s;", ct, strchr(ct, '*') ? "" : " ", eolian_typedecl_struct_field_name_get(memb)); @@ -135,7 +135,7 @@ _type_generate(const Eolian_Unit *src, const Eolian_Typedecl *tp, eina_strbuf_append(buf, "void "); else { - Eina_Stringshare *ct = eolian_type_c_type_get(src, rtp, EOLIAN_C_TYPE_RETURN); + Eina_Stringshare *ct = eolian_type_c_type_get(rtp, EOLIAN_C_TYPE_RETURN); eina_strbuf_append_printf(buf, "%s ", ct); } @@ -147,7 +147,7 @@ _type_generate(const Eolian_Unit *src, const Eolian_Typedecl *tp, /* Parameters */ eina_strbuf_append(buf, "(void *data"); int nidx = 1; - eo_gen_params(src, eolian_function_parameters_get(fid), buf, NULL, &nidx, EOLIAN_FUNCTION_POINTER); + eo_gen_params(eolian_function_parameters_get(fid), buf, NULL, &nidx, EOLIAN_FUNCTION_POINTER); eina_strbuf_append(buf, ")"); break; @@ -195,7 +195,7 @@ _var_generate(const Eolian_Unit *src, const Eolian_Variable *vr, Eina_Bool legac } else { - Eina_Stringshare *ct = eolian_type_c_type_get(src, vt, EOLIAN_C_TYPE_DEFAULT); + Eina_Stringshare *ct = eolian_type_c_type_get(vt, EOLIAN_C_TYPE_DEFAULT); eina_strbuf_append_printf(buf, "EWAPI extern %s %s;", ct, fn); eina_stringshare_del(ct); } @@ -257,8 +257,7 @@ void eo_gen_types_header_gen(const Eolian_Unit *src, eina_iterator_free(itr); } -void eo_gen_types_source_gen(const Eolian_Unit *src, - Eina_Iterator *itr, Eina_Strbuf *buf) +void eo_gen_types_source_gen(Eina_Iterator *itr, Eina_Strbuf *buf) { const Eolian_Declaration *decl; EINA_ITERATOR_FOREACH(itr, decl) @@ -285,7 +284,7 @@ void eo_gen_types_source_gen(const Eolian_Unit *src, eina_str_toupper(&fn); const Eolian_Type *vt = eolian_variable_base_type_get(vr); - Eina_Stringshare *ct = eolian_type_c_type_get(src, vt, EOLIAN_C_TYPE_DEFAULT); + Eina_Stringshare *ct = eolian_type_c_type_get(vt, EOLIAN_C_TYPE_DEFAULT); eina_strbuf_append_printf(buf, "EWAPI %s %s = ", ct, fn); eina_stringshare_del(ct); free(fn); diff --git a/src/bin/eolian/types.h b/src/bin/eolian/types.h index 7ad56673b9..35d5905a74 100644 --- a/src/bin/eolian/types.h +++ b/src/bin/eolian/types.h @@ -2,7 +2,7 @@ #define EOLIAN_GEN_TYPES_H void eo_gen_types_header_gen(const Eolian_Unit *src, Eina_Iterator *itr, Eina_Strbuf *buf, Eina_Bool full, Eina_Bool legacy); -void eo_gen_types_source_gen(const Eolian_Unit *src, Eina_Iterator *itr, Eina_Strbuf *buf); +void eo_gen_types_source_gen(Eina_Iterator *itr, Eina_Strbuf *buf); Eina_Strbuf *eo_gen_class_typedef_gen(const Eolian_Unit *src, const char *eof); #endif diff --git a/src/bindings/luajit/eolian.lua b/src/bindings/luajit/eolian.lua index 70a0763534..773d302a55 100644 --- a/src/bindings/luajit/eolian.lua +++ b/src/bindings/luajit/eolian.lua @@ -411,8 +411,8 @@ ffi.cdef [[ Eina_Bool eolian_typedecl_is_extern(const Eolian_Typedecl *tp); - const char *eolian_type_c_type_get(const Eolian_Unit *unit, const Eolian_Type *tp, Eolian_C_Type_Type ctype); - const char *eolian_typedecl_c_type_get(const Eolian_Unit *unit, const Eolian_Typedecl *tp); + const char *eolian_type_c_type_get(const Eolian_Type *tp, Eolian_C_Type_Type ctype); + const char *eolian_typedecl_c_type_get(const Eolian_Typedecl *tp); const char *eolian_type_name_get(const Eolian_Type *tp); const char *eolian_typedecl_name_get(const Eolian_Typedecl *tp); @@ -776,8 +776,8 @@ M.Typedecl = ffi.metatype("Eolian_Typedecl", { return eolian.eolian_typedecl_is_extern(self) ~= 0 end, - c_type_get = function(self, unit) - local v = eolian.eolian_typedecl_c_type_get(unit, self) + c_type_get = function(self) + local v = eolian.eolian_typedecl_c_type_get(self) if v == nil then return nil end return ffi_stringshare(v) end, @@ -871,8 +871,8 @@ M.Type = ffi.metatype("Eolian_Type", { return eolian.eolian_type_is_ptr(self) ~= 0 end, - c_type_get = function(self, unit, ctype) - local v = eolian.eolian_type_c_type_get(unit, self, ctype) + c_type_get = function(self, ctype) + local v = eolian.eolian_type_c_type_get(self, ctype) if v == nil then return nil end return ffi_stringshare(v) end, diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h index 9c6f2de9fe..2688dd71a8 100644 --- a/src/lib/eolian/Eolian.h +++ b/src/lib/eolian/Eolian.h @@ -1827,7 +1827,6 @@ EAPI Eina_Bool eolian_typedecl_is_extern(const Eolian_Typedecl *tp); /* * @brief Get the full C type name of the given type. * - * @param[in] unit the unit to look in * @param[in] tp the type declaration. * @return The C type name assuming @c tp is not NULL. * @@ -1837,7 +1836,7 @@ EAPI Eina_Bool eolian_typedecl_is_extern(const Eolian_Typedecl *tp); * * @ingroup Eolian */ -EAPI Eina_Stringshare *eolian_typedecl_c_type_get(const Eolian_Unit *unit, const Eolian_Typedecl *tp); +EAPI Eina_Stringshare *eolian_typedecl_c_type_get(const Eolian_Typedecl *tp); /* * @brief Get the name of the given type declaration. Keep in mind that the @@ -2024,7 +2023,6 @@ EAPI Eina_Bool eolian_type_is_ptr(const Eolian_Type *tp); /* * @brief Get the full C type name of the given type. * - * @param[in] unit the unit to look in * @param[in] tp the type. * @param[in] ctype the context within which the C type string will be used. * @return The C type name assuming @c tp is not NULL. @@ -2035,7 +2033,7 @@ EAPI Eina_Bool eolian_type_is_ptr(const Eolian_Type *tp); * * @ingroup Eolian */ -EAPI Eina_Stringshare *eolian_type_c_type_get(const Eolian_Unit *unit, const Eolian_Type *tp, Eolian_C_Type_Type ctype); +EAPI Eina_Stringshare *eolian_type_c_type_get(const Eolian_Type *tp, Eolian_C_Type_Type ctype); /* * @brief Get the name of the given type. For regular types, this is for diff --git a/src/lib/eolian/database_type.c b/src/lib/eolian/database_type.c index 17651e6b39..178b8f8e05 100644 --- a/src/lib/eolian/database_type.c +++ b/src/lib/eolian/database_type.c @@ -103,7 +103,7 @@ _buf_add_suffix(Eina_Strbuf *buf, const char *suffix) } void -database_type_to_str(const Eolian_Unit *src, const Eolian_Type *tp, +database_type_to_str(const Eolian_Type *tp, Eina_Strbuf *buf, const char *name, Eolian_C_Type_Type ctype) { @@ -111,7 +111,7 @@ database_type_to_str(const Eolian_Unit *src, const Eolian_Type *tp, || tp->type == EOLIAN_TYPE_CLASS || tp->type == EOLIAN_TYPE_VOID) && tp->is_const - && ((ctype != EOLIAN_C_TYPE_RETURN) || database_type_is_ownable(src, tp))) + && ((ctype != EOLIAN_C_TYPE_RETURN) || database_type_is_ownable(NULL, tp))) { eina_strbuf_append(buf, "const "); } @@ -138,7 +138,7 @@ database_type_to_str(const Eolian_Unit *src, const Eolian_Type *tp, else { /* handles arrays and pointers as they all serialize to pointers */ - database_type_to_str(src, tp->base_type, buf, NULL, + database_type_to_str(tp->base_type, buf, NULL, EOLIAN_C_TYPE_DEFAULT); _buf_add_suffix(buf, "*"); if (tp->is_const && (ctype != EOLIAN_C_TYPE_RETURN)) @@ -152,8 +152,7 @@ database_type_to_str(const Eolian_Unit *src, const Eolian_Type *tp, } static void -_stype_to_str(const Eolian_Unit *src, const Eolian_Typedecl *tp, - Eina_Strbuf *buf) +_stype_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf) { Eolian_Struct_Type_Field *sf; Eina_List *l; @@ -170,7 +169,7 @@ _stype_to_str(const Eolian_Unit *src, const Eolian_Typedecl *tp, eina_strbuf_append(buf, " { "); EINA_LIST_FOREACH(tp->field_list, l, sf) { - database_type_to_str(src, sf->type, buf, sf->name, + database_type_to_str(sf->type, buf, sf->name, EOLIAN_C_TYPE_DEFAULT); eina_strbuf_append(buf, "; "); } @@ -178,8 +177,7 @@ _stype_to_str(const Eolian_Unit *src, const Eolian_Typedecl *tp, } static void -_etype_to_str(const Eolian_Unit *src, const Eolian_Typedecl *tp, - Eina_Strbuf *buf) +_etype_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf) { Eolian_Enum_Type_Field *ef; Eina_List *l; @@ -226,8 +224,7 @@ _append_name(const Eolian_Typedecl *tp, Eina_Strbuf *buf) } static void -_atype_to_str(const Eolian_Unit *src, const Eolian_Typedecl *tp, - Eina_Strbuf *buf) +_atype_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf) { eina_strbuf_append(buf, "typedef "); @@ -244,26 +241,25 @@ _atype_to_str(const Eolian_Unit *src, const Eolian_Typedecl *tp, Eina_Strbuf *fulln = eina_strbuf_new(); _append_name(tp, fulln); - database_type_to_str(src, tp->base_type, buf, eina_strbuf_string_get(fulln), + database_type_to_str(tp->base_type, buf, eina_strbuf_string_get(fulln), EOLIAN_C_TYPE_DEFAULT); eina_strbuf_free(fulln); } void -database_typedecl_to_str(const Eolian_Unit *src, const Eolian_Typedecl *tp, - Eina_Strbuf *buf) +database_typedecl_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf) { switch (tp->type) { case EOLIAN_TYPEDECL_ALIAS: - _atype_to_str(src, tp, buf); + _atype_to_str(tp, buf); break; case EOLIAN_TYPEDECL_ENUM: - _etype_to_str(src, tp, buf); + _etype_to_str(tp, buf); break; case EOLIAN_TYPEDECL_STRUCT: case EOLIAN_TYPEDECL_STRUCT_OPAQUE: - _stype_to_str(src, tp, buf); + _stype_to_str(tp, buf); break; default: break; diff --git a/src/lib/eolian/database_type_api.c b/src/lib/eolian/database_type_api.c index cb128910c7..510cae835d 100644 --- a/src/lib/eolian/database_type_api.c +++ b/src/lib/eolian/database_type_api.c @@ -338,27 +338,26 @@ eolian_typedecl_is_extern(const Eolian_Typedecl *tp) } EAPI Eina_Stringshare * -eolian_type_c_type_get(const Eolian_Unit *unit, const Eolian_Type *tp, - Eolian_C_Type_Type ctype) +eolian_type_c_type_get(const Eolian_Type *tp, Eolian_C_Type_Type ctype) { Eina_Stringshare *ret; Eina_Strbuf *buf; EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL); buf = eina_strbuf_new(); - database_type_to_str(unit, tp, buf, NULL, ctype); + database_type_to_str(tp, buf, NULL, ctype); ret = eina_stringshare_add(eina_strbuf_string_get(buf)); eina_strbuf_free(buf); return ret; } EAPI Eina_Stringshare * -eolian_typedecl_c_type_get(const Eolian_Unit *unit, const Eolian_Typedecl *tp) +eolian_typedecl_c_type_get(const Eolian_Typedecl *tp) { Eina_Stringshare *ret; Eina_Strbuf *buf; EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL); buf = eina_strbuf_new(); - database_typedecl_to_str(unit, tp, buf); + database_typedecl_to_str(tp, buf); ret = eina_stringshare_add(eina_strbuf_string_get(buf)); eina_strbuf_free(buf); return ret; diff --git a/src/lib/eolian/eolian_database.h b/src/lib/eolian/eolian_database.h index 166511a264..d6393a9462 100644 --- a/src/lib/eolian/eolian_database.h +++ b/src/lib/eolian/eolian_database.h @@ -341,8 +341,8 @@ void database_enum_add(Eolian *state, Eolian_Typedecl *tp); void database_type_del(Eolian_Type *tp); void database_typedecl_del(Eolian_Typedecl *tp); -void database_type_to_str(const Eolian_Unit *src, const Eolian_Type *tp, Eina_Strbuf *buf, const char *name, Eolian_C_Type_Type ctype); -void database_typedecl_to_str(const Eolian_Unit *src, const Eolian_Typedecl *tp, Eina_Strbuf *buf); +void database_type_to_str(const Eolian_Type *tp, Eina_Strbuf *buf, const char *name, Eolian_C_Type_Type ctype); +void database_typedecl_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf); Eolian_Typedecl *database_type_decl_find(const Eolian_Unit *src, const Eolian_Type *tp); diff --git a/src/lib/eolian_cxx/grammar/klass_def.hpp b/src/lib/eolian_cxx/grammar/klass_def.hpp index c59b39af73..ee9fccbf39 100644 --- a/src/lib/eolian_cxx/grammar/klass_def.hpp +++ b/src/lib/eolian_cxx/grammar/klass_def.hpp @@ -339,7 +339,7 @@ type_def const void_ {attributes::regular_type_def{"void", {qualifier_info::is_n inline void type_def::set(Eolian_Type const* eolian_type, Eolian_Unit const* unit, Eolian_C_Type_Type ctype) { - c_type = ::eolian_type_c_type_get(unit, eolian_type, ctype); + c_type = ::eolian_type_c_type_get(eolian_type, ctype); // ::eina_stringshare_del(stringshare); // this crashes Eolian_Type const* stp = eolian_type_base_type_get(eolian_type); has_own = !!::eolian_type_is_owned(eolian_type); diff --git a/src/scripts/elua/apps/docgen/doctree.lua b/src/scripts/elua/apps/docgen/doctree.lua index fda2e12d50..2e96d4f794 100644 --- a/src/scripts/elua/apps/docgen/doctree.lua +++ b/src/scripts/elua/apps/docgen/doctree.lua @@ -743,7 +743,7 @@ M.Type = Node:clone { end, c_type_get = function(self) - return self.type:c_type_get(eos:unit_get(), eolian.c_type_type.DEFAULT) + return self.type:c_type_get(eolian.c_type_type.DEFAULT) end, name_get = function(self) @@ -906,8 +906,7 @@ M.Typedecl = Node:clone { end, c_type_get = function(self) - -- FIXME: unit - return self.typedecl:c_type_get(eos:unit_get()) + return self.typedecl:c_type_get() end, name_get = function(self) diff --git a/src/scripts/elua/modules/lualian.lua b/src/scripts/elua/modules/lualian.lua index b8b32a830c..3864bd1d02 100644 --- a/src/scripts/elua/modules/lualian.lua +++ b/src/scripts/elua/modules/lualian.lua @@ -102,7 +102,7 @@ end local typeconv = function(tps, expr, isin) if tps:type_get() == type_type.POINTER then local base = tps:base_type_get() - local f = (isin and known_ptr_in or known_ptr_out)[base:c_type_get(gen_unit, eolian.c_type_type.DEFAULT)] + local f = (isin and known_ptr_in or known_ptr_out)[base:c_type_get(eolian.c_type_type.DEFAULT)] if f then return f(expr) end return build_calln(tps, expr, isin) end @@ -188,7 +188,7 @@ local Method = Node:clone { local proto = { name = meth:name_get() } - proto.ret_type = rett and rett:c_type_get(gen_unit, eolian.c_type_type.RETURN) or "void" + proto.ret_type = rett and rett:c_type_get(eolian.c_type_type.RETURN) or "void" local args, cargs, vargs = { "self" }, {}, {} proto.args, proto.cargs, proto.vargs = args, cargs, vargs local rets = {} @@ -206,7 +206,7 @@ local Method = Node:clone { for v in pars do local dir, tps, nm = v:direction_get(), v:type_get(), kw_t(v:name_get()) - local tp = tps:c_type_get(gen_unit, eolian.c_type_type.PARAM) + local tp = tps:c_type_get(eolian.c_type_type.PARAM) if dir == param_dir.OUT or dir == param_dir.INOUT then if dir == param_dir.INOUT then args[#args + 1] = nm @@ -283,7 +283,7 @@ local Property = Method:clone { nkeys = #keys, nvals = #vals } - proto.ret_type = rett and rett:c_type_get(gen_unit, eolian.c_type_type.RETURN) or "void" + proto.ret_type = rett and rett:c_type_get(eolian.c_type_type.RETURN) or "void" local args, cargs, vargs = { "self" }, {}, {} proto.args, proto.cargs, proto.vargs = args, cargs, vargs local rets = {} @@ -298,7 +298,7 @@ local Property = Method:clone { for i, v in ipairs(keys) do local nm = kw_t(v:name_get()) local tps = v:type_get() - local tp = tps:c_type_get(gen_unit, eolian.c_type_type.PARAM) + local tp = tps:c_type_get(eolian.c_type_type.PARAM) args [#args + 1] = nm cargs[#cargs + 1] = tp .. " " .. nm vargs[#vargs + 1] = typeconv(tps, nm, true) @@ -310,13 +310,13 @@ local Property = Method:clone { if self.isget then if #vals == 1 and not rett then local tps = vals[1]:type_get() - proto.ret_type = tps:c_type_get(gen_unit, eolian.c_type_type.PARAM) + proto.ret_type = tps:c_type_get(eolian.c_type_type.PARAM) rets[#rets + 1] = typeconv(tps, "v", false) else for i, v in ipairs(vals) do local dir, tps, nm = v:direction_get(), v:type_get(), kw_t(v:name_get()) - local tp = tps:c_type_get(gen_unit, eolian.c_type_type.PARAM) + local tp = tps:c_type_get(eolian.c_type_type.PARAM) cargs [#cargs + 1] = tp .. " *" .. nm vargs [#vargs + 1] = nm allocs[#allocs + 1] = { tp, nm } @@ -327,7 +327,7 @@ local Property = Method:clone { for i, v in ipairs(vals) do local dir, tps, nm = v:direction_get(), v:type_get(), kw_t(v:name_get()) - local tp = tps:c_type_get(gen_unit, eolian.c_type_type.PARAM) + local tp = tps:c_type_get(eolian.c_type_type.PARAM) args [#args + 1] = nm cargs[#cargs + 1] = tp .. " " .. nm vargs[#vargs + 1] = typeconv(tps, nm, true) diff --git a/src/scripts/pyolian/eolian.py b/src/scripts/pyolian/eolian.py index 934437b773..9ac479807f 100644 --- a/src/scripts/pyolian/eolian.py +++ b/src/scripts/pyolian/eolian.py @@ -1026,7 +1026,7 @@ class Implement(EolianBaseObject): return not self.is_property -class Type(EolianBaseObject): # OK (1 TODO Unit*) +class Type(EolianBaseObject): def __repr__(self): # return "".format(self) return "".format(self) @@ -1059,11 +1059,9 @@ class Type(EolianBaseObject): # OK (1 TODO Unit*) def builtin_type(self): return Eolian_Type_Builtin_Type(lib.eolian_type_builtin_type_get(self._obj)) - # TODO FIXME STRANGE API (need Eolian_Unit*) @cached_property def c_type(self): - # return _str_to_py(lib.eolian_type_c_type_get(self._obj)) - return 'FIXME' + return _str_to_py(lib.eolian_type_c_type_get(self._obj)) @cached_property def typedecl(self): @@ -1107,7 +1105,7 @@ class Type(EolianBaseObject): # OK (1 TODO Unit*) return bool(lib.eolian_type_is_ptr(self._obj)) -class Typedecl(EolianBaseObject): # OK (1 TODO Unit*) +class Typedecl(EolianBaseObject): def __repr__(self): return "".format(self) @@ -1127,10 +1125,9 @@ class Typedecl(EolianBaseObject): # OK (1 TODO Unit*) def type(self): return Eolian_Typedecl_Type(lib.eolian_typedecl_type_get(self._obj)) - # TODO FIX THIS, need Eolian_Unit* param ??? - # @cached_property - # def c_type(self): - # return _str_to_py(lib.eolian_typedecl_c_type_get(self._obj)) + @cached_property + def c_type(self): + return _str_to_py(lib.eolian_typedecl_c_type_get(self._obj)) @property def namespaces(self): diff --git a/src/scripts/pyolian/eolian_lib.py b/src/scripts/pyolian/eolian_lib.py index bd17374d40..42bea97c56 100644 --- a/src/scripts/pyolian/eolian_lib.py +++ b/src/scripts/pyolian/eolian_lib.py @@ -504,10 +504,9 @@ lib.eolian_typedecl_aliased_base_get.restype = c_void_p lib.eolian_typedecl_is_extern.argtypes = [c_void_p,] lib.eolian_typedecl_is_extern.restype = c_bool -# TODO FIXME STRANGE API (need Eolian_Unit*) -# EAPI Eina_Stringshare *eolian_typedecl_c_type_get(const Eolian_Unit *unit, const Eolian_Typedecl *tp); -# lib.eolian_typedecl_c_type_get.argtypes = [c_void_p,] -# lib.eolian_typedecl_c_type_get.restype = None +# EAPI Eina_Stringshare *eolian_typedecl_c_type_get(const Eolian_Typedecl *tp); +lib.eolian_typedecl_c_type_get.argtypes = [c_void_p,] +lib.eolian_typedecl_c_type_get.restype = None # EAPI Eina_Stringshare *eolian_typedecl_name_get(const Eolian_Typedecl *tp); lib.eolian_typedecl_name_get.argtypes = [c_void_p,] @@ -573,10 +572,9 @@ lib.eolian_type_is_const.restype = c_bool lib.eolian_type_is_ptr.argtypes = [c_void_p,] lib.eolian_type_is_ptr.restype = c_bool -# TODO FIXME STRANGE API (need Eolian_Unit*) -# EAPI Eina_Stringshare *eolian_type_c_type_get(const Eolian_Unit *unit, const Eolian_Type *tp, Eolian_C_Type_Type ctype); -# lib.eolian_type_c_type_get.argtypes = [c_void_p,] -# lib.eolian_type_c_type_get.restype = c_void_p # Stringshare TO BE FREED +# EAPI Eina_Stringshare *eolian_type_c_type_get(const Eolian_Type *tp, Eolian_C_Type_Type ctype); +lib.eolian_type_c_type_get.argtypes = [c_void_p,] +lib.eolian_type_c_type_get.restype = c_void_p # Stringshare TO BE FREED # EAPI Eina_Stringshare *eolian_type_name_get(const Eolian_Type *tp); lib.eolian_type_name_get.argtypes = [c_void_p,] diff --git a/src/tests/eolian/eolian_parsing.c b/src/tests/eolian/eolian_parsing.c index 8ec67560d3..7c75be94da 100644 --- a/src/tests/eolian/eolian_parsing.c +++ b/src/tests/eolian/eolian_parsing.c @@ -348,7 +348,7 @@ START_TEST(eolian_typedef) fail_if(eolian_typedecl_type_get(tdl) != EOLIAN_TYPEDECL_ALIAS); fail_if(!(type_name = eolian_typedecl_name_get(tdl))); fail_if(strcmp(type_name, "Coord")); - fail_if(!(type_name = eolian_typedecl_c_type_get(unit, tdl))); + fail_if(!(type_name = eolian_typedecl_c_type_get(tdl))); fail_if(strcmp(type_name, "typedef int Evas_Coord")); eina_stringshare_del(type_name); fail_if(!(type = eolian_typedecl_base_type_get(tdl))); @@ -372,13 +372,13 @@ START_TEST(eolian_typedef) fail_if(!(type_name = eolian_typedecl_name_get(tdl))); fail_if(strcmp(type_name, "List_Objects")); fail_if(!(type = eolian_typedecl_base_type_get(tdl))); - fail_if(!(type_name = eolian_type_c_type_get(unit, type, EOLIAN_C_TYPE_DEFAULT))); + fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_DEFAULT))); fail_if(eolian_type_is_owned(type)); fail_if(strcmp(type_name, "Eina_List *")); eina_stringshare_del(type_name); fail_if(!(type = eolian_type_base_type_get(type))); fail_if(!!eolian_type_next_type_get(type)); - fail_if(!(type_name = eolian_type_c_type_get(unit, type, EOLIAN_C_TYPE_DEFAULT))); + fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_DEFAULT))); fail_if(strcmp(type_name, "Eo *")); fail_if(eolian_type_is_owned(type)); eina_stringshare_del(type_name); @@ -428,21 +428,21 @@ START_TEST(eolian_complex_type) /* Properties return type */ fail_if(!(fid = eolian_class_function_get_by_name(class, "a", EOLIAN_PROPERTY))); fail_if(!(type = eolian_function_return_type_get(fid, EOLIAN_PROP_SET))); - fail_if(!(type_name = eolian_type_c_type_get(unit, type, EOLIAN_C_TYPE_RETURN))); + fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_RETURN))); fail_if(!eolian_type_is_owned(type)); fail_if(eolian_type_builtin_type_get(type) != EOLIAN_TYPE_BUILTIN_LIST); fail_if(strcmp(type_name, "Eina_List *")); eina_stringshare_del(type_name); fail_if(!(type = eolian_type_base_type_get(type))); fail_if(!!eolian_type_next_type_get(type)); - fail_if(!(type_name = eolian_type_c_type_get(unit, type, EOLIAN_C_TYPE_DEFAULT))); + fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_DEFAULT))); fail_if(eolian_type_is_owned(type)); fail_if(eolian_type_builtin_type_get(type) != EOLIAN_TYPE_BUILTIN_ARRAY); fail_if(strcmp(type_name, "Eina_Array *")); eina_stringshare_del(type_name); fail_if(!(type = eolian_type_base_type_get(type))); fail_if(!!eolian_type_next_type_get(type)); - fail_if(!(type_name = eolian_type_c_type_get(unit, type, EOLIAN_C_TYPE_DEFAULT))); + fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_DEFAULT))); fail_if(!eolian_type_is_owned(type)); fail_if(strcmp(type_name, "Eo *")); eina_stringshare_del(type_name); @@ -453,13 +453,13 @@ START_TEST(eolian_complex_type) eina_iterator_free(iter); fail_if(strcmp(eolian_parameter_name_get(param), "value")); fail_if(!(type = eolian_parameter_type_get(param))); - fail_if(!(type_name = eolian_type_c_type_get(unit, type, EOLIAN_C_TYPE_PARAM))); + fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_PARAM))); fail_if(!eolian_type_is_owned(type)); fail_if(strcmp(type_name, "Eina_List *")); eina_stringshare_del(type_name); fail_if(!(type = eolian_type_base_type_get(type))); fail_if(!!eolian_type_next_type_get(type)); - fail_if(!(type_name = eolian_type_c_type_get(unit, type, EOLIAN_C_TYPE_DEFAULT))); + fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_DEFAULT))); fail_if(eolian_type_is_owned(type)); fail_if(strcmp(type_name, "const char *")); eina_stringshare_del(type_name); @@ -467,13 +467,13 @@ START_TEST(eolian_complex_type) /* Methods return type */ fail_if(!(fid = eolian_class_function_get_by_name(class, "foo", EOLIAN_METHOD))); fail_if(!(type = eolian_function_return_type_get(fid, EOLIAN_METHOD))); - fail_if(!(type_name = eolian_type_c_type_get(unit, type, EOLIAN_C_TYPE_RETURN))); + fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_RETURN))); fail_if(!eolian_type_is_owned(type)); fail_if(strcmp(type_name, "Eina_List *")); eina_stringshare_del(type_name); fail_if(!(type = eolian_type_base_type_get(type))); fail_if(!!eolian_type_next_type_get(type)); - fail_if(!(type_name = eolian_type_c_type_get(unit, type, EOLIAN_C_TYPE_DEFAULT))); + fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_DEFAULT))); fail_if(eolian_type_is_owned(type)); fail_if(eolian_type_builtin_type_get(type) != EOLIAN_TYPE_BUILTIN_STRINGSHARE); fail_if(strcmp(type_name, "Eina_Stringshare *")); @@ -485,7 +485,7 @@ START_TEST(eolian_complex_type) eina_iterator_free(iter); fail_if(strcmp(eolian_parameter_name_get(param), "buf")); fail_if(!(type = eolian_parameter_type_get(param))); - fail_if(!(type_name = eolian_type_c_type_get(unit, type, EOLIAN_C_TYPE_PARAM))); + fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_PARAM))); fail_if(!eolian_type_is_owned(type)); fail_if(eolian_type_builtin_type_get(type) != EOLIAN_TYPE_BUILTIN_MSTRING); fail_if(strcmp(type_name, "char *")); @@ -621,7 +621,7 @@ START_TEST(eolian_simple_parsing) /* Function return */ tp = eolian_function_return_type_get(fid, EOLIAN_METHOD); fail_if(!tp); - string = eolian_type_c_type_get(unit, tp, EOLIAN_C_TYPE_RETURN); + string = eolian_type_c_type_get(tp, EOLIAN_C_TYPE_RETURN); fail_if(!string); fail_if(strcmp(string, "char *")); eina_stringshare_del(string); @@ -708,7 +708,7 @@ START_TEST(eolian_struct) fail_if(!(field = eolian_typedecl_struct_field_get(tdl, "something"))); fail_if(!(ftype = eolian_typedecl_struct_field_type_get(field))); fail_if(eolian_type_is_ptr(ftype)); - fail_if(!(type_name = eolian_type_c_type_get(unit, ftype, EOLIAN_C_TYPE_DEFAULT))); + fail_if(!(type_name = eolian_type_c_type_get(ftype, EOLIAN_C_TYPE_DEFAULT))); fail_if(strcmp(type_name, "const char *")); eina_stringshare_del(type_name); @@ -1468,20 +1468,20 @@ START_TEST(eolian_function_types) fail_if(strcmp(eolian_function_name_get(fid), "SimpleFunc")); fail_if(!(type = eolian_function_return_type_get(fid, EOLIAN_FUNCTION_POINTER))); // void is null_return_type? - fail_if(!(type_name = eolian_type_c_type_get(unit, type, EOLIAN_C_TYPE_RETURN))); + fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_RETURN))); fail_if(strcmp(type_name, "const char *")); fail_if(!(iter = (eolian_function_parameters_get(fid)))); fail_if(!(eina_iterator_next(iter, (void**)¶m))); fail_if(strcmp(eolian_parameter_name_get(param), "a")); fail_if(!(type = eolian_parameter_type_get(param))); - fail_if(!(type_name = eolian_type_c_type_get(unit, type, EOLIAN_C_TYPE_PARAM))); + fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_PARAM))); fail_if(strcmp(type_name, "int")); fail_if(!(eina_iterator_next(iter, (void**)¶m))); fail_if(strcmp(eolian_parameter_name_get(param), "b")); fail_if(!(type = eolian_parameter_type_get(param))); - fail_if(!(type_name = eolian_type_c_type_get(unit, type, EOLIAN_C_TYPE_PARAM))); + fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_PARAM))); fail_if(strcmp(type_name, "double")); fail_if(eina_iterator_next(iter, &dummy)); @@ -1494,7 +1494,7 @@ START_TEST(eolian_function_types) fail_if(eolian_function_type_get(fid) != EOLIAN_FUNCTION_POINTER); fail_if(!(type = eolian_function_return_type_get(fid, EOLIAN_FUNCTION_POINTER))); - fail_if(!(type_name = eolian_type_c_type_get(unit, type, EOLIAN_C_TYPE_RETURN))); + fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_RETURN))); fail_if(strcmp(type_name, "double")); fail_if(!(iter = (eolian_function_parameters_get(fid)))); @@ -1504,7 +1504,7 @@ START_TEST(eolian_function_types) fail_if(!(type = eolian_parameter_type_get(param))); fail_if(eolian_parameter_direction_get(param) != EOLIAN_IN_PARAM); fail_if(eolian_type_is_owned(type)); - fail_if(!(type_name = eolian_type_c_type_get(unit, type, EOLIAN_C_TYPE_PARAM))); + fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_PARAM))); fail_if(strcmp(type_name, "const char *")); /*out own string */ @@ -1513,7 +1513,7 @@ START_TEST(eolian_function_types) fail_if(eolian_parameter_direction_get(param) != EOLIAN_OUT_PARAM); fail_if(!(type = eolian_parameter_type_get(param))); fail_if(!eolian_type_is_owned(type)); - fail_if(!(type_name = eolian_type_c_type_get(unit, type, EOLIAN_C_TYPE_PARAM))); + fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_PARAM))); fail_if(strcmp(type_name, "char *")); fail_if(eina_iterator_next(iter, &dummy));