summaryrefslogtreecommitdiff
path: root/src/bin/eolian
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2014-08-13 11:25:04 +0100
committerDaniel Kolesa <d.kolesa@samsung.com>2014-08-21 09:26:04 +0100
commita5964f0252c7e6698ab26f77dfaf0454dd3acbe9 (patch)
tree8c51e452698e614bd8c3dc90f866d3b843f9dab5 /src/bin/eolian
parent18c2b5082e1cc6f84d437a6c024474b43d8f420f (diff)
eolian: add comments containing original expressions to generated enum fields
This required a new API, eolian_expression_serialize.
Diffstat (limited to 'src/bin/eolian')
-rw-r--r--src/bin/eolian/eo_generator.c4
-rw-r--r--src/bin/eolian/legacy_generator.c4
-rw-r--r--src/bin/eolian/types_generator.c6
3 files changed, 10 insertions, 4 deletions
diff --git a/src/bin/eolian/eo_generator.c b/src/bin/eolian/eo_generator.c
index 48234b0972..90d87b69cf 100644
--- a/src/bin/eolian/eo_generator.c
+++ b/src/bin/eolian/eo_generator.c
@@ -469,11 +469,11 @@ eo_bind_func_generate(const Eolian_Class *class, const Eolian_Function *funcid,
469 const char *val_str = NULL; 469 const char *val_str = NULL;
470 if (default_ret_val) 470 if (default_ret_val)
471 { 471 {
472 Eina_Value *val = NULL; 472 Eina_Value val;
473 Eolian_Expression_Type etp = eolian_expression_eval_type 473 Eolian_Expression_Type etp = eolian_expression_eval_type
474 (default_ret_val, rettypet, &val); 474 (default_ret_val, rettypet, &val);
475 if (etp) 475 if (etp)
476 val_str = eolian_expression_value_to_literal(val, etp); 476 val_str = eolian_expression_value_to_literal(&val, etp);
477 } 477 }
478 eina_strbuf_append_printf(eo_func_decl, ", %s%s, %s", 478 eina_strbuf_append_printf(eo_func_decl, ", %s%s, %s",
479 ret_const ? "const " : "", rettype, 479 ret_const ? "const " : "", rettype,
diff --git a/src/bin/eolian/legacy_generator.c b/src/bin/eolian/legacy_generator.c
index 1794384e69..e32e444f0f 100644
--- a/src/bin/eolian/legacy_generator.c
+++ b/src/bin/eolian/legacy_generator.c
@@ -331,11 +331,11 @@ _eapi_func_generate(const Eolian_Class *class, const Eolian_Function *funcid, Eo
331 const char *val_str = NULL; 331 const char *val_str = NULL;
332 if (default_ret_val) 332 if (default_ret_val)
333 { 333 {
334 Eina_Value *val = NULL; 334 Eina_Value val;
335 Eolian_Expression_Type etp = eolian_expression_eval_type 335 Eolian_Expression_Type etp = eolian_expression_eval_type
336 (default_ret_val, rettypet, &val); 336 (default_ret_val, rettypet, &val);
337 if (etp) 337 if (etp)
338 val_str = eolian_expression_value_to_literal(val, etp); 338 val_str = eolian_expression_value_to_literal(&val, etp);
339 } 339 }
340 Eina_Bool had_star = !!strchr(rettype, '*'); 340 Eina_Bool had_star = !!strchr(rettype, '*');
341 sprintf (tmpstr, " %s%s%s%s = %s;\n", 341 sprintf (tmpstr, " %s%s%s%s = %s;\n",
diff --git a/src/bin/eolian/types_generator.c b/src/bin/eolian/types_generator.c
index a92ff436b2..63d4128c91 100644
--- a/src/bin/eolian/types_generator.c
+++ b/src/bin/eolian/types_generator.c
@@ -138,6 +138,12 @@ _type_generate(const Eolian_Type *tp, Eina_Bool in_typedef)
138 Eolian_Expression_Type et = eolian_expression_eval(member, EOLIAN_MASK_INT, &v); 138 Eolian_Expression_Type et = eolian_expression_eval(member, EOLIAN_MASK_INT, &v);
139 const char *lit = eolian_expression_value_to_literal(&v, et); 139 const char *lit = eolian_expression_value_to_literal(&v, et);
140 eina_strbuf_append_printf(buf, " %s = %s", eina_strbuf_string_get(membuf), lit); 140 eina_strbuf_append_printf(buf, " %s = %s", eina_strbuf_string_get(membuf), lit);
141 const char *exp = eolian_expression_serialize(member);
142 if (exp && strcmp(lit, exp))
143 {
144 eina_strbuf_append_printf(buf, " /* %s */", exp);
145 eina_stringshare_del(exp);
146 }
141 eina_stringshare_del(lit); 147 eina_stringshare_del(lit);
142 eina_value_flush(&v); 148 eina_value_flush(&v);
143 } 149 }