summaryrefslogtreecommitdiff
path: root/src/bin/eolian/eo_generator.c
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2014-08-07 15:15:07 +0100
committerDaniel Kolesa <d.kolesa@samsung.com>2014-08-21 09:26:03 +0100
commit8c1b9ed3e22e6742f116ae2b8ff2414044c77b65 (patch)
treec9eb357e1630d20e70da70d2c67fe7f1f80b2cd6 /src/bin/eolian/eo_generator.c
parent90e17acd155d202d7c695f6c8192a7fe330978f8 (diff)
eolian: initial API for expression evaluation
This commit also does several side (related) changes. Particularly, it updates the Eolian C generator to use the new API, it adds missing expr types (null, char) and masks, updates the API dealing with default return values to use expressions instead of strings and does several fixes (mainly in lexer) around the place. It also disallows single quoted strings as those are reserved for characters.
Diffstat (limited to 'src/bin/eolian/eo_generator.c')
-rw-r--r--src/bin/eolian/eo_generator.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/bin/eolian/eo_generator.c b/src/bin/eolian/eo_generator.c
index 2d5f7deb73..48234b0972 100644
--- a/src/bin/eolian/eo_generator.c
+++ b/src/bin/eolian/eo_generator.c
@@ -464,20 +464,20 @@ eo_bind_func_generate(const Eolian_Class *class, const Eolian_Function *funcid,
464 func_env.lower_eo_func); 464 func_env.lower_eo_func);
465 if (!ret_is_void) 465 if (!ret_is_void)
466 { 466 {
467 const char *default_ret_val = 467 const Eolian_Expression *default_ret_val =
468 eolian_function_return_default_value_get(funcid, ftype); 468 eolian_function_return_default_value_get(funcid, ftype);
469 const char *val_str = NULL;
469 if (default_ret_val) 470 if (default_ret_val)
470 { 471 {
471 if (!strcmp(default_ret_val, "true")) 472 Eina_Value *val = NULL;
472 default_ret_val = "EINA_TRUE"; 473 Eolian_Expression_Type etp = eolian_expression_eval_type
473 else if (!strcmp(default_ret_val, "false")) 474 (default_ret_val, rettypet, &val);
474 default_ret_val = "EINA_FALSE"; 475 if (etp)
475 else if (!strcmp(default_ret_val, "null")) 476 val_str = eolian_expression_value_to_literal(val, etp);
476 default_ret_val = "NULL";
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,
480 default_ret_val?default_ret_val:"0"); 480 val_str?val_str:"0");
481 481
482 } 482 }
483 if (has_params) 483 if (has_params)