summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Zaoui <daniel.zaoui@samsung.com>2015-07-26 11:47:08 +0300
committerDaniel Zaoui <daniel.zaoui@samsung.com>2015-07-26 11:47:08 +0300
commit13e0a2fd5e089d4bc5a75eab0ddf5db9cbe239a2 (patch)
tree3c10d8ea22a8c81a3d919e8ac6532a9b563d51df
parent115f5520293d3d0bdc050841b7b1421afc91d7ea (diff)
Fix last comma handling of function parameters list
\b\b was used to remove the last comma. The problem is that the characters are not really removed. This patch fixes it by adding a comma before the current parameter.
-rw-r--r--src/bin/ea_cgen/ea_cgen.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/src/bin/ea_cgen/ea_cgen.c b/src/bin/ea_cgen/ea_cgen.c
index ab92551..0f6d58a 100644
--- a/src/bin/ea_cgen/ea_cgen.c
+++ b/src/bin/ea_cgen/ea_cgen.c
@@ -255,17 +255,16 @@ _prop_apply(const Ea *ea_obj, const Ea *ea_func, Object_Context *obj_ctx)
255{ 255{
256 if (!obj_ctx->inside_cb && !_check_function_resolution(ea_obj, ea_func)) return EINA_TRUE; 256 if (!obj_ctx->inside_cb && !_check_function_resolution(ea_obj, ea_func)) return EINA_TRUE;
257 Eina_Iterator *pitr = ea_function_parameters_get(ea_func); 257 Eina_Iterator *pitr = ea_function_parameters_get(ea_func);
258 Eina_Strbuf *buf = eina_strbuf_new(); 258 Eina_Strbuf *buf = NULL;
259 const Eolian_Function *func = ea_function_func_get(ea_func); 259 const Eolian_Function *func = ea_function_func_get(ea_func);
260 Eolian_Function_Type ftype = eolian_function_type_get(func); 260 Eolian_Function_Type ftype = eolian_function_type_get(func);
261 const Ea_Function_Parameter *ea_par; 261 const Ea_Function_Parameter *ea_par;
262 262
263 eina_strbuf_append_printf(buf, " eo_do(%s, %s(",
264 ea_object_name_get(ea_obj),
265 eolian_function_full_c_name_get(func, ftype == EOLIAN_PROPERTY ? EOLIAN_PROP_SET : ftype, EINA_FALSE));
266 if (obj_ctx->inside_cb) ADD_TO_LIST(session_ctx.global_entities, ea_obj); 263 if (obj_ctx->inside_cb) ADD_TO_LIST(session_ctx.global_entities, ea_obj);
267 EINA_ITERATOR_FOREACH(pitr, ea_par) 264 EINA_ITERATOR_FOREACH(pitr, ea_par)
268 { 265 {
266 if (!buf) buf = eina_strbuf_new();
267 else eina_strbuf_append_printf(buf, ", ");
269 if (obj_ctx->inside_cb && 268 if (obj_ctx->inside_cb &&
270 ea_parameter_type_get(ea_par) == EA_PARAM_OBJECT) 269 ea_parameter_type_get(ea_par) == EA_PARAM_OBJECT)
271 { 270 {
@@ -273,15 +272,14 @@ _prop_apply(const Ea *ea_obj, const Ea *ea_func, Object_Context *obj_ctx)
273 ADD_TO_LIST(session_ctx.global_entities, ea_par_obj); 272 ADD_TO_LIST(session_ctx.global_entities, ea_par_obj);
274 } 273 }
275 _param_append(ea_par, buf); 274 _param_append(ea_par, buf);
276 eina_strbuf_append_printf(buf, ", ");
277 } 275 }
278 /* Remove useless ", " */
279 if (pitr) eina_strbuf_append(buf, "\b\b");
280 eina_iterator_free(pitr); 276 eina_iterator_free(pitr);
281 277
282 eina_strbuf_append_printf(obj_ctx->buf, "%s));\n", 278 eina_strbuf_append_printf(obj_ctx->buf, " eo_do(%s, %s(%s));\n",
283 eina_strbuf_string_get(buf)); 279 ea_object_name_get(ea_obj),
284 eina_strbuf_free(buf); 280 eolian_function_full_c_name_get(func, ftype == EOLIAN_PROPERTY ? EOLIAN_PROP_SET : ftype, EINA_FALSE),
281 buf ? eina_strbuf_string_get(buf) : "");
282 if (buf) eina_strbuf_free(buf);
285 283
286#if 0 284#if 0
287 /* From callback but not because of item creation */ 285 /* From callback but not because of item creation */
@@ -560,15 +558,21 @@ _obj_create(const Ea *ea_obj, Object_Context *obj_ctx)
560 Eina_Iterator *pitr = ea_function_parameters_get(ea_func); 558 Eina_Iterator *pitr = ea_function_parameters_get(ea_func);
561 const Eolian_Function *func = ea_function_func_get(ea_func); 559 const Eolian_Function *func = ea_function_func_get(ea_func);
562 Eolian_Function_Type ftype = eolian_function_type_get(func); 560 Eolian_Function_Type ftype = eolian_function_type_get(func);
561 Eina_Strbuf *params = NULL;
563 eina_strbuf_append_printf(ctor_buf, "%s(", 562 eina_strbuf_append_printf(ctor_buf, "%s(",
564 eolian_function_full_c_name_get(func, ftype == EOLIAN_PROPERTY ? EOLIAN_PROP_SET : ftype, EINA_FALSE)); 563 eolian_function_full_c_name_get(func, ftype == EOLIAN_PROPERTY ? EOLIAN_PROP_SET : ftype, EINA_FALSE));
565 EINA_ITERATOR_FOREACH(pitr, ea_par) 564 EINA_ITERATOR_FOREACH(pitr, ea_par)
566 { 565 {
567 _param_append(ea_par, ctor_buf); 566 if (!params) params = eina_strbuf_new();
568 eina_strbuf_append_printf(ctor_buf, ", "); 567 else eina_strbuf_append_printf(params, ", ");
568 _param_append(ea_par, params);
569 } 569 }
570 /* Remove useless ", " */ 570 /* Remove useless ", " */
571 if (pitr) eina_strbuf_append(ctor_buf, "\b\b"); 571 if (params)
572 {
573 eina_strbuf_append(ctor_buf, eina_strbuf_string_get(params));
574 eina_strbuf_free(params);
575 }
572 eina_iterator_free(pitr); 576 eina_iterator_free(pitr);
573 eina_strbuf_append_printf(ctor_buf, "),"); 577 eina_strbuf_append_printf(ctor_buf, "),");
574 } 578 }