+added support to evaluate a sub routine by an accessor in print statement.
This commit is contained in:
parent
8ace911338
commit
15f8eb3b5e
3
HISTORY
3
HISTORY
@ -1,3 +1,6 @@
|
|||||||
|
Dec. 17 2015
|
||||||
|
Added support to evaluate a sub routine by an accessor in PRINT statement
|
||||||
|
|
||||||
Dec. 15 2015
|
Dec. 15 2015
|
||||||
Added a pair of mb_begin_class/mb_end_class functions
|
Added a pair of mb_begin_class/mb_end_class functions
|
||||||
Added an mb_get_value_by_name function
|
Added an mb_get_value_by_name function
|
||||||
|
@ -11772,7 +11772,7 @@ int _std_print(mb_interpreter_t* s, void** l) {
|
|||||||
int result = MB_FUNC_OK;
|
int result = MB_FUNC_OK;
|
||||||
_ls_node_t* ast = 0;
|
_ls_node_t* ast = 0;
|
||||||
_object_t* obj = 0;
|
_object_t* obj = 0;
|
||||||
|
_object_t tmp;
|
||||||
_object_t val_obj;
|
_object_t val_obj;
|
||||||
_object_t* val_ptr = 0;
|
_object_t* val_ptr = 0;
|
||||||
|
|
||||||
@ -11791,12 +11791,22 @@ int _std_print(mb_interpreter_t* s, void** l) {
|
|||||||
obj = (_object_t*)(ast->data);
|
obj = (_object_t*)(ast->data);
|
||||||
do {
|
do {
|
||||||
switch(obj->type) {
|
switch(obj->type) {
|
||||||
|
case _DT_VAR:
|
||||||
|
if(obj->data.variable->pathing) {
|
||||||
|
_execute_statement(s, &ast);
|
||||||
|
_MAKE_NIL(&tmp);
|
||||||
|
_public_value_to_internal_object(&s->running_context->intermediate_value, &tmp);
|
||||||
|
val_ptr = obj = &tmp;
|
||||||
|
if(ast) ast = ast->prev;
|
||||||
|
|
||||||
|
goto _print;
|
||||||
|
}
|
||||||
|
/* Fall through */
|
||||||
case _DT_TYPE: /* Fall through */
|
case _DT_TYPE: /* Fall through */
|
||||||
case _DT_NIL: /* Fall through */
|
case _DT_NIL: /* Fall through */
|
||||||
case _DT_INT: /* Fall through */
|
case _DT_INT: /* Fall through */
|
||||||
case _DT_REAL: /* Fall through */
|
case _DT_REAL: /* Fall through */
|
||||||
case _DT_STRING: /* Fall through */
|
case _DT_STRING: /* Fall through */
|
||||||
case _DT_VAR: /* Fall through */
|
|
||||||
case _DT_ARRAY: /* Fall through */
|
case _DT_ARRAY: /* Fall through */
|
||||||
#ifdef MB_ENABLE_CLASS
|
#ifdef MB_ENABLE_CLASS
|
||||||
case _DT_CLASS: /* Fall through */
|
case _DT_CLASS: /* Fall through */
|
||||||
@ -11804,6 +11814,7 @@ int _std_print(mb_interpreter_t* s, void** l) {
|
|||||||
case _DT_FUNC: /* Fall through */
|
case _DT_FUNC: /* Fall through */
|
||||||
case _DT_ROUTINE:
|
case _DT_ROUTINE:
|
||||||
result = _calc_expression(s, &ast, &val_ptr);
|
result = _calc_expression(s, &ast, &val_ptr);
|
||||||
|
_print:
|
||||||
if(val_ptr->type == _DT_NIL) {
|
if(val_ptr->type == _DT_NIL) {
|
||||||
_get_printer(s)(MB_NIL);
|
_get_printer(s)(MB_NIL);
|
||||||
} else if(val_ptr->type == _DT_INT) {
|
} else if(val_ptr->type == _DT_INT) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user