format code

This commit is contained in:
lixianjing 2021-08-30 17:17:48 +08:00
parent 179642e882
commit aa0922299d
61 changed files with 322 additions and 306 deletions

View File

@ -31,7 +31,6 @@
/* awtk develop released a stable version */
#ifndef AWTK_VERSION_RELEASE_ID
#define AWTK_VERSION_RELEASE_ID AWTK_VERSION_EXPERIMENTAL
#endif/*AWTK_VERSION_RELEASE_ID*/
#endif/*AWTK_VERSION_H*/
#endif /*AWTK_VERSION_RELEASE_ID*/
#endif /*AWTK_VERSION_H*/

View File

@ -135,7 +135,8 @@ event_t* wheel_event_init(wheel_event_t* event, uint32_t type, void* target, int
}
event_t* orientation_event_init(orientation_event_t* event, uint32_t type, void* target,
lcd_orientation_t old_orientation, lcd_orientation_t new_orientation) {
lcd_orientation_t old_orientation,
lcd_orientation_t new_orientation) {
return_value_if_fail(event != NULL, NULL);
memset(event, 0x00, sizeof(orientation_event_t));

View File

@ -587,7 +587,8 @@ orientation_event_t* orientation_event_cast(event_t* event);
* @return {event_t*} event对象
*/
event_t* orientation_event_init(orientation_event_t* event, uint32_t type, void* target,
lcd_orientation_t old_orientation, lcd_orientation_t new_orientation);
lcd_orientation_t old_orientation,
lcd_orientation_t new_orientation);
/**
* @class value_change_event_t

View File

@ -134,7 +134,7 @@ ret_t widget_set_self_layout(widget_t* widget, const char* params) {
if (widget->self_layout != NULL) {
str_set(&(widget->self_layout->params), params);
}
return widget_set_need_relayout(widget);
}
@ -152,7 +152,7 @@ ret_t widget_set_children_layout(widget_t* widget, const char* params) {
if (widget->children_layout != NULL) {
str_set(&(widget->children_layout->params), params);
}
return widget_set_need_relayout(widget);
}

View File

@ -339,7 +339,8 @@ ret_t lcd_resize(lcd_t* lcd, wh_t w, wh_t h, uint32_t line_length) {
return RET_FAIL;
}
ret_t lcd_set_orientation(lcd_t* lcd, lcd_orientation_t old_orientation, lcd_orientation_t new_orientation) {
ret_t lcd_set_orientation(lcd_t* lcd, lcd_orientation_t old_orientation,
lcd_orientation_t new_orientation) {
return_value_if_fail(lcd != NULL, RET_BAD_PARAMS);
if (lcd->set_orientation != NULL) {
return lcd->set_orientation(lcd, old_orientation, new_orientation);

View File

@ -51,7 +51,8 @@ typedef const dirty_rects_t* (*lcd_get_dirty_rects_t)(lcd_t* lcd);
typedef ret_t (*lcd_begin_frame_t)(lcd_t* lcd, const dirty_rects_t* dirty_rects);
typedef ret_t (*lcd_set_clip_rect_t)(lcd_t* lcd, const rect_t* rect);
typedef ret_t (*lcd_get_clip_rect_t)(lcd_t* lcd, rect_t* rect);
typedef ret_t (*lcd_set_orientation_t)(lcd_t* lcd, lcd_orientation_t old_orientation, lcd_orientation_t new_orientation);
typedef ret_t (*lcd_set_orientation_t)(lcd_t* lcd, lcd_orientation_t old_orientation,
lcd_orientation_t new_orientation);
typedef ret_t (*lcd_resize_t)(lcd_t* lcd, wh_t w, wh_t h, uint32_t line_length);
typedef ret_t (*lcd_get_text_metrics_t)(lcd_t* lcd, float_t* ascent, float_t* descent,
float_t* line_hight);
@ -719,7 +720,8 @@ bool_t lcd_is_support_dirty_rect(lcd_t* lcd);
/* private */
bool_t lcd_is_dirty(lcd_t* lcd);
ret_t lcd_set_canvas(lcd_t* lcd, canvas_t* c);
ret_t lcd_set_orientation(lcd_t* lcd, lcd_orientation_t old_orientation, lcd_orientation_t new_orientation);
ret_t lcd_set_orientation(lcd_t* lcd, lcd_orientation_t old_orientation,
lcd_orientation_t new_orientation);
END_C_DECLS

View File

