From 4bf8c7e83fc4ddf24af6af2675b14e875f514a87 Mon Sep 17 00:00:00 2001 From: RushFan Date: Sat, 31 Dec 2016 14:12:33 -0800 Subject: [PATCH 1/2] rename _is_using_char to _is_using_at_char. This makes it a bit more descriptive as to which character this function is testing. --- core/my_basic.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/my_basic.c b/core/my_basic.c index 7654e6d..c577d6a 100755 --- a/core/my_basic.c +++ b/core/my_basic.c @@ -1394,7 +1394,7 @@ static bool_t _is_numeric_char(char c); static bool_t _is_identifier_char(char c); static bool_t _is_operator_char(char c); static bool_t _is_exponential_char(char c); -static bool_t _is_using_char(char c); +static bool_t _is_using_at_char(char c); static bool_t _is_exponent_prefix(char* s, int begin, int end); static int _append_char_to_symbol(mb_interpreter_t* s, char c); @@ -4737,7 +4737,7 @@ static bool_t _is_exponential_char(char c) { } /* Determine whether a character is module using char */ -static bool_t _is_using_char(char c) { +static bool_t _is_using_at_char(char c) { return (c == '@'); } @@ -5186,7 +5186,7 @@ static _data_e _get_symbol_type(mb_interpreter_t* s, char* sym, _raw_t* value) { sym[_sl - 1] = _ZERO_CHAR; context->parsing_state = _PS_NORMAL; /* Using a module */ - if(_is_using_char(*(sym + 1))) { + if(_is_using_at_char(*(sym + 1))) { #ifdef MB_ENABLE_MODULE char* ns = mb_strdup(sym + 2, strlen(sym + 2) + 1); mb_strupr(ns); From 9090b6c6090bdab4d880fa80b24bef9b7bd484ec Mon Sep 17 00:00:00 2001 From: RushFan Date: Sat, 31 Dec 2016 14:33:11 -0800 Subject: [PATCH 2/2] add MB_DISABLE_LOAD_FILE to disable _load_file This will disable loading any script without going through either the import_handler or by loading a module. --- core/my_basic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/my_basic.c b/core/my_basic.c index c577d6a..529c509 100755 --- a/core/my_basic.c +++ b/core/my_basic.c @@ -32,6 +32,7 @@ #include "my_basic.h" #if defined ARDUINO && !defined MB_CP_ARDUINO # define MB_CP_ARDUINO +# define MB_DISABLE_LOAD_FILE #endif /* ARDUINO && !MB_CP_ARDUINO */ #ifdef MB_CP_VC # include @@ -4606,7 +4607,7 @@ static void _print_string(mb_interpreter_t* s, _object_t* obj) { /* Read all content of a file into a buffer */ static char* _load_file(mb_interpreter_t* s, const char* f, const char* prefix) { -#ifndef MB_CP_ARDUINO +#ifndef MB_DISABLE_LOAD_FILE FILE* fp = 0; char* buf = 0; long curpos = 0;