*fixed a wrong token position marking issue with interactive mode
This commit is contained in:
parent
8d50fa5f83
commit
424f394432
383
HISTORY
383
HISTORY
@ -1,190 +1,193 @@
|
|||||||
May. 6 2015
|
Jun. 15 2015
|
||||||
Removed redundant EOS tokens
|
Fixed a wrong token position marking issue with interactive mode, thanks to Daniel Haensse for pointing it out
|
||||||
Polished data precision related macros
|
|
||||||
|
May. 6 2015
|
||||||
May. 5 2015
|
Removed redundant EOS tokens
|
||||||
Added string type support for non-simple array
|
Polished data precision related macros
|
||||||
Fixed a memory leak when storing strings to a non-string array
|
|
||||||
Polished data precision related macros
|
May. 5 2015
|
||||||
|
Added string type support for non-simple array
|
||||||
Apr. 27 2015
|
Fixed a memory leak when storing strings to a non-string array
|
||||||
Added code line inserting/removing to interpreter shell
|
Polished data precision related macros
|
||||||
Changed mb_dispose_value as public
|
|
||||||
|
Apr. 27 2015
|
||||||
Apr. 23 2015 Version 1.1
|
Added code line inserting/removing to interpreter shell
|
||||||
Added debug APIs
|
Changed mb_dispose_value as public
|
||||||
Added (nestable) multi line IF statement support
|
|
||||||
|
Apr. 23 2015 Version 1.1
|
||||||
Apr. 15 2015
|
Added debug APIs
|
||||||
Added mb_pop_usertype, mb_push_usertype to support user defined type
|
Added (nestable) multi line IF statement support
|
||||||
Polished code
|
|
||||||
Polished document
|
Apr. 15 2015
|
||||||
|
Added mb_pop_usertype, mb_push_usertype to support user defined type
|
||||||
Apr. 13 2015
|
Polished code
|
||||||
Added mixed integer/float array support
|
Polished document
|
||||||
Added warning prompt when passing strings to maths functions
|
|
||||||
Fixed a memory leak when storing strings in an array
|
Apr. 13 2015
|
||||||
Polished the interpreter commands
|
Added mixed integer/float array support
|
||||||
|
Added warning prompt when passing strings to maths functions
|
||||||
Apr. 11 2015
|
Fixed a memory leak when storing strings in an array
|
||||||
Moved struct mb_interpreter_t from my_basic.h to my_basic.c
|
Polished the interpreter commands
|
||||||
Added an mb_has_arg interface to tell whether there is any more argument
|
|
||||||
Added an MB_ENABLE_SOURCE_TRACE macro to enable or disable source tracing
|
Apr. 11 2015
|
||||||
Disposed parsing context at runtime to reduce memory occupation
|
Moved struct mb_interpreter_t from my_basic.h to my_basic.c
|
||||||
|
Added an mb_has_arg interface to tell whether there is any more argument
|
||||||
Apr. 10 2015
|
Added an MB_ENABLE_SOURCE_TRACE macro to enable or disable source tracing
|
||||||
Improved compatibility with PellesC
|
Disposed parsing context at runtime to reduce memory occupation
|
||||||
Fixed a double precision float parsing bug on all 32bit systems, thanks to Pito for pointing it out
|
|
||||||
Fixed an exponential number parsing bug, thanks to Pito for pointing it out
|
Apr. 10 2015
|
||||||
Fixed a crash bug when a script begins with a meaningless negtive number
|
Improved compatibility with PellesC
|
||||||
|
Fixed a double precision float parsing bug on all 32bit systems, thanks to Pito for pointing it out
|
||||||
Mar. 25 2015
|
Fixed an exponential number parsing bug, thanks to Pito for pointing it out
|
||||||
Changed _strupr macro to mb_strupr function
|
Fixed a crash bug when a script begins with a meaningless negtive number
|
||||||
Added an mb_memdup function
|
|
||||||
Fixed an intermediate value disposing more than once bug
|
Mar. 25 2015
|
||||||
|
Changed _strupr macro to mb_strupr function
|
||||||
Dec. 17 2014
|
Added an mb_memdup function
|
||||||
Fixed a calculation crash bug
|
Fixed an intermediate value disposing more than once bug
|
||||||
Fixed a memory leak with intermediate value
|
|
||||||
|
Dec. 17 2014
|
||||||
Dec. 16 2014
|
Fixed a calculation crash bug
|
||||||
Fixed a negative calculation bug in a function argument
|
Fixed a memory leak with intermediate value
|
||||||
|
|
||||||
Dec. 9 2014
|
Dec. 16 2014
|
||||||
Improved compatibility with BCB
|
Fixed a negative calculation bug in a function argument
|
||||||
|
|
||||||
May. 25 2014
|
Dec. 9 2014
|
||||||
Added an mb_set_inputer function which allows the user to specify an INPUT reader, thanks to Michael P. Welch for suggestion
|
Improved compatibility with BCB
|
||||||
Added an mb_remove_reserved_func function which allows the user to disable/remove a reserved statement
|
|
||||||
|
May. 25 2014
|
||||||
May. 22 2014
|
Added an mb_set_inputer function which allows the user to specify an INPUT reader, thanks to Michael P. Welch for suggestion
|
||||||
Fixed a crash bug when missing colon in a combined line, thanks to Michael P. Welch for pointing it out
|
Added an mb_remove_reserved_func function which allows the user to disable/remove a reserved statement
|
||||||
Fixed a missing lexical cursor stepping bug in INPUT function
|
|
||||||
|
May. 22 2014
|
||||||
Mar. 17 2014
|
Fixed a crash bug when missing colon in a combined line, thanks to Michael P. Welch for pointing it out
|
||||||
Added an XCode project
|
Fixed a missing lexical cursor stepping bug in INPUT function
|
||||||
Added a safe stdin reader function mb_gets
|
|
||||||
Fixed a crash bug in INPUT function
|
Mar. 17 2014
|
||||||
|
Added an XCode project
|
||||||
Feb. 17 2014
|
Added a safe stdin reader function mb_gets
|
||||||
Added mod by zero processing
|
Fixed a crash bug in INPUT function
|
||||||
|
|
||||||
Feb. 16 2014
|
Feb. 17 2014
|
||||||
Fixed a crash bug in _core_for, thanks to mummylauncher for pointing it out
|
Added mod by zero processing
|
||||||
|
|
||||||
Jul. 19 2013
|
Feb. 16 2014
|
||||||
Fixed a crash bug in _execute_statement, thanks to Jon Mayo for pointing it out
|
Fixed a crash bug in _core_for, thanks to mummylauncher for pointing it out
|
||||||
|
|
||||||
Feb. 25 2013
|
Jul. 19 2013
|
||||||
Fixed a cross routine multi-statement execution bug, thanks to Bruce Kendall for pointing it out
|
Fixed a crash bug in _execute_statement, thanks to Jon Mayo for pointing it out
|
||||||
Fixed a memory corruption bug when loading a script file
|
|
||||||
|
Feb. 25 2013
|
||||||
Jan. 9 2013
|
Fixed a cross routine multi-statement execution bug, thanks to Bruce Kendall for pointing it out
|
||||||
Fixed a crash bug when using EDIT command
|
Fixed a memory corruption bug when loading a script file
|
||||||
|
|
||||||
Dec. 14 2012
|
Jan. 9 2013
|
||||||
Added an invalid expression error handling
|
Fixed a crash bug when using EDIT command
|
||||||
Added an out of memory error handling
|
|
||||||
|
Dec. 14 2012
|
||||||
Dec. 5 2012
|
Added an invalid expression error handling
|
||||||
Fixed a minus calculation bug, thanks to Bill Walker for pointing it out
|
Added an out of memory error handling
|
||||||
|
|
||||||
Nov. 14 2012
|
Dec. 5 2012
|
||||||
Fixed a cross routine RETURN bug, thanks to Bruce Kendall for pointing it out
|
Fixed a minus calculation bug, thanks to Bill Walker for pointing it out
|
||||||
|
|
||||||
Sep. 12 2012
|
Nov. 14 2012
|
||||||
Fixed a bug in ASC
|
Fixed a cross routine RETURN bug, thanks to Bruce Kendall for pointing it out
|
||||||
Fixed a label parsing, jumping bug, thanks to Ahmad Hawwash for pointing above two issues out
|
|
||||||
Fixed a crash bug in IF statement
|
Sep. 12 2012
|
||||||
Added divide by zero processing
|
Fixed a bug in ASC
|
||||||
Added calculation error raising
|
Fixed a label parsing, jumping bug, thanks to Ahmad Hawwash for pointing above two issues out
|
||||||
|
Fixed a crash bug in IF statement
|
||||||
Sep. 1 2012
|
Added divide by zero processing
|
||||||
Fixed a redisposing bug when retrieving a string argument, thanks to Ahmad Hawwash for pointing it out
|
Added calculation error raising
|
||||||
Fixed a memory leak after retrieving a composited string argument
|
|
||||||
|
Sep. 1 2012
|
||||||
Aug. 29 2012
|
Fixed a redisposing bug when retrieving a string argument, thanks to Ahmad Hawwash for pointing it out
|
||||||
Modified an odd string comparison behavior, thanks to Matthias Nott for testing it out
|
Fixed a memory leak after retrieving a composited string argument
|
||||||
Added a warning system, disabled warning as default
|
|
||||||
Improved compatibility with GCC
|
Aug. 29 2012
|
||||||
|
Modified an odd string comparison behavior, thanks to Matthias Nott for testing it out
|
||||||
Aug. 3 2012
|
Added a warning system, disabled warning as default
|
||||||
Implemented memory occupation statistics
|
Improved compatibility with GCC
|
||||||
Improved compatibility on 64bit systems
|
|
||||||
Fixed some warnings under a stricter mode
|
Aug. 3 2012
|
||||||
|
Implemented memory occupation statistics
|
||||||
Jul. 21 2012
|
Improved compatibility on 64bit systems
|
||||||
Added a compatibility macro for PRINT a newline
|
Fixed some warnings under a stricter mode
|
||||||
Added an mb_attempt_func_end C API
|
|
||||||
Fixed a unary minus symbol parsing bug
|
Jul. 21 2012
|
||||||
|
Added a compatibility macro for PRINT a newline
|
||||||
Jul. 19 2012
|
Added an mb_attempt_func_end C API
|
||||||
Fixed a crash bug caused by a mistake in calculation priority table, thanks to Bruce Kendall for pointing it out
|
Fixed a unary minus symbol parsing bug
|
||||||
|
|
||||||
Jul. 10 2012
|
Jul. 19 2012
|
||||||
Implemented KILL command
|
Fixed a crash bug caused by a mistake in calculation priority table, thanks to Bruce Kendall for pointing it out
|
||||||
Fixed a negative calculation bug
|
|
||||||
Added an invalid identifier usage error handling
|
Jul. 10 2012
|
||||||
Avoided some warnings on gcc
|
Implemented KILL command
|
||||||
|
Fixed a negative calculation bug
|
||||||
Jul. 5 2012
|
Added an invalid identifier usage error handling
|
||||||
Implemented LIST, EDIT, LOAD, SAVE commands
|
Avoided some warnings on gcc
|
||||||
|
|
||||||
Jul. 4 2012
|
Jul. 5 2012
|
||||||
Fixed some crash bugs
|
Implemented LIST, EDIT, LOAD, SAVE commands
|
||||||
Fixed some memory leaks
|
|
||||||
|
Jul. 4 2012
|
||||||
Jul. 3 2012
|
Fixed some crash bugs
|
||||||
Modified/added math functions: FLOOR, CEIL, FIX
|
Fixed some memory leaks
|
||||||
Fixed an INPUT type issue
|
|
||||||
Changed float number formatting from using "%f" to "%g" in PRINT, thanks to Bruce Kendall for pointing above three issues out
|
Jul. 3 2012
|
||||||
Refactored the way to load a script file
|
Modified/added math functions: FLOOR, CEIL, FIX
|
||||||
Done several small improvements
|
Fixed an INPUT type issue
|
||||||
|
Changed float number formatting from using "%f" to "%g" in PRINT, thanks to Bruce Kendall for pointing above three issues out
|
||||||
Jun. 29 2012
|
Refactored the way to load a script file
|
||||||
Fixed a newline mistake in PRINT
|
Done several small improvements
|
||||||
|
|
||||||
Jun. 29 2012
|
Jun. 29 2012
|
||||||
Implemented customizable print functor
|
Fixed a newline mistake in PRINT
|
||||||
Improved PRINT statement
|
|
||||||
Fixed an infinity loop bug in RND function
|
Jun. 29 2012
|
||||||
Fixed some crash bugs
|
Implemented customizable print functor
|
||||||
|
Improved PRINT statement
|
||||||
Jun. 28 2012
|
Fixed an infinity loop bug in RND function
|
||||||
Fixed a cross routine RETURN bug, thanks to Bruce Kendall for pointing it out
|
Fixed some crash bugs
|
||||||
Fixed some memory leaks
|
|
||||||
Refactored error position informing
|
Jun. 28 2012
|
||||||
|
Fixed a cross routine RETURN bug, thanks to Bruce Kendall for pointing it out
|
||||||
Jun. 18 2012
|
Fixed some memory leaks
|
||||||
Implemented user extended abort, thanks to Bruce Kendall for giving suggestion
|
Refactored error position informing
|
||||||
|
|
||||||
Apr. 30 2012
|
Jun. 18 2012
|
||||||
Compress number to integer if necessary
|
Implemented user extended abort, thanks to Bruce Kendall for giving suggestion
|
||||||
|
|
||||||
Apr. 27 2012
|
Apr. 30 2012
|
||||||
Fixed a string connecting crash bug, thanks to Ahmad Hawwash for pointing it out
|
Compress number to integer if necessary
|
||||||
Improved portability on gcc
|
|
||||||
|
Apr. 27 2012
|
||||||
Aug. 3 2011
|
Fixed a string connecting crash bug, thanks to Ahmad Hawwash for pointing it out
|
||||||
Fixed hashtable removing bug
|
Improved portability on gcc
|
||||||
|
|
||||||
Jun. 18 2011
|
Aug. 3 2011
|
||||||
Fixed some mistakes
|
Fixed hashtable removing bug
|
||||||
Allowed underline character appear in an identifier
|
|
||||||
|
Jun. 18 2011
|
||||||
Apr. 15 2011
|
Fixed some mistakes
|
||||||
Fixed garbage collection and _label_t disposing bugs
|
Allowed underline character appear in an identifier
|
||||||
|
|
||||||
Apr. 14 2011
|
Apr. 15 2011
|
||||||
Fixed some list / comparison operator bugs
|
Fixed garbage collection and _label_t disposing bugs
|
||||||
|
|
||||||
Feb. 15 2011
|
Apr. 14 2011
|
||||||
Improved portability on Cocoa
|
Fixed some list / comparison operator bugs
|
||||||
Improved portability on VC++ 6.0
|
|
||||||
Fixed a suspend / resume bug
|
Feb. 15 2011
|
||||||
|
Improved portability on Cocoa
|
||||||
Feb. 9 2011
|
Improved portability on VC++ 6.0
|
||||||
Fixed struct mb_interpreter_t declaration warnings on gcc
|
Fixed a suspend / resume bug
|
||||||
|
|
||||||
Feb. 1 2011 Version 1.0
|
Feb. 9 2011
|
||||||
First release.
|
Fixed struct mb_interpreter_t declaration warnings on gcc
|
||||||
|
|
||||||
|
Feb. 1 2011 Version 1.0
|
||||||
|
First release.
|
||||||
|
@ -78,7 +78,7 @@ extern "C" {
|
|||||||
/** Macros */
|
/** Macros */
|
||||||
#define _VER_MAJOR 1
|
#define _VER_MAJOR 1
|
||||||
#define _VER_MINOR 1
|
#define _VER_MINOR 1
|
||||||
#define _VER_REVISION 54
|
#define _VER_REVISION 55
|
||||||
#define _MB_VERSION ((_VER_MAJOR * 0x01000000) + (_VER_MINOR * 0x00010000) + (_VER_REVISION))
|
#define _MB_VERSION ((_VER_MAJOR * 0x01000000) + (_VER_MINOR * 0x00010000) + (_VER_REVISION))
|
||||||
|
|
||||||
/* Uncomment this line to treat warnings as error */
|
/* Uncomment this line to treat warnings as error */
|
||||||
@ -307,6 +307,9 @@ typedef struct _parsing_context_t {
|
|||||||
_object_t* last_symbol;
|
_object_t* last_symbol;
|
||||||
_parsing_state_e parsing_state;
|
_parsing_state_e parsing_state;
|
||||||
_symbol_state_e symbol_state;
|
_symbol_state_e symbol_state;
|
||||||
|
int parsing_pos;
|
||||||
|
unsigned short parsing_row;
|
||||||
|
unsigned short parsing_col;
|
||||||
} _parsing_context_t;
|
} _parsing_context_t;
|
||||||
|
|
||||||
/* Running context */
|
/* Running context */
|
||||||
@ -3314,6 +3317,7 @@ int mb_open(struct mb_interpreter_t** s) {
|
|||||||
|
|
||||||
context = (_parsing_context_t*)mb_malloc(sizeof(_parsing_context_t));
|
context = (_parsing_context_t*)mb_malloc(sizeof(_parsing_context_t));
|
||||||
memset(context, 0, sizeof(_parsing_context_t));
|
memset(context, 0, sizeof(_parsing_context_t));
|
||||||
|
context->parsing_row = 1;
|
||||||
(*s)->parsing_context = context;
|
(*s)->parsing_context = context;
|
||||||
|
|
||||||
running = (_running_context_t*)mb_malloc(sizeof(_running_context_t));
|
running = (_running_context_t*)mb_malloc(sizeof(_running_context_t));
|
||||||
@ -3413,6 +3417,7 @@ int mb_reset(struct mb_interpreter_t** s, bool_t clrf/* = false*/) {
|
|||||||
(*s)->parsing_context = context;
|
(*s)->parsing_context = context;
|
||||||
}
|
}
|
||||||
memset(context, 0, sizeof(_parsing_context_t));
|
memset(context, 0, sizeof(_parsing_context_t));
|
||||||
|
context->parsing_row = 1;
|
||||||
|
|
||||||
ast = (*s)->ast;
|
ast = (*s)->ast;
|
||||||
_ls_foreach(ast, _destroy_object);
|
_ls_foreach(ast, _destroy_object);
|
||||||
@ -3799,8 +3804,6 @@ int mb_load_string(struct mb_interpreter_t* s, const char* l) {
|
|||||||
char ch = 0;
|
char ch = 0;
|
||||||
int status = 0;
|
int status = 0;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
unsigned short row = 1;
|
|
||||||
unsigned short col = 0;
|
|
||||||
unsigned short _row = 0;
|
unsigned short _row = 0;
|
||||||
unsigned short _col = 0;
|
unsigned short _col = 0;
|
||||||
char wrapped = '\0';
|
char wrapped = '\0';
|
||||||
@ -3814,16 +3817,16 @@ int mb_load_string(struct mb_interpreter_t* s, const char* l) {
|
|||||||
ch = l[i];
|
ch = l[i];
|
||||||
if((ch == '\n' || ch == '\r') && (!wrapped || wrapped == ch)) {
|
if((ch == '\n' || ch == '\r') && (!wrapped || wrapped == ch)) {
|
||||||
wrapped = ch;
|
wrapped = ch;
|
||||||
++row;
|
++context->parsing_row;
|
||||||
col = 0;
|
context->parsing_col = 0;
|
||||||
} else {
|
} else {
|
||||||
wrapped = '\0';
|
wrapped = '\0';
|
||||||
++col;
|
++context->parsing_col;
|
||||||
}
|
}
|
||||||
status = _parse_char(s, ch, i, _row, _col);
|
status = _parse_char(s, ch, context->parsing_pos, _row, _col);
|
||||||
result = status;
|
result = status;
|
||||||
if(status) {
|
if(status) {
|
||||||
_set_error_pos(s, i, _row, _col);
|
_set_error_pos(s, context->parsing_pos, _row, _col);
|
||||||
if(s->error_handler) {
|
if(s->error_handler) {
|
||||||
(s->error_handler)(s, s->last_error, (char*)mb_get_error_desc(s->last_error),
|
(s->error_handler)(s, s->last_error, (char*)mb_get_error_desc(s->last_error),
|
||||||
s->last_error_pos,
|
s->last_error_pos,
|
||||||
@ -3834,11 +3837,12 @@ int mb_load_string(struct mb_interpreter_t* s, const char* l) {
|
|||||||
|
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
_row = row;
|
_row = context->parsing_row;
|
||||||
_col = col;
|
_col = context->parsing_col;
|
||||||
++i;
|
++i;
|
||||||
|
++context->parsing_pos;
|
||||||
};
|
};
|
||||||
status = _parse_char(s, MB_EOS, i, row, col);
|
status = _parse_char(s, MB_EOS, context->parsing_pos, context->parsing_row, context->parsing_col);
|
||||||
|
|
||||||
_exit:
|
_exit:
|
||||||
context->parsing_state = _PS_NORMAL;
|
context->parsing_state = _PS_NORMAL;
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -1,77 +1,77 @@
|
|||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
#define APSTUDIO_READONLY_SYMBOLS
|
#define APSTUDIO_READONLY_SYMBOLS
|
||||||
|
|
||||||
#include "windows.h"
|
#include "windows.h"
|
||||||
|
|
||||||
#undef APSTUDIO_READONLY_SYMBOLS
|
#undef APSTUDIO_READONLY_SYMBOLS
|
||||||
|
|
||||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)
|
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)
|
||||||
# ifdef _WIN32
|
# ifdef _WIN32
|
||||||
LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED
|
LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED
|
||||||
# pragma code_page(936)
|
# pragma code_page(936)
|
||||||
# endif //_WIN32
|
# endif //_WIN32
|
||||||
|
|
||||||
# ifdef APSTUDIO_INVOKED
|
# ifdef APSTUDIO_INVOKED
|
||||||
|
|
||||||
1 TEXTINCLUDE
|
1 TEXTINCLUDE
|
||||||
BEGIN
|
BEGIN
|
||||||
"resource.h\0"
|
"resource.h\0"
|
||||||
END
|
END
|
||||||
|
|
||||||
2 TEXTINCLUDE
|
2 TEXTINCLUDE
|
||||||
BEGIN
|
BEGIN
|
||||||
"#include ""windows.h""\r\n"
|
"#include ""windows.h""\r\n"
|
||||||
"\0"
|
"\0"
|
||||||
END
|
END
|
||||||
|
|
||||||
3 TEXTINCLUDE
|
3 TEXTINCLUDE
|
||||||
BEGIN
|
BEGIN
|
||||||
"\r\n"
|
"\r\n"
|
||||||
"\0"
|
"\0"
|
||||||
END
|
END
|
||||||
|
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
IDI_ICON_MAIN ICON "icon.ico"
|
IDI_ICON_MAIN ICON "icon.ico"
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION 1,1,54,0
|
FILEVERSION 1,1,55,0
|
||||||
PRODUCTVERSION 1,1,54,0
|
PRODUCTVERSION 1,1,55,0
|
||||||
FILEFLAGSMASK 0x17L
|
FILEFLAGSMASK 0x17L
|
||||||
# ifdef _DEBUG
|
# ifdef _DEBUG
|
||||||
FILEFLAGS 0x1L
|
FILEFLAGS 0x1L
|
||||||
# else
|
# else
|
||||||
FILEFLAGS 0x0L
|
FILEFLAGS 0x0L
|
||||||
# endif
|
# endif
|
||||||
FILEOS 0x4L
|
FILEOS 0x4L
|
||||||
FILETYPE 0x1L
|
FILETYPE 0x1L
|
||||||
FILESUBTYPE 0x0L
|
FILESUBTYPE 0x0L
|
||||||
BEGIN
|
BEGIN
|
||||||
BLOCK "StringFileInfo"
|
BLOCK "StringFileInfo"
|
||||||
BEGIN
|
BEGIN
|
||||||
BLOCK "080404b0"
|
BLOCK "080404b0"
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "Comments", "MY-BASIC"
|
VALUE "Comments", "MY-BASIC"
|
||||||
VALUE "CompanyName", "W. Renxin"
|
VALUE "CompanyName", "W. Renxin"
|
||||||
VALUE "FileDescription", "MY-BASIC interpreter"
|
VALUE "FileDescription", "MY-BASIC interpreter"
|
||||||
VALUE "FileVersion", "1, 1, 54, 0"
|
VALUE "FileVersion", "1, 1, 55, 0"
|
||||||
VALUE "InternalName", "my_basic"
|
VALUE "InternalName", "my_basic"
|
||||||
VALUE "LegalCopyright", "Copyright (C) 2011 - 2015 W. Renxin"
|
VALUE "LegalCopyright", "Copyright (C) 2011 - 2015 W. Renxin"
|
||||||
VALUE "LegalTrademarks", "MY-BASIC"
|
VALUE "LegalTrademarks", "MY-BASIC"
|
||||||
VALUE "OriginalFilename", "my_basic.exe"
|
VALUE "OriginalFilename", "my_basic.exe"
|
||||||
VALUE "ProductName", "MY-BASIC"
|
VALUE "ProductName", "MY-BASIC"
|
||||||
VALUE "ProductVersion", "1, 1, 54, 0"
|
VALUE "ProductVersion", "1, 1, 55, 0"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "Translation", 0x804, 1200
|
VALUE "Translation", 0x804, 1200
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef APSTUDIO_INVOKED
|
#ifndef APSTUDIO_INVOKED
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
19
shell/main.c
19
shell/main.c
@ -103,12 +103,19 @@ static void _clear_code(_code_line_t* code) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void _append_line(_code_line_t* code, char* txt) {
|
static void _append_line(_code_line_t* code, char* txt) {
|
||||||
|
int l = 0;
|
||||||
|
char* buf = 0;
|
||||||
mb_assert(code && txt);
|
mb_assert(code && txt);
|
||||||
if(code->count + 1 == code->size) {
|
if(code->count + 1 == code->size) {
|
||||||
code->size += _LINE_INC_STEP;
|
code->size += _LINE_INC_STEP;
|
||||||
code->lines = (char**)realloc(code->lines, sizeof(char*) * code->size);
|
code->lines = (char**)realloc(code->lines, sizeof(char*) * code->size);
|
||||||
}
|
}
|
||||||
code->lines[code->count++] = strdup(txt);
|
l = strlen(txt);
|
||||||
|
buf = (char*)malloc(l + 2);
|
||||||
|
memcpy(buf, txt, l);
|
||||||
|
buf[l] = '\n';
|
||||||
|
buf[l + 1] = '\0';
|
||||||
|
code->lines[code->count++] = buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char* _get_code(_code_line_t* code) {
|
static char* _get_code(_code_line_t* code) {
|
||||||
@ -435,11 +442,11 @@ static int _do_line(void) {
|
|||||||
} else if(_str_eq(line, "NEW")) {
|
} else if(_str_eq(line, "NEW")) {
|
||||||
result = _new_program();
|
result = _new_program();
|
||||||
} else if(_str_eq(line, "RUN")) {
|
} else if(_str_eq(line, "RUN")) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
mb_assert(c);
|
mb_assert(c);
|
||||||
result = mb_reset(&bas, false);
|
result = mb_reset(&bas, false);
|
||||||
for(i = 0; i < c->count; ++i)
|
for(i = 0; i < c->count; ++i)
|
||||||
mb_load_string(bas, c->lines[i]);
|
mb_load_string(bas, c->lines[i]);
|
||||||
result = mb_run(bas);
|
result = mb_run(bas);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
} else if(_str_eq(line, "BYE")) {
|
} else if(_str_eq(line, "BYE")) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user