+added an mb_get_var_name
function.
This commit is contained in:
parent
3784ea5566
commit
f3ab800bec
3
HISTORY
3
HISTORY
@ -1,3 +1,6 @@
|
||||
Jul. 24 2017
|
||||
Added an mb_get_var_name function
|
||||
|
||||
Jul. 7 2017
|
||||
Added support to apply the FOR statement to an iterable class instance
|
||||
|
||||
|
Binary file not shown.
@ -12513,6 +12513,32 @@ _exit:
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Get the name of a variable */
|
||||
int mb_get_var_name(struct mb_interpreter_t* s, void* v, char** n) {
|
||||
int result = MB_FUNC_OK;
|
||||
_object_t* obj = 0;
|
||||
|
||||
if(n) *n = 0;
|
||||
|
||||
if(!s) {
|
||||
result = MB_FUNC_ERR;
|
||||
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
if(!n || !v)
|
||||
goto _exit;
|
||||
|
||||
obj = (_object_t*)v;
|
||||
if(obj->type != _DT_VAR)
|
||||
goto _exit;
|
||||
|
||||
if(n) *n = obj->data.variable->name;
|
||||
|
||||
_exit:
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Get the value of a variable */
|
||||
int mb_get_var_value(struct mb_interpreter_t* s, void* v, mb_value_t* val) {
|
||||
int result = MB_FUNC_OK;
|
||||
|
@ -631,6 +631,7 @@ MBAPI int mb_set_class_userdata(struct mb_interpreter_t* s, void** l, void* d);
|
||||
MBAPI int mb_get_value_by_name(struct mb_interpreter_t* s, void** l, const char* n, mb_value_t* val);
|
||||
MBAPI int mb_add_var(struct mb_interpreter_t* s, void** l, const char* n, mb_value_t val, bool_t force);
|
||||
MBAPI int mb_get_var(struct mb_interpreter_t* s, void** l, void** v);
|
||||
MBAPI int mb_get_var_name(struct mb_interpreter_t* s, void* v, char** n);
|
||||
MBAPI int mb_get_var_value(struct mb_interpreter_t* s, void* v, mb_value_t* val);
|
||||
MBAPI int mb_set_var_value(struct mb_interpreter_t* s, void* v, mb_value_t val);
|
||||
MBAPI int mb_init_array(struct mb_interpreter_t* s, void** l, mb_data_e t, int* d, int c, void** a);
|
||||
|
Loading…
x
Reference in New Issue
Block a user