Пример #1
0
void InitUnder(VALUE parent)
{
	VALUE cTaskbarProcess = Qnil;
  if (parent == Qnil)
  {
    cTaskbarProcess = rb_define_class("TaskbarProgress", rb_cObject);
  }
  else
  {
    cTaskbarProcess = rb_define_class_under(parent,
      "TaskbarProgress", rb_cObject);
  }

	rb_define_const(cTaskbarProcess, "CEXT_VERSION",  GetRubyInterface("1.0.0"));

	rb_define_alloc_func(cTaskbarProcess, wrap_progressbar_alloc);

	rb_define_method(cTaskbarProcess, "set_state", VALUEFUNC(wrap_set_state), 1);
	rb_define_method(cTaskbarProcess, "set_value", VALUEFUNC(wrap_set_value), 2);

	rb_define_const(cTaskbarProcess, "NOPROGRESS",    INT2NUM(TBPF_NOPROGRESS));
	rb_define_const(cTaskbarProcess, "INDETERMINATE", INT2NUM(TBPF_INDETERMINATE));
	rb_define_const(cTaskbarProcess, "NORMAL",        INT2NUM(TBPF_NORMAL));
	rb_define_const(cTaskbarProcess, "ERROR",         INT2NUM(TBPF_ERROR));
	rb_define_const(cTaskbarProcess, "PAUSED",        INT2NUM(TBPF_PAUSED));
}
void Init_SUEX_HelloWorld()
{
  VALUE mSUEX_HelloWorld = rb_define_module("SUEX_HelloWorld");
  rb_define_const(mSUEX_HelloWorld, "CEXT_VERSION", GetRubyInterface("1.0.0"));
  rb_define_module_function(mSUEX_HelloWorld, "hello_world",
    VALUEFUNC(hello_world), 0); 
}
VALUE hello_world(VALUE self) {
  return GetRubyInterface("Hello World!");
}