Sha256: cc1b6f481a328cdc03312657c01d3df8fad47083608809207d128ddea082df69

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

#include "beeps/ruby/processor.h"


#include "beeps/exception.h"
#include "defs.h"


RUCY_DEFINE_WRAPPER_VALUE_FROM_TO(BEEPS_EXPORT, Beeps::Processor)

#define THIS  to<Beeps::Processor*>(self)

#define CHECK RUCY_CHECK_OBJ(Beeps::Processor, self)


static
VALUE alloc(VALUE klass)
{
	Beeps::beeps_error(__FILE__, __LINE__);
}

static
VALUE reset(VALUE self)
{
	CHECK;

	THIS->reset();
	return self;
}

static
VALUE set_input(VALUE self, VALUE input)
{
	CHECK;

	THIS->set_input(input ? to<Beeps::Processor*>(input) : NULL);
	return input;
}

static
VALUE get_input(VALUE self)
{
	CHECK;

	return value(THIS->input());
}


static Class cProcessor;

void
Init_beeps_processor ()
{
	Module mBeeps = rb_define_module("Beeps");

	cProcessor = rb_define_class_under(mBeeps, "Processor", rb_cObject);
	rb_define_alloc_func(cProcessor, alloc);
	rb_define_method(cProcessor, "reset", RUBY_METHOD_FUNC(reset), 0);
	rb_define_method(cProcessor, "input=", RUBY_METHOD_FUNC(set_input), 1);
	rb_define_method(cProcessor, "input", RUBY_METHOD_FUNC(get_input), 0);
}


namespace Beeps
{


	Class
	processor_class ()
	{
		return cProcessor;
	}


}// Beeps

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
beeps-0.3 .doc/ext/beeps/processor.cpp