Sha256: 36c922a4a345c3e8283bdf2ba3cb5eef68fdb50afa5f5310e56eb301bfac2b50

Contents?: true

Size: 1.52 KB

Versions: 3

Compression:

Stored size: 1.52 KB

Contents

#include <rucy.h>


using namespace Rucy;


static
RUBY_DEF0(do_nothing)
{
}
RUBY_END

static
RUBY_DEF0(return_nil)
{
	return Qnil;
}
RUBY_END

static
RUBY_DEF0(return_int)
{
	return Value(1);
}
RUBY_END

static
RUBY_DEF0(return_float)
{
	return Value(1.0f);
}
RUBY_END

static
RUBY_DEF0(return_string)
{
	return Value("");
}
RUBY_END

static
RUBY_DEF0(raise_ruby_exception)
{
	throw RubyException(rb_eStandardError, "raise_ruby_exception");
}
RUBY_END

static
RUBY_DEF0(raise_in_eval)
{
	eval("raise 'raise_in_eval'");
}
RUBY_END

static
RUBY_DEF0(throw_std_exception)
{
	throw std::exception();
}
RUBY_END

static
RUBY_DEF0(throw_std_runtime_error)
{
	throw std::runtime_error("std::runtime_error");
}
RUBY_END

static
RUBY_DEF0(throw_std_string)
{
	throw std::string("std::string");
}
RUBY_END

static
RUBY_DEF0(throw_cstring)
{
	throw "cstring";
}
RUBY_END


extern "C" void
Init_tester ()
{
	if (!init()) return;

	define_module("Rucy")
		.define_class("Tester")
			.define_method("do_nothing", do_nothing)
			.define_method("return_nil", return_nil)
			.define_method("return_int", return_int)
			.define_method("return_float", return_float)
			.define_method("return_string", return_string)
			.define_method("raise_ruby_exception", raise_ruby_exception)
			.define_method("raise_in_eval", raise_in_eval)
			.define_method("throw_std_exception", throw_std_exception)
			.define_method("throw_std_runtime_error", throw_std_runtime_error)
			.define_method("throw_std_string", throw_std_string)
			.define_method("throw_cstring", throw_cstring);
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rucy-0.1.2 ext/rucy/tester.cpp
rucy-0.1.1 ext/rucy/tester.cpp
rucy-0.1.0 ext/rucy/tester.cpp