本文整理匯總了C++中Data_Make_Struct函數的典型用法代碼示例。如果您正苦於以下問題:C++ Data_Make_Struct函數的具體用法?C++ Data_Make_Struct怎麽用?C++ Data_Make_Struct使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了Data_Make_Struct函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: rb_hps_alloc
static VALUE
rb_hps_alloc(VALUE klass)
{
hashpipe_status_t * p;
VALUE v;
v = Data_Make_Struct(klass, hashpipe_status_t, 0, free, p);
memset(p, 0, sizeof(hashpipe_status_t));
return v;
}
示例2: allocate
static VALUE allocate(VALUE klass) {
VALUE obj;
mysql_client_wrapper * wrapper;
obj = Data_Make_Struct(klass, mysql_client_wrapper, rb_mysql_client_mark, rb_mysql_client_free, wrapper);
wrapper->encoding = Qnil;
wrapper->active = 0;
wrapper->closed = 1;
wrapper->client = (MYSQL*)malloc(sizeof(MYSQL));
return obj;
}
示例3: memptr_allocate
static VALUE
memptr_allocate(VALUE klass)
{
Pointer* p;
VALUE obj = Data_Make_Struct(klass, Pointer, NULL, memptr_release, p);
p->rbParent = Qnil;
p->memory.flags = MEM_RD | MEM_WR;
return obj;
}
示例4: rb_gsl_sf_coulomb_wave_FG_e
static VALUE rb_gsl_sf_coulomb_wave_FG_e(VALUE obj, VALUE eta, VALUE x,
VALUE L_F, VALUE k)
{
gsl_sf_result *F, *Fp, *G, *Gp;
VALUE vF, vFp, vG, vGp;
double exp_G, exp_F;
int status;
Need_Float(eta); Need_Float(x); Need_Float(L_F);
CHECK_FIXNUM(k);
vF = Data_Make_Struct(cgsl_sf_result, gsl_sf_result, 0, free, F);
vFp = Data_Make_Struct(cgsl_sf_result, gsl_sf_result, 0, free, Fp);
vG = Data_Make_Struct(cgsl_sf_result, gsl_sf_result, 0, free, G);
vGp = Data_Make_Struct(cgsl_sf_result, gsl_sf_result, 0, free, Gp);
status = gsl_sf_coulomb_wave_FG_e(NUM2DBL(eta), NUM2DBL(x), NUM2DBL(L_F),
FIX2INT(k), F, Fp, G, Gp, &exp_F, &exp_G);
return rb_ary_new3(7, vF, vFp, vG, vGp,
rb_float_new(exp_F), rb_float_new(exp_G), INT2FIX(status));
}
示例5: rb_gsl_sf_multiply_e
static VALUE rb_gsl_sf_multiply_e(VALUE obj, VALUE x, VALUE y)
{
gsl_sf_result *r;
VALUE v;
int status;
Need_Float(x); Need_Float(y);
v = Data_Make_Struct(cgsl_sf_result, gsl_sf_result, 0, free, r);
status = gsl_sf_multiply_e(NUM2DBL(x), NUM2DBL(y), r);
return v;
}
示例6: rb_gsl_sf_lnchoose_e
static VALUE rb_gsl_sf_lnchoose_e(VALUE obj, VALUE n, VALUE m)
{
gsl_sf_result *rslt = NULL;
VALUE v;
int status;
CHECK_FIXNUM(n); CHECK_FIXNUM(m);
v = Data_Make_Struct(cgsl_sf_result, gsl_sf_result, 0, free, rslt);
status = gsl_sf_lnchoose_e(FIX2INT(n), FIX2INT(m), rslt);
return v;
}
示例7: symbol_allocate
static VALUE
symbol_allocate(VALUE klass)
{
LibrarySymbol* sym;
VALUE obj = Data_Make_Struct(klass, LibrarySymbol, NULL, -1, sym);
sym->name = Qnil;
sym->library = Qnil;
sym->base.rbParent = Qnil;
return obj;
}
示例8: rb_ldap_entry_new
VALUE
rb_ldap_entry_new (LDAP * ldap, LDAPMessage * msg)
{
VALUE val;
RB_LDAPENTRY_DATA *edata;
val = Data_Make_Struct (rb_cLDAP_Entry, RB_LDAPENTRY_DATA,
0, rb_ldap_entry_free, edata);
edata->ldap = ldap;
edata->msg = msg;
return val;
}
示例9: rb_ds_artist_alloc
static VALUE
rb_ds_artist_alloc (VALUE klass)
{
rb_ds_artist *artist;
VALUE obj;
obj = Data_Make_Struct(klass, rb_ds_artist,
NULL, NULL, artist);
return obj;
}
示例10: rb_ds_playlist_alloc
static VALUE
rb_ds_playlist_alloc (VALUE klass)
{
rb_ds_playlist *pls;
VALUE obj;
obj = Data_Make_Struct(klass, rb_ds_playlist, NULL,
rb_ds_playlist_free, pls);
return obj;
}
示例11: type_allocate
static VALUE
type_allocate(VALUE klass)
{
Type* type;
VALUE obj = Data_Make_Struct(klass, Type, NULL, -1, type);
type->nativeType = -1;
type->ffiType = &ffi_type_void;
return obj;
}
示例12: num_alloc
static VALUE num_alloc(VALUE klass) {
decNumber self_struct, *self_ptr;
decContext context;
VALUE self;
self_ptr = &self_struct;
self = Data_Make_Struct(klass, decNumber, 0, free, self_ptr);
decContextDefault(&context, DEC_INIT_BASE);
(*self_ptr).bits = DECNAN;
return self;
}
示例13: rb_gsl_sf_pow_int_e
static VALUE rb_gsl_sf_pow_int_e(VALUE obj, VALUE x, VALUE n)
{
gsl_sf_result *rslt = NULL;
VALUE v;
int status;
Need_Float(x);
CHECK_FIXNUM(n);
v = Data_Make_Struct(cgsl_sf_result, gsl_sf_result, 0, free, rslt);
status = gsl_sf_pow_int_e(NUM2DBL(x), FIX2INT(n), rslt);
return v;
}
示例14: rb_gsl_sf_lngamma_sgn_e
static VALUE rb_gsl_sf_lngamma_sgn_e(VALUE obj, VALUE x)
{
gsl_sf_result *rslt = NULL;
VALUE v;
int status;
double sgn;
Need_Float(x);
v = Data_Make_Struct(cgsl_sf_result, gsl_sf_result, 0, free, rslt);
status = gsl_sf_lngamma_sgn_e(NUM2DBL(x), rslt, &sgn);
return rb_ary_new3(2, v, rb_float_new(sgn));
}
示例15: static_gedcom_date_new
static VALUE static_gedcom_date_new( int argc,
VALUE *argv,
VALUE klass )
{
char *s_date;
int i_type;
int rc;
VALUE date;
VALUE type;
VALUE new_date;
gedDATEVALUE_t parsed_date;
gedDATEVALUE_t *temp;
if( rb_scan_args( argc, argv, "11", &date, &type ) == 1 )
{
i_type = gctDEFAULT;
}
else
{
i_type = FIX2INT( type );
}
s_date = STR2CSTR( date );
rc = parseGEDCOMDate( s_date, &parsed_date, i_type );
if( rc != 0 )
{
VALUE err_msg;
err_msg = rb_str_new2( "format error at '" );
if( parsed_date.date1.flags & gfNONSTANDARD )
rb_str_cat( err_msg, parsed_date.date1.data.phrase, strlen( parsed_date.date1.data.phrase ) );
else
rb_str_cat( err_msg, parsed_date.date2.data.phrase, strlen( parsed_date.date2.data.phrase ) );
rb_str_cat( err_msg, "'", 1 );
if( rb_block_given_p() )
{
rb_yield( err_msg );
}
else
{
rb_raise( eDateFormatException, STR2CSTR( err_msg ) );
}
}
new_date = Data_Make_Struct( klass, gedDATEVALUE_t, 0, 0, temp );
memcpy( temp, &parsed_date, sizeof( parsed_date ) );
return new_date;
}