+added some location parameters to the mb_get_last_error function.

This commit is contained in:
Wang Renxin 2017-11-01 21:41:56 +08:00
parent b12a60650d
commit dcc187a5ea
4 changed files with 10 additions and 3 deletions

View File

@ -1,3 +1,6 @@
Nov. 1 2017
Added some location parameters to the mb_get_last_error function
Oct. 30 2017
Added support to apply the STR statement to a type value
Fixed a referencing bug with an unnamed array

Binary file not shown.

View File

@ -14153,7 +14153,7 @@ _exit:
}
/* Get the last error information */
mb_error_e mb_get_last_error(struct mb_interpreter_t* s) {
mb_error_e mb_get_last_error(struct mb_interpreter_t* s, const char** file, int* pos, unsigned short* row, unsigned short* col) {
mb_error_e result = SE_NO_ERR;
if(!s)
@ -14161,6 +14161,10 @@ mb_error_e mb_get_last_error(struct mb_interpreter_t* s) {
result = s->last_error;
s->last_error = SE_NO_ERR; /* Clear error state */
if(file) *file = s->last_error_file;
if(pos) *pos = s->last_error_pos;
if(row) *row = s->last_error_row;
if(col) *col = s->last_error_col;
_exit:
return result;
@ -15332,7 +15336,7 @@ _elseif:
if(ast) la = ast;
}
if(!ast) {
mb_get_last_error(s);
mb_get_last_error(s, 0, 0, 0, 0);
_handle_error_on_obj(s, SE_RN_ENDIF_EXPECTED, s->source_file, DON(la), MB_FUNC_ERR, _exit, result);
}
if(ast && _IS_FUNC(ast->data, _core_endif)) {

View File

@ -677,7 +677,7 @@ MBAPI int mb_debug_set_stepped_handler(struct mb_interpreter_t* s, mb_debug_step
MBAPI const char* mb_get_type_string(mb_data_e t);
MBAPI int mb_raise_error(struct mb_interpreter_t* s, void** l, mb_error_e err, int ret);
MBAPI mb_error_e mb_get_last_error(struct mb_interpreter_t* s);
MBAPI mb_error_e mb_get_last_error(struct mb_interpreter_t* s, const char** file, int* pos, unsigned short* row, unsigned short* col);
MBAPI const char* mb_get_error_desc(mb_error_e err);
MBAPI int mb_set_error_handler(struct mb_interpreter_t* s, mb_error_handler_t h);