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.
This commit is contained in:
parent
dd2e579fec
commit
d47610a732
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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 "<eolian.Type '{0.full_name}', type: {0.type!s}, c_type: '{0.c_type}'>".format(self)
|
||||
return "<eolian.Type '{0.full_name}', type={0.type!s}>".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 "<eolian.Typedecl '{0.full_name}', type={0.type!s}>".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):
|
||||
|
|
|
@ -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,]
|
||||
|
|
|
@ -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));
|
||||
|
|
Loading…
Reference in New Issue