當前位置: 首頁>>代碼示例>>C++>>正文


C++ Data_Make_Struct函數代碼示例

本文整理匯總了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;
}
開發者ID:david-macmahon,項目名稱:rb-hashpipe,代碼行數:10,代碼來源:rb_hashpipe.c

示例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;
}
開發者ID:heathd,項目名稱:mysql2,代碼行數:10,代碼來源:client.c

示例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;
}
開發者ID:Rsoon,項目名稱:rsoon.github.io,代碼行數:10,代碼來源:MemoryPointer.c

示例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));
}
開發者ID:Zenexer,項目名稱:rb-gsl,代碼行數:19,代碼來源:sf_coulomb.c

示例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;
}
開發者ID:Fudge,項目名稱:rb-gsl,代碼行數:10,代碼來源:sf_elementary.c

示例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;
}
開發者ID:Fudge,項目名稱:rb-gsl,代碼行數:10,代碼來源:sf_gamma.c

示例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;
}
開發者ID:AndreasDattilo,項目名稱:sample_app,代碼行數:11,代碼來源:DynamicLibrary.c

示例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;
}
開發者ID:mahlonsmith,項目名稱:ruby-ldap,代碼行數:11,代碼來源:entry.c

示例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;
}
開發者ID:Voxar,項目名稱:spot,代碼行數:11,代碼來源:artist.c

示例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;
}
開發者ID:Voxar,項目名稱:spot,代碼行數:11,代碼來源:playlist.c

示例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;
}
開發者ID:Flameeyes,項目名稱:ffi,代碼行數:11,代碼來源:Type.c

示例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;
}
開發者ID:rubypanther,項目名稱:dec_number,代碼行數:11,代碼來源:dec_number.c

示例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;
}
開發者ID:Fudge,項目名稱:rb-gsl,代碼行數:11,代碼來源:sf_power.c

示例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));
}
開發者ID:Fudge,項目名稱:rb-gsl,代碼行數:11,代碼來源:sf_gamma.c

示例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;
}
開發者ID:GunioRobot,項目名稱:gedcom-ruby,代碼行數:54,代碼來源:gedcom.c


注:本文中的Data_Make_Struct函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。