Sha256: a6f5d6b602ce5f45de5c5a27a1f32bd9167462846a0599532b01bd00e9bde517

Contents?: true

Size: 1.42 KB

Versions: 1

Compression:

Stored size: 1.42 KB

Contents

#include "ruby.h"

static VALUE rb_api_mParent;
static VALUE rb_api_mTimer;

VALUE rb_s_Timer_create(int argc, VALUE *argv);
VALUE rb_Timer_start(int argc, VALUE *argv, VALUE obj);
VALUE rb_Timer_stop(int argc, VALUE *argv, VALUE obj);
VALUE rb_Timer_isAlive(int argc, VALUE *argv, VALUE obj);




VALUE getRuby_Timer_Module(){ return rb_api_mTimer; }



static void _free_class_object(void *p)
{
    ruby_xfree(p);
}

static VALUE _allocate_class_object(VALUE klass)
{
    VALUE valObj = 0;
    char ** ppString = NULL;
    void* pData = ALLOC(void*);
    memset( pData, 0, sizeof(pData) );
    
	valObj = Data_Wrap_Struct(klass, 0, _free_class_object, pData);

    Data_Get_Struct(valObj, char *, ppString);
    *ppString = xmalloc(10);
    sprintf(*ppString, "%X", valObj);

    return valObj;
}

void Init_RubyAPI_Timer(void)
{

    VALUE tmpParent = Qnil;
    rb_api_mParent = rb_define_module("Rho");
    

	rb_api_mTimer = rb_define_class_under(rb_api_mParent, "Timer", rb_cObject);

	rb_define_alloc_func(rb_api_mTimer, _allocate_class_object);
    //Constructor should be not available in case of static members
    //rb_undef_alloc_func(rb_api_mTimer);

    rb_define_singleton_method(rb_api_mTimer, "create", rb_s_Timer_create, -1);
    rb_define_method(rb_api_mTimer, "start", rb_Timer_start, -1);
    rb_define_method(rb_api_mTimer, "stop", rb_Timer_stop, -1);
    rb_define_method(rb_api_mTimer, "isAlive", rb_Timer_isAlive, -1);








}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tauplatform-1.0.1 lib/commonAPI/coreapi/ext/shared/generated/timer_ruby_api.c