[DOC] mention rb_define_alloc_func [ci skip]
This commit is contained in:
parent
e2b2b577b6
commit
8f755ad6c8
@ -698,7 +698,8 @@ Cの世界で定義されたデータ(構造体)をRubyのオブジェクトと
|
|||||||
このマクロの戻り値は生成されたオブジェクトを表すVALUE値です.
|
このマクロの戻り値は生成されたオブジェクトを表すVALUE値です.
|
||||||
|
|
||||||
klassはこのオブジェクトのクラスです.klassは, Objectクラスか
|
klassはこのオブジェクトのクラスです.klassは, Objectクラスか
|
||||||
ら派生し, 必ずrb_undef_alloc_func(klass)を呼び出してください.
|
ら派生し, 必ずrb_define_alloc_funcかrb_undef_alloc_funcを呼
|
||||||
|
び出してallocatorを設定してください.
|
||||||
|
|
||||||
data_typeはこの構造体をRubyが管理するための情報を記述した
|
data_typeはこの構造体をRubyが管理するための情報を記述した
|
||||||
const rb_data_type_t型へのポインタです.
|
const rb_data_type_t型へのポインタです.
|
||||||
@ -708,16 +709,16 @@ rb_data_type_tは次のように定義されています.
|
|||||||
typedef struct rb_data_type_struct rb_data_type_t;
|
typedef struct rb_data_type_struct rb_data_type_t;
|
||||||
|
|
||||||
struct rb_data_type_struct {
|
struct rb_data_type_struct {
|
||||||
const char *wrap_struct_name;
|
const char *wrap_struct_name;
|
||||||
struct {
|
struct {
|
||||||
void (*dmark)(void*);
|
void (*dmark)(void*);
|
||||||
void (*dfree)(void*);
|
void (*dfree)(void*);
|
||||||
size_t (*dsize)(const void *);
|
size_t (*dsize)(const void *);
|
||||||
void *reserved[2];
|
void *reserved[2];
|
||||||
} function;
|
} function;
|
||||||
const rb_data_type_t *parent;
|
const rb_data_type_t *parent;
|
||||||
void *data;
|
void *data;
|
||||||
VALUE flags;
|
VALUE flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
wrap_struct_nameはこの構造体を識別する名前です.主に統計情報
|
wrap_struct_nameはこの構造体を識別する名前です.主に統計情報
|
||||||
|
@ -657,8 +657,10 @@ with the next macro.
|
|||||||
|
|
||||||
TypedData_Wrap_Struct() returns a created Ruby object as a VALUE.
|
TypedData_Wrap_Struct() returns a created Ruby object as a VALUE.
|
||||||
|
|
||||||
The klass argument is the class for the object. It is recommended
|
The klass argument is the class for the object. The klass should
|
||||||
that klass derives from rb_cObject.
|
derive from rb_cObject, and the allocator must be set by calling
|
||||||
|
rb_define_alloc_func or rb_undef_alloc_func.
|
||||||
|
|
||||||
data_type is a pointer to a const rb_data_type_t which describes
|
data_type is a pointer to a const rb_data_type_t which describes
|
||||||
how Ruby should manage the struct.
|
how Ruby should manage the struct.
|
||||||
|
|
||||||
@ -668,17 +670,17 @@ member of the struct.
|
|||||||
typedef struct rb_data_type_struct rb_data_type_t;
|
typedef struct rb_data_type_struct rb_data_type_t;
|
||||||
|
|
||||||
struct rb_data_type_struct {
|
struct rb_data_type_struct {
|
||||||
const char *wrap_struct_name;
|
const char *wrap_struct_name;
|
||||||
struct {
|
struct {
|
||||||
void (*dmark)(void*);
|
void (*dmark)(void*);
|
||||||
void (*dfree)(void*);
|
void (*dfree)(void*);
|
||||||
size_t (*dsize)(const void *);
|
size_t (*dsize)(const void *);
|
||||||
void (*dcompact)(void*);
|
void (*dcompact)(void*);
|
||||||
void *reserved[1];
|
void *reserved[1];
|
||||||
} function;
|
} function;
|
||||||
const rb_data_type_t *parent;
|
const rb_data_type_t *parent;
|
||||||
void *data;
|
void *data;
|
||||||
VALUE flags;
|
VALUE flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
wrap_struct_name is an identifier of this instance of the struct.
|
wrap_struct_name is an identifier of this instance of the struct.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user