Sha256: 93e1547e5890c03393990b2baabaf5bb809213f89708b96036d539447fcc0ca1

Contents?: true

Size: 1.17 KB

Versions: 20

Compression:

Stored size: 1.17 KB

Contents

#include "rucy.h"


using namespace Rucy;


/*
	do nothing.
*/
static
VALUE do_nothing(VALUE self)
{
}

/*
	return nil.
*/
static
VALUE return_nil(VALUE self)
{
	return nil();
}

/*
	return int.
*/
static
VALUE return_int(VALUE self)
{
	return value(1);
}

/*
	return flaot.
*/
static
VALUE return_float(VALUE self)
{
	return value(1.0f);
}

/*
	return string.
*/
static
VALUE return_string(VALUE self)
{
	return value("");
}

/*
	check_arg_count
*/
static
VALUE arg_count_must_1(VALUE self)
{
	check_arg_count(__FILE__, __LINE__, "arg_count_must_1", argc, 1);
	RUCY_SYM(ok);
	return ok.value();
}


void
Init_function ()
{
	Module mRucy = rb_define_module("Rucy");
	Module mTester = rb_define_module_under(mRucy, "Tester");

	rb_define_method(mTester, "do_nothing", RUBY_METHOD_FUNC(do_nothing), -1);
	rb_define_method(mTester, "return_nil", RUBY_METHOD_FUNC(return_nil), 0);
	rb_define_method(mTester, "return_int", RUBY_METHOD_FUNC(return_int), 0);
	rb_define_method(mTester, "return_float", RUBY_METHOD_FUNC(return_float), 0);
	rb_define_method(mTester, "return_string", RUBY_METHOD_FUNC(return_string), 0);
	rb_define_method(mTester, "arg_count_must_1", RUBY_METHOD_FUNC(arg_count_must_1), -1);
}

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
rucy-0.1.28 .doc/ext/rucy/function.cpp
rucy-0.1.27 .doc/ext/rucy/function.cpp
rucy-0.1.26 .doc/ext/rucy/function.cpp
rucy-0.1.25 .doc/ext/rucy/function.cpp
rucy-0.1.24 .doc/ext/rucy/function.cpp
rucy-0.1.23 .doc/ext/rucy/function.cpp
rucy-0.1.22 .doc/ext/rucy/function.cpp
rucy-0.1.21 .doc/ext/rucy/function.cpp
rucy-0.1.20 .doc/ext/rucy/function.cpp
rucy-0.1.18 .doc/ext/rucy/function.cpp
rucy-0.1.16 .doc/ext/rucy/function.cpp
rucy-0.1.15 .doc/ext/rucy/function.cpp
rucy-0.1.14 .doc/ext/rucy/function.cpp
rucy-0.1.13 .doc/ext/rucy/function.cpp
rucy-0.1.12 .doc/ext/rucy/function.cpp
rucy-0.1.11 .doc/ext/rucy/function.cpp
rucy-0.1.10 .doc/ext/rucy/function.cpp
rucy-0.1.9 .doc/ext/rucy/function.cpp
rucy-0.1.8 .doc/ext/rucy/function.cpp
rucy-0.1.7 .doc/ext/rucy/function.cpp