*fixed a file importing bug;

-removed the SET_IMPORTING_DIRS statement.
This commit is contained in:
Wang Renxin 2016-11-01 12:28:53 +08:00
parent c623be78f2
commit b358ba2fbc
5 changed files with 14 additions and 22 deletions

View File

@ -1,3 +1,7 @@
Nov. 1 2016
Fixed a file importing bug
Removed the SET_IMPORTING_DIRS statement
Oct. 23 2016 Oct. 23 2016
Fixed a percent symbol printing bug, thanks to Philip Bister for pointing it out Fixed a percent symbol printing bug, thanks to Philip Bister for pointing it out

Binary file not shown.

View File

@ -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/%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. 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) [![Build status](https://travis-ci.org/paladin-t/my_basic.svg?branch=master)](https://travis-ci.org/paladin-t/my_basic)

View File

@ -5159,8 +5159,16 @@ static _data_e _get_symbol_type(mb_interpreter_t* s, char* sym, _raw_t* value) {
} }
} else { } else {
if(!_ls_find(context->imported, (void*)(sym + 1), (_ls_compare)_ht_cmp_string, 0)) { 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) { if(s->import_handler) {
_ls_pushback(context->imported, mb_strdup(sym + 1, strlen(sym + 1) + 1)); _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 { } else {
_handle_error_now(s, SE_PS_OPEN_FILE_FAILED, s->source_file, MB_FUNC_ERR); _handle_error_now(s, SE_PS_OPEN_FILE_FAILED, s->source_file, MB_FUNC_ERR);
} }

View File

@ -1287,23 +1287,6 @@ static int now(struct mb_interpreter_t* s, void** l) {
return result; 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) { static int os(struct mb_interpreter_t* s, void** l) {
int result = MB_FUNC_OK; int result = MB_FUNC_OK;
@ -1505,7 +1488,6 @@ static void _on_startup(void) {
mb_reg_fun(bas, ticks); mb_reg_fun(bas, ticks);
#endif /* _HAS_TICKS */ #endif /* _HAS_TICKS */
mb_reg_fun(bas, now); mb_reg_fun(bas, now);
mb_reg_fun(bas, set_importing_dirs);
mb_reg_fun(bas, os); mb_reg_fun(bas, os);
mb_reg_fun(bas, sys); mb_reg_fun(bas, sys);
mb_reg_fun(bas, trace); mb_reg_fun(bas, trace);