Sha256: ae9489b2503fe1eca2e14a79f816f738bcac690e873df75b1cb3aa61b65c12fa

Contents?: true

Size: 1.38 KB

Versions: 20

Compression:

Stored size: 1.38 KB

Contents

#include "rucy.h"


using namespace Rucy;


static
RUCY_DEFN(true_to_value)
{
	return value(true);
}
RUCY_END

static
RUCY_DEFN(false_to_value)
{
	return value(false);
}
RUCY_END

static
RUCY_DEFN(NULL_to_value)
{
	return nil();
}
RUCY_END

static
RUCY_DEFN(nil_value)
{
	return nil();
}
RUCY_END

static
RUCY_DEFN(array_value)
{
	const Value* a = argv;
	switch (argc)
	{
		case 1:  return array(a[0]);
		case 2:  return array(a[0], a[1]);
		case 3:  return array(a[0], a[1], a[2]);
		case 4:  return array(a[0], a[1], a[2], a[3]);
		case 5:  return array(a[0], a[1], a[2], a[3], a[4]);
		case 6:  return array(a[0], a[1], a[2], a[3], a[4], a[5]);
		case 7:  return array(a[0], a[1], a[2], a[3], a[4], a[5], a[6]);
		case 8:  return array(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7]);
		case 9:  return array(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8]);
		case 10: return array(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9]);
		case 0:
		default: argument_error(__FILE__, __LINE__);
	}
}
RUCY_END


void
Init_value ()
{
	Module mRucy   =       define_module("Rucy");
	Module mTester = mRucy.define_module("Tester");

	mTester.define_method("true_to_value", true_to_value);
	mTester.define_method("false_to_value", false_to_value);
	mTester.define_method("null_to_value", NULL_to_value);
	mTester.define_method("nil_value", nil_value);
	mTester.define_method("array_value", array_value);
}

Version data entries

20 entries across 20 versions & 1 rubygems

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