@ -65,8 +65,9 @@ static ret_t lcd_profile_resize(lcd_t* lcd, wh_t w, wh_t h, uint32_t line_length
return lcd_resize(profile->impl, w, h, line_length);
}
static ret_t lcd_profile_set_orientation(lcd_t* lcd, lcd_orientation_t old_orientation, lcd_orientation_t new_orientation) {
lcd_profile_t* profile = LCD_PROFILE(lcd);
static ret_t lcd_profile_set_orientation(lcd_t* lcd, lcd_orientation_t old_orientation,
lcd_orientation_t new_orientation) {
lcd_profile_t* profile = LCD_PROFILE(lcd);
return lcd_set_orientation(profile->impl, old_orientation, new_orientation);
}
@ -231,7 +232,8 @@ static ret_t lcd_profile_draw_text(lcd_t* lcd, const wchar_t* str, uint32_t nr,
return ret;
}
static ret_t lcd_profile_draw_image(lcd_t* lcd, bitmap_t* img, const rect_t* src, const rect_t* dst) {
static ret_t lcd_profile_draw_image(lcd_t* lcd, bitmap_t* img, const rect_t* src,
const rect_t* dst) {
ret_t ret = RET_OK;
uint32_t cost = 0;

View File

@ -46,7 +46,8 @@ ret_t native_window_resize(native_window_t* win, wh_t w, wh_t h, bool_t force) {
return RET_OK;
}
ret_t native_window_set_orientation(native_window_t* win, lcd_orientation_t old_orientation, lcd_orientation_t new_orientation) {
ret_t native_window_set_orientation(native_window_t* win, lcd_orientation_t old_orientation,
lcd_orientation_t new_orientation) {
return_value_if_fail(win != NULL && win->vt != NULL, RET_BAD_PARAMS);
if (win->vt->set_orientation != NULL) {

View File

@ -45,7 +45,9 @@ typedef struct _native_window_info_t {
typedef canvas_t* (*native_window_get_canvas_t)(native_window_t* win);
typedef ret_t (*native_window_move_t)(native_window_t* win, xy_t x, xy_t y);
typedef ret_t (*native_window_resize_t)(native_window_t* win, wh_t w, wh_t h);
typedef ret_t (*native_window_set_orientation_t)(native_window_t* win, lcd_orientation_t old_orientation, lcd_orientation_t new_orientation);
typedef ret_t (*native_window_set_orientation_t)(native_window_t* win,
lcd_orientation_t old_orientation,
lcd_orientation_t new_orientation);
typedef ret_t (*native_window_gl_make_current_t)(native_window_t* win);
typedef ret_t (*native_window_swap_buffer_t)(native_window_t* win);
typedef ret_t (*native_window_preprocess_event_t)(native_window_t* win, event_t* e);
@ -136,7 +138,8 @@ ret_t native_window_resize(native_window_t* win, wh_t w, wh_t h, bool_t force);
*
* @return {ret_t} RET_OK表示成功
*/
ret_t native_window_set_orientation(native_window_t* win, lcd_orientation_t old_orientation, lcd_orientation_t new_orientation);
ret_t native_window_set_orientation(native_window_t* win, lcd_orientation_t old_orientation,
lcd_orientation_t new_orientation);
/**
* @method native_window_minimize

View File

@ -400,7 +400,8 @@ const char* system_info_fix_font_name(const char* name) {
return (name && *name) ? name : system_info()->default_font;
}
bool_t tk_is_swap_size_by_orientation(lcd_orientation_t old_orientation, lcd_orientation_t new_orientation) {
bool_t tk_is_swap_size_by_orientation(lcd_orientation_t old_orientation,
lcd_orientation_t new_orientation) {
if (old_orientation == LCD_ORIENTATION_0 || old_orientation == LCD_ORIENTATION_180) {
if (new_orientation == LCD_ORIENTATION_90 || new_orientation == LCD_ORIENTATION_270) {
return TRUE;

View File

@ -309,7 +309,8 @@ ret_t system_info_set_app_info(system_info_t* info, app_type_t app_type, const c
ret_t system_info_eval_exprs(system_info_t* info, const char* exprs, tk_visit_t on_expr_result,
void* ctx);
bool_t tk_is_swap_size_by_orientation(lcd_orientation_t old_orientation, lcd_orientation_t new_orientation);
bool_t tk_is_swap_size_by_orientation(lcd_orientation_t old_orientation,
lcd_orientation_t new_orientation);
END_C_DECLS

View File

@ -37,7 +37,8 @@ ret_t widget_factory_register(widget_factory_t* factory, const char* type, widge
return general_factory_register(factory, type, (tk_create_t)create);
}
ret_t widget_factory_register_multi(widget_factory_t* factory, const general_factory_table_t* table) {
ret_t widget_factory_register_multi(widget_factory_t* factory,
const general_factory_table_t* table) {
return general_factory_register_table(factory, table);
}
@ -59,7 +60,7 @@ ret_t widget_factory_set(widget_factory_t* factory) {
}
ret_t widget_factory_destroy(widget_factory_t* factory) {
if(s_widget_factory == factory) {
if (s_widget_factory == factory) {
s_widget_factory = NULL;
}
return general_factory_destroy(factory);

View File

@ -85,7 +85,8 @@ ret_t widget_factory_register(widget_factory_t* factory, const char* type, widge
*
* @return {ret_t} RET_OK表示成功
*/
ret_t widget_factory_register_multi(widget_factory_t* factory, const general_factory_table_t* table);
ret_t widget_factory_register_multi(widget_factory_t* factory,
const general_factory_table_t* table);
/**
* @method widget_factory_create_widget

View File

@ -81,7 +81,7 @@ static ret_t children_layouter_register_ext_builtins(void) {
ret_t tk_ext_widgets_init(void) {
widget_factory_t* f = widget_factory();
FACTORY_TABLE_BEGIN(s_ext_widgets)
FACTORY_TABLE_BEGIN(s_ext_widgets)
FACTORY_TABLE_ENTRY(WIDGET_TYPE_RICH_TEXT, rich_text_create)
FACTORY_TABLE_ENTRY(WIDGET_TYPE_RICH_TEXT_VIEW, rich_text_view_create)
FACTORY_TABLE_ENTRY(WIDGET_TYPE_COLOR_PICKER, color_picker_create)
@ -128,7 +128,7 @@ FACTORY_TABLE_BEGIN(s_ext_widgets)
#ifdef TK_FILE_BROWSER_VIEW_H
FACTORY_TABLE_ENTRY(WIDGET_TYPE_FILE_BROWSER_VIEW, file_browser_view_create)
#endif /*TK_FILE_BROWSER_VIEW_H*/
FACTORY_TABLE_END()
FACTORY_TABLE_END()
children_layouter_register_ext_builtins();

View File

@ -104,8 +104,7 @@ static ret_t list_view_on_wheel_before(void* ctx, event_t* e) {
static bool_t list_view_is_play_floating_scroll_bar_animtion(list_view_t* list_view) {
scroll_view_t* scroll_view = NULL;
return_value_if_fail(
list_view != NULL && list_view->scroll_view != NULL, FALSE);
return_value_if_fail(list_view != NULL && list_view->scroll_view != NULL, FALSE);
if (list_view->scroll_bar != NULL) {
scroll_view = SCROLL_VIEW(list_view->scroll_view);

View File

@ -263,7 +263,8 @@ static uint32_t slide_menu_get_visible_children(widget_t* widget,
if (children[curr - i + 1]->x > clip_rect.x && curr - i >= 0 && nr < widget->children->size) {
children[curr - i] = slide_menu_get_child(widget, index - i);
}
if (children[curr + i - 1]->x + children[curr + i - 1]->w < clip_rect.x + clip_rect.w && curr + i < MAX_VISIBLE_NR && nr < widget->children->size) {
if (children[curr + i - 1]->x + children[curr + i - 1]->w < clip_rect.x + clip_rect.w &&
curr + i < MAX_VISIBLE_NR && nr < widget->children->size) {
children[curr + i] = slide_menu_get_child(widget, index + i);
}

View File

@ -810,7 +810,7 @@ static ret_t slide_view_restore_target(widget_t* widget) {
widget_t* active_view = NULL;
slide_view_t* slide_view = SLIDE_VIEW(widget);
return_value_if_fail(slide_view != NULL && widget->children != NULL, RET_BAD_PARAMS);
if (slide_view->active < widget->children->size) {
active_view = widget_get_child(widget, slide_view->active);
}

View File

@ -972,7 +972,8 @@ ret_t text_selector_set_selected_index(widget_t* widget, uint32_t index) {
if (index != text_selector->selected_index) {
text_selector_set_selected_index_only(text_selector, index);
text_selector_sync_yoffset_with_selected_index(text_selector, text_selector->enable_value_animator);
text_selector_sync_yoffset_with_selected_index(text_selector,
text_selector->enable_value_animator);
}
return widget_invalidate(widget, NULL);

View File

@ -31,11 +31,10 @@ static ret_t func_app_conf_save(fscript_t* fscript, fscript_args_t* args, value_
}
FACTORY_TABLE_BEGIN(s_ext_app_conf)
FACTORY_TABLE_ENTRY("app_conf", func_app_conf)
FACTORY_TABLE_ENTRY("app_conf_save", func_app_conf_save)
FACTORY_TABLE_ENTRY("app_conf", func_app_conf)
FACTORY_TABLE_ENTRY("app_conf_save", func_app_conf_save)
FACTORY_TABLE_END()
ret_t fscript_app_conf_register(void) {
return fscript_register_funcs(s_ext_app_conf);
}

View File

@ -392,31 +392,30 @@ static ret_t func_array_sum(fscript_t* fscript, fscript_args_t* args, value_t* r
}
FACTORY_TABLE_BEGIN(s_ext_array)
FACTORY_TABLE_ENTRY("array_create", func_array_create)
FACTORY_TABLE_ENTRY("array_dup", func_array_dup)
FACTORY_TABLE_ENTRY("array_create_with_str", func_array_create_with_str)
FACTORY_TABLE_ENTRY("array_create_repeated", func_array_create_repeated)
FACTORY_TABLE_ENTRY("array_push", func_array_push)
FACTORY_TABLE_ENTRY("array_pop", func_array_pop)
FACTORY_TABLE_ENTRY("array_shift", func_array_shift)
FACTORY_TABLE_ENTRY("array_get", func_array_get)
FACTORY_TABLE_ENTRY("array_set", func_array_set)
FACTORY_TABLE_ENTRY("array_insert", func_array_insert)
FACTORY_TABLE_ENTRY("array_remove", func_array_remove)
FACTORY_TABLE_ENTRY("array_get_and_remove", func_array_get_and_remove)
FACTORY_TABLE_ENTRY("array_index_of", func_array_index_of)
FACTORY_TABLE_ENTRY("array_last_index_of", func_array_last_index_of)
FACTORY_TABLE_ENTRY("array_clear", func_array_clear)
FACTORY_TABLE_ENTRY("array_join", func_array_join)
FACTORY_TABLE_ENTRY("array_sort", func_array_sort)
FACTORY_TABLE_ENTRY("array_clone_and_sort", func_array_clone_and_sort)
FACTORY_TABLE_ENTRY("array_min", func_array_min)
FACTORY_TABLE_ENTRY("array_max", func_array_max)
FACTORY_TABLE_ENTRY("array_avg", func_array_avg)
FACTORY_TABLE_ENTRY("array_sum", func_array_sum)
FACTORY_TABLE_ENTRY("array_create", func_array_create)
FACTORY_TABLE_ENTRY("array_dup", func_array_dup)
FACTORY_TABLE_ENTRY("array_create_with_str", func_array_create_with_str)
FACTORY_TABLE_ENTRY("array_create_repeated", func_array_create_repeated)
FACTORY_TABLE_ENTRY("array_push", func_array_push)
FACTORY_TABLE_ENTRY("array_pop", func_array_pop)
FACTORY_TABLE_ENTRY("array_shift", func_array_shift)
FACTORY_TABLE_ENTRY("array_get", func_array_get)
FACTORY_TABLE_ENTRY("array_set", func_array_set)
FACTORY_TABLE_ENTRY("array_insert", func_array_insert)
FACTORY_TABLE_ENTRY("array_remove", func_array_remove)
FACTORY_TABLE_ENTRY("array_get_and_remove", func_array_get_and_remove)
FACTORY_TABLE_ENTRY("array_index_of", func_array_index_of)
FACTORY_TABLE_ENTRY("array_last_index_of", func_array_last_index_of)
FACTORY_TABLE_ENTRY("array_clear", func_array_clear)
FACTORY_TABLE_ENTRY("array_join", func_array_join)
FACTORY_TABLE_ENTRY("array_sort", func_array_sort)
FACTORY_TABLE_ENTRY("array_clone_and_sort", func_array_clone_and_sort)
FACTORY_TABLE_ENTRY("array_min", func_array_min)
FACTORY_TABLE_ENTRY("array_max", func_array_max)
FACTORY_TABLE_ENTRY("array_avg", func_array_avg)
FACTORY_TABLE_ENTRY("array_sum", func_array_sum)
FACTORY_TABLE_END()
ret_t fscript_array_register(void) {
return fscript_register_funcs(s_ext_array);
}

View File

@ -427,16 +427,16 @@ static ret_t func_bit_not(fscript_t* fscript, fscript_args_t* args, value_t* res
}
FACTORY_TABLE_BEGIN(s_ext_bits)
FACTORY_TABLE_ENTRY("&", func_bit_and)
FACTORY_TABLE_ENTRY("^", func_bit_nor)
FACTORY_TABLE_ENTRY("~", func_bit_not)
FACTORY_TABLE_ENTRY("|", func_bit_or)
FACTORY_TABLE_ENTRY("<<", func_lshift)
FACTORY_TABLE_ENTRY(">>", func_rshift)
FACTORY_TABLE_ENTRY("bit_get", func_bit_get)
FACTORY_TABLE_ENTRY("bit_set", func_bit_set)
FACTORY_TABLE_ENTRY("bit_clear", func_bit_clear)
FACTORY_TABLE_ENTRY("bit_toggle", func_bit_toggle)
FACTORY_TABLE_ENTRY("&", func_bit_and)
FACTORY_TABLE_ENTRY("^", func_bit_nor)
FACTORY_TABLE_ENTRY("~", func_bit_not)
FACTORY_TABLE_ENTRY("|", func_bit_or)
FACTORY_TABLE_ENTRY("<<", func_lshift)
FACTORY_TABLE_ENTRY(">>", func_rshift)
FACTORY_TABLE_ENTRY("bit_get", func_bit_get)
FACTORY_TABLE_ENTRY("bit_set", func_bit_set)
FACTORY_TABLE_ENTRY("bit_clear", func_bit_clear)
FACTORY_TABLE_ENTRY("bit_toggle", func_bit_toggle)
FACTORY_TABLE_END()
ret_t fscript_bits_register(void) {

View File

@ -52,9 +52,9 @@ static ret_t func_chsum(fscript_t* fscript, fscript_args_t* args, value_t* resul
}
FACTORY_TABLE_BEGIN(s_ext_crc)
FACTORY_TABLE_ENTRY("crc16", func_crc16)
FACTORY_TABLE_ENTRY("crc32", func_crc32)
FACTORY_TABLE_ENTRY("cksum", func_chsum)
FACTORY_TABLE_ENTRY("crc16", func_crc16)
FACTORY_TABLE_ENTRY("crc32", func_crc32)
FACTORY_TABLE_ENTRY("cksum", func_chsum)
FACTORY_TABLE_END()
ret_t fscript_crc_register(void) {

View File

@ -101,16 +101,16 @@ static ret_t func_get_days_of_month(fscript_t* fscript, fscript_args_t* args, va
}
FACTORY_TABLE_BEGIN(s_ext_date_time)
FACTORY_TABLE_ENTRY("date_time_create", func_date_time_create)
FACTORY_TABLE_ENTRY("date_time_to_time", func_date_time_to_time)
FACTORY_TABLE_ENTRY("date_time_from_time", func_date_time_from_time)
FACTORY_TABLE_ENTRY("date_time_set", func_date_time_set)
FACTORY_TABLE_ENTRY("time_now_us", func_time_now_us)
FACTORY_TABLE_ENTRY("time_now_ms", func_time_now_ms)
FACTORY_TABLE_ENTRY("time_now_s", func_time_now_s)
FACTORY_TABLE_ENTRY("time_now", func_time_now_s)
FACTORY_TABLE_ENTRY("is_leap_year", func_year_is_leap)
FACTORY_TABLE_ENTRY("get_days_of_month", func_get_days_of_month)
FACTORY_TABLE_ENTRY("date_time_create", func_date_time_create)
FACTORY_TABLE_ENTRY("date_time_to_time", func_date_time_to_time)
FACTORY_TABLE_ENTRY("date_time_from_time", func_date_time_from_time)
FACTORY_TABLE_ENTRY("date_time_set", func_date_time_set)
FACTORY_TABLE_ENTRY("time_now_us", func_time_now_us)
FACTORY_TABLE_ENTRY("time_now_ms", func_time_now_ms)
FACTORY_TABLE_ENTRY("time_now_s", func_time_now_s)
FACTORY_TABLE_ENTRY("time_now", func_time_now_s)
FACTORY_TABLE_ENTRY("is_leap_year", func_year_is_leap)
FACTORY_TABLE_ENTRY("get_days_of_month", func_get_days_of_month)
FACTORY_TABLE_END()
ret_t fscript_date_time_register(void) {

View File

@ -81,19 +81,19 @@ static ret_t func_ntohll(fscript_t* fscript, fscript_args_t* args, value_t* resu
}
FACTORY_TABLE_BEGIN(s_ext_endian)
FACTORY_TABLE_ENTRY("is_little", func_is_little_endian)
FACTORY_TABLE_ENTRY("is_little", func_is_little_endian)
FACTORY_TABLE_ENTRY("htonl", func_htonl)
FACTORY_TABLE_ENTRY("ntohl", func_ntohl)
FACTORY_TABLE_ENTRY("htonl", func_htonl)
FACTORY_TABLE_ENTRY("ntohl", func_ntohl)
FACTORY_TABLE_ENTRY("htons", func_htons)
FACTORY_TABLE_ENTRY("ntohs", func_ntohs)
FACTORY_TABLE_ENTRY("htons", func_htons)
FACTORY_TABLE_ENTRY("ntohs", func_ntohs)
FACTORY_TABLE_ENTRY("htonf", func_htonf)
FACTORY_TABLE_ENTRY("ntohf", func_ntohf)
FACTORY_TABLE_ENTRY("htonf", func_htonf)
FACTORY_TABLE_ENTRY("ntohf", func_ntohf)
FACTORY_TABLE_ENTRY("htonll", func_htonll)
FACTORY_TABLE_ENTRY("ntohll", func_ntohll)
FACTORY_TABLE_ENTRY("htonll", func_htonll)
FACTORY_TABLE_ENTRY("ntohll", func_ntohll)
FACTORY_TABLE_END()
ret_t fscript_endian_register(void) {

View File

@ -246,21 +246,21 @@ static ret_t func_value_get_binary_data(fscript_t* fscript, fscript_args_t* args
}
FACTORY_TABLE_BEGIN(s_ext_basic)
FACTORY_TABLE_ENTRY("index_of", func_index_of)
FACTORY_TABLE_ENTRY("last_index_of", func_last_index_of)
FACTORY_TABLE_ENTRY("ulen", func_ulen)
FACTORY_TABLE_ENTRY("trim_left", func_trim_left)
FACTORY_TABLE_ENTRY("trim_right", func_trim_right)
FACTORY_TABLE_ENTRY("totitle", func_totitle)
FACTORY_TABLE_ENTRY("char_at", func_char_at)
FACTORY_TABLE_ENTRY("usubstr", func_usubstr)
FACTORY_TABLE_ENTRY("index_of", func_index_of)
FACTORY_TABLE_ENTRY("last_index_of", func_last_index_of)
FACTORY_TABLE_ENTRY("ulen", func_ulen)
FACTORY_TABLE_ENTRY("trim_left", func_trim_left)
FACTORY_TABLE_ENTRY("trim_right", func_trim_right)
FACTORY_TABLE_ENTRY("totitle", func_totitle)
FACTORY_TABLE_ENTRY("char_at", func_char_at)
FACTORY_TABLE_ENTRY("usubstr", func_usubstr)
#ifdef HAS_STDIO
FACTORY_TABLE_ENTRY("prompt", func_prompt)
FACTORY_TABLE_ENTRY("prompt", func_prompt)
#endif /*HAS_STDIO*/
FACTORY_TABLE_ENTRY("value_is_valid", func_value_is_valid)
FACTORY_TABLE_ENTRY("value_is_null", func_value_is_null)
FACTORY_TABLE_ENTRY("value_get_binary_data", func_value_get_binary_data)
FACTORY_TABLE_ENTRY("value_get_binary_size", func_value_get_binary_size)
FACTORY_TABLE_ENTRY("value_is_valid", func_value_is_valid)
FACTORY_TABLE_ENTRY("value_is_null", func_value_is_null)
FACTORY_TABLE_ENTRY("value_get_binary_data", func_value_get_binary_data)
FACTORY_TABLE_ENTRY("value_get_binary_size", func_value_get_binary_size)
FACTORY_TABLE_END()
ret_t fscript_ext_init(void) {

View File

@ -186,21 +186,20 @@ static ret_t func_path_get_app_root(fscript_t* fscript, fscript_args_t* args, va
}
FACTORY_TABLE_BEGIN(s_ext_fs)
FACTORY_TABLE_ENTRY("file_read_text", func_file_read_text)
FACTORY_TABLE_ENTRY("file_read_binary", func_file_read_binary)
FACTORY_TABLE_ENTRY("file_write", func_file_write)
FACTORY_TABLE_ENTRY("file_exist", func_file_exist)
FACTORY_TABLE_ENTRY("file_get_size", func_file_get_size)
FACTORY_TABLE_ENTRY("file_remove", func_file_remove)
FACTORY_TABLE_ENTRY("path_create", func_path_create)
FACTORY_TABLE_ENTRY("path_remove", func_path_remove)
FACTORY_TABLE_ENTRY("path_exist", func_path_exist)
FACTORY_TABLE_ENTRY("path_get_temp", func_path_get_temp)
FACTORY_TABLE_ENTRY("path_get_app_root", func_path_get_app_root)
FACTORY_TABLE_ENTRY("path_get_user_storage_root", func_path_get_user_storage_root)
FACTORY_TABLE_ENTRY("file_read_text", func_file_read_text)
FACTORY_TABLE_ENTRY("file_read_binary", func_file_read_binary)
FACTORY_TABLE_ENTRY("file_write", func_file_write)
FACTORY_TABLE_ENTRY("file_exist", func_file_exist)
FACTORY_TABLE_ENTRY("file_get_size", func_file_get_size)
FACTORY_TABLE_ENTRY("file_remove", func_file_remove)
FACTORY_TABLE_ENTRY("path_create", func_path_create)
FACTORY_TABLE_ENTRY("path_remove", func_path_remove)
FACTORY_TABLE_ENTRY("path_exist", func_path_exist)
FACTORY_TABLE_ENTRY("path_get_temp", func_path_get_temp)
FACTORY_TABLE_ENTRY("path_get_app_root", func_path_get_app_root)
FACTORY_TABLE_ENTRY("path_get_user_storage_root", func_path_get_user_storage_root)
FACTORY_TABLE_END()
ret_t fscript_fs_register(void) {
return fscript_register_funcs(s_ext_fs);
}

View File

@ -39,10 +39,10 @@ static ret_t func_iostream_get_ostream(fscript_t* fscript, fscript_args_t* args,
return RET_OK;
}
FACTORY_TABLE_BEGIN(s_ext_iostream)
FACTORY_TABLE_ENTRY("iostream_get_istream", func_iostream_get_istream)
FACTORY_TABLE_ENTRY("iostream_get_ostream", func_iostream_get_ostream)
FACTORY_TABLE_ENTRY("iostream_get_istream", func_iostream_get_istream)
FACTORY_TABLE_ENTRY("iostream_get_ostream", func_iostream_get_ostream)
FACTORY_TABLE_END()
ret_t fscript_iostream_register(void) {

View File

@ -50,8 +50,8 @@ static ret_t func_ostream_file_create(fscript_t* fscript, fscript_args_t* args,
}
FACTORY_TABLE_BEGIN(s_ext_iostream_file)
FACTORY_TABLE_ENTRY("istream_file_create", func_istream_file_create)
FACTORY_TABLE_ENTRY("ostream_file_create", func_ostream_file_create)
FACTORY_TABLE_ENTRY("istream_file_create", func_istream_file_create)
FACTORY_TABLE_ENTRY("ostream_file_create", func_ostream_file_create)
FACTORY_TABLE_END()
ret_t fscript_iostream_file_register(void) {

View File

@ -54,8 +54,8 @@ static ret_t func_iostream_udp_create(fscript_t* fscript, fscript_args_t* args,
}
FACTORY_TABLE_BEGIN(s_ext_iostream_inet)
FACTORY_TABLE_ENTRY("iostream_tcp_create", func_iostream_tcp_create)
FACTORY_TABLE_ENTRY("iostream_udp_create", func_iostream_udp_create)
FACTORY_TABLE_ENTRY("iostream_tcp_create", func_iostream_tcp_create)
FACTORY_TABLE_ENTRY("iostream_udp_create", func_iostream_udp_create)
FACTORY_TABLE_END()
ret_t fscript_iostream_inet_register(void) {

View File

@ -75,7 +75,7 @@ static ret_t func_iostream_serial_create(fscript_t* fscript, fscript_args_t* arg
}
FACTORY_TABLE_BEGIN(s_ext_iostream_serial)
FACTORY_TABLE_ENTRY("iostream_serial_create", func_iostream_serial_create)
FACTORY_TABLE_ENTRY("iostream_serial_create", func_iostream_serial_create)
FACTORY_TABLE_END()
ret_t fscript_iostream_serial_register(void) {

View File

@ -288,22 +288,22 @@ static ret_t func_istream_read_line(fscript_t* fscript, fscript_args_t* args, va
}
FACTORY_TABLE_BEGIN(s_ext_istream)
FACTORY_TABLE_ENTRY("istream_seek", func_istream_seek)
FACTORY_TABLE_ENTRY("istream_tell", func_istream_tell)
FACTORY_TABLE_ENTRY("istream_read_uint8", func_istream_read_uint8)
FACTORY_TABLE_ENTRY("istream_read_uint16", func_istream_read_uint16)
FACTORY_TABLE_ENTRY("istream_read_uint32", func_istream_read_uint32)
FACTORY_TABLE_ENTRY("istream_read_uint64", func_istream_read_uint64)
FACTORY_TABLE_ENTRY("istream_read_int8", func_istream_read_int8)
FACTORY_TABLE_ENTRY("istream_read_int16", func_istream_read_int16)
FACTORY_TABLE_ENTRY("istream_read_int32", func_istream_read_int32)
FACTORY_TABLE_ENTRY("istream_read_int64", func_istream_read_int64)
FACTORY_TABLE_ENTRY("istream_read_float", func_istream_read_float)
FACTORY_TABLE_ENTRY("istream_read_double", func_istream_read_double)
FACTORY_TABLE_ENTRY("istream_read_string", func_istream_read_string)
FACTORY_TABLE_ENTRY("istream_read_binary", func_istream_read_binary)
FACTORY_TABLE_ENTRY("istream_read_line", func_istream_read_line)
FACTORY_TABLE_ENTRY("istream_is_eos", func_istream_is_eos)
FACTORY_TABLE_ENTRY("istream_seek", func_istream_seek)
FACTORY_TABLE_ENTRY("istream_tell", func_istream_tell)
FACTORY_TABLE_ENTRY("istream_read_uint8", func_istream_read_uint8)
FACTORY_TABLE_ENTRY("istream_read_uint16", func_istream_read_uint16)
FACTORY_TABLE_ENTRY("istream_read_uint32", func_istream_read_uint32)
FACTORY_TABLE_ENTRY("istream_read_uint64", func_istream_read_uint64)
FACTORY_TABLE_ENTRY("istream_read_int8", func_istream_read_int8)
FACTORY_TABLE_ENTRY("istream_read_int16", func_istream_read_int16)
FACTORY_TABLE_ENTRY("istream_read_int32", func_istream_read_int32)
FACTORY_TABLE_ENTRY("istream_read_int64", func_istream_read_int64)
FACTORY_TABLE_ENTRY("istream_read_float", func_istream_read_float)
FACTORY_TABLE_ENTRY("istream_read_double", func_istream_read_double)
FACTORY_TABLE_ENTRY("istream_read_string", func_istream_read_string)
FACTORY_TABLE_ENTRY("istream_read_binary", func_istream_read_binary)
FACTORY_TABLE_ENTRY("istream_read_line", func_istream_read_line)
FACTORY_TABLE_ENTRY("istream_is_eos", func_istream_is_eos)
FACTORY_TABLE_END()
ret_t fscript_istream_register(void) {

View File

@ -102,10 +102,10 @@ static ret_t func_ubjson_save(fscript_t* fscript, fscript_args_t* args, value_t*
}
FACTORY_TABLE_BEGIN(s_ext_json)
FACTORY_TABLE_ENTRY("json_load", func_json_load)
FACTORY_TABLE_ENTRY("json_save", func_json_save)
FACTORY_TABLE_ENTRY("ubjson_load", func_ubjson_load)
FACTORY_TABLE_ENTRY("ubjson_save", func_ubjson_save)
FACTORY_TABLE_ENTRY("json_load", func_json_load)
FACTORY_TABLE_ENTRY("json_save", func_json_save)
FACTORY_TABLE_ENTRY("ubjson_load", func_ubjson_load)
FACTORY_TABLE_ENTRY("ubjson_save", func_ubjson_save)
FACTORY_TABLE_END()
ret_t fscript_json_register(void) {

View File

@ -133,23 +133,22 @@ static ret_t func_r2d(fscript_t* fscript, fscript_args_t* args, value_t* result)
}
FACTORY_TABLE_BEGIN(s_ext_math)
FACTORY_TABLE_ENTRY("d2r", func_d2r)
FACTORY_TABLE_ENTRY("r2d", func_r2d)
FACTORY_TABLE_ENTRY("acos", func_acos)
FACTORY_TABLE_ENTRY("asin", func_asin)
FACTORY_TABLE_ENTRY("atan", func_atan)
FACTORY_TABLE_ENTRY("atan2", func_atan2)
FACTORY_TABLE_ENTRY("cos", func_cos)
FACTORY_TABLE_ENTRY("sin", func_sin)
FACTORY_TABLE_ENTRY("exp", func_exp)
FACTORY_TABLE_ENTRY("log", func_log)
FACTORY_TABLE_ENTRY("sqrt", func_sqrt)
FACTORY_TABLE_ENTRY("tan", func_tan)
FACTORY_TABLE_ENTRY("pow", func_pow)
FACTORY_TABLE_ENTRY("is_prime", func_is_prime)
FACTORY_TABLE_ENTRY("d2r", func_d2r)
FACTORY_TABLE_ENTRY("r2d", func_r2d)
FACTORY_TABLE_ENTRY("acos", func_acos)
FACTORY_TABLE_ENTRY("asin", func_asin)
FACTORY_TABLE_ENTRY("atan", func_atan)
FACTORY_TABLE_ENTRY("atan2", func_atan2)
FACTORY_TABLE_ENTRY("cos", func_cos)
FACTORY_TABLE_ENTRY("sin", func_sin)
FACTORY_TABLE_ENTRY("exp", func_exp)
FACTORY_TABLE_ENTRY("log", func_log)
FACTORY_TABLE_ENTRY("sqrt", func_sqrt)
FACTORY_TABLE_ENTRY("tan", func_tan)
FACTORY_TABLE_ENTRY("pow", func_pow)
FACTORY_TABLE_ENTRY("is_prime", func_is_prime)
FACTORY_TABLE_END()
ret_t fscript_math_register(void) {
return fscript_register_funcs(s_ext_math);
}

View File

@ -87,15 +87,14 @@ static ret_t func_object_create(fscript_t* fscript, fscript_args_t* args, value_
}
FACTORY_TABLE_BEGIN(s_ext_object)
FACTORY_TABLE_ENTRY("object_create", func_object_create)
FACTORY_TABLE_ENTRY("object_ref", func_object_ref)
FACTORY_TABLE_ENTRY("object_unref", func_object_unref)
FACTORY_TABLE_ENTRY("object_set", func_object_set_prop)
FACTORY_TABLE_ENTRY("object_get", func_object_get_prop)
FACTORY_TABLE_ENTRY("object_remove", func_object_remove_prop)
FACTORY_TABLE_ENTRY("object_create", func_object_create)
FACTORY_TABLE_ENTRY("object_ref", func_object_ref)
FACTORY_TABLE_ENTRY("object_unref", func_object_unref)
FACTORY_TABLE_ENTRY("object_set", func_object_set_prop)
FACTORY_TABLE_ENTRY("object_get", func_object_get_prop)
FACTORY_TABLE_ENTRY("object_remove", func_object_remove_prop)
FACTORY_TABLE_END()
ret_t fscript_object_register(void) {
return fscript_register_funcs(s_ext_object);
}

View File

@ -194,7 +194,7 @@ static ret_t func_ostream_write_string(fscript_t* fscript, fscript_args_t* args,
slen = strlen((char*)data);
}
} else {
value_str_ex(v, str, sizeof(str)-1);
value_str_ex(v, str, sizeof(str) - 1);
data = (const uint8_t*)str;
slen = strlen(str);
}
@ -240,21 +240,21 @@ static ret_t func_ostream_write_binary(fscript_t* fscript, fscript_args_t* args,
}
FACTORY_TABLE_BEGIN(s_ext_ostream)
FACTORY_TABLE_ENTRY("ostream_seek", func_ostream_seek)
FACTORY_TABLE_ENTRY("ostream_tell", func_ostream_tell)
FACTORY_TABLE_ENTRY("ostream_flush", func_ostream_flush)
FACTORY_TABLE_ENTRY("ostream_write_uint8", func_ostream_write_uint8)
FACTORY_TABLE_ENTRY("ostream_write_uint16", func_ostream_write_uint16)
FACTORY_TABLE_ENTRY("ostream_write_uint32", func_ostream_write_uint32)
FACTORY_TABLE_ENTRY("ostream_write_uint64", func_ostream_write_uint64)
FACTORY_TABLE_ENTRY("ostream_write_int8", func_ostream_write_uint8)
FACTORY_TABLE_ENTRY("ostream_write_int16", func_ostream_write_uint16)
FACTORY_TABLE_ENTRY("ostream_write_int32", func_ostream_write_uint32)
FACTORY_TABLE_ENTRY("ostream_write_int64", func_ostream_write_uint64)
FACTORY_TABLE_ENTRY("ostream_write_float", func_ostream_write_float)
FACTORY_TABLE_ENTRY("ostream_write_double", func_ostream_write_double)
FACTORY_TABLE_ENTRY("ostream_write_string", func_ostream_write_string)
FACTORY_TABLE_ENTRY("ostream_write_binary", func_ostream_write_binary)
FACTORY_TABLE_ENTRY("ostream_seek", func_ostream_seek)
FACTORY_TABLE_ENTRY("ostream_tell", func_ostream_tell)
FACTORY_TABLE_ENTRY("ostream_flush", func_ostream_flush)
FACTORY_TABLE_ENTRY("ostream_write_uint8", func_ostream_write_uint8)
FACTORY_TABLE_ENTRY("ostream_write_uint16", func_ostream_write_uint16)
FACTORY_TABLE_ENTRY("ostream_write_uint32", func_ostream_write_uint32)
FACTORY_TABLE_ENTRY("ostream_write_uint64", func_ostream_write_uint64)
FACTORY_TABLE_ENTRY("ostream_write_int8", func_ostream_write_uint8)
FACTORY_TABLE_ENTRY("ostream_write_int16", func_ostream_write_uint16)
FACTORY_TABLE_ENTRY("ostream_write_int32", func_ostream_write_uint32)
FACTORY_TABLE_ENTRY("ostream_write_int64", func_ostream_write_uint64)
FACTORY_TABLE_ENTRY("ostream_write_float", func_ostream_write_float)
FACTORY_TABLE_ENTRY("ostream_write_double", func_ostream_write_double)
FACTORY_TABLE_ENTRY("ostream_write_string", func_ostream_write_string)
FACTORY_TABLE_ENTRY("ostream_write_binary", func_ostream_write_binary)
FACTORY_TABLE_END()
ret_t fscript_ostream_register(void) {

View File

@ -263,27 +263,27 @@ static ret_t func_rbuffer_read_binary(fscript_t* fscript, fscript_args_t* args,
}
FACTORY_TABLE_BEGIN(s_ext_rbuffer)
FACTORY_TABLE_ENTRY("rbuffer_create", func_rbuffer_create)
FACTORY_TABLE_ENTRY("rbuffer_skip", func_rbuffer_skip)
FACTORY_TABLE_ENTRY("rbuffer_rewind", func_rbuffer_rewind)
FACTORY_TABLE_ENTRY("rbuffer_create", func_rbuffer_create)
FACTORY_TABLE_ENTRY("rbuffer_skip", func_rbuffer_skip)
FACTORY_TABLE_ENTRY("rbuffer_rewind", func_rbuffer_rewind)
FACTORY_TABLE_ENTRY("rbuffer_read_uint8", func_rbuffer_read_uint8)
FACTORY_TABLE_ENTRY("rbuffer_read_uint16", func_rbuffer_read_uint16)
FACTORY_TABLE_ENTRY("rbuffer_read_uint32", func_rbuffer_read_uint32)
FACTORY_TABLE_ENTRY("rbuffer_read_uint64", func_rbuffer_read_uint64)
FACTORY_TABLE_ENTRY("rbuffer_read_int8", func_rbuffer_read_int8)
FACTORY_TABLE_ENTRY("rbuffer_read_int16", func_rbuffer_read_int16)
FACTORY_TABLE_ENTRY("rbuffer_read_int32", func_rbuffer_read_int32)
FACTORY_TABLE_ENTRY("rbuffer_read_int64", func_rbuffer_read_int64)
FACTORY_TABLE_ENTRY("rbuffer_read_uint8", func_rbuffer_read_uint8)
FACTORY_TABLE_ENTRY("rbuffer_read_uint16", func_rbuffer_read_uint16)
FACTORY_TABLE_ENTRY("rbuffer_read_uint32", func_rbuffer_read_uint32)
FACTORY_TABLE_ENTRY("rbuffer_read_uint64", func_rbuffer_read_uint64)
FACTORY_TABLE_ENTRY("rbuffer_read_int8", func_rbuffer_read_int8)
FACTORY_TABLE_ENTRY("rbuffer_read_int16", func_rbuffer_read_int16)
FACTORY_TABLE_ENTRY("rbuffer_read_int32", func_rbuffer_read_int32)
FACTORY_TABLE_ENTRY("rbuffer_read_int64", func_rbuffer_read_int64)
FACTORY_TABLE_ENTRY("rbuffer_read_float", func_rbuffer_read_float)
FACTORY_TABLE_ENTRY("rbuffer_read_double", func_rbuffer_read_double)
FACTORY_TABLE_ENTRY("rbuffer_read_string", func_rbuffer_read_string)
FACTORY_TABLE_ENTRY("rbuffer_read_binary", func_rbuffer_read_binary)
FACTORY_TABLE_ENTRY("rbuffer_read_float", func_rbuffer_read_float)
FACTORY_TABLE_ENTRY("rbuffer_read_double", func_rbuffer_read_double)
FACTORY_TABLE_ENTRY("rbuffer_read_string", func_rbuffer_read_string)
FACTORY_TABLE_ENTRY("rbuffer_read_binary", func_rbuffer_read_binary)
FACTORY_TABLE_ENTRY("rbuffer_get_data", func_rbuffer_get_data)
FACTORY_TABLE_ENTRY("rbuffer_get_cursor", func_rbuffer_get_cursor)
FACTORY_TABLE_ENTRY("rbuffer_get_capacity", func_rbuffer_get_capacity)
FACTORY_TABLE_ENTRY("rbuffer_get_data", func_rbuffer_get_data)
FACTORY_TABLE_ENTRY("rbuffer_get_cursor", func_rbuffer_get_cursor)
FACTORY_TABLE_ENTRY("rbuffer_get_capacity", func_rbuffer_get_capacity)
FACTORY_TABLE_END()
ret_t fscript_rbuffer_register(void) {

View File

@ -188,15 +188,15 @@ static ret_t func_typed_array_join(fscript_t* fscript, fscript_args_t* args, val
}
FACTORY_TABLE_BEGIN(s_ext_typed_array)
FACTORY_TABLE_ENTRY("typed_array_create", func_typed_array_create)
FACTORY_TABLE_ENTRY("typed_array_push", func_typed_array_push)
FACTORY_TABLE_ENTRY("typed_array_pop", func_typed_array_pop)
FACTORY_TABLE_ENTRY("typed_array_get", func_typed_array_get)
FACTORY_TABLE_ENTRY("typed_array_set", func_typed_array_set)
FACTORY_TABLE_ENTRY("typed_array_insert", func_typed_array_insert)
FACTORY_TABLE_ENTRY("typed_array_remove", func_typed_array_remove)
FACTORY_TABLE_ENTRY("typed_array_clear", func_typed_array_clear)
FACTORY_TABLE_ENTRY("typed_array_join", func_typed_array_join)
FACTORY_TABLE_ENTRY("typed_array_create", func_typed_array_create)
FACTORY_TABLE_ENTRY("typed_array_push", func_typed_array_push)
FACTORY_TABLE_ENTRY("typed_array_pop", func_typed_array_pop)
FACTORY_TABLE_ENTRY("typed_array_get", func_typed_array_get)
FACTORY_TABLE_ENTRY("typed_array_set", func_typed_array_set)
FACTORY_TABLE_ENTRY("typed_array_insert", func_typed_array_insert)
FACTORY_TABLE_ENTRY("typed_array_remove", func_typed_array_remove)
FACTORY_TABLE_ENTRY("typed_array_clear", func_typed_array_clear)
FACTORY_TABLE_ENTRY("typed_array_join", func_typed_array_join)
FACTORY_TABLE_END()
ret_t fscript_typed_array_register(void) {

View File

@ -258,28 +258,28 @@ static ret_t func_wbuffer_write_binary(fscript_t* fscript, fscript_args_t* args,
}
FACTORY_TABLE_BEGIN(s_ext_wbuffer)
FACTORY_TABLE_ENTRY("wbuffer_create", func_wbuffer_create)
FACTORY_TABLE_ENTRY("wbuffer_attach", func_wbuffer_attach)
FACTORY_TABLE_ENTRY("wbuffer_skip", func_wbuffer_skip)
FACTORY_TABLE_ENTRY("wbuffer_rewind", func_wbuffer_rewind)
FACTORY_TABLE_ENTRY("wbuffer_create", func_wbuffer_create)
FACTORY_TABLE_ENTRY("wbuffer_attach", func_wbuffer_attach)
FACTORY_TABLE_ENTRY("wbuffer_skip", func_wbuffer_skip)
FACTORY_TABLE_ENTRY("wbuffer_rewind", func_wbuffer_rewind)
FACTORY_TABLE_ENTRY("wbuffer_write_uint8", func_wbuffer_write_uint8)
FACTORY_TABLE_ENTRY("wbuffer_write_uint16", func_wbuffer_write_uint16)
FACTORY_TABLE_ENTRY("wbuffer_write_uint32", func_wbuffer_write_uint32)
FACTORY_TABLE_ENTRY("wbuffer_write_uint64", func_wbuffer_write_uint64)
FACTORY_TABLE_ENTRY("wbuffer_write_int8", func_wbuffer_write_uint8)
FACTORY_TABLE_ENTRY("wbuffer_write_int16", func_wbuffer_write_uint16)
FACTORY_TABLE_ENTRY("wbuffer_write_int32", func_wbuffer_write_uint32)
FACTORY_TABLE_ENTRY("wbuffer_write_int64", func_wbuffer_write_uint64)
FACTORY_TABLE_ENTRY("wbuffer_write_uint8", func_wbuffer_write_uint8)
FACTORY_TABLE_ENTRY("wbuffer_write_uint16", func_wbuffer_write_uint16)
FACTORY_TABLE_ENTRY("wbuffer_write_uint32", func_wbuffer_write_uint32)
FACTORY_TABLE_ENTRY("wbuffer_write_uint64", func_wbuffer_write_uint64)
FACTORY_TABLE_ENTRY("wbuffer_write_int8", func_wbuffer_write_uint8)
FACTORY_TABLE_ENTRY("wbuffer_write_int16", func_wbuffer_write_uint16)
FACTORY_TABLE_ENTRY("wbuffer_write_int32", func_wbuffer_write_uint32)
FACTORY_TABLE_ENTRY("wbuffer_write_int64", func_wbuffer_write_uint64)
FACTORY_TABLE_ENTRY("wbuffer_write_float", func_wbuffer_write_float)
FACTORY_TABLE_ENTRY("wbuffer_write_double", func_wbuffer_write_double)
FACTORY_TABLE_ENTRY("wbuffer_write_string", func_wbuffer_write_string)
FACTORY_TABLE_ENTRY("wbuffer_write_binary", func_wbuffer_write_binary)
FACTORY_TABLE_ENTRY("wbuffer_write_float", func_wbuffer_write_float)
FACTORY_TABLE_ENTRY("wbuffer_write_double", func_wbuffer_write_double)
FACTORY_TABLE_ENTRY("wbuffer_write_string", func_wbuffer_write_string)
FACTORY_TABLE_ENTRY("wbuffer_write_binary", func_wbuffer_write_binary)
FACTORY_TABLE_ENTRY("wbuffer_get_data", func_wbuffer_get_data)
FACTORY_TABLE_ENTRY("wbuffer_get_cursor", func_wbuffer_get_cursor)
FACTORY_TABLE_ENTRY("wbuffer_get_capacity", func_wbuffer_get_capacity)
FACTORY_TABLE_ENTRY("wbuffer_get_data", func_wbuffer_get_data)
FACTORY_TABLE_ENTRY("wbuffer_get_cursor", func_wbuffer_get_cursor)
FACTORY_TABLE_ENTRY("wbuffer_get_capacity", func_wbuffer_get_capacity)
FACTORY_TABLE_END()
ret_t fscript_wbuffer_register(void) {

View File

@ -396,21 +396,21 @@ static ret_t func_widget_send_key(fscript_t* fscript, fscript_args_t* args, valu
}
FACTORY_TABLE_BEGIN(s_ext_widget)
FACTORY_TABLE_ENTRY("open", func_window_open)
FACTORY_TABLE_ENTRY("close", func_window_close)
FACTORY_TABLE_ENTRY("back", func_back)
FACTORY_TABLE_ENTRY("back_to_home", func_back_to_home)
FACTORY_TABLE_ENTRY("quit", func_quit)
FACTORY_TABLE_ENTRY("tr", func_tr)
FACTORY_TABLE_ENTRY("widget_lookup", func_widget_lookup)
FACTORY_TABLE_ENTRY("widget_get", func_widget_get)
FACTORY_TABLE_ENTRY("widget_eval", func_widget_eval)
FACTORY_TABLE_ENTRY("widget_set", func_widget_set)
FACTORY_TABLE_ENTRY("widget_create", func_widget_create)
FACTORY_TABLE_ENTRY("widget_destroy", func_widget_destroy)
FACTORY_TABLE_ENTRY("start_timer", func_widget_add_timer)
FACTORY_TABLE_ENTRY("stop_timer", func_widget_remove_timer)
FACTORY_TABLE_ENTRY("send_key", func_widget_send_key)
FACTORY_TABLE_ENTRY("open", func_window_open)
FACTORY_TABLE_ENTRY("close", func_window_close)
FACTORY_TABLE_ENTRY("back", func_back)
FACTORY_TABLE_ENTRY("back_to_home", func_back_to_home)
FACTORY_TABLE_ENTRY("quit", func_quit)
FACTORY_TABLE_ENTRY("tr", func_tr)
FACTORY_TABLE_ENTRY("widget_lookup", func_widget_lookup)
FACTORY_TABLE_ENTRY("widget_get", func_widget_get)
FACTORY_TABLE_ENTRY("widget_eval", func_widget_eval)
FACTORY_TABLE_ENTRY("widget_set", func_widget_set)
FACTORY_TABLE_ENTRY("widget_create", func_widget_create)
FACTORY_TABLE_ENTRY("widget_destroy", func_widget_destroy)
FACTORY_TABLE_ENTRY("start_timer", func_widget_add_timer)
FACTORY_TABLE_ENTRY("stop_timer", func_widget_remove_timer)
FACTORY_TABLE_ENTRY("send_key", func_widget_send_key)
FACTORY_TABLE_END()
ret_t fscript_widget_register(void) {

View File

@ -173,7 +173,8 @@ static ret_t lcd_mono_resize(lcd_t* lcd, wh_t w, wh_t h, uint32_t line_length) {
return lcd_sdl2_mono_reinit(lcd, w, h, line_length);
}
static ret_t lcd_mono_set_orientation(lcd_t* lcd, lcd_orientation_t old_orientation, lcd_orientation_t new_orientation) {
static ret_t lcd_mono_set_orientation(lcd_t* lcd, lcd_orientation_t old_orientation,
lcd_orientation_t new_orientation) {
if (tk_is_swap_size_by_orientation(old_orientation, new_orientation)) {
return lcd_mono_resize(lcd, lcd->h, lcd->w, 0);
}

View File

@ -108,7 +108,7 @@ static ret_t lcd_sdl2_flush(lcd_t* lcd) {
if (o == LCD_ORIENTATION_0) {
image_copy(&dst, &src, dr, dr->x, dr->y);
} else {
image_rotate(&dst, &src, dr,o);
image_rotate(&dst, &src, dr, o);
}
}
}

View File

@ -112,7 +112,9 @@ static ret_t native_window_fb_gl_resize(native_window_t* win, wh_t w, wh_t h) {
return RET_OK;
}
static ret_t native_window_fb_gl_set_orientation(native_window_t* win, lcd_orientation_t old_orientation, lcd_orientation_t new_orientation) {
static ret_t native_window_fb_gl_set_orientation(native_window_t* win,
lcd_orientation_t old_orientation,
lcd_orientation_t new_orientation) {
wh_t w, h;
ret_t ret = RET_OK;
native_window_info_t info;

View File

@ -70,7 +70,9 @@ static ret_t native_window_raw_resize(native_window_t* win, wh_t w, wh_t h) {
return RET_OK;
}
static ret_t native_window_raw_set_orientation(native_window_t* win, lcd_orientation_t old_orientation, lcd_orientation_t new_orientation) {
static ret_t native_window_raw_set_orientation(native_window_t* win,
lcd_orientation_t old_orientation,
lcd_orientation_t new_orientation) {
wh_t w, h;
ret_t ret = RET_OK;
native_window_info_t info;

View File

@ -106,7 +106,9 @@ static ret_t native_window_sdl_resize(native_window_t* win, wh_t w, wh_t h) {
return ret;
}
static ret_t native_window_sdl_set_orientation(native_window_t* win, lcd_orientation_t old_orientation, lcd_orientation_t new_orientation) {
static ret_t native_window_sdl_set_orientation(native_window_t* win,
lcd_orientation_t old_orientation,
lcd_orientation_t new_orientation) {
wh_t w, h;
native_window_info_t info;
native_window_sdl_t* sdl = NATIVE_WINDOW_SDL(win);

View File

@ -27,7 +27,6 @@
#include "tkc/socket_helper.h"
#include "streams/inet/ostream_tcp.h"
static int32_t tk_ostream_tcp_write(tk_ostream_t* stream, const uint8_t* buff, uint32_t max_size) {
int32_t ret = 0;
tk_ostream_tcp_t* ostream_tcp = TK_OSTREAM_TCP(stream);

View File

@ -13,11 +13,11 @@ int main(int argc, char* argv[]) {
return_value_if_fail(lsock > 0, 0);
log_debug("listen at 8080...\n");
while(1) {
while (1) {
int32_t sock = 0;
sock = tcp_accept(lsock);
if(sock < 0) {
break;
if (sock < 0) {
break;
}
log_debug("%d client come in...\n", sock);
io = tk_iostream_tcp_create(sock);
@ -28,7 +28,7 @@ int main(int argc, char* argv[]) {
ret = tk_istream_read(in, buff, sizeof(buff));
log_debug("recv %d %s\n", ret, buff);
ret = tk_ostream_write(out, response, strlen(response));
log_debug("send %d %s\n", ret, response);

View File

@ -231,7 +231,8 @@ ret_t darray_insert(darray_t* darray, uint32_t index, void* data) {
return RET_OK;
}
ret_t darray_sorted_insert(darray_t* darray, void* data, tk_compare_t cmp, bool_t replace_if_exist) {
ret_t darray_sorted_insert(darray_t* darray, void* data, tk_compare_t cmp,
bool_t replace_if_exist) {
int32_t low = -1;
int32_t index = 0;
return_value_if_fail(darray != NULL, RET_BAD_PARAMS);

View File

@ -211,7 +211,7 @@ static ret_t check_button_set_radio(widget_t* widget, bool_t radio) {
check_button_t* check_button = CHECK_BUTTON(widget);
return_value_if_fail(check_button != NULL, RET_BAD_PARAMS);
check_button->radio = radio;
if(radio) {
if (radio) {
widget->vt = TK_REF_VTABLE(radio_button);
} else {
widget->vt = TK_REF_VTABLE(check_button);

View File

@ -94,7 +94,7 @@ typedef struct _check_button_t {
* (TRUEFALSE)
*/
bool_t value;
/**
* @property {bool_t} radio
* @annotation ["set_prop","get_prop"]

View File

@ -1290,7 +1290,7 @@ static ret_t edit_set_text(widget_t* widget, const value_t* v) {
if (!wstr_equal(&(widget->text), &str)) {
uint32_t len = edit->max > 0 ? tk_min(str.size, edit->max) : str.size;
wstr_set_with_len(&(widget->text), str.str, len);
text_edit_set_cursor(edit->model, widget->text.size);
edit_dispatch_value_change_event(widget, EVT_VALUE_CHANGED);
edit_update_status(widget);

View File

@ -63,7 +63,7 @@
ret_t tk_widgets_init(void) {
widget_factory_t* f = widget_factory();
FACTORY_TABLE_BEGIN(s_basic_widgets)
FACTORY_TABLE_BEGIN(s_basic_widgets)
FACTORY_TABLE_ENTRY(WIDGET_TYPE_DIALOG, dialog_create)
FACTORY_TABLE_ENTRY(WIDGET_TYPE_NORMAL_WINDOW, window_create)
#ifndef AWTK_NOGUI
@ -102,7 +102,7 @@ FACTORY_TABLE_BEGIN(s_basic_widgets)
FACTORY_TABLE_ENTRY(WIDGET_TYPE_COLUMN, column_create)
FACTORY_TABLE_ENTRY(WIDGET_TYPE_APP_BAR, app_bar_create)
FACTORY_TABLE_ENTRY(WIDGET_TYPE_DIGIT_CLOCK, digit_clock_create)
FACTORY_TABLE_END()
FACTORY_TABLE_END()
#endif /*AWTK_LITE*/
#endif /**AWTK_NOGUI*/

View File

@ -1123,7 +1123,9 @@ static ret_t window_manager_default_is_animating(widget_t* widget, bool_t* playi
return RET_OK;
}
static ret_t window_manager_default_orientation(widget_t* widget, wh_t w, wh_t h, lcd_orientation_t old_orientation, lcd_orientation_t new_orientation) {
static ret_t window_manager_default_orientation(widget_t* widget, wh_t w, wh_t h,
lcd_orientation_t old_orientation,
lcd_orientation_t new_orientation) {
ret_t ret = RET_OK;
rect_t r = rect_init(0, 0, w, h);
window_manager_default_t* wm = WINDOW_MANAGER_DEFAULT(widget);

View File

@ -157,7 +157,6 @@ TEST(Bitmap, clone) {
}
static ret_t clear_r(void* ctx, bitmap_t* bitmap, uint32_t x, uint32_t y, rgba_t* pixel) {
pixel->r = *((uint8_t*)ctx);
return RET_OK;
@ -176,7 +175,7 @@ TEST(Bitmap, transform1) {
bitmap_get_pixel(b, 0, 0, &rgba);
ASSERT_EQ(rgba.r, red);
bitmap_get_pixel(b, 5, 5, &rgba);
ASSERT_EQ(rgba.r, red);
@ -196,7 +195,7 @@ TEST(Bitmap, transform2) {
bitmap_get_pixel(b, 0, 0, &rgba);
ASSERT_EQ(rgba.r, red);
bitmap_get_pixel(b, 5, 5, &rgba);
ASSERT_EQ(rgba.r, red);

View File

@ -296,19 +296,19 @@ TEST(ComboBox, remove_option) {
ASSERT_EQ(combo_box_append_option(w, 2, "green"), RET_OK);
ASSERT_EQ(combo_box_append_option(w, 3, "blue"), RET_OK);
ASSERT_EQ(combo_box_count_options(w), 3);
ASSERT_EQ(combo_box_remove_option(w, 1), RET_OK);
ASSERT_EQ(combo_box_count_options(w), 2);
ASSERT_EQ(combo_box_remove_option(w, 1), RET_NOT_FOUND);
ASSERT_EQ(combo_box_count_options(w), 2);
ASSERT_EQ(combo_box_remove_option(w, 3), RET_OK);
ASSERT_EQ(combo_box_count_options(w), 1);
ASSERT_EQ(combo_box_remove_option(w, 2), RET_OK);
ASSERT_EQ(combo_box_count_options(w), 0);
ASSERT_EQ(combo_box_remove_option(w, 2), RET_NOT_FOUND);
ASSERT_EQ(combo_box_count_options(w), 0);

View File

@ -423,21 +423,20 @@ TEST(DArrayTest, set) {
ASSERT_EQ(darray_insert(&darray, 0, tk_pointer_from_int(2)), RET_OK);
ASSERT_EQ(darray_insert(&darray, 0, tk_pointer_from_int(1)), RET_OK);
ASSERT_EQ(darray_insert(&darray, 0, tk_pointer_from_int(0)), RET_OK);
ASSERT_EQ(tk_pointer_to_int(darray_get(&darray, 0)), 0);
ASSERT_EQ(tk_pointer_to_int(darray_get(&darray, 1)), 1);
ASSERT_EQ(tk_pointer_to_int(darray_get(&darray, 2)), 2);
ASSERT_EQ(tk_pointer_to_int(darray_get(&darray, 3)), 3);
ASSERT_EQ(tk_pointer_to_int(darray_get(&darray, 0)), 0);
ASSERT_EQ(tk_pointer_to_int(darray_get(&darray, 1)), 1);
ASSERT_EQ(tk_pointer_to_int(darray_get(&darray, 2)), 2);
ASSERT_EQ(tk_pointer_to_int(darray_get(&darray, 3)), 3);
ASSERT_EQ(darray_set(&darray, 0, tk_pointer_from_int(100)), RET_OK);
ASSERT_EQ(tk_pointer_to_int(darray_get(&darray, 0)), 100);
ASSERT_EQ(tk_pointer_to_int(darray_get(&darray, 0)), 100);
ASSERT_EQ(darray_set(&darray, 1, tk_pointer_from_int(200)), RET_OK);
ASSERT_EQ(tk_pointer_to_int(darray_get(&darray, 1)), 200);
ASSERT_EQ(tk_pointer_to_int(darray_get(&darray, 1)), 200);
darray_deinit(&darray);
}
TEST(DArrayTest, insert_order) {
darray_t darray;
darray_init(&darray, 2, NULL, NULL);
@ -466,13 +465,13 @@ TEST(DArrayTest, insert_order) {
ASSERT_EQ(darray_sorted_insert(&darray, tk_pointer_from_int(4), NULL, true), RET_OK);
ASSERT_EQ(darray.size, 7);
ASSERT_EQ(tk_pointer_to_int(darray_get(&darray, 0)), 0);
ASSERT_EQ(tk_pointer_to_int(darray_get(&darray, 1)), 1);
ASSERT_EQ(tk_pointer_to_int(darray_get(&darray, 2)), 2);
ASSERT_EQ(tk_pointer_to_int(darray_get(&darray, 3)), 3);
ASSERT_EQ(tk_pointer_to_int(darray_get(&darray, 4)), 4);
ASSERT_EQ(tk_pointer_to_int(darray_get(&darray, 5)), 5);
ASSERT_EQ(tk_pointer_to_int(darray_get(&darray, 6)), 6);
ASSERT_EQ(tk_pointer_to_int(darray_get(&darray, 0)), 0);
ASSERT_EQ(tk_pointer_to_int(darray_get(&darray, 1)), 1);
ASSERT_EQ(tk_pointer_to_int(darray_get(&darray, 2)), 2);
ASSERT_EQ(tk_pointer_to_int(darray_get(&darray, 3)), 3);
ASSERT_EQ(tk_pointer_to_int(darray_get(&darray, 4)), 4);
ASSERT_EQ(tk_pointer_to_int(darray_get(&darray, 5)), 5);
ASSERT_EQ(tk_pointer_to_int(darray_get(&darray, 6)), 6);
ASSERT_EQ(darray_sorted_insert(&darray, tk_pointer_from_int(3), NULL, false), RET_OK);
ASSERT_EQ(darray.size, 8);
@ -488,17 +487,17 @@ TEST(DArrayTest, insert_order) {
ASSERT_EQ(darray.size, 13);
ASSERT_EQ(darray_sorted_insert(&darray, tk_pointer_from_int(4), NULL, false), RET_OK);
ASSERT_EQ(darray.size, 14);
ASSERT_EQ(tk_pointer_to_int(darray_get(&darray, 0)), 0);
ASSERT_EQ(tk_pointer_to_int(darray_get(&darray, 1)), 0);
ASSERT_EQ(tk_pointer_to_int(darray_get(&darray, 2)), 1);
ASSERT_EQ(tk_pointer_to_int(darray_get(&darray, 3)), 1);
ASSERT_EQ(tk_pointer_to_int(darray_get(&darray, 4)), 2);
ASSERT_EQ(tk_pointer_to_int(darray_get(&darray, 5)), 2);
ASSERT_EQ(tk_pointer_to_int(darray_get(&darray, 6)), 3);
ASSERT_EQ(tk_pointer_to_int(darray_get(&darray, 7)), 3);
ASSERT_EQ(tk_pointer_to_int(darray_get(&darray, 8)), 4);
ASSERT_EQ(tk_pointer_to_int(darray_get(&darray, 9)), 4);
ASSERT_EQ(tk_pointer_to_int(darray_get(&darray, 0)), 0);
ASSERT_EQ(tk_pointer_to_int(darray_get(&darray, 1)), 0);
ASSERT_EQ(tk_pointer_to_int(darray_get(&darray, 2)), 1);
ASSERT_EQ(tk_pointer_to_int(darray_get(&darray, 3)), 1);
ASSERT_EQ(tk_pointer_to_int(darray_get(&darray, 4)), 2);
ASSERT_EQ(tk_pointer_to_int(darray_get(&darray, 5)), 2);
ASSERT_EQ(tk_pointer_to_int(darray_get(&darray, 6)), 3);
ASSERT_EQ(tk_pointer_to_int(darray_get(&darray, 7)), 3);
ASSERT_EQ(tk_pointer_to_int(darray_get(&darray, 8)), 4);
ASSERT_EQ(tk_pointer_to_int(darray_get(&darray, 9)), 4);
darray_deinit(&darray);
}

View File

@ -28,28 +28,28 @@ FACTORY_TABLE_END()
TEST(GeneralFactory, basic) {
general_factory_t factory;
general_factory_t* f = general_factory_init(&factory);
ASSERT_EQ(general_factory_find(f, "foo") == foo_create, false);
ASSERT_EQ(general_factory_register(f, "foo", foo_create), RET_OK);
ASSERT_EQ(general_factory_find(f, "foo") == foo_create, true);
ASSERT_EQ(general_factory_find(f, "bar") == bar_create, false);
ASSERT_EQ(general_factory_register(f, "bar", bar_create), RET_OK);
ASSERT_EQ(general_factory_find(f, "bar") == bar_create, true);
ASSERT_EQ(general_factory_find(f, "alpha") == alpha_create, false);
ASSERT_EQ(general_factory_register(f, "alpha", alpha_create), RET_OK);
ASSERT_EQ(general_factory_find(f, "alpha") == alpha_create, true);
ASSERT_EQ(general_factory_unregister(f, "foo"), RET_OK);
ASSERT_EQ(general_factory_find(f, "foo") == foo_create, false);
ASSERT_EQ(general_factory_unregister(f, "bar"), RET_OK);
ASSERT_EQ(general_factory_find(f, "bar") == bar_create, false);
ASSERT_EQ(general_factory_unregister(f, "alpha"), RET_OK);
ASSERT_EQ(general_factory_find(f, "alpha") == alpha_create, false);
ASSERT_EQ(general_factory_register_ex(f, "alpha", alpha_create, FALSE), RET_OK);
ASSERT_EQ(general_factory_find(f, "alpha") == alpha_create, true);
@ -59,13 +59,13 @@ TEST(GeneralFactory, basic) {
TEST(GeneralFactory, table) {
general_factory_t factory;
general_factory_t* f = general_factory_init(&factory);
ASSERT_EQ(general_factory_register_table(f, s_demo), RET_OK);
ASSERT_EQ(general_factory_register_table(f, s_demo), RET_OK);
ASSERT_EQ(general_factory_find(f, "foo") == foo_create, true);
ASSERT_EQ(general_factory_find(f, "bar") == bar_create, true);
ASSERT_EQ(general_factory_find(f, "alpha") == alpha_create, true);
ASSERT_EQ(general_factory_register_table(f, s_bar), RET_OK);
ASSERT_EQ(general_factory_register_table(f, s_bar), RET_OK);
ASSERT_EQ(general_factory_find(f, "aaa") == foo_create, true);
ASSERT_EQ(general_factory_find(f, "bbb") == bar_create, true);
ASSERT_EQ(general_factory_find(f, "ccc") == alpha_create, true);

View File

@ -84,7 +84,7 @@ TEST(ScrollBar, is_mobile_prop) {
ASSERT_EQ(widget_set_prop_bool(w, SCROLL_BAR_PROP_IS_MOBILE, TRUE), RET_OK);
ASSERT_EQ(widget_get_prop_bool(w, SCROLL_BAR_PROP_IS_MOBILE, FALSE), TRUE);
ASSERT_EQ(widget_set_prop_bool(w, SCROLL_BAR_PROP_IS_MOBILE, FALSE), RET_OK);
ASSERT_EQ(widget_get_prop_bool(w, SCROLL_BAR_PROP_IS_MOBILE, TRUE), FALSE);

View File

@ -617,7 +617,7 @@ TEST(SelfLayoutDefault, center_middle_and_widget_set_prop) {
ASSERT_EQ(self_layouter_get_param_int(layouter, "y_attr", 0), Y_ATTR_MIDDLE);
ASSERT_EQ(self_layouter_get_param_int(layouter, "w_attr", 0), W_ATTR_UNDEF);
ASSERT_EQ(self_layouter_get_param_int(layouter, "h_attr", 0), H_ATTR_PERCENT);
ASSERT_EQ(self_layouter_set_param_str(layouter, "w", "30%"), RET_OK);
ASSERT_EQ(self_layouter_set_param_str(layouter, "w", "30%"), RET_OK);
widget_set_prop_int(b, "h", 10);
ASSERT_EQ(widget_layout_self(b), RET_OK);

View File

@ -533,7 +533,7 @@ TEST(Utils, isspace) {
const char* str = "(1)这;这个。(2)他(她,它)”,在“,它)";
size_t n = strlen(str);
for(i = 0; i < n; i++) {
for (i = 0; i < n; i++) {
tk_isspace(str[i]);
tk_isdigit(str[i]);
tk_isalpha(str[i]);

View File

@ -67,4 +67,3 @@ TEST(WidgetFactory, over_write) {
widget_destroy(custom);
widget_factory_destroy(factory);
}

View File

@ -389,7 +389,7 @@ TEST(WStr, set_with_len) {
wstr_init(&s, 0);
for(i = 0; i < n; i++) {
for (i = 0; i < n; i++) {
ASSERT_EQ(wstr_set_with_len(&s, cstr, i), RET_OK);
ASSERT_EQ(s.size, i);
ASSERT_EQ(wcsncmp(s.str, cstr, i), 0);