{
if (exp)
{
- Eolian_Value val = eolian_expression_eval_type(src, exp, tp);
+ Eolian_Value val = eolian_expression_eval_type(exp, tp);
Eina_Stringshare *lit = eolian_expression_value_to_literal(&val);
if (lit)
{
}
else if ((ftype != EOLIAN_PROP_SET) && dfv)
{
- Eolian_Value val = eolian_expression_eval(src, dfv, EOLIAN_MASK_ALL);
+ Eolian_Value val = eolian_expression_eval(dfv, EOLIAN_MASK_ALL);
if (val.type)
{
Eina_Stringshare *vals = eolian_expression_value_to_literal(&val);
else
{
Eolian_Value val =
- eolian_expression_eval(src, vale, EOLIAN_MASK_INT);
+ eolian_expression_eval(vale, EOLIAN_MASK_INT);
const char *lit = eolian_expression_value_to_literal(&val);
eina_strbuf_append_printf(buf, " %s = %s", membn, lit);
const char *exp = eolian_expression_serialize(vale);
eina_strbuf_prepend_printf(buf, "#ifndef %s\n", fn);
eina_strbuf_append_printf(buf, "#define %s ", fn);
const Eolian_Expression *vv = eolian_variable_value_get(vr);
- Eolian_Value val = eolian_expression_eval_type(src, vv, vt);
+ Eolian_Value val = eolian_expression_eval_type(vv, vt);
Eina_Stringshare *lit = eolian_expression_value_to_literal(&val);
eina_strbuf_append(buf, lit);
Eina_Stringshare *exp = eolian_expression_serialize(vv);
eina_stringshare_del(ct);
free(fn);
- Eolian_Value val = eolian_expression_eval_type(src, vv, vt);
+ Eolian_Value val = eolian_expression_eval_type(vv, vt);
Eina_Stringshare *lit = eolian_expression_value_to_literal(&val);
eina_strbuf_append(buf, lit);
eina_strbuf_append_char(buf, ';');
const Eolian_Function *eolian_typedecl_function_pointer_get(const Eolian_Typedecl *tp);
- Eolian_Value_t eolian_expression_eval(const Eolian_Unit *unit, const Eolian_Expression *expr, Eolian_Expression_Mask m);
- Eolian_Value_t eolian_expression_eval_type(const Eolian_Unit *unit, const Eolian_Expression *expr, const Eolian_Type *type);
+ Eolian_Value_t eolian_expression_eval(const Eolian_Expression *expr, Eolian_Expression_Mask m);
+ Eolian_Value_t eolian_expression_eval_type(const Eolian_Expression *expr, const Eolian_Type *type);
const char *eolian_expression_value_to_literal(const Eolian_Value *v);
const char *eolian_expression_serialize(const Eolian_Expression *expr);
Eolian_Expression_Type eolian_expression_type_get(const Eolian_Expression *expr);
M.Expression = ffi.metatype("Eolian_Expression", {
__index = {
- eval = function(self, unit, mask)
+ eval = function(self, mask)
mask = mask or emask.ALL
- local v = eolian.eolian_expression_eval(unit, self, mask)
+ local v = eolian.eolian_expression_eval(self, mask)
if v == nil then return nil end
return ffi.cast("Eolian_Value*", v)
end,
- eval_type = function(self, unit, tp)
- local v = eolian.eolian_expression_eval_type(unit, self, tp)
+ eval_type = function(self, tp)
+ local v = eolian.eolian_expression_eval_type(self, tp)
if v == nil then return nil end
return ffi.cast("Eolian_Value*", v)
end,
]]
get {}
values {
- l: uint(0); [[Left border pixels, usually 0 or 1]]
- r: uint(0); [[Right border pixels, usually 0 or 1]]
- t: uint(0); [[Top border pixels, usually 0 or 1]]
- b: uint(0); [[Bottom border pixels, usually 0 or 1]]
+ l: uint(0U); [[Left border pixels, usually 0 or 1]]
+ r: uint(0U); [[Right border pixels, usually 0 or 1]]
+ t: uint(0U); [[Top border pixels, usually 0 or 1]]
+ b: uint(0U); [[Bottom border pixels, usually 0 or 1]]
}
}
/*
* @brief Evaluate an Eolian expression.
*
- * @param[in] unit the unit to look in
* @param[in] expr the expression.
* @param[in] mask the mask of allowed values (can combine with bitwise OR).
* @return the value, its type is set to EOLIAN_EXPR_UNKNOWN on error.
*
* @ingroup Eolian
*/
-EAPI Eolian_Value eolian_expression_eval(const Eolian_Unit *unit, const Eolian_Expression *expr, Eolian_Expression_Mask m);
+EAPI Eolian_Value eolian_expression_eval(const Eolian_Expression *expr, Eolian_Expression_Mask m);
/*
* @brief Evaluate an Eolian expression given a type instead of a mask.
*
- * @param[in] unit the unit to look in
* @param[in] expr the expression.
* @param[in] type the type the expression is assigned to.
* @return the value, its type is set to EOLIAN_EXPR_UNKNOWN on error.
*
* @ingroup Eolian
*/
-EAPI Eolian_Value eolian_expression_eval_type(const Eolian_Unit *unit, const Eolian_Expression *expr, const Eolian_Type *type);
+EAPI Eolian_Value eolian_expression_eval_type(const Eolian_Expression *expr, const Eolian_Type *type);
/*
* @brief Convert the result of expression evaluation to a literal as in how
}
case EOLIAN_EXPR_STRING:
{
- if (!(mask & EOLIAN_MASK_STRING))
+ if (!(mask & EOLIAN_MASK_STRING) && !(mask & EOLIAN_MASK_NULL))
return expr_type_error(expr, EOLIAN_MASK_STRING, mask);
*out = *expr;
return EINA_TRUE;
#include "eolian_database.h"
EAPI Eolian_Value
-eolian_expression_eval(const Eolian_Unit *unit, const Eolian_Expression *expr,
- Eolian_Expression_Mask m)
+eolian_expression_eval(const Eolian_Expression *expr, Eolian_Expression_Mask m)
{
Eolian_Value err;
err.type = EOLIAN_EXPR_UNKNOWN;
EINA_SAFETY_ON_NULL_RETURN_VAL(expr, err);
- return database_expr_eval(unit, (Eolian_Expression *)expr, m);
+ return database_expr_eval(NULL, (Eolian_Expression *)expr, m);
}
EAPI Eolian_Value
-eolian_expression_eval_type(const Eolian_Unit *unit,
- const Eolian_Expression *expr,
+eolian_expression_eval_type(const Eolian_Expression *expr,
const Eolian_Type *type)
{
Eolian_Value err;
err.type = EOLIAN_EXPR_UNKNOWN;
EINA_SAFETY_ON_NULL_RETURN_VAL(expr, err);
- return database_expr_eval_type(unit, (Eolian_Expression *)expr, type);
+ return database_expr_eval_type(NULL, (Eolian_Expression *)expr, type);
}
static void
eina_strbuf_append(buf, ef->name);
if (ef->value)
{
- Eolian_Value val = eolian_expression_eval(src, ef->value,
- EOLIAN_MASK_INT);
+ Eolian_Value val = eolian_expression_eval(ef->value,
+ EOLIAN_MASK_INT);
const char *ret;
eina_strbuf_append(buf, " = ");
ret = eolian_expression_value_to_literal(&val);
if (!_validate_type(src, param->type))
return EINA_FALSE;
+ if (param->value && !_validate_expr(src, param->value, param->type, 0))
+ return EINA_FALSE;
+
if (!_validate_doc(src, param->doc))
return EINA_FALSE;
name = eolian_typedecl_enum_field_name_get(enum_field);
c_name = eolian_typedecl_enum_field_c_name_get(enum_field);
auto exp = eolian_typedecl_enum_field_value_get(enum_field, EINA_TRUE);
- value = eolian_expression_eval(unit, exp, EOLIAN_MASK_INT); // FIXME hardcoded int
+ value = eolian_expression_eval(exp, EOLIAN_MASK_INT); // FIXME hardcoded int
documentation = eolian_typedecl_enum_field_documentation_get(enum_field);
}
};
@property viewbox_align {
[[Control how the viewbox is positioned inside the viewport.]]
values {
- align_x: double(0); [[Alignment in the horizontal axis (0 <= align_x <= 1).]]
- align_y: double(0); [[Alignment in the vertical axis (0 <= align_y <= 1).]]
+ align_x: double(0.0); [[Alignment in the horizontal axis (0 <= align_x <= 1).]]
+ align_y: double(0.0); [[Alignment in the vertical axis (0 <= align_y <= 1).]]
}
}
@property root_node {
end,
eval_enum = function(self)
- -- FIXME: unit
- return self.expr:eval(eos:unit_get(), eolian.expression_mask.INT)
+ return self.expr:eval(eolian.expression_mask.INT)
end,
eval_type = function(self, tp)
- -- FIXME: unit
- return self.expr:eval_type(eos:unit_get(), tp.type)
+ return self.expr:eval_type(tp.type)
end,
serialize = function(self)
fail_if(strcmp(eolian_type_name_get(tp), "bool"));
expr = eolian_function_return_default_value_get(fid, EOLIAN_PROP_SET);
fail_if(!expr);
- v = eolian_expression_eval(unit, expr, EOLIAN_MASK_BOOL);
+ v = eolian_expression_eval(expr, EOLIAN_MASK_BOOL);
fail_if(v.type != EOLIAN_EXPR_BOOL);
/* Get return */
tp = eolian_function_return_type_get(fid, EOLIAN_PROP_GET);
fail_if(strcmp(eolian_parameter_name_get(param), "value"));
expr = eolian_parameter_default_value_get(param);
fail_if(!expr);
- v = eolian_expression_eval(unit, expr, EOLIAN_MASK_INT);
+ v = eolian_expression_eval(expr, EOLIAN_MASK_INT);
fail_if(v.type != EOLIAN_EXPR_INT);
fail_if(v.value.i != 100);
eina_stringshare_del(string);
expr = eolian_function_return_default_value_get(fid, EOLIAN_METHOD);
fail_if(!expr);
- v = eolian_expression_eval(unit, expr, EOLIAN_MASK_NULL);
+ v = eolian_expression_eval(expr, EOLIAN_MASK_NULL);
fail_if(v.type != EOLIAN_EXPR_NULL);
fail_if(eolian_function_is_legacy_only(fid, EOLIAN_METHOD));
fail_if(strcmp(eolian_parameter_name_get(param), "c"));
expr = eolian_parameter_default_value_get(param);
fail_if(!expr);
- v = eolian_expression_eval(unit, expr, EOLIAN_MASK_FLOAT);
+ v = eolian_expression_eval(expr, EOLIAN_MASK_FLOAT);
fail_if(v.type != EOLIAN_EXPR_DOUBLE);
fail_if(v.value.d != 1337.6);
fail_if(!(eina_iterator_next(iter, (void**)¶m)));
fail_if(!(name = eolian_type_name_get(type)));
fail_if(strcmp(name, "int"));
fail_if(!(exp = eolian_variable_value_get(var)));
- v = eolian_expression_eval_type(unit, exp, type);
+ v = eolian_expression_eval_type(exp, type);
fail_if(v.type != EOLIAN_EXPR_INT);
fail_if(v.value.i != 5);
fail_if(!(name = eolian_type_name_get(type)));
fail_if(strcmp(name, "float"));
fail_if(!(exp = eolian_variable_value_get(var)));
- v = eolian_expression_eval_type(unit, exp, type);
+ v = eolian_expression_eval_type(exp, type);
fail_if(v.type != EOLIAN_EXPR_FLOAT);
fail_if(((int)v.value.f) != 10);
fail_if(!(field = eolian_typedecl_enum_field_get(tdl, "first")));
fail_if(!(exp = eolian_typedecl_enum_field_value_get(field, EINA_FALSE)));
- v = eolian_expression_eval(unit, exp, EOLIAN_MASK_ALL);
+ v = eolian_expression_eval(exp, EOLIAN_MASK_ALL);
fail_if(v.type != EOLIAN_EXPR_INT);
fail_if(v.value.i != 0);
fail_if(!(field = eolian_typedecl_enum_field_get(tdl, "baz")));
fail_if(!(exp = eolian_typedecl_enum_field_value_get(field, EINA_FALSE)));
- v = eolian_expression_eval(unit, exp, EOLIAN_MASK_ALL);
+ v = eolian_expression_eval(exp, EOLIAN_MASK_ALL);
fail_if(v.type != EOLIAN_EXPR_INT);
fail_if(v.value.i != 15);
fail_if(!(field = eolian_typedecl_enum_field_get(tdl, "foo")));
fail_if(!(exp = eolian_typedecl_enum_field_value_get(field, EINA_FALSE)));
- v = eolian_expression_eval(unit, exp, EOLIAN_MASK_ALL);
+ v = eolian_expression_eval(exp, EOLIAN_MASK_ALL);
fail_if(v.type != EOLIAN_EXPR_INT);
fail_if(v.value.i != 15);
fail_if(!(field = eolian_typedecl_enum_field_get(tdl, "flag1")));
fail_if(!(exp = eolian_typedecl_enum_field_value_get(field, EINA_FALSE)));
- v = eolian_expression_eval(unit, exp, EOLIAN_MASK_ALL);
+ v = eolian_expression_eval(exp, EOLIAN_MASK_ALL);
fail_if(v.type != EOLIAN_EXPR_INT);
fail_if(v.value.i != (1 << 0));
fail_if(!(field = eolian_typedecl_enum_field_get(tdl, "flag2")));
fail_if(!(exp = eolian_typedecl_enum_field_value_get(field, EINA_FALSE)));
- v = eolian_expression_eval(unit, exp, EOLIAN_MASK_ALL);
+ v = eolian_expression_eval(exp, EOLIAN_MASK_ALL);
fail_if(v.type != EOLIAN_EXPR_INT);
fail_if(v.value.i != (1 << 1));
fail_if(!(field = eolian_typedecl_enum_field_get(tdl, "flag3")));
fail_if(!(exp = eolian_typedecl_enum_field_value_get(field, EINA_FALSE)));
- v = eolian_expression_eval(unit, exp, EOLIAN_MASK_ALL);
+ v = eolian_expression_eval(exp, EOLIAN_MASK_ALL);
fail_if(v.type != EOLIAN_EXPR_INT);
fail_if(v.value.i != (1 << 2));
fail_if(!(name = eolian_type_name_get(type)));
fail_if(strcmp(name, "Baz"));
fail_if(!(exp = eolian_variable_value_get(var)));
- v = eolian_expression_eval(unit, exp, EOLIAN_MASK_ALL);
+ v = eolian_expression_eval(exp, EOLIAN_MASK_ALL);
fail_if(v.type != EOLIAN_EXPR_INT);
fail_if(v.value.i != (1 << 0));
fail_if(!(var = eolian_variable_constant_get_by_name(unit, "Pants")));
fail_if(eolian_variable_type_get(var) != EOLIAN_VAR_CONSTANT);
fail_if(!(exp = eolian_variable_value_get(var)));
- v = eolian_expression_eval(unit, exp, EOLIAN_MASK_ALL);
+ v = eolian_expression_eval(exp, EOLIAN_MASK_ALL);
fail_if(v.type != EOLIAN_EXPR_INT);
fail_if(v.value.i != 5);