Sha256: a6803641757f9a3bca56c770bddb9cead0c81d2c9fc33b58a2bdfb2db55a6f53

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 KB

Contents

#include <rucy.h>
#include <reflex/reflex.h>
#include "reflex.h"


using namespace Rucy;


namespace Reflex
{


	Module
	reflex_module ()
	{
		static Module m = define_module("Reflex");
		return m;
	}

	Class
	reflex_error_class ()
	{
		static Class c =
			reflex_module().define_class("ReflexError", native_error_class());
		return c;
	}


}// Reflex


static
RUBY_DEF0(init)
{
	if (!Reflex::init())
		error("Reflex::init() failed.");

	return self;
}
RUBY_END

static
RUBY_DEF0(fin)
{
	if (!Reflex::fin())
		error("Reflex::fin() failed.");

	return self;
}
RUBY_END

static
RUBY_DEF1(run, name)
{
	if (!Reflex::run(name ? name.c_str() : NULL))
		error("Reflex::run() failed.");

	return self;
}
RUBY_END

static
RUBY_DEF0(quit)
{
	if (!Reflex::quit())
		error("Reflex::quit() failed.");

	return self;
}
RUBY_END


void
Init_reflex ()
{
	Reflex::reflex_error_class();

	Reflex::reflex_module()
		.define_singleton_method("init!", init)
		.define_singleton_method("fin!", fin)
		.define_singleton_method("run!", run)
		.define_singleton_method("quit", quit);
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
reflexion-0.1.2 ext/reflex/reflex.cpp
reflexion-0.1.1 ext/reflex/reflex.cpp