Public Types | Public Member Functions

el7::scripting::VirtualMachine Class Reference

#include <VirtualMachine.h>

List of all members.

Public Types

typedef std::map
< cl7::string_type, Symbol
Symbols
typedef std::pair
< cl7::string_type, Symbol
SymbolEntry

Public Member Functions

 VirtualMachine (void)
 VirtualMachine (cl7::logging::Logger *std_output)
 ~VirtualMachine (void)
const Symbolsget_symbol_map () const
const RuntimeEnvironmentget_global_env () const
RuntimeEnvironmentget_global_env ()
cl7::logging::Loggerget_std_output () const
void set_std_output (cl7::logging::Logger *std_output)
const libs::stdget_std_lib () const
const libs::mathget_math_lib () const
Symbol get_symbol (const cl7::string_type &identifier)
Symbol find_symbol (const cl7::string_type &identifier)
bool find_symbol (Symbol symbol, cl7::string_type *identifier=NULL)
bool add_lib (const Library *lib, RuntimeEnvironment *env=NULL)
bool remove_lib (const Library *lib, RuntimeEnvironment *env=NULL)
bool add_default_libs (RuntimeEnvironment *env)
Scriptload_script (const cl7::string_type &script_code)
bool unload_script (Script *script)
bool run_script (const Script *script, RuntimeEnvironment *env=NULL)
bool execute (const cl7::string_type &script_code, RuntimeEnvironment *env=NULL)
void post_build_time_error (const cl7::string_type &msg, signed code_ref)
void post_build_time_warning (const cl7::string_type &msg, signed code_ref)
void post_runtime_error (const cl7::string_type &msg, signed code_ref)
void post_runtime_warning (const cl7::string_type &msg, signed code_ref)

Detailed Description

Represents a virtual machine for executing scripts and managing particular runtime environments.


Member Typedef Documentation


Constructor & Destructor Documentation

el7::scripting::VirtualMachine::VirtualMachine ( void   ) 

Default constructor.

el7::scripting::VirtualMachine::VirtualMachine ( cl7::logging::Logger std_output  ) 

Explicit constructor.

el7::scripting::VirtualMachine::~VirtualMachine ( void   ) 

Destructor.


Member Function Documentation

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).


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines