|
MXVM 1.8.1
Virtual Machine, Compiler, and Pascal Frontend
|
String module C++ runtime bindings for the MXVM interpreter. More...
#include <cstdio>#include <cstdlib>#include <cstring>#include <mxvm/icode.hpp>#include <mxvm/instruct.hpp>#include <string>
Go to the source code of this file.
Functions | |
| static std::string | getStringFromVar (mxvm::Program *program, const std::string &varName) |
| static bool | isStringLike (mxvm::Variable &v) |
| static const char * | asReadPtr (mxvm::Variable &v) |
| static char * | asWritePtr (mxvm::Variable &v) |
| void | mxvm_string_strlen (mxvm::Program *program, std::vector< mxvm::Operand > &operand) |
| void | mxvm_string_strcmp (mxvm::Program *program, std::vector< mxvm::Operand > &operand) |
| void | mxvm_string_strncpy (mxvm::Program *program, std::vector< mxvm::Operand > &operand) |
| void | mxvm_string_strncat (mxvm::Program *program, std::vector< mxvm::Operand > &operand) |
| void | mxvm_string_snprintf (mxvm::Program *program, std::vector< mxvm::Operand > &operand) |
| void | mxvm_string_strfind (mxvm::Program *program, std::vector< mxvm::Operand > &operand) |
| void | mxvm_string_substr (mxvm::Program *program, std::vector< mxvm::Operand > &operand) |
| void | mxvm_string_strat (mxvm::Program *program, std::vector< mxvm::Operand > &operand) |
| void | mxvm_string_pos (mxvm::Program *program, std::vector< mxvm::Operand > &operand) |
| void | mxvm_string_copy (mxvm::Program *program, std::vector< mxvm::Operand > &operand) |
| void | mxvm_string_insert (mxvm::Program *program, std::vector< mxvm::Operand > &operand) |
| void | mxvm_string_delete (mxvm::Program *program, std::vector< mxvm::Operand > &operand) |
| void | mxvm_string_inttostr (mxvm::Program *program, std::vector< mxvm::Operand > &operand) |
| Convert an integer to its decimal string representation. | |
| void | mxvm_string_strtoint (mxvm::Program *program, std::vector< mxvm::Operand > &operand) |
String module C++ runtime bindings for the MXVM interpreter.
Definition in file string.cpp.
|
inlinestatic |
Definition at line 31 of file string.cpp.
References mxvm::except_assert(), mxvm::Variable_Value::ptr_value, mxvm::Variable_Value::str_value, mxvm::Variable::type, mxvm::VAR_POINTER, and mxvm::Variable::var_value.
Referenced by mxvm_string_strfind(), mxvm_string_strncat(), mxvm_string_strncpy(), and mxvm_string_substr().
|
inlinestatic |
Definition at line 38 of file string.cpp.
References mxvm::except_assert(), mxvm::Variable_Value::ptr_value, mxvm::Variable::type, mxvm::VAR_POINTER, and mxvm::Variable::var_value.
Referenced by mxvm_string_strncpy().
|
static |
Definition at line 13 of file string.cpp.
References mxvm::except_assert(), mxvm::Program::getVariable(), mxvm::Program::isVariable(), mxvm::Variable_Value::ptr_value, mxvm::Variable_Value::str_value, mxvm::Variable::type, mxvm::VAR_POINTER, mxvm::VAR_STRING, and mxvm::Variable::var_value.
Referenced by mxvm_string_copy(), mxvm_string_delete(), mxvm_string_insert(), mxvm_string_pos(), and mxvm_string_strtoint().
|
inlinestatic |
Definition at line 28 of file string.cpp.
References mxvm::Variable::type, mxvm::VAR_POINTER, and mxvm::VAR_STRING.
Referenced by mxvm_string_strfind(), mxvm_string_strncat(), mxvm_string_strncpy(), and mxvm_string_substr().
| void mxvm_string_copy | ( | mxvm::Program * | program, |
| std::vector< mxvm::Operand > & | operand ) |
Definition at line 385 of file string.cpp.
References getStringFromVar(), mxvm::Program::getVariable(), mxvm::Variable_Value::int_value, mxvm::VAR_POINTER, mxvm::Variable::var_value, and mxvm::Base::vars.
| void mxvm_string_delete | ( | mxvm::Program * | program, |
| std::vector< mxvm::Operand > & | operand ) |
Definition at line 438 of file string.cpp.
References getStringFromVar(), mxvm::Program::getVariable(), mxvm::Variable_Value::int_value, mxvm::VAR_POINTER, mxvm::Variable::var_value, and mxvm::Base::vars.
| void mxvm_string_insert | ( | mxvm::Program * | program, |
| std::vector< mxvm::Operand > & | operand ) |
Definition at line 413 of file string.cpp.
References getStringFromVar(), mxvm::Program::getVariable(), mxvm::Variable_Value::int_value, mxvm::VAR_POINTER, mxvm::Variable::var_value, and mxvm::Base::vars.
| void mxvm_string_inttostr | ( | mxvm::Program * | program, |
| std::vector< mxvm::Operand > & | operand ) |
Convert an integer to its decimal string representation.
Allocates a new heap buffer for the result string and returns it via rax as a pointer. Frees any previously-owned pointer in rax before overwriting to prevent memory leaks from repeated calls (e.g. inttostr(score) inside a render loop).
| program | VM program context. |
| operand | Single operand: the integer variable to convert. |
Definition at line 477 of file string.cpp.
References mxvm::Program::getVariable(), mxvm::Variable_Value::int_value, mxvm::VAR_POINTER, mxvm::Variable::var_value, and mxvm::Base::vars.
| void mxvm_string_pos | ( | mxvm::Program * | program, |
| std::vector< mxvm::Operand > & | operand ) |
Definition at line 371 of file string.cpp.
References getStringFromVar(), mxvm::VAR_INTEGER, and mxvm::Base::vars.
| void mxvm_string_snprintf | ( | mxvm::Program * | program, |
| std::vector< mxvm::Operand > & | operand ) |
Definition at line 186 of file string.cpp.
References mxvm::except_assert(), mxvm::Variable_Value::float_value, mxvm::Program::getVariable(), mxvm::Variable_Value::int_value, mxvm::Program::isVariable(), mxvm::Variable_Value::ptr_value, mxvm::Variable_Value::str_value, mxvm::Variable::type, mxvm::VAR_BYTE, mxvm::VAR_EXTERN, mxvm::VAR_FLOAT, mxvm::VAR_INTEGER, mxvm::VAR_POINTER, mxvm::VAR_STRING, mxvm::Variable::var_value, and mxvm::Base::vars.
| void mxvm_string_strat | ( | mxvm::Program * | program, |
| std::vector< mxvm::Operand > & | operand ) |
Definition at line 351 of file string.cpp.
References mxvm::Program::getVariable(), mxvm::Variable_Value::int_value, mxvm::Program::isVariable(), mxvm::OP_CONSTANT, pos(), mxvm::Variable_Value::str_value, mxvm::VAR_INTEGER, mxvm::Variable::var_value, and mxvm::Base::vars.
| void mxvm_string_strcmp | ( | mxvm::Program * | program, |
| std::vector< mxvm::Operand > & | operand ) |
Definition at line 76 of file string.cpp.
References mxvm::except_assert(), mxvm::Program::getVariable(), mxvm::Program::isVariable(), mxvm::Variable_Value::ptr_value, mxvm::Variable_Value::str_value, mxvm::Variable::type, mxvm::VAR_INTEGER, mxvm::Variable::var_name, mxvm::VAR_POINTER, mxvm::VAR_STRING, mxvm::Variable::var_value, and mxvm::Base::vars.
| void mxvm_string_strfind | ( | mxvm::Program * | program, |
| std::vector< mxvm::Operand > & | operand ) |
Definition at line 284 of file string.cpp.
References asReadPtr(), mxvm::Program::getVariable(), mxvm::Variable_Value::int_value, isStringLike(), mxvm::Program::isVariable(), pos(), mxvm::VAR_INTEGER, mxvm::Variable::var_value, and mxvm::Base::vars.
| void mxvm_string_strlen | ( | mxvm::Program * | program, |
| std::vector< mxvm::Operand > & | operand ) |
Definition at line 46 of file string.cpp.
References mxvm::except_assert(), mxvm::Program::getVariable(), mxvm::Program::isVariable(), mxvm::Variable_Value::ptr_value, mxvm::Variable_Value::str_value, mxvm::Variable::type, mxvm::VAR_EXTERN, mxvm::VAR_INTEGER, mxvm::Variable::var_name, mxvm::VAR_POINTER, mxvm::VAR_STRING, mxvm::Variable::var_value, and mxvm::Base::vars.
| void mxvm_string_strncat | ( | mxvm::Program * | program, |
| std::vector< mxvm::Operand > & | operand ) |
Definition at line 151 of file string.cpp.
References asReadPtr(), mxvm::Variable_Value::buffer_size, mxvm::Program::getVariable(), mxvm::Variable_Value::int_value, isStringLike(), mxvm::Program::isVariable(), mxvm::Variable_Value::ptr_value, mxvm::Variable_Value::str_value, mxvm::Variable::type, mxvm::VAR_INTEGER, mxvm::VAR_POINTER, mxvm::Variable::var_value, and mxvm::Base::vars.
| void mxvm_string_strncpy | ( | mxvm::Program * | program, |
| std::vector< mxvm::Operand > & | operand ) |
Definition at line 117 of file string.cpp.
References asReadPtr(), asWritePtr(), mxvm::Variable_Value::buffer_size, mxvm::Program::getVariable(), mxvm::Variable_Value::int_value, isStringLike(), mxvm::Program::isVariable(), mxvm::Variable_Value::str_value, mxvm::Variable::type, mxvm::VAR_INTEGER, mxvm::VAR_POINTER, mxvm::Variable::var_value, and mxvm::Base::vars.
| void mxvm_string_strtoint | ( | mxvm::Program * | program, |
| std::vector< mxvm::Operand > & | operand ) |
Definition at line 502 of file string.cpp.
References getStringFromVar(), mxvm::VAR_INTEGER, and mxvm::Base::vars.
| void mxvm_string_substr | ( | mxvm::Program * | program, |
| std::vector< mxvm::Operand > & | operand ) |
Definition at line 310 of file string.cpp.
References asReadPtr(), mxvm::Variable_Value::buffer_size, mxvm::except_assert(), mxvm::Program::getVariable(), mxvm::Variable_Value::int_value, isStringLike(), mxvm::Program::isVariable(), pos(), mxvm::Variable_Value::ptr_value, mxvm::Variable_Value::str_value, mxvm::Variable::type, mxvm::VAR_INTEGER, mxvm::VAR_POINTER, mxvm::Variable::var_value, and mxvm::Base::vars.