diff --git a/src/awtk_global.c b/src/awtk_global.c index 1d99cb7f6..424a15f02 100644 --- a/src/awtk_global.c +++ b/src/awtk_global.c @@ -35,6 +35,7 @@ #include "base/window_manager.h" #include "base/widget_factory.h" #include "base/assets_manager.h" +#include "fscript_ext/fscript_ext.h" #ifdef WITH_DATA_READER_WRITER #include "tkc/data_reader_factory.h" @@ -153,6 +154,7 @@ ret_t tk_init_internal(void) { s_ui_thread_id = tk_thread_self(); fscript_global_init(); + fscript_ext_init(); #ifdef WITH_DATA_READER_WRITER data_writer_factory_set(data_writer_factory_create()); data_reader_factory_set(data_reader_factory_create()); diff --git a/src/fscript_ext/fscript_ext.c b/src/fscript_ext/fscript_ext.c new file mode 100644 index 000000000..c3b127e38 --- /dev/null +++ b/src/fscript_ext/fscript_ext.c @@ -0,0 +1,30 @@ +/** + * File: fscript_ext.h + * Author: AWTK Develop Team + * Brief: ext functions for fscript + * + * Copyright (c) 2020 - 2021 Guangzhou ZHIYUAN Electronics Co.,Ltd. + * + */ + +/** + * History: + * ================================================================ + * 2021-01-03 Li XianJing created + * + */ + +#include "fscript_ext/fscript_math.h" + +#if defined(LINUX) || defined(WINDOWS) || defined(MACOS) || defined(ANDROID) || defined(IOS) +#define FSCRIPT_WITH_MATH 1 +#endif/*PC*/ + +ret_t fscript_ext_init(void) { +#ifdef FSCRIPT_WITH_MATH + fscript_math_register(); +#endif/*FSCRIPT_WITH_MATH*/ + + return RET_OK; +} + diff --git a/src/fscript_ext/fscript_ext.h b/src/fscript_ext/fscript_ext.h new file mode 100644 index 000000000..d1d2b402e --- /dev/null +++ b/src/fscript_ext/fscript_ext.h @@ -0,0 +1,35 @@ +/** + * File: fscript_ext.h + * Author: AWTK Develop Team + * Brief: ext functions for fscript + * + * Copyright (c) 2020 - 2021 Guangzhou ZHIYUAN Electronics Co.,Ltd. + * + */ + +/** + * History: + * ================================================================ + * 2021-01-03 Li XianJing created + * + */ + +#ifndef TK_FSCRIPT_EXT_H +#define TK_FSCRIPT_EXT_H + +#include "tkc/str.h" +#include "tkc/object.h" + +BEGIN_C_DECLS + +/** + * @method fscript_ext_init + * 注册扩展函数。 + * + * @return {ret_t} 返回RET_OK表示成功,否则表示失败。 + */ +ret_t fscript_ext_init(void); + +END_C_DECLS + +#endif /*TK_FSCRIPT_EXT_H*/