MXVM 1.8.1
Virtual Machine, Compiler, and Pascal Frontend
Loading...
Searching...
No Matches
mxvm::Variable_Value Struct Reference

Runtime value storage for a variable. More...

#include <instruct.hpp>

Public Member Functions

 Variable_Value (const Variable_Value &other)
 Copy constructor — deep-copies all fields, dispatching on type for the union member.
Variable_Valueoperator= (const Variable_Value &other)
 Copy-assignment operator — self-check then deep copy, dispatching on type.
 Variable_Value ()
 Default constructor — initialises to VAR_NULL with zeroed fields.

Public Attributes

std::string str_value
std::string label_value
union { 
   int64_t   int_value 
   double   float_value 
   void *   ptr_value 
}; 
uint64_t ptr_size = 0
 size of each element in allocated memory
uint64_t ptr_count = 0
 number of elements allocated
VarType type
uint64_t buffer_size
 declared buffer size
bool owns = false
 true if this value owns the allocated memory
bool released = false
 true if the owned memory has been freed

Detailed Description

Runtime value storage for a variable.

Uses a union for int/float/pointer storage. Tracks pointer ownership and allocation state for memory management.

Definition at line 210 of file instruct.hpp.

Constructor & Destructor Documentation

◆ Variable_Value() [1/2]

mxvm::Variable_Value::Variable_Value ( const Variable_Value & other)
inline

Copy constructor — deep-copies all fields, dispatching on type for the union member.

Parameters
otherSource value to copy from

Definition at line 228 of file instruct.hpp.

References Variable_Value(), buffer_size, float_value, int_value, label_value, owns, ptr_count, ptr_size, ptr_value, released, str_value, type, mxvm::VAR_BYTE, mxvm::VAR_FLOAT, mxvm::VAR_INTEGER, and mxvm::VAR_POINTER.

Referenced by Variable_Value(), and operator=().

◆ Variable_Value() [2/2]

mxvm::Variable_Value::Variable_Value ( )
inline

Default constructor — initialises to VAR_NULL with zeroed fields.

Definition at line 288 of file instruct.hpp.

References buffer_size, int_value, owns, ptr_count, ptr_size, released, and type.

Member Function Documentation

◆ operator=()

Variable_Value & mxvm::Variable_Value::operator= ( const Variable_Value & other)
inline

Copy-assignment operator — self-check then deep copy, dispatching on type.

Parameters
otherSource value to copy from
Returns
Reference to this

Definition at line 258 of file instruct.hpp.

References Variable_Value(), buffer_size, float_value, int_value, label_value, owns, ptr_count, ptr_size, ptr_value, released, str_value, type, mxvm::VAR_BYTE, mxvm::VAR_FLOAT, mxvm::VAR_INTEGER, and mxvm::VAR_POINTER.

Member Data Documentation

◆ [union]

union { ... } mxvm::Variable_Value

◆ buffer_size

◆ float_value

◆ int_value

int64_t mxvm::Variable_Value::int_value

Definition at line 214 of file instruct.hpp.

