Sha256: 11115d97006cb4e2307680623b364cca031d86ec54cee5b6885289f2d991c35c

Contents?: true

Size: 1.1 KB

Versions: 12

Compression:

Stored size: 1.1 KB

Contents

#include "VM.hpp"
#include "detail/ruby.hpp"
#include "detail/env.hpp"
#include "detail/ruby_version_code.hpp"

#include <stdexcept>

Rice::VM::
VM(char * app_name)
{
  init_stack();
  init(1, &app_name);
}

Rice::VM::
VM(int argc, char * argv[])
{
  init_stack();
  init(argc, argv);
}

Rice::VM::
VM(std::vector<const char *> const & args)
{
  check_not_initialized();
  init_stack();
  init(args.size(), const_cast<char * *>(&args[0]));
}

Rice::VM::
~VM()
{
  init_stack();
}

void Rice::VM::
init_stack()
{
  RUBY_INIT_STACK;
}

void Rice::VM::
run()
{
#if RICE__RUBY_VERSION_CODE >= 190
  ruby_run_node(node_);
#else
  ruby_run();
#endif
}

extern "C"
{

#if RICE__RUBY_VERSION_CODE < 190
RUBY_EXTERN VALUE * rb_gc_stack_start;
#endif

}

void Rice::VM::
check_not_initialized() const
{
#if RICE__RUBY_VERSION_CODE < 190
  if(rb_gc_stack_start)
  {
    throw std::runtime_error("Only one VM allowed per application");
  }
#endif
  // TODO: how to do this check on 1.9?
}

void Rice::VM::
init(int argc, char * argv[])
{
  ruby_init();
#if RICE__RUBY_VERSION_CODE >= 190
  node_ =
#endif
  ruby_options(argc, argv);
}

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
rice-1.7.0 rice/VM.cpp
rice-1.6.3 rice/VM.cpp
rice-1.6.2 rice/VM.cpp
rice-1.6.1 rice/VM.cpp
rice-1.6.0 rice/VM.cpp
rice-1.6.0.pre rice/VM.cpp
rice-1.5.3 rice/VM.cpp
rice-1.5.2 rice/VM.cpp
keyme-rice-1.5.1.keyme1 rice/VM.cpp
keyme-rice-1.5.1.keyme rice/VM.cpp
rice-1.5.1 rice/VM.cpp
rice-1.5.0 rice/VM.cpp