コード例 #1
0
static VALUE
  rb_gimp_rgb_alloc(VALUE klass)
{
  GimpRGB *color = ALLOC(GimpRGB);
  return TypedData_Wrap_Struct(klass, &GimpRGB_type, color);
}
コード例 #2
0
ファイル: dataerror.c プロジェクト: 0x00evil/ruby
static VALUE
dataerror_alloc(VALUE klass)
{
    VALUE n = rb_str_new_cstr("[Bug #9167] error");
    return TypedData_Wrap_Struct(klass, &dataerror_type, (void *)n);
}
コード例 #3
0
ファイル: dbm.c プロジェクト: 0x00evil/ruby
static VALUE
fdbm_alloc(VALUE klass)
{
    return TypedData_Wrap_Struct(klass, &dbm_type, 0);
}
コード例 #4
0
ファイル: engine.c プロジェクト: skimura0/ruby-qml
static VALUE engine_alloc(VALUE klass) {
    engine_t *data = ALLOC(engine_t);
    data->engine = NULL;
    return TypedData_Wrap_Struct(klass, &data_type, data);
}
コード例 #5
0
ファイル: map.c プロジェクト: 2007750219/protobuf
VALUE Map_alloc(VALUE klass) {
  Map* self = ALLOC(Map);
  memset(self, 0, sizeof(Map));
  self->value_type_class = Qnil;
  return TypedData_Wrap_Struct(klass, &Map_type, self);
}
コード例 #6
0
ファイル: typed_data_spec.c プロジェクト: Azzurrio/rubinius
VALUE sdaf_alloc_typed_func(VALUE klass) {
    struct sample_typed_wrapped_struct* bar = (struct sample_typed_wrapped_struct *)malloc(sizeof(struct sample_typed_wrapped_struct));
    bar->foo = 42;
    return TypedData_Wrap_Struct(klass, &sample_typed_wrapped_struct_data_type, bar);
}
コード例 #7
0
ファイル: rb_server.c プロジェクト: FabioBatSilva/grpc
/* Allocates grpc_rb_server instances. */
static VALUE grpc_rb_server_alloc(VALUE cls) {
  grpc_rb_server *wrapper = ALLOC(grpc_rb_server);
  wrapper->wrapped = NULL;
  wrapper->mark = Qnil;
  return TypedData_Wrap_Struct(cls, &grpc_rb_server_data_type, wrapper);
}
コード例 #8
0
ファイル: rb-grn-column-cache.c プロジェクト: kenhys/rroonga
static VALUE
rb_grn_column_cache_allocate (VALUE klass)
{
    return TypedData_Wrap_Struct(klass, &data_type, NULL);
}
コード例 #9
0
/* Allocates CallCredentials instances.
   Provides safe initial defaults for the instance fields. */
static VALUE grpc_rb_call_credentials_alloc(VALUE cls) {
  grpc_rb_call_credentials *wrapper = ALLOC(grpc_rb_call_credentials);
  wrapper->wrapped = NULL;
  wrapper->mark = Qnil;
  return TypedData_Wrap_Struct(cls, &grpc_rb_call_credentials_data_type, wrapper);
}
コード例 #10
0
ファイル: objspace.c プロジェクト: riddochc/ruby
static VALUE
iow_newobj(VALUE obj)
{
    return TypedData_Wrap_Struct(rb_mInternalObjectWrapper, &iow_data_type, (void *)obj);
}
コード例 #11
0
static VALUE
di_open_s(VALUE klass)
{
    VALUE self = TypedData_Wrap_Struct(klass, &di_data_type, 0);
    return rb_ensure(di_open_body, self, di_open_ensure, self);
}
コード例 #12
0
ファイル: channel.c プロジェクト: sorah/libssh-ruby
static VALUE channel_alloc(VALUE klass) {
  ChannelHolder *holder = ALLOC(ChannelHolder);
  holder->channel = NULL;
  holder->session = Qundef;
  return TypedData_Wrap_Struct(klass, &channel_type, holder);
}
コード例 #13
0
ファイル: defs.c プロジェクト: Overruler/protobuf
/*
 * call-seq:
 *     DescriptorPool.new => pool
 *
 * Creates a new, empty, descriptor pool.
 */
VALUE DescriptorPool_alloc(VALUE klass) {
  DescriptorPool* self = ALLOC(DescriptorPool);
  self->symtab = upb_symtab_new(&self->symtab);
  return TypedData_Wrap_Struct(klass, &_DescriptorPool_type, self);
}
コード例 #14
0
static VALUE ossl_ssl_session_alloc(VALUE klass)
{
	return TypedData_Wrap_Struct(klass, &ossl_ssl_session_type, NULL);
}
コード例 #15
0
ファイル: rb_server.c プロジェクト: deepaklukose/grpc
/* Allocates grpc_rb_server instances. */
static VALUE grpc_rb_server_alloc(VALUE cls) {
  grpc_rb_server* wrapper = ALLOC(grpc_rb_server);
  wrapper->wrapped = NULL;
  wrapper->shutdown_started = (gpr_atm)0;
  return TypedData_Wrap_Struct(cls, &grpc_rb_server_data_type, wrapper);
}
コード例 #16
0
ファイル: rb_channel.c プロジェクト: aaronjheng/grpc
/* Allocates grpc_rb_channel instances. */
static VALUE grpc_rb_channel_alloc(VALUE cls) {
  grpc_rb_channel *wrapper = ALLOC(grpc_rb_channel);
  wrapper->bg_wrapped = NULL;
  wrapper->credentials = Qnil;
  return TypedData_Wrap_Struct(cls, &grpc_channel_data_type, wrapper);
}
コード例 #17
0
ファイル: encoding.c プロジェクト: SongJungHwan/hwan
static VALUE
enc_new(rb_encoding *encoding)
{
    return TypedData_Wrap_Struct(rb_cEncoding, &encoding_data_type, encoding);
}
コード例 #18
0
static VALUE
rb_hello_alloc(VALUE klass)
{
  return TypedData_Wrap_Struct(klass, &rb_hello_type, NULL);
}
コード例 #19
0
ファイル: typed_data_spec.c プロジェクト: Azzurrio/rubinius
VALUE sws_typed_wrap_struct(VALUE self, VALUE val) {
    struct sample_typed_wrapped_struct* bar = (struct sample_typed_wrapped_struct *)malloc(sizeof(struct sample_typed_wrapped_struct));
    bar->foo = FIX2INT(val);
    return TypedData_Wrap_Struct(rb_cObject, &sample_typed_wrapped_struct_data_type, bar);
}
コード例 #20
0
ファイル: application.c プロジェクト: polamjag/ruby-qml
static VALUE application_alloc(VALUE klass) {
    application_t *data = ALLOC(application_t);
    data->application = NULL;
    return TypedData_Wrap_Struct(klass, &data_type, data);
}