diff --git a/HISTORY b/HISTORY index 6cf9030..e0e2f05 100755 --- a/HISTORY +++ b/HISTORY @@ -1,3 +1,6 @@ +Jul. 20 2015 +Fixed a string manipulation bug + Jul. 12 2015 Added array manipulation functions diff --git a/MY-BASIC Quick Reference.pdf b/MY-BASIC Quick Reference.pdf index 214a089..25090e4 100755 Binary files a/MY-BASIC Quick Reference.pdf and b/MY-BASIC Quick Reference.pdf differ diff --git a/core/my_basic.c b/core/my_basic.c index aa0ad67..65d75fb 100755 --- a/core/my_basic.c +++ b/core/my_basic.c @@ -78,7 +78,7 @@ extern "C" { /** Macros */ #define _VER_MAJOR 1 #define _VER_MINOR 1 -#define _VER_REVISION 57 +#define _VER_REVISION 58 #define _MB_VERSION ((_VER_MAJOR * 0x01000000) + (_VER_MINOR * 0x00010000) + (_VER_REVISION)) /* Uncomment this line to treat warnings as error */ @@ -1747,10 +1747,11 @@ int _calc_expression(mb_interpreter_t* s, _ls_node_t** l, _object_t** val) { } else { (*val)->type = c->type; if(_is_string(c)) { - size_t _sl = strlen(_extract_string(c)); + char* _str = _extract_string(c); + size_t _sl = strlen(_str); (*val)->data.string = (char*)mb_malloc(_sl + 1); (*val)->data.string[_sl] = '\0'; - memcpy((*val)->data.string, c->data.string, _sl + 1); + memcpy((*val)->data.string, _str, _sl + 1); } else if(c->type == _DT_ARRAY) { (*val)->data = c->data; c->type = _DT_NIL; @@ -2722,6 +2723,9 @@ char* _extract_string(_object_t* obj) { else if(obj->type == _DT_VAR && obj->data.variable->data->type == _DT_STRING) result = obj->data.variable->data->data.string; + if(!result) + result = MB_NULL_STRING; + return result; } diff --git a/output/my_basic.exe b/output/my_basic.exe index 3c46727..1f712b6 100755 Binary files a/output/my_basic.exe and b/output/my_basic.exe differ diff --git a/output/my_basic_mac b/output/my_basic_mac index a32db8f..0027ac9 100755 Binary files a/output/my_basic_mac and b/output/my_basic_mac differ diff --git a/resource/my_basic.rc b/resource/my_basic.rc index d28918b..d4739b5 100755 --- a/resource/my_basic.rc +++ b/resource/my_basic.rc @@ -36,8 +36,8 @@ IDI_ICON_MAIN ICON "icon.ico" VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,1,57,0 - PRODUCTVERSION 1,1,57,0 + FILEVERSION 1,1,58,0 + PRODUCTVERSION 1,1,58,0 FILEFLAGSMASK 0x17L # ifdef _DEBUG FILEFLAGS 0x1L @@ -55,13 +55,13 @@ VALUE "Comments", "MY-BASIC" VALUE "CompanyName", "W. Renxin" VALUE "FileDescription", "MY-BASIC interpreter" - VALUE "FileVersion", "1, 1, 57, 0" + VALUE "FileVersion", "1, 1, 58, 0" VALUE "InternalName", "my_basic" VALUE "LegalCopyright", "Copyright (C) 2011 - 2015 W. Renxin" VALUE "LegalTrademarks", "MY-BASIC" VALUE "OriginalFilename", "my_basic.exe" VALUE "ProductName", "MY-BASIC" - VALUE "ProductVersion", "1, 1, 57, 0" + VALUE "ProductVersion", "1, 1, 58, 0" END END BLOCK "VarFileInfo"