diff --git a/HISTORY b/HISTORY index 9aac08e..fe72ee4 100755 --- a/HISTORY +++ b/HISTORY @@ -1,4 +1,5 @@ Feb. 25 2016 +Improved importing directory detection Fixed a bug with the END and RETURN statement with FOR loop Fixed an array index calculation bug diff --git a/core/my_basic.c b/core/my_basic.c index 341f7c4..b6e8c73 100755 --- a/core/my_basic.c +++ b/core/my_basic.c @@ -4672,8 +4672,12 @@ static _data_e _get_symbol_type(mb_interpreter_t* s, char* sym, _raw_t* value) { _post_import(s, lf, &pos, &row, &col); } } else { - if(!s->import_handler || s->import_handler(s, sym + 1) != MB_FUNC_OK) { - _handle_error_now(s, SE_PS_FILE_OPEN_FAILED, s->source_file, MB_FUNC_ERR); + if(!_ls_find(context->imported, (void*)(sym + 1), (_ls_compare)_ht_cmp_string, 0)) { + if(s->import_handler && s->import_handler(s, sym + 1) == MB_FUNC_OK) { + _ls_pushback(context->imported, mb_strdup(sym + 1, strlen(sym + 1) + 1)); + } else { + _handle_error_now(s, SE_PS_FILE_OPEN_FAILED, s->source_file, MB_FUNC_ERR); + } } }