diff --git a/HISTORY b/HISTORY index 52d1e64..0756b93 100755 --- a/HISTORY +++ b/HISTORY @@ -1,3 +1,7 @@ +Nov. 1 2016 +Fixed a file importing bug +Removed the SET_IMPORTING_DIRS statement + Oct. 23 2016 Fixed a percent symbol printing bug, thanks to Philip Bister for pointing it out diff --git a/MY-BASIC Quick Reference.pdf b/MY-BASIC Quick Reference.pdf index 5bb8b6e..7a4df1c 100644 Binary files a/MY-BASIC Quick Reference.pdf and b/MY-BASIC Quick Reference.pdf differ diff --git a/README.md b/README.md index 286e499..fbc872f 100755 --- a/README.md +++ b/README.md @@ -10,8 +10,6 @@ [简体中文](https://github.com/paladin-t/my_basic/wiki/%E7%94%B1%E7%BA%AF-C-%E8%AF%AD%E8%A8%80%E7%BC%96%E5%86%99%E7%9A%84-BASIC-%E8%84%9A%E6%9C%AC%E8%A7%A3%E9%87%8A%E5%99%A8) -[日本語](https://github.com/paladin-t/my_basic/wiki/BASIC-%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%97%E3%83%88%E3%82%A4%E3%83%B3%E3%82%BF%E3%83%97%E3%83%AA%E3%82%BF) - Why were other script interpreters so complex? Why was it so difficult to integrate with them and use the API? Why not try MY-BASIC today! Script had never been so simple and enjoyable. [![Build status](https://travis-ci.org/paladin-t/my_basic.svg?branch=master)](https://travis-ci.org/paladin-t/my_basic) diff --git a/core/my_basic.c b/core/my_basic.c index 1cdf552..2fae140 100755 --- a/core/my_basic.c +++ b/core/my_basic.c @@ -5159,8 +5159,16 @@ static _data_e _get_symbol_type(mb_interpreter_t* s, char* sym, _raw_t* value) { } } else { 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)); + if(s->import_handler) { + _object_t* sep = _create_object(); + sep->type = _DT_SEP; + sep->data.separator = ':'; + _ls_pushback(s->ast, sep); + if(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_OPEN_FILE_FAILED, s->source_file, MB_FUNC_ERR); + } } else { _handle_error_now(s, SE_PS_OPEN_FILE_FAILED, s->source_file, MB_FUNC_ERR); } diff --git a/shell/main.c b/shell/main.c index 1c4473e..863ec88 100755 --- a/shell/main.c +++ b/shell/main.c @@ -1287,23 +1287,6 @@ static int now(struct mb_interpreter_t* s, void** l) { return result; } -static int set_importing_dirs(struct mb_interpreter_t* s, void** l) { - int result = MB_FUNC_OK; - char* arg = 0; - - mb_assert(s && l); - - mb_check(mb_attempt_open_bracket(s, l)); - - mb_check(mb_pop_string(s, l, &arg)); - if(arg) - _set_importing_directories(arg); - - mb_check(mb_attempt_close_bracket(s, l)); - - return result; -} - static int os(struct mb_interpreter_t* s, void** l) { int result = MB_FUNC_OK; @@ -1505,7 +1488,6 @@ static void _on_startup(void) { mb_reg_fun(bas, ticks); #endif /* _HAS_TICKS */ mb_reg_fun(bas, now); - mb_reg_fun(bas, set_importing_dirs); mb_reg_fun(bas, os); mb_reg_fun(bas, sys); mb_reg_fun(bas, trace);