*improved the stepped handler.
This commit is contained in:
parent
ed3f2f791a
commit
69eb74ae35
3
HISTORY
3
HISTORY
@ -1,3 +1,6 @@
|
||||
Jan. 17 2017
|
||||
Improved the stepped handler
|
||||
|
||||
Jan. 7 2017
|
||||
Added dot symbol accessing of functions for referenced usertype
|
||||
|
||||
|
Binary file not shown.
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user