summaryrefslogtreecommitdiff
path: root/src/bin/eolian
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2019-09-05 15:14:39 +0200
committerDaniel Kolesa <d.kolesa@samsung.com>2019-09-05 15:19:28 +0200
commit04b0321bea1637539eff15c7759ab43991fe4d09 (patch)
tree095eecf1f68ea98092946b7a305538f88f7a11d3 /src/bin/eolian
parentee0023055f76096788afae3dbdaaeb9c05b99334 (diff)
eolian: update C generator to respect by_ref as well as tests
Diffstat (limited to 'src/bin/eolian')
-rw-r--r--src/bin/eolian/headers.c9
-rw-r--r--src/bin/eolian/sources.c67
-rw-r--r--src/bin/eolian/types.c6
3 files changed, 44 insertions, 38 deletions
diff --git a/src/bin/eolian/headers.c b/src/bin/eolian/headers.c
index f21ae2e..0973038 100644
--- a/src/bin/eolian/headers.c
+++ b/src/bin/eolian/headers.c
@@ -18,7 +18,7 @@ _gen_param(Eina_Strbuf *buf, Eolian_Function_Parameter *pr,
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(prt, EOLIAN_C_TYPE_PARAM); 21 Eina_Stringshare *prtn = eolian_parameter_c_type_get(pr, EINA_FALSE);
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 {
@@ -83,6 +83,7 @@ _gen_func(const Eolian_State *state, const Eolian_Function *fid,
83 Eina_Bool var_as_ret = EINA_FALSE; 83 Eina_Bool var_as_ret = EINA_FALSE;
84 const Eolian_Type *rtp = eolian_function_return_type_get(fid, ftype); 84 const Eolian_Type *rtp = eolian_function_return_type_get(fid, ftype);
85 Eina_Bool return_move = eolian_function_return_is_move(fid, ftype); 85 Eina_Bool return_move = eolian_function_return_is_move(fid, ftype);
86 Eina_Stringshare *rtps = NULL;
86 if (ftype == EOLIAN_PROP_GET && !rtp) 87 if (ftype == EOLIAN_PROP_GET && !rtp)
87 { 88 {
88 void *d1, *d2; 89 void *d1, *d2;
@@ -92,6 +93,7 @@ _gen_func(const Eolian_State *state, const Eolian_Function *fid,
92 Eolian_Function_Parameter *pr = (Eolian_Function_Parameter *)d1; 93 Eolian_Function_Parameter *pr = (Eolian_Function_Parameter *)d1;
93 rtp = eolian_parameter_type_get(pr); 94 rtp = eolian_parameter_type_get(pr);
94 return_move = eolian_parameter_is_move(pr); 95 return_move = eolian_parameter_is_move(pr);
96 rtps = eolian_parameter_c_type_get(pr, EINA_TRUE);
95 var_as_ret = EINA_TRUE; 97 var_as_ret = EINA_TRUE;
96 } 98 }
97 eina_iterator_free(itr); 99 eina_iterator_free(itr);
@@ -119,17 +121,18 @@ _gen_func(const Eolian_State *state, const Eolian_Function *fid,
119 eina_strbuf_append(buf, "EOAPI "); 121 eina_strbuf_append(buf, "EOAPI ");
120 if (rtp) 122 if (rtp)
121 { 123 {
122 Eina_Stringshare *rtps = eolian_type_c_type_get(rtp, EOLIAN_C_TYPE_RETURN); 124 if (!rtps)
125 rtps = eolian_function_return_c_type_get(fid, ftype);
123 eina_strbuf_append(buf, rtps); 126 eina_strbuf_append(buf, rtps);
124 if (rtps[strlen(rtps) - 1] != '*') 127 if (rtps[strlen(rtps) - 1] != '*')
125 eina_strbuf_append_char(buf, ' '); 128 eina_strbuf_append_char(buf, ' ');
126 eina_stringshare_del(rtps);
127 } 129 }
128 else 130 else
129 eina_strbuf_append(buf, "void "); 131 eina_strbuf_append(buf, "void ");
130 132
131 eina_strbuf_append(buf, fcn); 133 eina_strbuf_append(buf, fcn);
132 eina_stringshare_del(fcn); 134 eina_stringshare_del(fcn);
135 eina_stringshare_del(rtps);
133 136
134 Eina_Strbuf *flagbuf = NULL; 137 Eina_Strbuf *flagbuf = NULL;
135 int nidx = !eolian_function_is_static(fid); 138 int nidx = !eolian_function_is_static(fid);
diff --git a/src/bin/eolian/sources.c b/src/bin/eolian/sources.c
index 2d2db38..dea9d86 100644
--- a/src/bin/eolian/sources.c
+++ b/src/bin/eolian/sources.c
@@ -103,7 +103,7 @@ _gen_func_pointer_param(const char *name, Eina_Stringshare *c_type,
103} 103}
104 104
105static void 105static void
106_append_defval(Eina_Strbuf *buf, const Eolian_Expression *exp, const Eolian_Type *tp) 106_append_defval(Eina_Strbuf *buf, const Eolian_Expression *exp, const Eolian_Type *tp, const char *ctp)
107{ 107{
108 if (exp) 108 if (exp)
109 { 109 {
@@ -139,13 +139,11 @@ _append_defval(Eina_Strbuf *buf, const Eolian_Expression *exp, const Eolian_Type
139 free(sn); 139 free(sn);
140 return; 140 return;
141 } 141 }
142 Eina_Stringshare *ctp = eolian_type_c_type_get(btp, EOLIAN_C_TYPE_DEFAULT);
143 if (strchr(ctp, '*')) 142 if (strchr(ctp, '*'))
144 { 143 {
145 eina_strbuf_append(buf, "NULL"); 144 eina_strbuf_append(buf, "NULL");
146 return; 145 return;
147 } 146 }
148 eina_stringshare_del(ctp);
149 /* enums and remaining regulars... 0 should do */ 147 /* enums and remaining regulars... 0 should do */
150 eina_strbuf_append(buf, "0"); 148 eina_strbuf_append(buf, "0");
151} 149}
@@ -377,9 +375,11 @@ _get_reflect_initf(const Eolian_Type *abtp)
377} 375}
378 376
379static void 377static void
380_gen_reflect_get(Eina_Strbuf *buf, const char *cnamel, const Eolian_Type *valt, 378_gen_reflect_get(Eina_Strbuf *buf, const char *cnamel,
379 const Eolian_Function_Parameter *pr,
381 const Eolian_Function *fid, Eina_Hash *refh) 380 const Eolian_Function *fid, Eina_Hash *refh)
382{ 381{
382 const Eolian_Type *valt = eolian_parameter_type_get(pr);
383 if (eolian_type_is_ptr(valt)) 383 if (eolian_type_is_ptr(valt))
384 return; 384 return;
385 385
@@ -399,7 +399,7 @@ _gen_reflect_get(Eina_Strbuf *buf, const char *cnamel, const Eolian_Type *valt,
399 cnamel, eolian_function_name_get(fid)); 399 cnamel, eolian_function_name_get(fid));
400 eina_strbuf_append(buf, "{\n"); 400 eina_strbuf_append(buf, "{\n");
401 401
402 Eina_Stringshare *ct = eolian_type_c_type_get(valt, EOLIAN_C_TYPE_RETURN); 402 Eina_Stringshare *ct = eolian_parameter_c_type_get(pr, EINA_TRUE);
403 const char *starsp = (ct[strlen(ct) - 1] != '*') ? " " : ""; 403 const char *starsp = (ct[strlen(ct) - 1] != '*') ? " " : "";
404 404
405 Eina_Stringshare *fcn = eolian_function_full_c_name_get(fid, EOLIAN_PROP_GET); 405 Eina_Stringshare *fcn = eolian_function_full_c_name_get(fid, EOLIAN_PROP_GET);
@@ -412,9 +412,11 @@ _gen_reflect_get(Eina_Strbuf *buf, const char *cnamel, const Eolian_Type *valt,
412} 412}
413 413
414static void 414static void
415_gen_reflect_set(Eina_Strbuf *buf, const char *cnamel, const Eolian_Type *valt, 415_gen_reflect_set(Eina_Strbuf *buf, const char *cnamel,
416 const Eolian_Function_Parameter *pr,
416 const Eolian_Function *fid, Eina_Hash *refh) 417 const Eolian_Function *fid, Eina_Hash *refh)
417{ 418{
419 const Eolian_Type *valt = eolian_parameter_type_get(pr);
418 if (eolian_type_is_ptr(valt)) 420 if (eolian_type_is_ptr(valt))
419 return; 421 return;
420 422
@@ -435,7 +437,7 @@ _gen_reflect_set(Eina_Strbuf *buf, const char *cnamel, const Eolian_Type *valt,
435 eina_strbuf_append(buf, "{\n"); 437 eina_strbuf_append(buf, "{\n");
436 eina_strbuf_append(buf, " Eina_Error r = 0;"); 438 eina_strbuf_append(buf, " Eina_Error r = 0;");
437 439
438 Eina_Stringshare *ct = eolian_type_c_type_get(valt, EOLIAN_C_TYPE_PARAM); 440 Eina_Stringshare *ct = eolian_parameter_c_type_get(pr, EINA_FALSE);
439 const char *starsp = (ct[strlen(ct) - 1] != '*') ? " " : ""; 441 const char *starsp = (ct[strlen(ct) - 1] != '*') ? " " : "";
440 eina_strbuf_append_printf(buf, " %s%scval;\n", ct, starsp); 442 eina_strbuf_append_printf(buf, " %s%scval;\n", ct, starsp);
441 eina_stringshare_del(ct); 443 eina_stringshare_del(ct);
@@ -458,14 +460,11 @@ _gen_reflect_set(Eina_Strbuf *buf, const char *cnamel, const Eolian_Type *valt,
458} 460}
459 461
460static void 462static void
461_emit_class_function(Eina_Strbuf *buf, const Eolian_Function *fid, const Eolian_Type *rtp, Eina_Strbuf *params_full, 463_emit_class_function(Eina_Strbuf *buf, const Eolian_Function *fid, const char *rtpn, Eina_Strbuf *params_full,
462 const char *ocnamel, const char *func_suffix, Eina_Strbuf *params, const char *function_name) 464 const char *ocnamel, const char *func_suffix, Eina_Strbuf *params, const char *function_name)
463{ 465{
464 eina_strbuf_append(buf, "EOAPI "); 466 eina_strbuf_append(buf, "EOAPI ");
465 if (rtp) 467 eina_strbuf_append(buf, rtpn);
466 eina_strbuf_append(buf, eolian_type_c_type_get(rtp, EOLIAN_C_TYPE_RETURN));
467 else
468 eina_strbuf_append(buf, "void");
469 eina_strbuf_append(buf, " "); 468 eina_strbuf_append(buf, " ");
470 eina_strbuf_append(buf, function_name); 469 eina_strbuf_append(buf, function_name);
471 eina_strbuf_append(buf, "("); 470 eina_strbuf_append(buf, "(");
@@ -476,7 +475,7 @@ _emit_class_function(Eina_Strbuf *buf, const Eolian_Function *fid, const Eolian_
476 eina_strbuf_append(buf, ")\n"); 475 eina_strbuf_append(buf, ")\n");
477 eina_strbuf_append(buf, "{\n"); 476 eina_strbuf_append(buf, "{\n");
478 eina_strbuf_append_printf(buf, " %s();\n", eolian_class_c_get_function_name_get(eolian_function_class_get(fid))); 477 eina_strbuf_append_printf(buf, " %s();\n", eolian_class_c_get_function_name_get(eolian_function_class_get(fid)));
479 if (rtp) 478 if (strcmp(rtpn, "void"))
480 eina_strbuf_append(buf, " return "); 479 eina_strbuf_append(buf, " return ");
481 else 480 else
482 eina_strbuf_append(buf, " "); 481 eina_strbuf_append(buf, " ");
@@ -504,14 +503,16 @@ _gen_func(const Eolian_Class *cl, const Eolian_Function *fid,
504 Eina_Bool is_prop = (ftype == EOLIAN_PROP_GET || ftype == EOLIAN_PROP_SET); 503 Eina_Bool is_prop = (ftype == EOLIAN_PROP_GET || ftype == EOLIAN_PROP_SET);
505 Eina_Bool var_as_ret = EINA_FALSE; 504 Eina_Bool var_as_ret = EINA_FALSE;
506 /* assume we're not generating reflection api by default */ 505 /* assume we're not generating reflection api by default */
507 const Eolian_Type *reflect_type = NULL; 506 const Eolian_Function_Parameter *reflect_param = NULL;
508 507
509 const Eolian_Expression *def_ret = NULL; 508 const Eolian_Expression *def_ret = NULL;
510 const Eolian_Type *rtp = eolian_function_return_type_get(fid, ftype); 509 const Eolian_Type *rtp = eolian_function_return_type_get(fid, ftype);
510 Eina_Stringshare *rtpn = NULL;
511 if (rtp) 511 if (rtp)
512 { 512 {
513 is_auto = EINA_FALSE; /* can't do auto if func returns */ 513 is_auto = EINA_FALSE; /* can't do auto if func returns */
514 def_ret = eolian_function_return_default_value_get(fid, ftype); 514 def_ret = eolian_function_return_default_value_get(fid, ftype);
515 rtpn = eolian_function_return_c_type_get(fid, ftype);
515 } 516 }
516 517
517 const char *func_suffix = ""; 518 const char *func_suffix = "";
@@ -528,9 +529,10 @@ _gen_func(const Eolian_Class *cl, const Eolian_Function *fid,
528 rtp = eolian_parameter_type_get(pr); 529 rtp = eolian_parameter_type_get(pr);
529 /* reflect only when returning 1 val */ 530 /* reflect only when returning 1 val */
530 if (!eolian_parameter_is_by_ref(pr)) 531 if (!eolian_parameter_is_by_ref(pr))
531 reflect_type = rtp; 532 reflect_param = pr;
532 var_as_ret = EINA_TRUE; 533 var_as_ret = EINA_TRUE;
533 def_ret = eolian_parameter_default_value_get(pr); 534 def_ret = eolian_parameter_default_value_get(pr);
535 rtpn = eolian_parameter_c_type_get(pr, EINA_TRUE);
534 } 536 }
535 eina_iterator_free(itr); 537 eina_iterator_free(itr);
536 } 538 }
@@ -545,7 +547,7 @@ _gen_func(const Eolian_Class *cl, const Eolian_Function *fid,
545 { 547 {
546 Eolian_Function_Parameter *pr = d1; 548 Eolian_Function_Parameter *pr = d1;
547 if (!eolian_parameter_is_by_ref(pr)) 549 if (!eolian_parameter_is_by_ref(pr))
548 reflect_type = eolian_parameter_type_get(pr); 550 reflect_param = pr;
549 } 551 }
550 eina_iterator_free(itr); 552 eina_iterator_free(itr);
551 } 553 }
@@ -560,13 +562,12 @@ _gen_func(const Eolian_Class *cl, const Eolian_Function *fid,
560 { 562 {
561 Eina_Iterator *itr = eolian_property_keys_get(fid, ftype); 563 Eina_Iterator *itr = eolian_property_keys_get(fid, ftype);
562 if (itr) /* has keys: no reflection */ 564 if (itr) /* has keys: no reflection */
563 reflect_type = NULL; 565 reflect_param = NULL;
564 Eolian_Function_Parameter *pr; 566 Eolian_Function_Parameter *pr;
565 EINA_ITERATOR_FOREACH(itr, pr) 567 EINA_ITERATOR_FOREACH(itr, pr)
566 { 568 {
567 const char *prn = eolian_parameter_name_get(pr); 569 const char *prn = eolian_parameter_name_get(pr);
568 const Eolian_Type *pt = eolian_parameter_type_get(pr); 570 Eina_Stringshare *ptn = eolian_parameter_c_type_get(pr, EINA_FALSE);
569 Eina_Stringshare *ptn = eolian_type_c_type_get(pt, EOLIAN_C_TYPE_PARAM);
570 571
571 if (eina_strbuf_length_get(params)) 572 if (eina_strbuf_length_get(params))
572 eina_strbuf_append(params, ", "); 573 eina_strbuf_append(params, ", ");
@@ -646,7 +647,7 @@ _gen_func(const Eolian_Class *cl, const Eolian_Function *fid,
646 const Eolian_Expression *dfv = eolian_parameter_default_value_get(pr); 647 const Eolian_Expression *dfv = eolian_parameter_default_value_get(pr);
647 const char *prn = eolian_parameter_name_get(pr); 648 const char *prn = eolian_parameter_name_get(pr);
648 const Eolian_Type *pt = eolian_parameter_type_get(pr); 649 const Eolian_Type *pt = eolian_parameter_type_get(pr);
649 Eina_Stringshare *ptn = eolian_type_c_type_get(pt, EOLIAN_C_TYPE_PARAM); 650 Eina_Stringshare *ptn = eolian_parameter_c_type_get(pr, EINA_FALSE);
650 const Eolian_Typedecl *ptd = eolian_type_typedecl_get(pt); 651 const Eolian_Typedecl *ptd = eolian_type_typedecl_get(pt);
651 652
652 Eina_Bool had_star = ptn[strlen(ptn) - 1] == '*'; 653 Eina_Bool had_star = ptn[strlen(ptn) - 1] == '*';
@@ -720,8 +721,8 @@ _gen_func(const Eolian_Class *cl, const Eolian_Function *fid,
720 if (impl_same_class && eolian_implement_is_pure_virtual(impl, ftype)) 721 if (impl_same_class && eolian_implement_is_pure_virtual(impl, ftype))
721 impl_need = EINA_FALSE; 722 impl_need = EINA_FALSE;
722 723
723 Eina_Stringshare *rtpn = rtp ? eolian_type_c_type_get(rtp, EOLIAN_C_TYPE_RETURN) 724 if (!rtpn)
724 : eina_stringshare_add("void"); 725 rtpn = eina_stringshare_add("void");
725 726
726 char *cname = NULL, *cnamel = NULL, *ocnamel = NULL; 727 char *cname = NULL, *cnamel = NULL, *ocnamel = NULL;
727 eo_gen_class_names_get(cl, &cname, NULL, &cnamel); 728 eo_gen_class_names_get(cl, &cname, NULL, &cnamel);
@@ -809,7 +810,7 @@ _gen_func(const Eolian_Class *cl, const Eolian_Function *fid,
809 if (rtp) 810 if (rtp)
810 { 811 {
811 eina_strbuf_append(buf, " return "); 812 eina_strbuf_append(buf, " return ");
812 _append_defval(buf, def_ret, rtp); 813 _append_defval(buf, def_ret, rtp, rtpn);
813 eina_strbuf_append(buf, ";\n"); 814 eina_strbuf_append(buf, ";\n");
814 } 815 }
815 eina_strbuf_append(buf, "}\n\n"); 816 eina_strbuf_append(buf, "}\n\n");
@@ -837,12 +838,12 @@ _gen_func(const Eolian_Class *cl, const Eolian_Function *fid,
837 if (impl_same_class && !eolian_function_is_static(fid)) 838 if (impl_same_class && !eolian_function_is_static(fid))
838 { 839 {
839 /* generate reflection implementation */ 840 /* generate reflection implementation */
840 if (reflect_type) 841 if (reflect_param)
841 { 842 {
842 if (ftype == EOLIAN_PROP_GET) 843 if (ftype == EOLIAN_PROP_GET)
843 _gen_reflect_get(buf, cnamel, reflect_type, fid, refh); 844 _gen_reflect_get(buf, cnamel, reflect_param, fid, refh);
844 else 845 else
845 _gen_reflect_set(buf, cnamel, reflect_type, fid, refh); 846 _gen_reflect_set(buf, cnamel, reflect_param, fid, refh);
846 } 847 }
847 848
848 void *data; 849 void *data;
@@ -893,7 +894,7 @@ _gen_func(const Eolian_Class *cl, const Eolian_Function *fid,
893 if (strcmp(rtpn, "void")) 894 if (strcmp(rtpn, "void"))
894 { 895 {
895 eina_strbuf_append_printf(buf, ", %s, ", rtpn); 896 eina_strbuf_append_printf(buf, ", %s, ", rtpn);
896 _append_defval(buf, def_ret, rtp); 897 _append_defval(buf, def_ret, rtp, rtpn);
897 } 898 }
898 899
899 if (fallback_free_ownership) 900 if (fallback_free_ownership)
@@ -912,7 +913,7 @@ _gen_func(const Eolian_Class *cl, const Eolian_Function *fid,
912 eina_stringshare_del(eofn); 913 eina_stringshare_del(eofn);
913 } 914 }
914 if (impl_same_class && eolian_function_is_static(fid)) 915 if (impl_same_class && eolian_function_is_static(fid))
915 _emit_class_function(buf, fid, rtp, params_full, ocnamel, func_suffix, params, eolian_function_full_c_name_get(fid, ftype)); 916 _emit_class_function(buf, fid, rtpn, params_full, ocnamel, func_suffix, params, eolian_function_full_c_name_get(fid, ftype));
916 917
917 free(cname); 918 free(cname);
918 free(cnamel); 919 free(cnamel);
@@ -1245,8 +1246,7 @@ _gen_params(const Eolian_Function *fid, Eolian_Function_Type ftype,
1245 EINA_ITERATOR_FOREACH(itr, pr) 1246 EINA_ITERATOR_FOREACH(itr, pr)
1246 { 1247 {
1247 const char *prn = eolian_parameter_name_get(pr); 1248 const char *prn = eolian_parameter_name_get(pr);
1248 const Eolian_Type *pt = eolian_parameter_type_get(pr); 1249 Eina_Stringshare *ptn = eolian_parameter_c_type_get(pr, EINA_FALSE);
1249 Eina_Stringshare *ptn = eolian_type_c_type_get(pt, EOLIAN_C_TYPE_PARAM);
1250 1250
1251 eina_strbuf_append(params, ", "); 1251 eina_strbuf_append(params, ", ");
1252 eina_strbuf_append(params, prn); 1252 eina_strbuf_append(params, prn);
@@ -1276,7 +1276,7 @@ _gen_params(const Eolian_Function *fid, Eolian_Function_Type ftype,
1276 const char *prn = eolian_parameter_name_get(pr); 1276 const char *prn = eolian_parameter_name_get(pr);
1277 const Eolian_Type *pt = eolian_parameter_type_get(pr); 1277 const Eolian_Type *pt = eolian_parameter_type_get(pr);
1278 const Eolian_Typedecl *ptd = eolian_type_typedecl_get(pt); 1278 const Eolian_Typedecl *ptd = eolian_type_typedecl_get(pt);
1279 Eina_Stringshare *ptn = eolian_type_c_type_get(pt, EOLIAN_C_TYPE_PARAM); 1279 Eina_Stringshare *ptn = eolian_parameter_c_type_get(pr, EINA_FALSE);
1280 1280
1281 if (ptd && eolian_typedecl_type_get(ptd) == EOLIAN_TYPEDECL_FUNCTION_POINTER) 1281 if (ptd && eolian_typedecl_type_get(ptd) == EOLIAN_TYPEDECL_FUNCTION_POINTER)
1282 { 1282 {
@@ -1339,6 +1339,7 @@ _gen_proto(const Eolian_Class *cl, const Eolian_Function *fid,
1339 1339
1340 Eina_Bool var_as_ret = EINA_FALSE; 1340 Eina_Bool var_as_ret = EINA_FALSE;
1341 const Eolian_Type *rtp = eolian_function_return_type_get(fid, ftype); 1341 const Eolian_Type *rtp = eolian_function_return_type_get(fid, ftype);
1342 Eina_Stringshare *rtpn = NULL;
1342 if ((ftype == EOLIAN_PROP_GET) && !rtp) 1343 if ((ftype == EOLIAN_PROP_GET) && !rtp)
1343 { 1344 {
1344 void *d1, *d2; 1345 void *d1, *d2;
@@ -1347,6 +1348,7 @@ _gen_proto(const Eolian_Class *cl, const Eolian_Function *fid,
1347 { 1348 {
1348 Eolian_Function_Parameter *pr = d1; 1349 Eolian_Function_Parameter *pr = d1;
1349 rtp = eolian_parameter_type_get(pr); 1350 rtp = eolian_parameter_type_get(pr);
1351 rtpn = eolian_parameter_c_type_get(pr, EINA_FALSE);
1350 var_as_ret = EINA_TRUE; 1352 var_as_ret = EINA_TRUE;
1351 } 1353 }
1352 eina_iterator_free(itr); 1354 eina_iterator_free(itr);
@@ -1355,7 +1357,8 @@ _gen_proto(const Eolian_Class *cl, const Eolian_Function *fid,
1355 eina_strbuf_append(buf, "EOLIAN static "); 1357 eina_strbuf_append(buf, "EOLIAN static ");
1356 if (rtp) 1358 if (rtp)
1357 { 1359 {
1358 Eina_Stringshare *rtpn = eolian_type_c_type_get(rtp, EOLIAN_C_TYPE_RETURN); 1360 if (!rtpn)
1361 rtpn = eolian_function_return_c_type_get(fid, ftype);
1359 eina_strbuf_append(buf, rtpn); 1362 eina_strbuf_append(buf, rtpn);
1360 eina_stringshare_del(rtpn); 1363 eina_stringshare_del(rtpn);
1361 } 1364 }
diff --git a/src/bin/eolian/types.c b/src/bin/eolian/types.c
index d45d1ba..e79b73b 100644
--- a/src/bin/eolian/types.c
+++ b/src/bin/eolian/types.c
@@ -41,9 +41,8 @@ _type_generate(const Eolian_State *state, const Eolian_Typedecl *tp,
41 Eina_Iterator *membs = eolian_typedecl_struct_fields_get(tp); 41 Eina_Iterator *membs = eolian_typedecl_struct_fields_get(tp);
42 EINA_ITERATOR_FOREACH(membs, memb) 42 EINA_ITERATOR_FOREACH(membs, memb)
43 { 43 {
44 const Eolian_Type *mtp = eolian_typedecl_struct_field_type_get(memb);
45 Eina_Stringshare *ct = NULL; 44 Eina_Stringshare *ct = NULL;
46 ct = eolian_type_c_type_get(mtp, EOLIAN_C_TYPE_DEFAULT); 45 ct = eolian_typedecl_struct_field_c_type_get(memb);
47 eina_strbuf_append_printf(buf, " %s%s%s;", 46 eina_strbuf_append_printf(buf, " %s%s%s;",
48 ct, strchr(ct, '*') ? "" : " ", 47 ct, strchr(ct, '*') ? "" : " ",
49 eolian_typedecl_struct_field_name_get(memb)); 48 eolian_typedecl_struct_field_name_get(memb));
@@ -137,8 +136,9 @@ _type_generate(const Eolian_State *state, const Eolian_Typedecl *tp,
137 eina_strbuf_append(buf, "void "); 136 eina_strbuf_append(buf, "void ");
138 else 137 else
139 { 138 {
140 Eina_Stringshare *ct = eolian_type_c_type_get(rtp, EOLIAN_C_TYPE_RETURN); 139 Eina_Stringshare *ct = eolian_function_return_c_type_get(fid, EOLIAN_FUNCTION_POINTER);
141 eina_strbuf_append_printf(buf, "%s ", ct); 140 eina_strbuf_append_printf(buf, "%s ", ct);
141 eina_stringshare_del(ct);
142 } 142 }
143 143
144 /* Function name */ 144 /* Function name */