diff --git a/HISTORY b/HISTORY index 8235abe..93ac2ad 100755 --- a/HISTORY +++ b/HISTORY @@ -1,3 +1,6 @@ +Jan. 17 2017 +Improved the stepped handler + Jan. 7 2017 Added dot symbol accessing of functions for referenced usertype diff --git a/MY-BASIC Quick Reference.pdf b/MY-BASIC Quick Reference.pdf index 5c34506..c06e15d 100644 Binary files a/MY-BASIC Quick Reference.pdf and b/MY-BASIC Quick Reference.pdf differ diff --git a/core/my_basic.c b/core/my_basic.c index 245a738..2d26655 100755 --- a/core/my_basic.c +++ b/core/my_basic.c @@ -1809,7 +1809,7 @@ static _object_t* _eval_var_in_print(mb_interpreter_t* s, _object_t** val_ptr, _ /** Interpretation */ -static void _stepped(mb_interpreter_t* s, _ls_node_t* ast); +static int _stepped(mb_interpreter_t* s, _ls_node_t* ast); static int _execute_statement(mb_interpreter_t* s, _ls_node_t** l, bool_t force_next); static int _common_end_looping(mb_interpreter_t* s, _ls_node_t** l); static int _common_keep_looping(mb_interpreter_t* s, _ls_node_t** l, _var_t* var_loop); @@ -9919,7 +9919,8 @@ static _object_t* _eval_var_in_print(mb_interpreter_t* s, _object_t** val_ptr, _ /** Interpretation */ /* Callback a stepped debug handler, this function is called each step */ -static void _stepped(mb_interpreter_t* s, _ls_node_t* ast) { +static int _stepped(mb_interpreter_t* s, _ls_node_t* ast) { + int result = MB_FUNC_OK; _object_t* obj = 0; mb_assert(s); @@ -9928,14 +9929,16 @@ static void _stepped(mb_interpreter_t* s, _ls_node_t* ast) { if(ast && ast->data) { obj = (_object_t*)ast->data; #ifdef MB_ENABLE_SOURCE_TRACE - s->debug_stepped_handler(s, (void**)&ast, s->source_file, obj->source_pos, obj->source_row, obj->source_col); + result = s->debug_stepped_handler(s, (void**)&ast, s->source_file, obj->source_pos, obj->source_row, obj->source_col); #else /* MB_ENABLE_SOURCE_TRACE */ - s->debug_stepped_handler(s, (void**)&ast, s->source_file, obj->source_pos, 0, 0); + result = s->debug_stepped_handler(s, (void**)&ast, s->source_file, obj->source_pos, 0, 0); #endif /* MB_ENABLE_SOURCE_TRACE */ } else { - s->debug_stepped_handler(s, (void**)&ast, s->source_file, -1, 0, 0); + result = s->debug_stepped_handler(s, (void**)&ast, s->source_file, -1, 0, 0); } } + + return result; } /* Execute the ast, this is the core execution function */ @@ -10144,7 +10147,11 @@ _exit: *l = ast; - _stepped(s, ast); + do { + int ret = _stepped(s, ast); + if(result == MB_FUNC_OK) + result = ret; + } while(0); return result; } diff --git a/core/my_basic.h b/core/my_basic.h index 6eb6b7d..a38350f 100755 --- a/core/my_basic.h +++ b/core/my_basic.h @@ -536,7 +536,7 @@ typedef int (* mb_func_t)(struct mb_interpreter_t*, void**); typedef int (* mb_has_routine_arg_func_t)(struct mb_interpreter_t*, void**, mb_value_t*, unsigned, unsigned*, void*); typedef int (* mb_pop_routine_arg_func_t)(struct mb_interpreter_t*, void**, mb_value_t*, unsigned, unsigned*, void*, mb_value_t*); typedef int (* mb_routine_func_t)(struct mb_interpreter_t*, void**, mb_value_t*, unsigned, void*, mb_has_routine_arg_func_t, mb_pop_routine_arg_func_t); -typedef void (* mb_debug_stepped_handler_t)(struct mb_interpreter_t*, void**, char*, int, unsigned short, unsigned short); +typedef int (* mb_debug_stepped_handler_t)(struct mb_interpreter_t*, void**, char*, int, unsigned short, unsigned short); typedef void (* mb_error_handler_t)(struct mb_interpreter_t*, enum mb_error_e, char*, char*, int, unsigned short, unsigned short, int); typedef int (* mb_print_func_t)(const char*, ...); typedef int (* mb_input_func_t)(char*, int); diff --git a/shell/main.c b/shell/main.c index 7161eaa..0239e5b 100755 --- a/shell/main.c +++ b/shell/main.c @@ -1437,13 +1437,15 @@ static int beep(struct mb_interpreter_t* s, void** l) { ** Callbacks and handlers */ -static void _on_stepped(struct mb_interpreter_t* s, void** l, char* f, int p, unsigned short row, unsigned short col) { +static int _on_stepped(struct mb_interpreter_t* s, void** l, char* f, int p, unsigned short row, unsigned short col) { mb_unrefvar(s); mb_unrefvar(l); mb_unrefvar(f); mb_unrefvar(p); mb_unrefvar(row); mb_unrefvar(col); + + return MB_FUNC_OK; } static void _on_error(struct mb_interpreter_t* s, mb_error_e e, char* m, char* f, int p, unsigned short row, unsigned short col, int abort_code) {