Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)
|
Defines struct RTypedData. More...
#include "ruby/internal/config.h"
#include "ruby/internal/assume.h"
#include "ruby/internal/attr/artificial.h"
#include "ruby/internal/attr/pure.h"
#include "ruby/internal/cast.h"
#include "ruby/internal/core/rbasic.h"
#include "ruby/internal/core/rdata.h"
#include "ruby/internal/dllexport.h"
#include "ruby/internal/error.h"
#include "ruby/internal/fl_type.h"
#include "ruby/internal/stdbool.h"
#include "ruby/internal/value_type.h"
Go to the source code of this file.
Data Structures | |
struct | rb_data_type_struct |
struct | RTypedData |
Macros | |
#define | HAVE_TYPE_RB_DATA_TYPE_T 1 |
#define | HAVE_RB_DATA_TYPE_T_FUNCTION 1 |
#define | HAVE_RB_DATA_TYPE_T_PARENT 1 |
#define | RUBY_TYPED_DEFAULT_FREE RUBY_DEFAULT_FREE |
#define | RUBY_TYPED_NEVER_FREE RUBY_NEVER_FREE |
#define | RTYPEDDATA(obj) RBIMPL_CAST((struct RTypedData *)(obj)) |
#define | RTYPEDDATA_DATA(v) (RTYPEDDATA(v)->data) |
#define | Check_TypedStruct(v, t) rb_check_typeddata(RBIMPL_CAST((VALUE)(v)), (t)) |
#define | TypedData_Wrap_Struct(klass, data_type, sval) rb_data_typed_object_wrap((klass),(sval),(data_type)) |
#define | TypedData_Make_Struct0(result, klass, type, size, data_type, sval) |
#define | TypedData_Make_Struct(klass, type, data_type, sval) |
#define | TypedData_Get_Struct(obj, type, data_type, sval) ((sval) = RBIMPL_CAST((type *)rb_check_typeddata((obj), (data_type)))) |
Typedefs | |
typedef struct rb_data_type_struct | rb_data_type_t |
Enumerations | |
enum | rbimpl_typeddata_flags { RUBY_TYPED_FREE_IMMEDIATELY = 1 , RUBY_TYPED_FROZEN_SHAREABLE = RUBY_FL_SHAREABLE , RUBY_TYPED_WB_PROTECTED = RUBY_FL_WB_PROTECTED , RUBY_TYPED_PROMOTED1 = RUBY_FL_PROMOTED1 } |
Functions | |
VALUE | rb_data_typed_object_wrap (VALUE klass, void *datap, const rb_data_type_t *) |
VALUE | rb_data_typed_object_zalloc (VALUE klass, size_t size, const rb_data_type_t *type) |
int | rb_typeddata_inherited_p (const rb_data_type_t *child, const rb_data_type_t *parent) |
int | rb_typeddata_is_kind_of (VALUE obj, const rb_data_type_t *data_type) |
void * | rb_check_typeddata (VALUE obj, const rb_data_type_t *data_type) |
Defines struct RTypedData.
RBIMPL
or rbimpl
are implementation details. Don't take them as canon. They could rapidly appear then vanish. The name (path) of this header file is also an implementation detail. Do not expect it to persist at the place it is now. Developers are free to move it anywhere anytime at will. __VA_ARGS__
is always available. We assume C99 for ruby itself but we don't assume languages of extension libraries. They could be written in C++98. Definition in file rtypeddata.h.
#define Check_TypedStruct | ( | v, | |
t | |||
) | rb_check_typeddata(RBIMPL_CAST((VALUE)(v)), (t)) |
Definition at line 48 of file rtypeddata.h.
#define HAVE_RB_DATA_TYPE_T_FUNCTION 1 |
Definition at line 42 of file rtypeddata.h.
#define HAVE_RB_DATA_TYPE_T_PARENT 1 |
Definition at line 43 of file rtypeddata.h.
#define HAVE_TYPE_RB_DATA_TYPE_T 1 |
Definition at line 41 of file rtypeddata.h.
#define RTYPEDDATA | ( | obj | ) | RBIMPL_CAST((struct RTypedData *)(obj)) |
Definition at line 46 of file rtypeddata.h.
#define RTYPEDDATA_DATA | ( | v | ) | (RTYPEDDATA(v)->data) |
Definition at line 47 of file rtypeddata.h.
#define RUBY_TYPED_DEFAULT_FREE RUBY_DEFAULT_FREE |
Definition at line 44 of file rtypeddata.h.
#define RUBY_TYPED_NEVER_FREE RUBY_NEVER_FREE |
Definition at line 45 of file rtypeddata.h.
#define TypedData_Get_Struct | ( | obj, | |
type, | |||
data_type, | |||
sval | |||
) | ((sval) = RBIMPL_CAST((type *)rb_check_typeddata((obj), (data_type)))) |
Definition at line 130 of file rtypeddata.h.
#define TypedData_Make_Struct | ( | klass, | |
type, | |||
data_type, | |||
sval | |||
) |
Definition at line 122 of file rtypeddata.h.
#define TypedData_Make_Struct0 | ( | result, | |
klass, | |||
type, | |||
size, | |||
data_type, | |||
sval | |||
) |
Definition at line 104 of file rtypeddata.h.
#define TypedData_Wrap_Struct | ( | klass, | |
data_type, | |||
sval | |||
) | rb_data_typed_object_wrap((klass),(sval),(data_type)) |
Definition at line 101 of file rtypeddata.h.
typedef struct rb_data_type_struct rb_data_type_t |
Definition at line 68 of file rtypeddata.h.
Enumerator | |
---|---|
RUBY_TYPED_FREE_IMMEDIATELY | |
RUBY_TYPED_FROZEN_SHAREABLE | |
RUBY_TYPED_WB_PROTECTED | |
RUBY_TYPED_PROMOTED1 |
Definition at line 61 of file rtypeddata.h.
VALUE rb_data_typed_object_wrap | ( | VALUE | klass, |
void * | datap, | ||
const rb_data_type_t * | type | ||
) |
Definition at line 2505 of file gc.c.
References RUBY_ASSERT_ALWAYS, RUBY_FL_WB_PROTECTED, T_CLASS, and T_DATA.
Referenced by rb_data_typed_object_zalloc().
VALUE rb_data_typed_object_zalloc | ( | VALUE | klass, |
size_t | size, | ||
const rb_data_type_t * | type | ||
) |
Definition at line 2513 of file gc.c.
References DATA_PTR, rb_data_typed_object_wrap(), and xcalloc.