Referenced by Variable_Value(), Variable_Value(), mxvm::Program::addVariables(), mxvm::Program::createTempVariable(), mxvm::Program::divVariables(), mxvm::Program::exec_alloc(), mxvm::Program::exec_and(), mxvm::Program::exec_cmp(), mxvm::Program::exec_exit(), mxvm::Program::exec_fcmp(), mxvm::Program::exec_lea(), mxvm::Program::exec_load(), mxvm::Program::exec_mod(), mxvm::Program::exec_mov(), mxvm::Program::exec_neg(), mxvm::Program::exec_not(), mxvm::Program::exec_or(), mxvm::Program::exec_pop(), mxvm::Program::exec_push(), mxvm::Program::exec_realloc(), mxvm::Program::exec_stack_load(), mxvm::Program::exec_stack_store(), mxvm::Program::exec_stack_sub(), mxvm::Program::exec_store(), mxvm::Program::exec_string_print(), mxvm::Program::exec_to_float(), mxvm::Program::exec_to_int(), mxvm::Program::exec_xor(), mxvm::Program::mulVariables(), mxvm_io_fread(), mxvm_io_fseek(), mxvm_io_fwrite(), mxvm_io_rand_number(), mxvm_sdl_blit_surface(), mxvm_sdl_clear(), mxvm_sdl_create_render_target(), mxvm_sdl_create_renderer(), mxvm_sdl_create_rgb_surface(), mxvm_sdl_create_texture(), mxvm_sdl_create_window(), mxvm_sdl_delay(), mxvm_sdl_destroy_render_target(), mxvm_sdl_destroy_renderer(), mxvm_sdl_destroy_texture(), mxvm_sdl_destroy_window(), mxvm_sdl_draw_line(), mxvm_sdl_draw_point(), mxvm_sdl_draw_rect(), mxvm_sdl_draw_text(), mxvm_sdl_fill_rect(), mxvm_sdl_free_surface(), mxvm_sdl_free_wav(), mxvm_sdl_get_keyboard_state(), mxvm_sdl_get_mouse_state(), mxvm_sdl_get_relative_mouse_state(), mxvm_sdl_get_renderer_output_size(), mxvm_sdl_get_window_size(), mxvm_sdl_is_key_pressed(), mxvm_sdl_load_font(), mxvm_sdl_load_texture(), mxvm_sdl_load_texture_color_key(), mxvm_sdl_load_texture_color_key_rgb(), mxvm_sdl_load_wav(), mxvm_sdl_lock_texture(), mxvm_sdl_open_audio(), mxvm_sdl_pause_audio(), mxvm_sdl_present(), mxvm_sdl_present_scaled(), mxvm_sdl_present_stretched(), mxvm_sdl_queue_audio(), mxvm_sdl_render_texture(), mxvm_sdl_set_draw_color(), mxvm_sdl_set_render_target(), mxvm_sdl_set_window_fullscreen(), mxvm_sdl_set_window_icon(), mxvm_sdl_set_window_position(), mxvm_sdl_set_window_title(), mxvm_sdl_show_cursor(), mxvm_sdl_unlock_texture(), mxvm_sdl_update_texture(), mxvm_std_abs(), mxvm_std_acos(), mxvm_std_argv(), mxvm_std_asin(), mxvm_std_atan(), mxvm_std_atan2(), mxvm_std_calloc(), mxvm_std_ceil(), mxvm_std_cos(), mxvm_std_cosh(), mxvm_std_exit(), mxvm_std_exp(), mxvm_std_exp2(), mxvm_std_fabs(), mxvm_std_float_to_int(), mxvm_std_floor(), mxvm_std_fmod(), mxvm_std_hypot(), mxvm_std_int_to_float(), mxvm_std_isalpha(), mxvm_std_isdigit(), mxvm_std_isspace(), mxvm_std_log(), mxvm_std_log10(), mxvm_std_log2(), mxvm_std_malloc(), mxvm_std_memcmp(), mxvm_std_memcpy(), mxvm_std_memmove(), mxvm_std_memset(), mxvm_std_pow(), mxvm_std_round(), mxvm_std_set_program_args(), mxvm_std_sin(), mxvm_std_sinh(), mxvm_std_sqrt(), mxvm_std_srand(), mxvm_std_tan(), mxvm_std_tanh(), mxvm_std_tolower(), mxvm_std_toupper(), mxvm_std_trunc(), mxvm_string_copy(), mxvm_string_delete(), mxvm_string_insert(), mxvm_string_inttostr(), mxvm_string_snprintf(), mxvm_string_strat(), mxvm_string_strfind(), mxvm_string_strncat(), mxvm_string_strncpy(), mxvm_string_substr(), operator=(), mxvm::Program::printFormatted(), mxvm::Program::setVariableFromConstant(), mxvm::Program::setVariableFromString(), and mxvm::Program::subVariables().

◆ label_value

std::string mxvm::Variable_Value::label_value

Definition at line 212 of file instruct.hpp.

Referenced by Variable_Value(), and operator=().

◆ owns

◆ ptr_count

◆ ptr_size

◆ ptr_value

void* mxvm::Variable_Value::ptr_value

Definition at line 216 of file instruct.hpp.

Referenced by Variable_Value(), mxvm::Program::addVariables(), asReadPtr(), asWritePtr(), mxvm::Program::exec_alloc(), mxvm::Program::exec_cmp(), mxvm::Program::exec_free(), mxvm::Program::exec_invoke(), mxvm::Program::exec_lea(), mxvm::Program::exec_load(), mxvm::Program::exec_mov(), mxvm::Program::exec_pop(), mxvm::Program::exec_push(), mxvm::Program::exec_realloc(), mxvm::Program::exec_stack_load(), mxvm::Program::exec_stack_store(), mxvm::Program::exec_store(), mxvm::Program::exec_string_print(), mxvm::Program::exec_to_float(), getStringFromVar(), mxvm_io_fclose(), mxvm_io_feof(), mxvm_io_fprintf(), mxvm_io_fputs(), mxvm_io_fread(), mxvm_io_fseek(), mxvm_io_fsize(), mxvm_io_fwrite(), mxvm_io_mxvm_fgets(), mxvm_sdl_create_window(), mxvm_sdl_draw_text(), mxvm_sdl_load_font(), mxvm_sdl_load_texture(), mxvm_sdl_load_texture_color_key(), mxvm_sdl_load_texture_color_key_rgb(), mxvm_sdl_load_wav(), mxvm_sdl_lock_texture(), mxvm_sdl_queue_audio(), mxvm_sdl_set_clipboard_text(), mxvm_sdl_set_window_icon(), mxvm_sdl_set_window_title(), mxvm_sdl_update_texture(), mxvm_std_atof(), mxvm_std_atoi(), mxvm_std_memcmp(), mxvm_std_memcpy(), mxvm_std_memmove(), mxvm_std_memset(), mxvm_std_release(), mxvm_std_set_program_args(), mxvm_std_system(), mxvm_string_snprintf(), mxvm_string_strcmp(), mxvm_string_strlen(), mxvm_string_strncat(), mxvm_string_substr(), operator=(), mxvm::Program::printFormatted(), mxvm::releaseOwnedPointer(), mxvm::Program::setVariableFromConstant(), and mxvm::Program::subVariables().

◆ released

bool mxvm::Variable_Value::released = false

true if the owned memory has been freed

Definition at line 223 of file instruct.hpp.

Referenced by Variable_Value(), Variable_Value(), and operator=().

◆ str_value

◆ type


The documentation for this struct was generated from the following file: