Sha256: 8c4b69e3fe6db4c2d98fb14c3d11284aa8ab80143c3ef4b0469ee6771f041c41
Contents?: true
Size: 1.11 KB
Versions: 21
Compression:
Stored size: 1.11 KB
Contents
#include "reflex/ruby/event.h" #include "reflex/exception.h" #include "defs.h" RUCY_DEFINE_VALUE_FROM_TO(Reflex::Event) #define THIS to<Reflex::Event*>(self) #define CHECK RUCY_CHECK_OBJ(Reflex::Event, self) static VALUE alloc(VALUE klass) { Reflex::reflex_error(__FILE__, __LINE__, "can not instantiate Event class."); } static VALUE block(VALUE self) { CHECK; check_arg_count(__FILE__, __LINE__, "Event#block", argc, 0, 1); if (argc >= 1) THIS->block((bool) argv[0]); else THIS->block(); } static VALUE is_blocked(VALUE self) { CHECK; return value(THIS->is_blocked()); } static VALUE get_time(VALUE self) { CHECK; return value(THIS->time()); } static Class cEvent; void Init_reflex_event () { Module mReflex = rb_define_module("Reflex"); cEvent = rb_define_class_under(mReflex, "Event", rb_cObject); rb_define_alloc_func(cEvent, alloc); rb_define_method(cEvent, "block", RUBY_METHOD_FUNC(block), -1); cEvent.define_method("blocked?", is_blocked); rb_define_method(cEvent, "time", RUBY_METHOD_FUNC(get_time), 0); } namespace Reflex { Class event_class () { return cEvent; } }// Reflex
Version data entries
21 entries across 21 versions & 1 rubygems