mb_value_t |
The mb_value_t data type is used to interchange data and variables between function callbacks and the MyBASIC2 Interpreter. It can hold data of any of the supported data types. Functions such as mb_pop_value, mb_push_value and mb_make_value_t uses this data type. There are also supporting Macros to inetrchange data of type mb_value_t.
The mb_value_t structure is defined as a struct of the data type (mb_value_e), the variable name (mb_char_ptr) and the actual value (mb_value_u)
///////////////////////////////////////////////////////////////////////////// // mb_value_e // typedef enum mb_data_e { MB_DT_NIL = -1, // Invalid or no type MB_DT_UNKNOWN = 0, // Undefined type MB_DT_ANY = 0, // Any Type MB_DT_INT = 1, // Integer MB_DT_REAL = 2, // Floating point MB_DT_STRING = 3, // String MB_DT_REFERENCE = 4, // Reference pointer MB_DT_MODULE = 5, // Core, std or extension function MB_DT_HANDLE = 6, // Array, integer, real or string MB_DT_ARRAY = 7 // Variable } mb_data_e;
///////////////////////////////////////////////////////////////////////////// // mb_value_u union // typedef union mb_value_u { int_t integer; real_t float_point; char* string; void* reference; void* module; handle_t handle; void* pointer; void* array; } mb_value_u;
#define mb_char_ptr char*
///////////////////////////////////////////////////////////////////////////// // mb_value_t structure // typedef struct mb_value_t { mb_data_e type; mb_char_ptr name; mb_value_u value; } mb_value_t;
|