diff options
author | Daniel Kolesa <d.kolesa@osg.samsung.com> | 2018-01-16 16:36:45 +0100 |
---|---|---|
committer | Daniel Kolesa <d.kolesa@osg.samsung.com> | 2018-01-16 16:39:05 +0100 |
commit | d47610a7323dd357e57f26ca83014c7b39dd48e9 (patch) | |
tree | c218e79bd8519a7a567c68dd3386a2cffa94e340 /src | |
parent | dd2e579fecbe6ec4d1e0e7d46c82daff39be03c5 (diff) |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/eolian/docs.c | 2 | ||||
-rw-r--r-- | src/bin/eolian/headers.c | 16 | ||||
-rw-r--r-- | src/bin/eolian/headers.h | 2 | ||||
-rw-r--r-- | src/bin/eolian/main.c | 6 | ||||
-rw-r--r-- | src/bin/eolian/sources.c | 69 | ||||
-rw-r--r-- | src/bin/eolian/sources.h | 4 | ||||
-rw-r--r-- | src/bin/eolian/types.c | 15 | ||||
-rw-r--r-- | src/bin/eolian/types.h | 2 | ||||
-rw-r--r-- | src/bindings/luajit/eolian.lua | 12 | ||||
-rw-r--r-- | src/lib/eolian/Eolian.h | 6 | ||||
-rw-r--r-- | src/lib/eolian/database_type.c | 28 | ||||
-rw-r--r-- | src/lib/eolian/database_type_api.c | 9 | ||||
-rw-r--r-- | src/lib/eolian/eolian_database.h | 4 | ||||
-rw-r--r-- | src/lib/eolian_cxx/grammar/klass_def.hpp | 2 | ||||
-rw-r--r-- | src/scripts/elua/apps/docgen/doctree.lua | 5 | ||||
-rw-r--r-- | src/scripts/elua/modules/lualian.lua | 16 | ||||
-rw-r--r-- | src/scripts/pyolian/eolian.py | 15 | ||||
-rw-r--r-- | src/scripts/pyolian/eolian_lib.py | 14 | ||||
-rw-r--r-- | 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, | |||
377 | if (rt) | 377 | if (rt) |
378 | { | 378 | { |
379 | p = buf; | 379 | p = buf; |
380 | Eina_Stringshare *rts = eolian_type_c_type_get(src, rt, EOLIAN_C_TYPE_DEFAULT); | 380 | Eina_Stringshare *rts = eolian_type_c_type_get(rt, EOLIAN_C_TYPE_DEFAULT); |
381 | snprintf(buf, sizeof(buf), "@return %s", rts); | 381 | snprintf(buf, sizeof(buf), "@return %s", rts); |
382 | eina_stringshare_del(rts); | 382 | eina_stringshare_del(rts); |
383 | } | 383 | } |
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) | |||
12 | } | 12 | } |
13 | 13 | ||
14 | static int | 14 | static int |
15 | _gen_param(const Eolian_Unit *src, Eina_Strbuf *buf, | 15 | _gen_param(Eina_Strbuf *buf, Eolian_Function_Parameter *pr, |
16 | Eolian_Function_Parameter *pr, Eolian_Function_Type ftype, int *rpid) | 16 | Eolian_Function_Type ftype, int *rpid) |
17 | { | 17 | { |
18 | const Eolian_Type *prt = eolian_parameter_type_get(pr); | 18 | const Eolian_Type *prt = eolian_parameter_type_get(pr); |
19 | const Eolian_Typedecl *ptd = eolian_type_typedecl_get(prt); | 19 | const Eolian_Typedecl *ptd = eolian_type_typedecl_get(prt); |
20 | const char *prn = eolian_parameter_name_get(pr); | 20 | const char *prn = eolian_parameter_name_get(pr); |
21 | Eina_Stringshare *prtn = eolian_type_c_type_get(src, prt, EOLIAN_C_TYPE_PARAM); | 21 | Eina_Stringshare *prtn = eolian_type_c_type_get(prt, EOLIAN_C_TYPE_PARAM); |
22 | 22 | ||
23 | if (ptd && (eolian_typedecl_type_get(ptd) == EOLIAN_TYPEDECL_FUNCTION_POINTER)) | 23 | if (ptd && (eolian_typedecl_type_get(ptd) == EOLIAN_TYPEDECL_FUNCTION_POINTER)) |
24 | { | 24 | { |
@@ -40,7 +40,7 @@ _gen_param(const Eolian_Unit *src, Eina_Strbuf *buf, | |||
40 | } | 40 | } |
41 | 41 | ||
42 | void | 42 | void |
43 | eo_gen_params(const Eolian_Unit *src, Eina_Iterator *itr, Eina_Strbuf *buf, | 43 | eo_gen_params(Eina_Iterator *itr, Eina_Strbuf *buf, |
44 | Eina_Strbuf **flagbuf, int *nidx, Eolian_Function_Type ftype) | 44 | Eina_Strbuf **flagbuf, int *nidx, Eolian_Function_Type ftype) |
45 | { | 45 | { |
46 | Eolian_Function_Parameter *pr; | 46 | Eolian_Function_Parameter *pr; |
@@ -49,7 +49,7 @@ eo_gen_params(const Eolian_Unit *src, Eina_Iterator *itr, Eina_Strbuf *buf, | |||
49 | int rpid = 0; | 49 | int rpid = 0; |
50 | if (*nidx) | 50 | if (*nidx) |
51 | eina_strbuf_append(buf, ", "); | 51 | eina_strbuf_append(buf, ", "); |
52 | *nidx += _gen_param(src, buf, pr, ftype, &rpid); | 52 | *nidx += _gen_param(buf, pr, ftype, &rpid); |
53 | 53 | ||
54 | if (!eolian_parameter_is_nonull(pr) || !flagbuf) | 54 | if (!eolian_parameter_is_nonull(pr) || !flagbuf) |
55 | continue; | 55 | continue; |
@@ -112,7 +112,7 @@ _gen_func(const Eolian_Unit *src, const Eolian_Function *fid, | |||
112 | eina_strbuf_append(buf, legacy ? "EAPI " : "EOAPI "); | 112 | eina_strbuf_append(buf, legacy ? "EAPI " : "EOAPI "); |
113 | if (rtp) | 113 | if (rtp) |
114 | { | 114 | { |
115 | Eina_Stringshare *rtps = eolian_type_c_type_get(src, rtp, EOLIAN_C_TYPE_RETURN); | 115 | Eina_Stringshare *rtps = eolian_type_c_type_get(rtp, EOLIAN_C_TYPE_RETURN); |
116 | eina_strbuf_append(buf, rtps); | 116 | eina_strbuf_append(buf, rtps); |
117 | if (rtps[strlen(rtps) - 1] != '*') | 117 | if (rtps[strlen(rtps) - 1] != '*') |
118 | eina_strbuf_append_char(buf, ' '); | 118 | eina_strbuf_append_char(buf, ' '); |
@@ -141,7 +141,7 @@ _gen_func(const Eolian_Unit *src, const Eolian_Function *fid, | |||
141 | eina_strbuf_append(buf, "Eo *obj"); | 141 | eina_strbuf_append(buf, "Eo *obj"); |
142 | } | 142 | } |
143 | 143 | ||
144 | eo_gen_params(src, eolian_property_keys_get(fid, ftype), buf, &flagbuf, &nidx, EOLIAN_PROPERTY); | 144 | eo_gen_params(eolian_property_keys_get(fid, ftype), buf, &flagbuf, &nidx, EOLIAN_PROPERTY); |
145 | 145 | ||
146 | if (!var_as_ret) | 146 | if (!var_as_ret) |
147 | { | 147 | { |
@@ -150,7 +150,7 @@ _gen_func(const Eolian_Unit *src, const Eolian_Function *fid, | |||
150 | itr = eolian_property_values_get(fid, ftype); | 150 | itr = eolian_property_values_get(fid, ftype); |
151 | else | 151 | else |
152 | itr = eolian_function_parameters_get(fid); | 152 | itr = eolian_function_parameters_get(fid); |
153 | eo_gen_params(src, itr, buf, &flagbuf, &nidx, ftype); | 153 | eo_gen_params(itr, buf, &flagbuf, &nidx, ftype); |
154 | } | 154 | } |
155 | 155 | ||
156 | if (flagbuf) | 156 | 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 @@ | |||
3 | 3 | ||
4 | #include "main.h" | 4 | #include "main.h" |
5 | 5 | ||
6 | void eo_gen_params(const Eolian_Unit *src, Eina_Iterator *itr, Eina_Strbuf *buf, Eina_Strbuf **flagbuf, int *nidx, Eolian_Function_Type ftype); | 6 | void eo_gen_params(Eina_Iterator *itr, Eina_Strbuf *buf, Eina_Strbuf **flagbuf, int *nidx, Eolian_Function_Type ftype); |
7 | void eo_gen_header_gen(const Eolian_Unit *src, const Eolian_Class *cl, Eina_Strbuf *buf, Eina_Bool legacy); | 7 | void eo_gen_header_gen(const Eolian_Unit *src, const Eolian_Class *cl, Eina_Strbuf *buf, Eina_Bool legacy); |
8 | 8 | ||
9 | #endif | 9 | #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, | |||
386 | Eina_Strbuf *buf = eina_strbuf_new(); | 386 | Eina_Strbuf *buf = eina_strbuf_new(); |
387 | 387 | ||
388 | const Eolian_Class *cl = eolian_class_get_by_file(src, ifname); | 388 | const Eolian_Class *cl = eolian_class_get_by_file(src, ifname); |
389 | eo_gen_types_source_gen(src, eolian_declarations_get_by_file(eos, ifname), buf); | 389 | eo_gen_types_source_gen(eolian_declarations_get_by_file(eos, ifname), buf); |
390 | eo_gen_source_gen(src, cl, buf); | 390 | eo_gen_source_gen(cl, buf); |
391 | if (cl || (eot && eina_strbuf_length_get(buf))) | 391 | if (cl || (eot && eina_strbuf_length_get(buf))) |
392 | { | 392 | { |
393 | if (_write_file(ofname, buf)) | 393 | if (_write_file(ofname, buf)) |
@@ -414,7 +414,7 @@ _write_impl(const Eolian_Unit *src, const char *ofname, const char *ifname) | |||
414 | if (!_read_file(ofname, &buf)) | 414 | if (!_read_file(ofname, &buf)) |
415 | return EINA_FALSE; | 415 | return EINA_FALSE; |
416 | 416 | ||
417 | eo_gen_impl_gen(src, cl, buf); | 417 | eo_gen_impl_gen(cl, buf); |
418 | Eina_Bool ret = _write_file(ofname, buf); | 418 | Eina_Bool ret = _write_file(ofname, buf); |
419 | eina_strbuf_free(buf); | 419 | eina_strbuf_free(buf); |
420 | return ret; | 420 | 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, | |||
103 | } | 103 | } |
104 | 104 | ||
105 | static void | 105 | static void |
106 | _append_defval(const Eolian_Unit *src, Eina_Strbuf *buf, | 106 | _append_defval(Eina_Strbuf *buf, const Eolian_Expression *exp, const Eolian_Type *tp) |
107 | const Eolian_Expression *exp, const Eolian_Type *tp) | ||
108 | { | 107 | { |
109 | if (exp) | 108 | if (exp) |
110 | { | 109 | { |
@@ -140,7 +139,7 @@ _append_defval(const Eolian_Unit *src, Eina_Strbuf *buf, | |||
140 | free(sn); | 139 | free(sn); |
141 | return; | 140 | return; |
142 | } | 141 | } |
143 | Eina_Stringshare *ctp = eolian_type_c_type_get(src, btp, EOLIAN_C_TYPE_DEFAULT); | 142 | Eina_Stringshare *ctp = eolian_type_c_type_get(btp, EOLIAN_C_TYPE_DEFAULT); |
144 | if (strchr(ctp, '*')) | 143 | if (strchr(ctp, '*')) |
145 | { | 144 | { |
146 | eina_strbuf_append(buf, "NULL"); | 145 | eina_strbuf_append(buf, "NULL"); |
@@ -182,7 +181,7 @@ _generate_loop_content(Eina_Strbuf **buf, const Eolian_Type *inner_type, const E | |||
182 | } | 181 | } |
183 | 182 | ||
184 | static void | 183 | static void |
185 | _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) | 184 | _generate_iterative_free(Eina_Strbuf **buf, const Eolian_Type *type, const Eolian_Type *inner_type, Eolian_Function_Parameter *parameter, Eina_Strbuf *param) |
186 | { | 185 | { |
187 | Eina_Strbuf *iterator_header, *iter_param; | 186 | Eina_Strbuf *iterator_header, *iter_param; |
188 | 187 | ||
@@ -194,7 +193,7 @@ _generate_iterative_free(const Eolian_Unit *src, Eina_Strbuf **buf, const Eolian | |||
194 | eina_strbuf_append_printf(iter_param, "%s_iter", eolian_parameter_name_get(parameter)); | 193 | eina_strbuf_append_printf(iter_param, "%s_iter", eolian_parameter_name_get(parameter)); |
195 | 194 | ||
196 | //generate the field definition | 195 | //generate the field definition |
197 | eina_strbuf_append_printf(*buf, " %s", eolian_type_c_type_get(src, inner_type, EOLIAN_C_TYPE_DEFAULT)); | 196 | eina_strbuf_append_printf(*buf, " %s", eolian_type_c_type_get(inner_type, EOLIAN_C_TYPE_DEFAULT)); |
198 | if(t == EOLIAN_TYPE_BUILTIN_INARRAY | 197 | if(t == EOLIAN_TYPE_BUILTIN_INARRAY |
199 | || t == EOLIAN_TYPE_BUILTIN_INLIST) | 198 | || t == EOLIAN_TYPE_BUILTIN_INLIST) |
200 | { | 199 | { |
@@ -269,9 +268,9 @@ _generate_iterative_free(const Eolian_Unit *src, Eina_Strbuf **buf, const Eolian | |||
269 | } | 268 | } |
270 | 269 | ||
271 | static void | 270 | static void |
272 | _gen_func(const Eolian_Unit *src, const Eolian_Class *cl, | 271 | _gen_func(const Eolian_Class *cl, const Eolian_Function *fid, |
273 | const Eolian_Function *fid, Eolian_Function_Type ftype, | 272 | Eolian_Function_Type ftype, Eina_Strbuf *buf, |
274 | Eina_Strbuf *buf, const Eolian_Implement *impl, Eina_Strbuf *lbuf) | 273 | const Eolian_Implement *impl, Eina_Strbuf *lbuf) |
275 | { | 274 | { |
276 | Eina_Bool is_empty = eolian_implement_is_empty(impl, ftype); | 275 | Eina_Bool is_empty = eolian_implement_is_empty(impl, ftype); |
277 | Eina_Bool is_auto = eolian_implement_is_auto(impl, ftype); | 276 | Eina_Bool is_auto = eolian_implement_is_auto(impl, ftype); |
@@ -328,7 +327,7 @@ _gen_func(const Eolian_Unit *src, const Eolian_Class *cl, | |||
328 | { | 327 | { |
329 | const char *prn = eolian_parameter_name_get(pr); | 328 | const char *prn = eolian_parameter_name_get(pr); |
330 | const Eolian_Type *pt = eolian_parameter_type_get(pr); | 329 | const Eolian_Type *pt = eolian_parameter_type_get(pr); |
331 | Eina_Stringshare *ptn = eolian_type_c_type_get(src, pt, EOLIAN_C_TYPE_PARAM); | 330 | Eina_Stringshare *ptn = eolian_type_c_type_get(pt, EOLIAN_C_TYPE_PARAM); |
332 | 331 | ||
333 | if (eina_strbuf_length_get(params)) | 332 | if (eina_strbuf_length_get(params)) |
334 | eina_strbuf_append(params, ", "); | 333 | eina_strbuf_append(params, ", "); |
@@ -400,7 +399,7 @@ _gen_func(const Eolian_Unit *src, const Eolian_Class *cl, | |||
400 | } | 399 | } |
401 | else if (inner_type && eolian_type_is_owned(inner_type)) | 400 | else if (inner_type && eolian_type_is_owned(inner_type)) |
402 | { | 401 | { |
403 | _generate_iterative_free(src, &fallback_free_ownership, type, inner_type, pr, param_call); | 402 | _generate_iterative_free(&fallback_free_ownership, type, inner_type, pr, param_call); |
404 | } | 403 | } |
405 | } | 404 | } |
406 | eina_iterator_free(itr); | 405 | eina_iterator_free(itr); |
@@ -429,7 +428,7 @@ _gen_func(const Eolian_Unit *src, const Eolian_Class *cl, | |||
429 | const Eolian_Expression *dfv = eolian_parameter_default_value_get(pr); | 428 | const Eolian_Expression *dfv = eolian_parameter_default_value_get(pr); |
430 | const char *prn = eolian_parameter_name_get(pr); | 429 | const char *prn = eolian_parameter_name_get(pr); |
431 | const Eolian_Type *pt = eolian_parameter_type_get(pr); | 430 | const Eolian_Type *pt = eolian_parameter_type_get(pr); |
432 | Eina_Stringshare *ptn = eolian_type_c_type_get(src, pt, EOLIAN_C_TYPE_PARAM); | 431 | Eina_Stringshare *ptn = eolian_type_c_type_get(pt, EOLIAN_C_TYPE_PARAM); |
433 | const Eolian_Typedecl *ptd = eolian_type_typedecl_get(pt); | 432 | const Eolian_Typedecl *ptd = eolian_type_typedecl_get(pt); |
434 | 433 | ||
435 | Eina_Bool had_star = ptn[strlen(ptn) - 1] == '*'; | 434 | Eina_Bool had_star = ptn[strlen(ptn) - 1] == '*'; |
@@ -501,7 +500,7 @@ _gen_func(const Eolian_Unit *src, const Eolian_Class *cl, | |||
501 | if (impl_same_class && eolian_implement_is_pure_virtual(impl, ftype)) | 500 | if (impl_same_class && eolian_implement_is_pure_virtual(impl, ftype)) |
502 | impl_need = EINA_FALSE; | 501 | impl_need = EINA_FALSE; |
503 | 502 | ||
504 | Eina_Stringshare *rtpn = rtp ? eolian_type_c_type_get(src, rtp, EOLIAN_C_TYPE_RETURN) | 503 | Eina_Stringshare *rtpn = rtp ? eolian_type_c_type_get(rtp, EOLIAN_C_TYPE_RETURN) |
505 | : eina_stringshare_add("void"); | 504 | : eina_stringshare_add("void"); |
506 | 505 | ||
507 | char *cname = NULL, *cnamel = NULL, *ocnamel = NULL; | 506 | char *cname = NULL, *cnamel = NULL, *ocnamel = NULL; |
@@ -585,7 +584,7 @@ _gen_func(const Eolian_Unit *src, const Eolian_Class *cl, | |||
585 | if (rtp) | 584 | if (rtp) |
586 | { | 585 | { |
587 | eina_strbuf_append(buf, " return "); | 586 | eina_strbuf_append(buf, " return "); |
588 | _append_defval(src, buf, def_ret, rtp); | 587 | _append_defval(buf, def_ret, rtp); |
589 | eina_strbuf_append(buf, ";\n"); | 588 | eina_strbuf_append(buf, ";\n"); |
590 | } | 589 | } |
591 | eina_strbuf_append(buf, "}\n\n"); | 590 | eina_strbuf_append(buf, "}\n\n"); |
@@ -660,7 +659,7 @@ _gen_func(const Eolian_Unit *src, const Eolian_Class *cl, | |||
660 | if (strcmp(rtpn, "void")) | 659 | if (strcmp(rtpn, "void")) |
661 | { | 660 | { |
662 | eina_strbuf_append_printf(buf, ", %s, ", rtpn); | 661 | eina_strbuf_append_printf(buf, ", %s, ", rtpn); |
663 | _append_defval(src, buf, def_ret, rtp); | 662 | _append_defval(buf, def_ret, rtp); |
664 | } | 663 | } |
665 | 664 | ||
666 | if (fallback_free_ownership) | 665 | if (fallback_free_ownership) |
@@ -872,8 +871,7 @@ _gen_initializer(const Eolian_Class *cl, Eina_Strbuf *buf) | |||
872 | } | 871 | } |
873 | 872 | ||
874 | void | 873 | void |
875 | eo_gen_source_gen(const Eolian_Unit *src, | 874 | eo_gen_source_gen(const Eolian_Class *cl, Eina_Strbuf *buf) |
876 | const Eolian_Class *cl, Eina_Strbuf *buf) | ||
877 | { | 875 | { |
878 | if (!cl) | 876 | if (!cl) |
879 | return; | 877 | return; |
@@ -918,14 +916,14 @@ eo_gen_source_gen(const Eolian_Unit *src, | |||
918 | { | 916 | { |
919 | case EOLIAN_PROP_GET: | 917 | case EOLIAN_PROP_GET: |
920 | case EOLIAN_PROP_SET: | 918 | case EOLIAN_PROP_SET: |
921 | _gen_func(src, cl, fid, ftype, buf, imp, lbuf); | 919 | _gen_func(cl, fid, ftype, buf, imp, lbuf); |
922 | break; | 920 | break; |
923 | case EOLIAN_PROPERTY: | 921 | case EOLIAN_PROPERTY: |
924 | _gen_func(src, cl, fid, EOLIAN_PROP_SET, buf, imp, lbuf); | 922 | _gen_func(cl, fid, EOLIAN_PROP_SET, buf, imp, lbuf); |
925 | _gen_func(src, cl, fid, EOLIAN_PROP_GET, buf, imp, lbuf); | 923 | _gen_func(cl, fid, EOLIAN_PROP_GET, buf, imp, lbuf); |
926 | break; | 924 | break; |
927 | default: | 925 | default: |
928 | _gen_func(src, cl, fid, EOLIAN_METHOD, buf, imp, lbuf); | 926 | _gen_func(cl, fid, EOLIAN_METHOD, buf, imp, lbuf); |
929 | } | 927 | } |
930 | } | 928 | } |
931 | eina_iterator_free(itr); | 929 | eina_iterator_free(itr); |
@@ -1018,9 +1016,8 @@ eo_gen_source_gen(const Eolian_Unit *src, | |||
1018 | } | 1016 | } |
1019 | 1017 | ||
1020 | static void | 1018 | static void |
1021 | _gen_params(const Eolian_Unit *src, const Eolian_Function *fid, | 1019 | _gen_params(const Eolian_Function *fid, Eolian_Function_Type ftype, |
1022 | Eolian_Function_Type ftype, Eina_Bool var_as_ret, | 1020 | Eina_Bool var_as_ret, Eina_Strbuf *params, Eina_Strbuf *params_full) |
1023 | Eina_Strbuf *params, Eina_Strbuf *params_full) | ||
1024 | { | 1021 | { |
1025 | Eina_Bool is_prop = (ftype == EOLIAN_PROP_GET || ftype == EOLIAN_PROP_SET); | 1022 | Eina_Bool is_prop = (ftype == EOLIAN_PROP_GET || ftype == EOLIAN_PROP_SET); |
1026 | 1023 | ||
@@ -1032,7 +1029,7 @@ _gen_params(const Eolian_Unit *src, const Eolian_Function *fid, | |||
1032 | { | 1029 | { |
1033 | const char *prn = eolian_parameter_name_get(pr); | 1030 | const char *prn = eolian_parameter_name_get(pr); |
1034 | const Eolian_Type *pt = eolian_parameter_type_get(pr); | 1031 | const Eolian_Type *pt = eolian_parameter_type_get(pr); |
1035 | Eina_Stringshare *ptn = eolian_type_c_type_get(src, pt, EOLIAN_C_TYPE_PARAM); | 1032 | Eina_Stringshare *ptn = eolian_type_c_type_get(pt, EOLIAN_C_TYPE_PARAM); |
1036 | 1033 | ||
1037 | eina_strbuf_append(params, ", "); | 1034 | eina_strbuf_append(params, ", "); |
1038 | eina_strbuf_append(params, prn); | 1035 | eina_strbuf_append(params, prn); |
@@ -1062,7 +1059,7 @@ _gen_params(const Eolian_Unit *src, const Eolian_Function *fid, | |||
1062 | const char *prn = eolian_parameter_name_get(pr); | 1059 | const char *prn = eolian_parameter_name_get(pr); |
1063 | const Eolian_Type *pt = eolian_parameter_type_get(pr); | 1060 | const Eolian_Type *pt = eolian_parameter_type_get(pr); |
1064 | const Eolian_Typedecl *ptd = eolian_type_typedecl_get(pt); | 1061 | const Eolian_Typedecl *ptd = eolian_type_typedecl_get(pt); |
1065 | Eina_Stringshare *ptn = eolian_type_c_type_get(src, pt, EOLIAN_C_TYPE_PARAM); | 1062 | Eina_Stringshare *ptn = eolian_type_c_type_get(pt, EOLIAN_C_TYPE_PARAM); |
1066 | 1063 | ||
1067 | if (ptd && eolian_typedecl_type_get(ptd) == EOLIAN_TYPEDECL_FUNCTION_POINTER) | 1064 | if (ptd && eolian_typedecl_type_get(ptd) == EOLIAN_TYPEDECL_FUNCTION_POINTER) |
1068 | { | 1065 | { |
@@ -1093,10 +1090,9 @@ _gen_params(const Eolian_Unit *src, const Eolian_Function *fid, | |||
1093 | } | 1090 | } |
1094 | 1091 | ||
1095 | static void | 1092 | static void |
1096 | _gen_proto(const Eolian_Unit *src, const Eolian_Class *cl, | 1093 | _gen_proto(const Eolian_Class *cl, const Eolian_Function *fid, |
1097 | const Eolian_Function *fid, Eolian_Function_Type ftype, | 1094 | Eolian_Function_Type ftype, Eina_Strbuf *buf, |
1098 | Eina_Strbuf *buf, const Eolian_Implement *impl, const char *dtype, | 1095 | const Eolian_Implement *impl, const char *dtype, const char *cnamel) |
1099 | const char *cnamel) | ||
1100 | { | 1096 | { |
1101 | Eina_Bool impl_same_class = (eolian_implement_class_get(impl) == cl); | 1097 | Eina_Bool impl_same_class = (eolian_implement_class_get(impl) == cl); |
1102 | if (impl_same_class && eolian_implement_is_pure_virtual(impl, ftype)) | 1098 | 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, | |||
1142 | eina_strbuf_append(buf, "EOLIAN static "); | 1138 | eina_strbuf_append(buf, "EOLIAN static "); |
1143 | if (rtp) | 1139 | if (rtp) |
1144 | { | 1140 | { |
1145 | Eina_Stringshare *rtpn = eolian_type_c_type_get(src, rtp, EOLIAN_C_TYPE_RETURN); | 1141 | Eina_Stringshare *rtpn = eolian_type_c_type_get(rtp, EOLIAN_C_TYPE_RETURN); |
1146 | eina_strbuf_append(buf, rtpn); | 1142 | eina_strbuf_append(buf, rtpn); |
1147 | eina_stringshare_del(rtpn); | 1143 | eina_stringshare_del(rtpn); |
1148 | } | 1144 | } |
@@ -1163,7 +1159,7 @@ _gen_proto(const Eolian_Unit *src, const Eolian_Class *cl, | |||
1163 | /* gen params here */ | 1159 | /* gen params here */ |
1164 | Eina_Strbuf *params = eina_strbuf_new(); | 1160 | Eina_Strbuf *params = eina_strbuf_new(); |
1165 | Eina_Strbuf *params_full = eina_strbuf_new(); | 1161 | Eina_Strbuf *params_full = eina_strbuf_new(); |
1166 | _gen_params(src, fid, ftype, var_as_ret, params, params_full); | 1162 | _gen_params(fid, ftype, var_as_ret, params, params_full); |
1167 | 1163 | ||
1168 | if (eina_strbuf_length_get(params_full)) | 1164 | if (eina_strbuf_length_get(params_full)) |
1169 | eina_strbuf_append(buf, eina_strbuf_string_get(params_full)); | 1165 | eina_strbuf_append(buf, eina_strbuf_string_get(params_full)); |
@@ -1193,8 +1189,7 @@ _gen_proto(const Eolian_Unit *src, const Eolian_Class *cl, | |||
1193 | } | 1189 | } |
1194 | 1190 | ||
1195 | void | 1191 | void |
1196 | eo_gen_impl_gen(const Eolian_Unit *src, | 1192 | eo_gen_impl_gen(const Eolian_Class *cl, Eina_Strbuf *buf) |
1197 | const Eolian_Class *cl, Eina_Strbuf *buf) | ||
1198 | { | 1193 | { |
1199 | if (!cl) | 1194 | if (!cl) |
1200 | return; | 1195 | return; |
@@ -1244,14 +1239,14 @@ eo_gen_impl_gen(const Eolian_Unit *src, | |||
1244 | { | 1239 | { |
1245 | case EOLIAN_PROP_GET: | 1240 | case EOLIAN_PROP_GET: |
1246 | case EOLIAN_PROP_SET: | 1241 | case EOLIAN_PROP_SET: |
1247 | _gen_proto(src, cl, fid, ftype, buf, imp, dt, cnamel); | 1242 | _gen_proto(cl, fid, ftype, buf, imp, dt, cnamel); |
1248 | break; | 1243 | break; |
1249 | case EOLIAN_PROPERTY: | 1244 | case EOLIAN_PROPERTY: |
1250 | _gen_proto(src, cl, fid, EOLIAN_PROP_SET, buf, imp, dt, cnamel); | 1245 | _gen_proto(cl, fid, EOLIAN_PROP_SET, buf, imp, dt, cnamel); |
1251 | _gen_proto(src, cl, fid, EOLIAN_PROP_GET, buf, imp, dt, cnamel); | 1246 | _gen_proto(cl, fid, EOLIAN_PROP_GET, buf, imp, dt, cnamel); |
1252 | break; | 1247 | break; |
1253 | default: | 1248 | default: |
1254 | _gen_proto(src, cl, fid, EOLIAN_METHOD, buf, imp, dt, cnamel); | 1249 | _gen_proto(cl, fid, EOLIAN_METHOD, buf, imp, dt, cnamel); |
1255 | } | 1250 | } |
1256 | } | 1251 | } |
1257 | eina_iterator_free(itr); | 1252 | 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 @@ | |||
3 | 3 | ||
4 | #include "main.h" | 4 | #include "main.h" |
5 | 5 | ||
6 | void eo_gen_source_gen(const Eolian_Unit *src, const Eolian_Class *cl, Eina_Strbuf *buf); | 6 | void eo_gen_source_gen(const Eolian_Class *cl, Eina_Strbuf *buf); |
7 | void eo_gen_impl_gen(const Eolian_Unit *src, const Eolian_Class *cl, Eina_Strbuf *buf); | 7 | void eo_gen_impl_gen(const Eolian_Class *cl, Eina_Strbuf *buf); |
8 | 8 | ||
9 | #endif | 9 | #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, | |||
19 | { | 19 | { |
20 | case EOLIAN_TYPEDECL_ALIAS: | 20 | case EOLIAN_TYPEDECL_ALIAS: |
21 | { | 21 | { |
22 | Eina_Stringshare *tn = eolian_typedecl_c_type_get(src, tp); | 22 | Eina_Stringshare *tn = eolian_typedecl_c_type_get(tp); |
23 | eina_strbuf_append(buf, tn); | 23 | eina_strbuf_append(buf, tn); |
24 | eina_stringshare_del(tn); | 24 | eina_stringshare_del(tn); |
25 | break; | 25 | break; |
@@ -41,7 +41,7 @@ _type_generate(const Eolian_Unit *src, const Eolian_Typedecl *tp, | |||
41 | { | 41 | { |
42 | const Eolian_Type *mtp = eolian_typedecl_struct_field_type_get(memb); | 42 | const Eolian_Type *mtp = eolian_typedecl_struct_field_type_get(memb); |
43 | Eina_Stringshare *ct = NULL; | 43 | Eina_Stringshare *ct = NULL; |
44 | ct = eolian_type_c_type_get(src, mtp, EOLIAN_C_TYPE_DEFAULT); | 44 | ct = eolian_type_c_type_get(mtp, EOLIAN_C_TYPE_DEFAULT); |
45 | eina_strbuf_append_printf(buf, " %s%s%s;", | 45 | eina_strbuf_append_printf(buf, " %s%s%s;", |
46 | ct, strchr(ct, '*') ? "" : " ", | 46 | ct, strchr(ct, '*') ? "" : " ", |
47 | eolian_typedecl_struct_field_name_get(memb)); | 47 | eolian_typedecl_struct_field_name_get(memb)); |
@@ -135,7 +135,7 @@ _type_generate(const Eolian_Unit *src, const Eolian_Typedecl *tp, | |||
135 | eina_strbuf_append(buf, "void "); | 135 | eina_strbuf_append(buf, "void "); |
136 | else | 136 | else |
137 | { | 137 | { |
138 | Eina_Stringshare *ct = eolian_type_c_type_get(src, rtp, EOLIAN_C_TYPE_RETURN); | 138 | Eina_Stringshare *ct = eolian_type_c_type_get(rtp, EOLIAN_C_TYPE_RETURN); |
139 | eina_strbuf_append_printf(buf, "%s ", ct); | 139 | eina_strbuf_append_printf(buf, "%s ", ct); |
140 | } | 140 | } |
141 | 141 | ||
@@ -147,7 +147,7 @@ _type_generate(const Eolian_Unit *src, const Eolian_Typedecl *tp, | |||
147 | /* Parameters */ | 147 | /* Parameters */ |
148 | eina_strbuf_append(buf, "(void *data"); | 148 | eina_strbuf_append(buf, "(void *data"); |
149 | int nidx = 1; | 149 | int nidx = 1; |
150 | eo_gen_params(src, eolian_function_parameters_get(fid), buf, NULL, &nidx, EOLIAN_FUNCTION_POINTER); | 150 | eo_gen_params(eolian_function_parameters_get(fid), buf, NULL, &nidx, EOLIAN_FUNCTION_POINTER); |
151 | eina_strbuf_append(buf, ")"); | 151 | eina_strbuf_append(buf, ")"); |
152 | 152 | ||
153 | break; | 153 | break; |
@@ -195,7 +195,7 @@ _var_generate(const Eolian_Unit *src, const Eolian_Variable *vr, Eina_Bool legac | |||
195 | } | 195 | } |
196 | else | 196 | else |
197 | { | 197 | { |
198 | Eina_Stringshare *ct = eolian_type_c_type_get(src, vt, EOLIAN_C_TYPE_DEFAULT); | 198 | Eina_Stringshare *ct = eolian_type_c_type_get(vt, EOLIAN_C_TYPE_DEFAULT); |
199 | eina_strbuf_append_printf(buf, "EWAPI extern %s %s;", ct, fn); | 199 | eina_strbuf_append_printf(buf, "EWAPI extern %s %s;", ct, fn); |
200 | eina_stringshare_del(ct); | 200 | eina_stringshare_del(ct); |
201 | } | 201 | } |
@@ -257,8 +257,7 @@ void eo_gen_types_header_gen(const Eolian_Unit *src, | |||
257 | eina_iterator_free(itr); | 257 | eina_iterator_free(itr); |
258 | } | 258 | } |
259 | 259 | ||
260 | void eo_gen_types_source_gen(const Eolian_Unit *src, | 260 | void eo_gen_types_source_gen(Eina_Iterator *itr, Eina_Strbuf *buf) |
261 | Eina_Iterator *itr, Eina_Strbuf *buf) | ||
262 | { | 261 | { |
263 | const Eolian_Declaration *decl; | 262 | const Eolian_Declaration *decl; |
264 | EINA_ITERATOR_FOREACH(itr, decl) | 263 | EINA_ITERATOR_FOREACH(itr, decl) |
@@ -285,7 +284,7 @@ void eo_gen_types_source_gen(const Eolian_Unit *src, | |||
285 | eina_str_toupper(&fn); | 284 | eina_str_toupper(&fn); |
286 | 285 | ||
287 | const Eolian_Type *vt = eolian_variable_base_type_get(vr); | 286 | const Eolian_Type *vt = eolian_variable_base_type_get(vr); |
288 | Eina_Stringshare *ct = eolian_type_c_type_get(src, vt, EOLIAN_C_TYPE_DEFAULT); | 287 | Eina_Stringshare *ct = eolian_type_c_type_get(vt, EOLIAN_C_TYPE_DEFAULT); |
289 | eina_strbuf_append_printf(buf, "EWAPI %s %s = ", ct, fn); | 288 | eina_strbuf_append_printf(buf, "EWAPI %s %s = ", ct, fn); |
290 | eina_stringshare_del(ct); | 289 | eina_stringshare_del(ct); |
291 | free(fn); | 290 | 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 @@ | |||
2 | #define EOLIAN_GEN_TYPES_H | 2 | #define EOLIAN_GEN_TYPES_H |
3 | 3 | ||
4 | void eo_gen_types_header_gen(const Eolian_Unit *src, Eina_Iterator *itr, Eina_Strbuf *buf, Eina_Bool full, Eina_Bool legacy); | 4 | void eo_gen_types_header_gen(const Eolian_Unit *src, Eina_Iterator *itr, Eina_Strbuf *buf, Eina_Bool full, Eina_Bool legacy); |
5 | void eo_gen_types_source_gen(const Eolian_Unit *src, Eina_Iterator *itr, Eina_Strbuf *buf); | 5 | void eo_gen_types_source_gen(Eina_Iterator *itr, Eina_Strbuf *buf); |
6 | Eina_Strbuf *eo_gen_class_typedef_gen(const Eolian_Unit *src, const char *eof); | 6 | Eina_Strbuf *eo_gen_class_typedef_gen(const Eolian_Unit *src, const char *eof); |
7 | 7 | ||
8 | #endif | 8 | #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 [[ | |||
411 | 411 | ||
412 | Eina_Bool eolian_typedecl_is_extern(const Eolian_Typedecl *tp); | 412 | Eina_Bool eolian_typedecl_is_extern(const Eolian_Typedecl *tp); |
413 | 413 | ||
414 | const char *eolian_type_c_type_get(const Eolian_Unit *unit, const Eolian_Type *tp, Eolian_C_Type_Type ctype); | 414 | const char *eolian_type_c_type_get(const Eolian_Type *tp, Eolian_C_Type_Type ctype); |
415 | const char *eolian_typedecl_c_type_get(const Eolian_Unit *unit, const Eolian_Typedecl *tp); | 415 | const char *eolian_typedecl_c_type_get(const Eolian_Typedecl *tp); |
416 | 416 | ||
417 | const char *eolian_type_name_get(const Eolian_Type *tp); | 417 | const char *eolian_type_name_get(const Eolian_Type *tp); |
418 | const char *eolian_typedecl_name_get(const Eolian_Typedecl *tp); | 418 | const char *eolian_typedecl_name_get(const Eolian_Typedecl *tp); |
@@ -776,8 +776,8 @@ M.Typedecl = ffi.metatype("Eolian_Typedecl", { | |||
776 | return eolian.eolian_typedecl_is_extern(self) ~= 0 | 776 | return eolian.eolian_typedecl_is_extern(self) ~= 0 |
777 | end, | 777 | end, |
778 | 778 | ||
779 | c_type_get = function(self, unit) | 779 | c_type_get = function(self) |
780 | local v = eolian.eolian_typedecl_c_type_get(unit, self) | 780 | local v = eolian.eolian_typedecl_c_type_get(self) |
781 | if v == nil then return nil end | 781 | if v == nil then return nil end |
782 | return ffi_stringshare(v) | 782 | return ffi_stringshare(v) |
783 | end, | 783 | end, |
@@ -871,8 +871,8 @@ M.Type = ffi.metatype("Eolian_Type", { | |||
871 | return eolian.eolian_type_is_ptr(self) ~= 0 | 871 | return eolian.eolian_type_is_ptr(self) ~= 0 |
872 | end, | 872 | end, |
873 | 873 | ||
874 | c_type_get = function(self, unit, ctype) | 874 | c_type_get = function(self, ctype) |
875 | local v = eolian.eolian_type_c_type_get(unit, self, ctype) | 875 | local v = eolian.eolian_type_c_type_get(self, ctype) |
876 | if v == nil then return nil end | 876 | if v == nil then return nil end |
877 | return ffi_stringshare(v) | 877 | return ffi_stringshare(v) |
878 | end, | 878 | 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); | |||
1827 | /* | 1827 | /* |
1828 | * @brief Get the full C type name of the given type. | 1828 | * @brief Get the full C type name of the given type. |
1829 | * | 1829 | * |
1830 | * @param[in] unit the unit to look in | ||
1831 | * @param[in] tp the type declaration. | 1830 | * @param[in] tp the type declaration. |
1832 | * @return The C type name assuming @c tp is not NULL. | 1831 | * @return The C type name assuming @c tp is not NULL. |
1833 | * | 1832 | * |
@@ -1837,7 +1836,7 @@ EAPI Eina_Bool eolian_typedecl_is_extern(const Eolian_Typedecl *tp); | |||
1837 | * | 1836 | * |
1838 | * @ingroup Eolian | 1837 | * @ingroup Eolian |
1839 | */ | 1838 | */ |
1840 | EAPI Eina_Stringshare *eolian_typedecl_c_type_get(const Eolian_Unit *unit, const Eolian_Typedecl *tp); | 1839 | EAPI Eina_Stringshare *eolian_typedecl_c_type_get(const Eolian_Typedecl *tp); |
1841 | 1840 | ||
1842 | /* | 1841 | /* |
1843 | * @brief Get the name of the given type declaration. Keep in mind that the | 1842 | * @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); | |||
2024 | /* | 2023 | /* |
2025 | * @brief Get the full C type name of the given type. | 2024 | * @brief Get the full C type name of the given type. |
2026 | * | 2025 | * |
2027 | * @param[in] unit the unit to look in | ||
2028 | * @param[in] tp the type. | 2026 | * @param[in] tp the type. |
2029 | * @param[in] ctype the context within which the C type string will be used. | 2027 | * @param[in] ctype the context within which the C type string will be used. |
2030 | * @return The C type name assuming @c tp is not NULL. | 2028 | * @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); | |||
2035 | * | 2033 | * |
2036 | * @ingroup Eolian | 2034 | * @ingroup Eolian |
2037 | */ | 2035 | */ |
2038 | EAPI Eina_Stringshare *eolian_type_c_type_get(const Eolian_Unit *unit, const Eolian_Type *tp, Eolian_C_Type_Type ctype); | 2036 | EAPI Eina_Stringshare *eolian_type_c_type_get(const Eolian_Type *tp, Eolian_C_Type_Type ctype); |
2039 | 2037 | ||
2040 | /* | 2038 | /* |
2041 | * @brief Get the name of the given type. For regular types, this is for | 2039 | * @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) | |||
103 | } | 103 | } |
104 | 104 | ||
105 | void | 105 | void |
106 | database_type_to_str(const Eolian_Unit *src, const Eolian_Type *tp, | 106 | database_type_to_str(const Eolian_Type *tp, |
107 | Eina_Strbuf *buf, const char *name, | 107 | Eina_Strbuf *buf, const char *name, |
108 | Eolian_C_Type_Type ctype) | 108 | Eolian_C_Type_Type ctype) |
109 | { | 109 | { |
@@ -111,7 +111,7 @@ database_type_to_str(const Eolian_Unit *src, const Eolian_Type *tp, | |||
111 | || tp->type == EOLIAN_TYPE_CLASS | 111 | || tp->type == EOLIAN_TYPE_CLASS |
112 | || tp->type == EOLIAN_TYPE_VOID) | 112 | || tp->type == EOLIAN_TYPE_VOID) |
113 | && tp->is_const | 113 | && tp->is_const |
114 | && ((ctype != EOLIAN_C_TYPE_RETURN) || database_type_is_ownable(src, tp))) | 114 | && ((ctype != EOLIAN_C_TYPE_RETURN) || database_type_is_ownable(NULL, tp))) |
115 | { | 115 | { |
116 | eina_strbuf_append(buf, "const "); | 116 | eina_strbuf_append(buf, "const "); |
117 | } | 117 | } |
@@ -138,7 +138,7 @@ database_type_to_str(const Eolian_Unit *src, const Eolian_Type *tp, | |||
138 | else | 138 | else |
139 | { | 139 | { |
140 | /* handles arrays and pointers as they all serialize to pointers */ | 140 | /* handles arrays and pointers as they all serialize to pointers */ |
141 | database_type_to_str(src, tp->base_type, buf, NULL, | 141 | database_type_to_str(tp->base_type, buf, NULL, |
142 | EOLIAN_C_TYPE_DEFAULT); | 142 | EOLIAN_C_TYPE_DEFAULT); |
143 | _buf_add_suffix(buf, "*"); | 143 | _buf_add_suffix(buf, "*"); |
144 | if (tp->is_const && (ctype != EOLIAN_C_TYPE_RETURN)) | 144 | 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, | |||
152 | } | 152 | } |
153 | 153 | ||
154 | static void | 154 | static void |
155 | _stype_to_str(const Eolian_Unit *src, const Eolian_Typedecl *tp, | 155 | _stype_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf) |
156 | Eina_Strbuf *buf) | ||
157 | { | 156 | { |
158 | Eolian_Struct_Type_Field *sf; | 157 | Eolian_Struct_Type_Field *sf; |
159 | Eina_List *l; | 158 | Eina_List *l; |
@@ -170,7 +169,7 @@ _stype_to_str(const Eolian_Unit *src, const Eolian_Typedecl *tp, | |||
170 | eina_strbuf_append(buf, " { "); | 169 | eina_strbuf_append(buf, " { "); |
171 | EINA_LIST_FOREACH(tp->field_list, l, sf) | 170 | EINA_LIST_FOREACH(tp->field_list, l, sf) |
172 | { | 171 | { |
173 | database_type_to_str(src, sf->type, buf, sf->name, | 172 | database_type_to_str(sf->type, buf, sf->name, |
174 | EOLIAN_C_TYPE_DEFAULT); | 173 | EOLIAN_C_TYPE_DEFAULT); |
175 | eina_strbuf_append(buf, "; "); | 174 | eina_strbuf_append(buf, "; "); |
176 | } | 175 | } |
@@ -178,8 +177,7 @@ _stype_to_str(const Eolian_Unit *src, const Eolian_Typedecl *tp, | |||
178 | } | 177 | } |
179 | 178 | ||
180 | static void | 179 | static void |
181 | _etype_to_str(const Eolian_Unit *src, const Eolian_Typedecl *tp, | 180 | _etype_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf) |
182 | Eina_Strbuf *buf) | ||
183 | { | 181 | { |
184 | Eolian_Enum_Type_Field *ef; | 182 | Eolian_Enum_Type_Field *ef; |
185 | Eina_List *l; | 183 | Eina_List *l; |
@@ -226,8 +224,7 @@ _append_name(const Eolian_Typedecl *tp, Eina_Strbuf *buf) | |||
226 | } | 224 | } |
227 | 225 | ||
228 | static void | 226 | static void |
229 | _atype_to_str(const Eolian_Unit *src, const Eolian_Typedecl *tp, | 227 | _atype_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf) |
230 | Eina_Strbuf *buf) | ||
231 | { | 228 | { |
232 | eina_strbuf_append(buf, "typedef "); | 229 | eina_strbuf_append(buf, "typedef "); |
233 | 230 | ||
@@ -244,26 +241,25 @@ _atype_to_str(const Eolian_Unit *src, const Eolian_Typedecl *tp, | |||
244 | 241 | ||
245 | Eina_Strbuf *fulln = eina_strbuf_new(); | 242 | Eina_Strbuf *fulln = eina_strbuf_new(); |
246 | _append_name(tp, fulln); | 243 | _append_name(tp, fulln); |
247 | database_type_to_str(src, tp->base_type, buf, eina_strbuf_string_get(fulln), | 244 | database_type_to_str(tp->base_type, buf, eina_strbuf_string_get(fulln), |
248 | EOLIAN_C_TYPE_DEFAULT); | 245 | EOLIAN_C_TYPE_DEFAULT); |
249 | eina_strbuf_free(fulln); | 246 | eina_strbuf_free(fulln); |
250 | } | 247 | } |
251 | 248 | ||
252 | void | 249 | void |
253 | database_typedecl_to_str(const Eolian_Unit *src, const Eolian_Typedecl *tp, | 250 | database_typedecl_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf) |
254 | Eina_Strbuf *buf) | ||
255 | { | 251 | { |
256 | switch (tp->type) | 252 | switch (tp->type) |
257 | { | 253 | { |
258 | case EOLIAN_TYPEDECL_ALIAS: | 254 | case EOLIAN_TYPEDECL_ALIAS: |
259 | _atype_to_str(src, tp, buf); | 255 | _atype_to_str(tp, buf); |
260 | break; | 256 | break; |
261 | case EOLIAN_TYPEDECL_ENUM: | 257 | case EOLIAN_TYPEDECL_ENUM: |
262 | _etype_to_str(src, tp, buf); | 258 | _etype_to_str(tp, buf); |
263 | break; | 259 | break; |
264 | case EOLIAN_TYPEDECL_STRUCT: | 260 | case EOLIAN_TYPEDECL_STRUCT: |
265 | case EOLIAN_TYPEDECL_STRUCT_OPAQUE: | 261 | case EOLIAN_TYPEDECL_STRUCT_OPAQUE: |
266 | _stype_to_str(src, tp, buf); | 262 | _stype_to_str(tp, buf); |
267 | break; | 263 | break; |
268 | default: | 264 | default: |
269 | break; | 265 | 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) | |||
338 | } | 338 | } |
339 | 339 | ||
340 | EAPI Eina_Stringshare * | 340 | EAPI Eina_Stringshare * |
341 | eolian_type_c_type_get(const Eolian_Unit *unit, const Eolian_Type *tp, | 341 | eolian_type_c_type_get(const Eolian_Type *tp, Eolian_C_Type_Type ctype) |
342 | Eolian_C_Type_Type ctype) | ||
343 | { | 342 | { |
344 | Eina_Stringshare *ret; | 343 | Eina_Stringshare *ret; |
345 | Eina_Strbuf *buf; | 344 | Eina_Strbuf *buf; |
346 | EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL); | 345 | EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL); |
347 | buf = eina_strbuf_new(); | 346 | buf = eina_strbuf_new(); |
348 | database_type_to_str(unit, tp, buf, NULL, ctype); | 347 | database_type_to_str(tp, buf, NULL, ctype); |
349 | ret = eina_stringshare_add(eina_strbuf_string_get(buf)); | 348 | ret = eina_stringshare_add(eina_strbuf_string_get(buf)); |
350 | eina_strbuf_free(buf); | 349 | eina_strbuf_free(buf); |
351 | return ret; | 350 | return ret; |
352 | } | 351 | } |
353 | 352 | ||
354 | EAPI Eina_Stringshare * | 353 | EAPI Eina_Stringshare * |
355 | eolian_typedecl_c_type_get(const Eolian_Unit *unit, const Eolian_Typedecl *tp) | 354 | eolian_typedecl_c_type_get(const Eolian_Typedecl *tp) |
356 | { | 355 | { |
357 | Eina_Stringshare *ret; | 356 | Eina_Stringshare *ret; |
358 | Eina_Strbuf *buf; | 357 | Eina_Strbuf *buf; |
359 | EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL); | 358 | EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL); |
360 | buf = eina_strbuf_new(); | 359 | buf = eina_strbuf_new(); |
361 | database_typedecl_to_str(unit, tp, buf); | 360 | database_typedecl_to_str(tp, buf); |
362 | ret = eina_stringshare_add(eina_strbuf_string_get(buf)); | 361 | ret = eina_stringshare_add(eina_strbuf_string_get(buf)); |
363 | eina_strbuf_free(buf); | 362 | eina_strbuf_free(buf); |
364 | return ret; | 363 | 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); | |||
341 | void database_type_del(Eolian_Type *tp); | 341 | void database_type_del(Eolian_Type *tp); |
342 | void database_typedecl_del(Eolian_Typedecl *tp); | 342 | void database_typedecl_del(Eolian_Typedecl *tp); |
343 | 343 | ||
344 | void database_type_to_str(const Eolian_Unit *src, const Eolian_Type *tp, Eina_Strbuf *buf, const char *name, Eolian_C_Type_Type ctype); | 344 | void database_type_to_str(const Eolian_Type *tp, Eina_Strbuf *buf, const char *name, Eolian_C_Type_Type ctype); |
345 | void database_typedecl_to_str(const Eolian_Unit *src, const Eolian_Typedecl *tp, Eina_Strbuf *buf); | 345 | void database_typedecl_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf); |
346 | 346 | ||
347 | Eolian_Typedecl *database_type_decl_find(const Eolian_Unit *src, const Eolian_Type *tp); | 347 | Eolian_Typedecl *database_type_decl_find(const Eolian_Unit *src, const Eolian_Type *tp); |
348 | 348 | ||
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 | |||
339 | 339 | ||
340 | inline void type_def::set(Eolian_Type const* eolian_type, Eolian_Unit const* unit, Eolian_C_Type_Type ctype) | 340 | inline void type_def::set(Eolian_Type const* eolian_type, Eolian_Unit const* unit, Eolian_C_Type_Type ctype) |
341 | { | 341 | { |
342 | c_type = ::eolian_type_c_type_get(unit, eolian_type, ctype); | 342 | c_type = ::eolian_type_c_type_get(eolian_type, ctype); |
343 | // ::eina_stringshare_del(stringshare); // this crashes | 343 | // ::eina_stringshare_del(stringshare); // this crashes |
344 | Eolian_Type const* stp = eolian_type_base_type_get(eolian_type); | 344 | Eolian_Type const* stp = eolian_type_base_type_get(eolian_type); |
345 | has_own = !!::eolian_type_is_owned(eolian_type); | 345 | 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 { | |||
743 | end, | 743 | end, |
744 | 744 | ||
745 | c_type_get = function(self) | 745 | c_type_get = function(self) |
746 | return self.type:c_type_get(eos:unit_get(), eolian.c_type_type.DEFAULT) | 746 | return self.type:c_type_get(eolian.c_type_type.DEFAULT) |
747 | end, | 747 | end, |
748 | 748 | ||
749 | name_get = function(self) | 749 | name_get = function(self) |
@@ -906,8 +906,7 @@ M.Typedecl = Node:clone { | |||
906 | end, | 906 | end, |
907 | 907 | ||
908 | c_type_get = function(self) | 908 | c_type_get = function(self) |
909 | -- FIXME: unit | 909 | return self.typedecl:c_type_get() |
910 | return self.typedecl:c_type_get(eos:unit_get()) | ||
911 | end, | 910 | end, |
912 | 911 | ||
913 | name_get = function(self) | 912 | 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 | |||
102 | local typeconv = function(tps, expr, isin) | 102 | local typeconv = function(tps, expr, isin) |
103 | if tps:type_get() == type_type.POINTER then | 103 | if tps:type_get() == type_type.POINTER then |
104 | local base = tps:base_type_get() | 104 | local base = tps:base_type_get() |
105 | local f = (isin and known_ptr_in or known_ptr_out)[base:c_type_get(gen_unit, eolian.c_type_type.DEFAULT)] | 105 | local f = (isin and known_ptr_in or known_ptr_out)[base:c_type_get(eolian.c_type_type.DEFAULT)] |
106 | if f then return f(expr) end | 106 | if f then return f(expr) end |
107 | return build_calln(tps, expr, isin) | 107 | return build_calln(tps, expr, isin) |
108 | end | 108 | end |
@@ -188,7 +188,7 @@ local Method = Node:clone { | |||
188 | local proto = { | 188 | local proto = { |
189 | name = meth:name_get() | 189 | name = meth:name_get() |
190 | } | 190 | } |
191 | proto.ret_type = rett and rett:c_type_get(gen_unit, eolian.c_type_type.RETURN) or "void" | 191 | proto.ret_type = rett and rett:c_type_get(eolian.c_type_type.RETURN) or "void" |
192 | local args, cargs, vargs = { "self" }, {}, {} | 192 | local args, cargs, vargs = { "self" }, {}, {} |
193 | proto.args, proto.cargs, proto.vargs = args, cargs, vargs | 193 | proto.args, proto.cargs, proto.vargs = args, cargs, vargs |
194 | local rets = {} | 194 | local rets = {} |
@@ -206,7 +206,7 @@ local Method = Node:clone { | |||
206 | 206 | ||
207 | for v in pars do | 207 | for v in pars do |
208 | local dir, tps, nm = v:direction_get(), v:type_get(), kw_t(v:name_get()) | 208 | local dir, tps, nm = v:direction_get(), v:type_get(), kw_t(v:name_get()) |
209 | local tp = tps:c_type_get(gen_unit, eolian.c_type_type.PARAM) | 209 | local tp = tps:c_type_get(eolian.c_type_type.PARAM) |
210 | if dir == param_dir.OUT or dir == param_dir.INOUT then | 210 | if dir == param_dir.OUT or dir == param_dir.INOUT then |
211 | if dir == param_dir.INOUT then | 211 | if dir == param_dir.INOUT then |
212 | args[#args + 1] = nm | 212 | args[#args + 1] = nm |
@@ -283,7 +283,7 @@ local Property = Method:clone { | |||
283 | nkeys = #keys, | 283 | nkeys = #keys, |
284 | nvals = #vals | 284 | nvals = #vals |
285 | } | 285 | } |
286 | proto.ret_type = rett and rett:c_type_get(gen_unit, eolian.c_type_type.RETURN) or "void" | 286 | proto.ret_type = rett and rett:c_type_get(eolian.c_type_type.RETURN) or "void" |
287 | local args, cargs, vargs = { "self" }, {}, {} | 287 | local args, cargs, vargs = { "self" }, {}, {} |
288 | proto.args, proto.cargs, proto.vargs = args, cargs, vargs | 288 | proto.args, proto.cargs, proto.vargs = args, cargs, vargs |
289 | local rets = {} | 289 | local rets = {} |
@@ -298,7 +298,7 @@ local Property = Method:clone { | |||
298 | for i, v in ipairs(keys) do | 298 | for i, v in ipairs(keys) do |
299 | local nm = kw_t(v:name_get()) | 299 | local nm = kw_t(v:name_get()) |
300 | local tps = v:type_get() | 300 | local tps = v:type_get() |
301 | local tp = tps:c_type_get(gen_unit, eolian.c_type_type.PARAM) | 301 | local tp = tps:c_type_get(eolian.c_type_type.PARAM) |
302 | args [#args + 1] = nm | 302 | args [#args + 1] = nm |
303 | cargs[#cargs + 1] = tp .. " " .. nm | 303 | cargs[#cargs + 1] = tp .. " " .. nm |
304 | vargs[#vargs + 1] = typeconv(tps, nm, true) | 304 | vargs[#vargs + 1] = typeconv(tps, nm, true) |
@@ -310,13 +310,13 @@ local Property = Method:clone { | |||
310 | if self.isget then | 310 | if self.isget then |
311 | if #vals == 1 and not rett then | 311 | if #vals == 1 and not rett then |
312 | local tps = vals[1]:type_get() | 312 | local tps = vals[1]:type_get() |
313 | proto.ret_type = tps:c_type_get(gen_unit, eolian.c_type_type.PARAM) | 313 | proto.ret_type = tps:c_type_get(eolian.c_type_type.PARAM) |
314 | rets[#rets + 1] = typeconv(tps, "v", false) | 314 | rets[#rets + 1] = typeconv(tps, "v", false) |
315 | else | 315 | else |
316 | for i, v in ipairs(vals) do | 316 | for i, v in ipairs(vals) do |
317 | local dir, tps, nm = v:direction_get(), v:type_get(), | 317 | local dir, tps, nm = v:direction_get(), v:type_get(), |
318 | kw_t(v:name_get()) | 318 | kw_t(v:name_get()) |
319 | local tp = tps:c_type_get(gen_unit, eolian.c_type_type.PARAM) | 319 | local tp = tps:c_type_get(eolian.c_type_type.PARAM) |
320 | cargs [#cargs + 1] = tp .. " *" .. nm | 320 | cargs [#cargs + 1] = tp .. " *" .. nm |
321 | vargs [#vargs + 1] = nm | 321 | vargs [#vargs + 1] = nm |
322 | allocs[#allocs + 1] = { tp, nm } | 322 | allocs[#allocs + 1] = { tp, nm } |
@@ -327,7 +327,7 @@ local Property = Method:clone { | |||
327 | for i, v in ipairs(vals) do | 327 | for i, v in ipairs(vals) do |
328 | local dir, tps, nm = v:direction_get(), v:type_get(), | 328 | local dir, tps, nm = v:direction_get(), v:type_get(), |
329 | kw_t(v:name_get()) | 329 | kw_t(v:name_get()) |
330 | local tp = tps:c_type_get(gen_unit, eolian.c_type_type.PARAM) | 330 | local tp = tps:c_type_get(eolian.c_type_type.PARAM) |
331 | args [#args + 1] = nm | 331 | args [#args + 1] = nm |
332 | cargs[#cargs + 1] = tp .. " " .. nm | 332 | cargs[#cargs + 1] = tp .. " " .. nm |
333 | vargs[#vargs + 1] = typeconv(tps, nm, true) | 333 | 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): | |||
1026 | return not self.is_property | 1026 | return not self.is_property |
1027 | 1027 | ||
1028 | 1028 | ||
1029 | class Type(EolianBaseObject): # OK (1 TODO Unit*) | 1029 | class Type(EolianBaseObject): |
1030 | def __repr__(self): | 1030 | def __repr__(self): |
1031 | # return "<eolian.Type '{0.full_name}', type: {0.type!s}, c_type: '{0.c_type}'>".format(self) | 1031 | # return "<eolian.Type '{0.full_name}', type: {0.type!s}, c_type: '{0.c_type}'>".format(self) |
1032 | return "<eolian.Type '{0.full_name}', type={0.type!s}>".format(self) | 1032 | return "<eolian.Type '{0.full_name}', type={0.type!s}>".format(self) |
@@ -1059,11 +1059,9 @@ class Type(EolianBaseObject): # OK (1 TODO Unit*) | |||
1059 | def builtin_type(self): | 1059 | def builtin_type(self): |
1060 | return Eolian_Type_Builtin_Type(lib.eolian_type_builtin_type_get(self._obj)) | 1060 | return Eolian_Type_Builtin_Type(lib.eolian_type_builtin_type_get(self._obj)) |
1061 | 1061 | ||
1062 | # TODO FIXME STRANGE API (need Eolian_Unit*) | ||
1063 | @cached_property | 1062 | @cached_property |
1064 | def c_type(self): | 1063 | def c_type(self): |
1065 | # return _str_to_py(lib.eolian_type_c_type_get(self._obj)) | 1064 | return _str_to_py(lib.eolian_type_c_type_get(self._obj)) |
1066 | return 'FIXME' | ||
1067 | 1065 | ||
1068 | @cached_property | 1066 | @cached_property |
1069 | def typedecl(self): | 1067 | def typedecl(self): |
@@ -1107,7 +1105,7 @@ class Type(EolianBaseObject): # OK (1 TODO Unit*) | |||
1107 | return bool(lib.eolian_type_is_ptr(self._obj)) | 1105 | return bool(lib.eolian_type_is_ptr(self._obj)) |
1108 | 1106 | ||
1109 | 1107 | ||
1110 | class Typedecl(EolianBaseObject): # OK (1 TODO Unit*) | 1108 | class Typedecl(EolianBaseObject): |
1111 | def __repr__(self): | 1109 | def __repr__(self): |
1112 | return "<eolian.Typedecl '{0.full_name}', type={0.type!s}>".format(self) | 1110 | return "<eolian.Typedecl '{0.full_name}', type={0.type!s}>".format(self) |
1113 | 1111 | ||
@@ -1127,10 +1125,9 @@ class Typedecl(EolianBaseObject): # OK (1 TODO Unit*) | |||
1127 | def type(self): | 1125 | def type(self): |
1128 | return Eolian_Typedecl_Type(lib.eolian_typedecl_type_get(self._obj)) | 1126 | return Eolian_Typedecl_Type(lib.eolian_typedecl_type_get(self._obj)) |
1129 | 1127 | ||
1130 | # TODO FIX THIS, need Eolian_Unit* param ??? | 1128 | @cached_property |
1131 | # @cached_property | 1129 | def c_type(self): |
1132 | # def c_type(self): | 1130 | return _str_to_py(lib.eolian_typedecl_c_type_get(self._obj)) |
1133 | # return _str_to_py(lib.eolian_typedecl_c_type_get(self._obj)) | ||
1134 | 1131 | ||
1135 | @property | 1132 | @property |
1136 | def namespaces(self): | 1133 | 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 | |||
504 | lib.eolian_typedecl_is_extern.argtypes = [c_void_p,] | 504 | lib.eolian_typedecl_is_extern.argtypes = [c_void_p,] |
505 | lib.eolian_typedecl_is_extern.restype = c_bool | 505 | lib.eolian_typedecl_is_extern.restype = c_bool |
506 | 506 | ||
507 | # TODO FIXME STRANGE API (need Eolian_Unit*) | 507 | # EAPI Eina_Stringshare *eolian_typedecl_c_type_get(const Eolian_Typedecl *tp); |
508 | # EAPI Eina_Stringshare *eolian_typedecl_c_type_get(const Eolian_Unit *unit, const Eolian_Typedecl *tp); | 508 | lib.eolian_typedecl_c_type_get.argtypes = [c_void_p,] |
509 | # lib.eolian_typedecl_c_type_get.argtypes = [c_void_p,] | 509 | lib.eolian_typedecl_c_type_get.restype = None |
510 | # lib.eolian_typedecl_c_type_get.restype = None | ||
511 | 510 | ||
512 | # EAPI Eina_Stringshare *eolian_typedecl_name_get(const Eolian_Typedecl *tp); | 511 | # EAPI Eina_Stringshare *eolian_typedecl_name_get(const Eolian_Typedecl *tp); |
513 | lib.eolian_typedecl_name_get.argtypes = [c_void_p,] | 512 | lib.eolian_typedecl_name_get.argtypes = [c_void_p,] |
@@ -573,10 +572,9 @@ lib.eolian_type_is_const.restype = c_bool | |||
573 | lib.eolian_type_is_ptr.argtypes = [c_void_p,] | 572 | lib.eolian_type_is_ptr.argtypes = [c_void_p,] |
574 | lib.eolian_type_is_ptr.restype = c_bool | 573 | lib.eolian_type_is_ptr.restype = c_bool |
575 | 574 | ||
576 | # TODO FIXME STRANGE API (need Eolian_Unit*) | 575 | # EAPI Eina_Stringshare *eolian_type_c_type_get(const Eolian_Type *tp, Eolian_C_Type_Type ctype); |
577 | # EAPI Eina_Stringshare *eolian_type_c_type_get(const Eolian_Unit *unit, const Eolian_Type *tp, Eolian_C_Type_Type ctype); | 576 | lib.eolian_type_c_type_get.argtypes = [c_void_p,] |
578 | # lib.eolian_type_c_type_get.argtypes = [c_void_p,] | 577 | lib.eolian_type_c_type_get.restype = c_void_p # Stringshare TO BE FREED |
579 | # lib.eolian_type_c_type_get.restype = c_void_p # Stringshare TO BE FREED | ||
580 | 578 | ||
581 | # EAPI Eina_Stringshare *eolian_type_name_get(const Eolian_Type *tp); | 579 | # EAPI Eina_Stringshare *eolian_type_name_get(const Eolian_Type *tp); |
582 | lib.eolian_type_name_get.argtypes = [c_void_p,] | 580 | 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) | |||
348 | fail_if(eolian_typedecl_type_get(tdl) != EOLIAN_TYPEDECL_ALIAS); | 348 | fail_if(eolian_typedecl_type_get(tdl) != EOLIAN_TYPEDECL_ALIAS); |
349 | fail_if(!(type_name = eolian_typedecl_name_get(tdl))); | 349 | fail_if(!(type_name = eolian_typedecl_name_get(tdl))); |
350 | fail_if(strcmp(type_name, "Coord")); | 350 | fail_if(strcmp(type_name, "Coord")); |
351 | fail_if(!(type_name = eolian_typedecl_c_type_get(unit, tdl))); | 351 | fail_if(!(type_name = eolian_typedecl_c_type_get(tdl))); |
352 | fail_if(strcmp(type_name, "typedef int Evas_Coord")); | 352 | fail_if(strcmp(type_name, "typedef int Evas_Coord")); |
353 | eina_stringshare_del(type_name); | 353 | eina_stringshare_del(type_name); |
354 | fail_if(!(type = eolian_typedecl_base_type_get(tdl))); | 354 | fail_if(!(type = eolian_typedecl_base_type_get(tdl))); |
@@ -372,13 +372,13 @@ START_TEST(eolian_typedef) | |||
372 | fail_if(!(type_name = eolian_typedecl_name_get(tdl))); | 372 | fail_if(!(type_name = eolian_typedecl_name_get(tdl))); |
373 | fail_if(strcmp(type_name, "List_Objects")); | 373 | fail_if(strcmp(type_name, "List_Objects")); |
374 | fail_if(!(type = eolian_typedecl_base_type_get(tdl))); | 374 | fail_if(!(type = eolian_typedecl_base_type_get(tdl))); |
375 | fail_if(!(type_name = eolian_type_c_type_get(unit, type, EOLIAN_C_TYPE_DEFAULT))); | 375 | fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_DEFAULT))); |
376 | fail_if(eolian_type_is_owned(type)); | 376 | fail_if(eolian_type_is_owned(type)); |
377 | fail_if(strcmp(type_name, "Eina_List *")); | 377 | fail_if(strcmp(type_name, "Eina_List *")); |
378 | eina_stringshare_del(type_name); | 378 | eina_stringshare_del(type_name); |
379 | fail_if(!(type = eolian_type_base_type_get(type))); | 379 | fail_if(!(type = eolian_type_base_type_get(type))); |
380 | fail_if(!!eolian_type_next_type_get(type)); | 380 | fail_if(!!eolian_type_next_type_get(type)); |
381 | fail_if(!(type_name = eolian_type_c_type_get(unit, type, EOLIAN_C_TYPE_DEFAULT))); | 381 | fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_DEFAULT))); |
382 | fail_if(strcmp(type_name, "Eo *")); | 382 | fail_if(strcmp(type_name, "Eo *")); |
383 | fail_if(eolian_type_is_owned(type)); | 383 | fail_if(eolian_type_is_owned(type)); |
384 | eina_stringshare_del(type_name); | 384 | eina_stringshare_del(type_name); |
@@ -428,21 +428,21 @@ START_TEST(eolian_complex_type) | |||
428 | /* Properties return type */ | 428 | /* Properties return type */ |
429 | fail_if(!(fid = eolian_class_function_get_by_name(class, "a", EOLIAN_PROPERTY))); | 429 | fail_if(!(fid = eolian_class_function_get_by_name(class, "a", EOLIAN_PROPERTY))); |
430 | fail_if(!(type = eolian_function_return_type_get(fid, EOLIAN_PROP_SET))); | 430 | fail_if(!(type = eolian_function_return_type_get(fid, EOLIAN_PROP_SET))); |
431 | fail_if(!(type_name = eolian_type_c_type_get(unit, type, EOLIAN_C_TYPE_RETURN))); | 431 | fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_RETURN))); |
432 | fail_if(!eolian_type_is_owned(type)); | 432 | fail_if(!eolian_type_is_owned(type)); |
433 | fail_if(eolian_type_builtin_type_get(type) != EOLIAN_TYPE_BUILTIN_LIST); | 433 | fail_if(eolian_type_builtin_type_get(type) != EOLIAN_TYPE_BUILTIN_LIST); |
434 | fail_if(strcmp(type_name, "Eina_List *")); | 434 | fail_if(strcmp(type_name, "Eina_List *")); |
435 | eina_stringshare_del(type_name); | 435 | eina_stringshare_del(type_name); |
436 | fail_if(!(type = eolian_type_base_type_get(type))); | 436 | fail_if(!(type = eolian_type_base_type_get(type))); |
437 | fail_if(!!eolian_type_next_type_get(type)); | 437 | fail_if(!!eolian_type_next_type_get(type)); |
438 | fail_if(!(type_name = eolian_type_c_type_get(unit, type, EOLIAN_C_TYPE_DEFAULT))); | 438 | fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_DEFAULT))); |
439 | fail_if(eolian_type_is_owned(type)); | 439 | fail_if(eolian_type_is_owned(type)); |
440 | fail_if(eolian_type_builtin_type_get(type) != EOLIAN_TYPE_BUILTIN_ARRAY); | 440 | fail_if(eolian_type_builtin_type_get(type) != EOLIAN_TYPE_BUILTIN_ARRAY); |
441 | fail_if(strcmp(type_name, "Eina_Array *")); | 441 | fail_if(strcmp(type_name, "Eina_Array *")); |
442 | eina_stringshare_del(type_name); | 442 | eina_stringshare_del(type_name); |
443 | fail_if(!(type = eolian_type_base_type_get(type))); | 443 | fail_if(!(type = eolian_type_base_type_get(type))); |
444 | fail_if(!!eolian_type_next_type_get(type)); | 444 | fail_if(!!eolian_type_next_type_get(type)); |
445 | fail_if(!(type_name = eolian_type_c_type_get(unit, type, EOLIAN_C_TYPE_DEFAULT))); | 445 | fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_DEFAULT))); |
446 | fail_if(!eolian_type_is_owned(type)); | 446 | fail_if(!eolian_type_is_owned(type)); |
447 | fail_if(strcmp(type_name, "Eo *")); | 447 | fail_if(strcmp(type_name, "Eo *")); |
448 | eina_stringshare_del(type_name); | 448 | eina_stringshare_del(type_name); |
@@ -453,13 +453,13 @@ START_TEST(eolian_complex_type) | |||
453 | eina_iterator_free(iter); | 453 | eina_iterator_free(iter); |
454 | fail_if(strcmp(eolian_parameter_name_get(param), "value")); | 454 | fail_if(strcmp(eolian_parameter_name_get(param), "value")); |
455 | fail_if(!(type = eolian_parameter_type_get(param))); | 455 | fail_if(!(type = eolian_parameter_type_get(param))); |
456 | fail_if(!(type_name = eolian_type_c_type_get(unit, type, EOLIAN_C_TYPE_PARAM))); | 456 | fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_PARAM))); |
457 | fail_if(!eolian_type_is_owned(type)); | 457 | fail_if(!eolian_type_is_owned(type)); |
458 | fail_if(strcmp(type_name, "Eina_List *")); | 458 | fail_if(strcmp(type_name, "Eina_List *")); |
459 | eina_stringshare_del(type_name); | 459 | eina_stringshare_del(type_name); |
460 | fail_if(!(type = eolian_type_base_type_get(type))); | 460 | fail_if(!(type = eolian_type_base_type_get(type))); |
461 | fail_if(!!eolian_type_next_type_get(type)); | 461 | fail_if(!!eolian_type_next_type_get(type)); |
462 | fail_if(!(type_name = eolian_type_c_type_get(unit, type, EOLIAN_C_TYPE_DEFAULT))); | 462 | fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_DEFAULT))); |
463 | fail_if(eolian_type_is_owned(type)); | 463 | fail_if(eolian_type_is_owned(type)); |
464 | fail_if(strcmp(type_name, "const char *")); | 464 | fail_if(strcmp(type_name, "const char *")); |
465 | eina_stringshare_del(type_name); | 465 | eina_stringshare_del(type_name); |
@@ -467,13 +467,13 @@ START_TEST(eolian_complex_type) | |||
467 | /* Methods return type */ | 467 | /* Methods return type */ |
468 | fail_if(!(fid = eolian_class_function_get_by_name(class, "foo", EOLIAN_METHOD))); | 468 | fail_if(!(fid = eolian_class_function_get_by_name(class, "foo", EOLIAN_METHOD))); |
469 | fail_if(!(type = eolian_function_return_type_get(fid, EOLIAN_METHOD))); | 469 | fail_if(!(type = eolian_function_return_type_get(fid, EOLIAN_METHOD))); |
470 | fail_if(!(type_name = eolian_type_c_type_get(unit, type, EOLIAN_C_TYPE_RETURN))); | 470 | fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_RETURN))); |
471 | fail_if(!eolian_type_is_owned(type)); | 471 | fail_if(!eolian_type_is_owned(type)); |
472 | fail_if(strcmp(type_name, "Eina_List *")); | 472 | fail_if(strcmp(type_name, "Eina_List *")); |
473 | eina_stringshare_del(type_name); | 473 | eina_stringshare_del(type_name); |
474 | fail_if(!(type = eolian_type_base_type_get(type))); | 474 | fail_if(!(type = eolian_type_base_type_get(type))); |
475 | fail_if(!!eolian_type_next_type_get(type)); | 475 | fail_if(!!eolian_type_next_type_get(type)); |
476 | fail_if(!(type_name = eolian_type_c_type_get(unit, type, EOLIAN_C_TYPE_DEFAULT))); | 476 | fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_DEFAULT))); |
477 | fail_if(eolian_type_is_owned(type)); | 477 | fail_if(eolian_type_is_owned(type)); |
478 | fail_if(eolian_type_builtin_type_get(type) != EOLIAN_TYPE_BUILTIN_STRINGSHARE); | 478 | fail_if(eolian_type_builtin_type_get(type) != EOLIAN_TYPE_BUILTIN_STRINGSHARE); |
479 | fail_if(strcmp(type_name, "Eina_Stringshare *")); | 479 | fail_if(strcmp(type_name, "Eina_Stringshare *")); |
@@ -485,7 +485,7 @@ START_TEST(eolian_complex_type) | |||
485 | eina_iterator_free(iter); | 485 | eina_iterator_free(iter); |
486 | fail_if(strcmp(eolian_parameter_name_get(param), "buf")); | 486 | fail_if(strcmp(eolian_parameter_name_get(param), "buf")); |
487 | fail_if(!(type = eolian_parameter_type_get(param))); | 487 | fail_if(!(type = eolian_parameter_type_get(param))); |
488 | fail_if(!(type_name = eolian_type_c_type_get(unit, type, EOLIAN_C_TYPE_PARAM))); | 488 | fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_PARAM))); |
489 | fail_if(!eolian_type_is_owned(type)); | 489 | fail_if(!eolian_type_is_owned(type)); |
490 | fail_if(eolian_type_builtin_type_get(type) != EOLIAN_TYPE_BUILTIN_MSTRING); | 490 | fail_if(eolian_type_builtin_type_get(type) != EOLIAN_TYPE_BUILTIN_MSTRING); |
491 | fail_if(strcmp(type_name, "char *")); | 491 | fail_if(strcmp(type_name, "char *")); |
@@ -621,7 +621,7 @@ START_TEST(eolian_simple_parsing) | |||
621 | /* Function return */ | 621 | /* Function return */ |
622 | tp = eolian_function_return_type_get(fid, EOLIAN_METHOD); | 622 | tp = eolian_function_return_type_get(fid, EOLIAN_METHOD); |
623 | fail_if(!tp); | 623 | fail_if(!tp); |
624 | string = eolian_type_c_type_get(unit, tp, EOLIAN_C_TYPE_RETURN); | 624 | string = eolian_type_c_type_get(tp, EOLIAN_C_TYPE_RETURN); |
625 | fail_if(!string); | 625 | fail_if(!string); |
626 | fail_if(strcmp(string, "char *")); | 626 | fail_if(strcmp(string, "char *")); |
627 | eina_stringshare_del(string); | 627 | eina_stringshare_del(string); |
@@ -708,7 +708,7 @@ START_TEST(eolian_struct) | |||
708 | fail_if(!(field = eolian_typedecl_struct_field_get(tdl, "something"))); | 708 | fail_if(!(field = eolian_typedecl_struct_field_get(tdl, "something"))); |
709 | fail_if(!(ftype = eolian_typedecl_struct_field_type_get(field))); | 709 | fail_if(!(ftype = eolian_typedecl_struct_field_type_get(field))); |
710 | fail_if(eolian_type_is_ptr(ftype)); | 710 | fail_if(eolian_type_is_ptr(ftype)); |
711 | fail_if(!(type_name = eolian_type_c_type_get(unit, ftype, EOLIAN_C_TYPE_DEFAULT))); | 711 | fail_if(!(type_name = eolian_type_c_type_get(ftype, EOLIAN_C_TYPE_DEFAULT))); |
712 | fail_if(strcmp(type_name, "const char *")); | 712 | fail_if(strcmp(type_name, "const char *")); |
713 | eina_stringshare_del(type_name); | 713 | eina_stringshare_del(type_name); |
714 | 714 | ||
@@ -1468,20 +1468,20 @@ START_TEST(eolian_function_types) | |||
1468 | fail_if(strcmp(eolian_function_name_get(fid), "SimpleFunc")); | 1468 | fail_if(strcmp(eolian_function_name_get(fid), "SimpleFunc")); |
1469 | 1469 | ||
1470 | fail_if(!(type = eolian_function_return_type_get(fid, EOLIAN_FUNCTION_POINTER))); // void is null_return_type? | 1470 | fail_if(!(type = eolian_function_return_type_get(fid, EOLIAN_FUNCTION_POINTER))); // void is null_return_type? |
1471 | fail_if(!(type_name = eolian_type_c_type_get(unit, type, EOLIAN_C_TYPE_RETURN))); | 1471 | fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_RETURN))); |
1472 | fail_if(strcmp(type_name, "const char *")); | 1472 | fail_if(strcmp(type_name, "const char *")); |
1473 | fail_if(!(iter = (eolian_function_parameters_get(fid)))); | 1473 | fail_if(!(iter = (eolian_function_parameters_get(fid)))); |
1474 | 1474 | ||
1475 | fail_if(!(eina_iterator_next(iter, (void**)¶m))); | 1475 | fail_if(!(eina_iterator_next(iter, (void**)¶m))); |
1476 | fail_if(strcmp(eolian_parameter_name_get(param), "a")); | 1476 | fail_if(strcmp(eolian_parameter_name_get(param), "a")); |
1477 | fail_if(!(type = eolian_parameter_type_get(param))); | 1477 | fail_if(!(type = eolian_parameter_type_get(param))); |
1478 | fail_if(!(type_name = eolian_type_c_type_get(unit, type, EOLIAN_C_TYPE_PARAM))); | 1478 | fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_PARAM))); |
1479 | fail_if(strcmp(type_name, "int")); | 1479 | fail_if(strcmp(type_name, "int")); |
1480 | 1480 | ||
1481 | fail_if(!(eina_iterator_next(iter, (void**)¶m))); | 1481 | fail_if(!(eina_iterator_next(iter, (void**)¶m))); |
1482 | fail_if(strcmp(eolian_parameter_name_get(param), "b")); | 1482 | fail_if(strcmp(eolian_parameter_name_get(param), "b")); |
1483 | fail_if(!(type = eolian_parameter_type_get(param))); | 1483 | fail_if(!(type = eolian_parameter_type_get(param))); |
1484 | fail_if(!(type_name = eolian_type_c_type_get(unit, type, EOLIAN_C_TYPE_PARAM))); | 1484 | fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_PARAM))); |
1485 | fail_if(strcmp(type_name, "double")); | 1485 | fail_if(strcmp(type_name, "double")); |
1486 | 1486 | ||
1487 | fail_if(eina_iterator_next(iter, &dummy)); | 1487 | fail_if(eina_iterator_next(iter, &dummy)); |
@@ -1494,7 +1494,7 @@ START_TEST(eolian_function_types) | |||
1494 | fail_if(eolian_function_type_get(fid) != EOLIAN_FUNCTION_POINTER); | 1494 | fail_if(eolian_function_type_get(fid) != EOLIAN_FUNCTION_POINTER); |
1495 | 1495 | ||
1496 | fail_if(!(type = eolian_function_return_type_get(fid, EOLIAN_FUNCTION_POINTER))); | 1496 | fail_if(!(type = eolian_function_return_type_get(fid, EOLIAN_FUNCTION_POINTER))); |
1497 | fail_if(!(type_name = eolian_type_c_type_get(unit, type, EOLIAN_C_TYPE_RETURN))); | 1497 | fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_RETURN))); |
1498 | fail_if(strcmp(type_name, "double")); | 1498 | fail_if(strcmp(type_name, "double")); |
1499 | fail_if(!(iter = (eolian_function_parameters_get(fid)))); | 1499 | fail_if(!(iter = (eolian_function_parameters_get(fid)))); |
1500 | 1500 | ||
@@ -1504,7 +1504,7 @@ START_TEST(eolian_function_types) | |||
1504 | fail_if(!(type = eolian_parameter_type_get(param))); | 1504 | fail_if(!(type = eolian_parameter_type_get(param))); |
1505 | fail_if(eolian_parameter_direction_get(param) != EOLIAN_IN_PARAM); | 1505 | fail_if(eolian_parameter_direction_get(param) != EOLIAN_IN_PARAM); |
1506 | fail_if(eolian_type_is_owned(type)); | 1506 | fail_if(eolian_type_is_owned(type)); |
1507 | fail_if(!(type_name = eolian_type_c_type_get(unit, type, EOLIAN_C_TYPE_PARAM))); | 1507 | fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_PARAM))); |
1508 | fail_if(strcmp(type_name, "const char *")); | 1508 | fail_if(strcmp(type_name, "const char *")); |
1509 | 1509 | ||
1510 | /*out own string */ | 1510 | /*out own string */ |
@@ -1513,7 +1513,7 @@ START_TEST(eolian_function_types) | |||
1513 | fail_if(eolian_parameter_direction_get(param) != EOLIAN_OUT_PARAM); | 1513 | fail_if(eolian_parameter_direction_get(param) != EOLIAN_OUT_PARAM); |
1514 | fail_if(!(type = eolian_parameter_type_get(param))); | 1514 | fail_if(!(type = eolian_parameter_type_get(param))); |
1515 | fail_if(!eolian_type_is_owned(type)); | 1515 | fail_if(!eolian_type_is_owned(type)); |
1516 | fail_if(!(type_name = eolian_type_c_type_get(unit, type, EOLIAN_C_TYPE_PARAM))); | 1516 | fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_PARAM))); |
1517 | fail_if(strcmp(type_name, "char *")); | 1517 | fail_if(strcmp(type_name, "char *")); |
1518 | 1518 | ||
1519 | fail_if(eina_iterator_next(iter, &dummy)); | 1519 | fail_if(eina_iterator_next(iter, &dummy)); |