improve fscripts

This commit is contained in:
lixianjing 2020-11-16 18:22:46 +08:00
parent 601d23bd49
commit 25de6c486c
2 changed files with 8 additions and 3 deletions

View File

@ -4,6 +4,7 @@
* 增加函数object\_to\_json。
* expr\_eval添加对类似$temp.[0].value格式的变量的支持感谢朝泽提供补丁
* object添加object\_set\_prop\_by\_path、object\_can\_exec\_by\_path、object\_exec\_by\_path的接口感谢朝泽提供补丁
* 完善fscript感谢剑超提供补丁
2020/11/14
* 修复android不能熄屏的问题。

View File

@ -187,10 +187,12 @@ static ret_t fscript_get_var(fscript_t* fscript, const char* name, value_t* valu
}
static ret_t fscript_exec_func(fscript_t* fscript, fscript_func_call_t* iter, value_t* result) {
value_t v;
uint32_t i = 0;
ret_t ret = RET_OK;
fscript_args_t args;
value_set_int(&v, 0);
func_args_init(&args, iter->args.size);
args.size = iter->args.size;
return_value_if_fail((args.args != NULL || args.size == 0), RET_OOM);
@ -207,17 +209,19 @@ static ret_t fscript_exec_func(fscript_t* fscript, fscript_func_call_t* iter, va
}
} else if (s->type == VALUE_TYPE_JSCRIPT_FUNC) {
s->type = VALUE_TYPE_POINTER;
fscript_func_call_t* func = (fscript_func_call_t*)value_pointer(s);
if (i > 0 && iter->func == func_if) {
if (value_bool(args.args) && i == 1) {
fscript_exec_func(fscript, func, d);
fscript_exec_func(fscript, func, &v);
}
if (!value_bool(args.args) && i == 2) {
fscript_exec_func(fscript, func, d);
fscript_exec_func(fscript, func, &v);
}
} else {
fscript_exec_func(fscript, func, d);
fscript_exec_func(fscript, func, &v);
}
value_deep_copy(d, &v);
} else {
value_copy(d, s);
}