summaryrefslogtreecommitdiff
path: root/src/bin/eolian
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2019-02-11 16:31:52 -0800
committerCedric BAIL <cedric.bail@free.fr>2019-02-21 11:54:09 -0800
commitb23f65291f9624827e40ebf32d5133cb1074aeb6 (patch)
tree34f7287c424413a2bf5debb2ff8601e6c7d1e00a /src/bin/eolian
parent56a91961ce07337fb9e73f46298415426175d25a (diff)
eo: make reflection setter able to return an error code in case of failure.
Reviewed-by: Marcel Hollerbach <marcel-hollerbach@t-online.de> Differential Revision: https://phab.enlightenment.org/D7935
Diffstat (limited to 'src/bin/eolian')
-rw-r--r--src/bin/eolian/sources.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/bin/eolian/sources.c b/src/bin/eolian/sources.c
index 2bcda4c..e7a4612 100644
--- a/src/bin/eolian/sources.c
+++ b/src/bin/eolian/sources.c
@@ -408,23 +408,30 @@ _gen_reflect_set(Eina_Strbuf *buf, const char *cnamel, const Eolian_Type *valt,
408 else 408 else
409 eina_hash_set(refh, &fid, (void *)EOLIAN_PROP_SET); 409 eina_hash_set(refh, &fid, (void *)EOLIAN_PROP_SET);
410 410
411 eina_strbuf_append(buf, "\nstatic void\n"); 411 eina_strbuf_append(buf, "\nstatic Eina_Error\n");
412 eina_strbuf_append_printf(buf, "__eolian_%s_%s_set_reflect(Eo *obj, Eina_Value val)\n", 412 eina_strbuf_append_printf(buf, "__eolian_%s_%s_set_reflect(Eo *obj, Eina_Value val)\n",
413 cnamel, eolian_function_name_get(fid)); 413 cnamel, eolian_function_name_get(fid));
414 eina_strbuf_append(buf, "{\n"); 414 eina_strbuf_append(buf, "{\n");
415 eina_strbuf_append(buf, " Eina_Error r = 0;");
415 416
416 Eina_Stringshare *ct = eolian_type_c_type_get(valt, EOLIAN_C_TYPE_PARAM); 417 Eina_Stringshare *ct = eolian_type_c_type_get(valt, EOLIAN_C_TYPE_PARAM);
417 const char *starsp = (ct[strlen(ct) - 1] != '*') ? " " : ""; 418 const char *starsp = (ct[strlen(ct) - 1] != '*') ? " " : "";
418 eina_strbuf_append_printf(buf, " %s%scval;\n", ct, starsp); 419 eina_strbuf_append_printf(buf, " %s%scval;\n", ct, starsp);
419 eina_stringshare_del(ct); 420 eina_stringshare_del(ct);
420 421
421 eina_strbuf_append_printf(buf, " eina_value_%s_convert(&val, &cval);\n", initf); 422 eina_strbuf_append_printf(buf, " if (!eina_value_%s_convert(&val, &cval))\n", initf);
423 eina_strbuf_append(buf, " {\n");
424 eina_strbuf_append(buf, " r = EINA_ERROR_VALUE_FAILED;\n");
425 eina_strbuf_append(buf, " goto end;\n");
426 eina_strbuf_append(buf, " }\n");
422 427
423 Eina_Stringshare *fcn = eolian_function_full_c_name_get(fid, EOLIAN_PROP_SET, EINA_FALSE); 428 Eina_Stringshare *fcn = eolian_function_full_c_name_get(fid, EOLIAN_PROP_SET, EINA_FALSE);
424 eina_strbuf_append_printf(buf, " %s(obj, cval);\n", fcn); 429 eina_strbuf_append_printf(buf, " %s(obj, cval);\n", fcn);
425 eina_stringshare_del(fcn); 430 eina_stringshare_del(fcn);
426 431
432 eina_strbuf_append(buf, " end:\n");
427 eina_strbuf_append(buf, " eina_value_flush(&val);\n"); 433 eina_strbuf_append(buf, " eina_value_flush(&val);\n");
434 eina_strbuf_append(buf, " return r;\n");
428 435
429 eina_strbuf_append(buf, "}\n\n"); 436 eina_strbuf_append(buf, "}\n\n");
430} 437}