#include <VirtualMachine.h>
Represents a virtual machine for executing scripts and managing particular runtime environments.
| typedef std::pair<cl7::string_type, Symbol> el7::scripting::VirtualMachine::SymbolEntry |
| typedef std::map<cl7::string_type, Symbol> el7::scripting::VirtualMachine::Symbols |
| el7::scripting::VirtualMachine::VirtualMachine | ( | void | ) |
Default constructor.
| el7::scripting::VirtualMachine::VirtualMachine | ( | cl7::logging::Logger * | std_output | ) |
Explicit constructor.
| el7::scripting::VirtualMachine::~VirtualMachine | ( | void | ) |
Destructor.
| bool el7::scripting::VirtualMachine::add_default_libs | ( | RuntimeEnvironment * | env | ) |
Adds the default function libraries to the given runtime environment.
| bool el7::scripting::VirtualMachine::add_lib | ( | const Library * | lib, | |
| RuntimeEnvironment * | env = NULL | |||
| ) |
Adds the given function library to the given runtime environment. If there is already an object with the name of the library, the function returns false. In this case, however, the library's functions will replace possible objects of the same name. If no runtime environment is specified, the virtual machine's own global runtime environment takes place.
| bool el7::scripting::VirtualMachine::execute | ( | const cl7::string_type & | script_code, | |
| RuntimeEnvironment * | env = NULL | |||
| ) |
Directly executes the given script code by running a temporary script (based on this code) in the given environment. If no runtime environment is specified, the virtual machine's own global runtime environment takes place.
| Symbol el7::scripting::VirtualMachine::find_symbol | ( | const cl7::string_type & | identifier | ) |
Returns the symbol for a given identifier. If the identifier is not present, the function returns 0.
| bool el7::scripting::VirtualMachine::find_symbol | ( | Symbol | symbol, | |
| cl7::string_type * | identifier = NULL | |||
| ) |
Searches for the given symbol and returns true, if the symbol gets found, false otherwise. If the given symbol can be found, the corresponding identifier will be stored into the specified parameter (if not null).
| const RuntimeEnvironment* el7::scripting::VirtualMachine::get_global_env | ( | ) | const [inline] |
Returns the virtual machine's own global runtime environment.
| RuntimeEnvironment* el7::scripting::VirtualMachine::get_global_env | ( | ) | [inline] |
Returns the virtual machine's own global runtime environment.
| const libs::math* el7::scripting::VirtualMachine::get_math_lib | ( | ) | const [inline] |
Returns the math library.
| const libs::std* el7::scripting::VirtualMachine::get_std_lib | ( | ) | const [inline] |
Returns the standard library.
| cl7::logging::Logger* el7::scripting::VirtualMachine::get_std_output | ( | ) | const [inline] |
Returns the standard output.
| Symbol el7::scripting::VirtualMachine::get_symbol | ( | const cl7::string_type & | identifier | ) |
Returns the symbol for a given identifier. If the identifier is not present, it will be added and a new generated symbol will be returned.
| const Symbols* el7::scripting::VirtualMachine::get_symbol_map | ( | ) | const [inline] |
Returns the identifier-to-symbol-map.
| Script * el7::scripting::VirtualMachine::load_script | ( | const cl7::string_type & | script_code | ) |
Parses the given script code, translates it into bytecode, and loads (and returns) the created script.
| void el7::scripting::VirtualMachine::post_build_time_error | ( | const cl7::string_type & | msg, | |
| signed | code_ref | |||
| ) |
Posts a build time error.
| void el7::scripting::VirtualMachine::post_build_time_warning | ( | const cl7::string_type & | msg, | |
| signed | code_ref | |||
| ) |
Posts a build time warning.
| void el7::scripting::VirtualMachine::post_runtime_error | ( | const cl7::string_type & | msg, | |
| signed | code_ref | |||
| ) |
Posts a runtime error.
| void el7::scripting::VirtualMachine::post_runtime_warning | ( | const cl7::string_type & | msg, | |
| signed | code_ref | |||
| ) |
Posts a runtime warning.
| bool el7::scripting::VirtualMachine::remove_lib | ( | const Library * | lib, | |
| RuntimeEnvironment * | env = NULL | |||
| ) |
Removes the given function library from the given runtime environment. If there is no object with the name of the library, the function returns false. If no runtime environment is specified, the virtual machine's own global runtime environment takes place.
| bool el7::scripting::VirtualMachine::run_script | ( | const Script * | script, | |
| RuntimeEnvironment * | env = NULL | |||
| ) |
Executes the given script by running it in the given runtime environment. If no runtime environment is specified, the virtual machine's own global runtime environment takes place.
| void el7::scripting::VirtualMachine::set_std_output | ( | cl7::logging::Logger * | std_output | ) | [inline] |
Sets the standard output.
| bool el7::scripting::VirtualMachine::unload_script | ( | Script * | script | ) |
Unloads a previously loaded script (see function load_script).
1.7.1