94 const long members_length =
RARRAY_LEN(members);
100 long i, j, mask = 64;
109 for (i=0; i < members_length; i++) {
151 "struct size differs (%ld required %ld given)",
154 for (j = 0; j < mask; j++) {
228 #define N_REF_FUNC numberof(ref_func) 300 const VALUE *ptr_members;
311 for (i=0; i<
len; i++) {
341 while ((mem = va_arg(ar,
char*)) != 0) {
512 for (i=0; i<
argc; i++) {
561 for (i=0; i<
argc; i++) {
616 va_start(args, klass);
617 for (i=0; i<
size; i++) {
618 mem[i] = va_arg(args,
VALUE);
714 if (recur || first !=
'#') {
724 for (i=0; i<
len; i++) {
731 else if (first !=
'#') {
836 if (
NIL_P(idx))
return -1;
945 if (i < 0)
return notfound;
1013 if (recur)
return Qtrue;
1017 for (i=0; i<
len; i++) {
1041 if (s == s2)
return Qtrue;
1045 rb_bug(
"inconsistent struct");
1071 for (i = 0; i <
len; i++) {
1085 if (recur)
return Qtrue;
1089 for (i=0; i<
len; i++) {
1107 if (s == s2)
return Qtrue;
1111 rb_bug(
"inconsistent struct");
1162 if (!--argc)
return self;
static VALUE struct_entry(VALUE s, long n)
static VALUE rb_struct_each_pair(VALUE s)
#define RBASIC_CLEAR_CLASS(obj)
FUNC_MINIMIZED(VALUE rb_struct_lookup(VALUE s, VALUE idx))
static VALUE struct_ivar_get(VALUE c, ID id)
NOINLINE(static VALUE rb_struct_lookup_default(VALUE s, VALUE idx, VALUE notfound))
static VALUE rb_struct_to_h(VALUE s)
VALUE rb_struct_s_members(VALUE klass)
VALUE rb_ary_entry(VALUE ary, long offset)
static VALUE struct_set_members(VALUE klass, VALUE members)
void rb_bug(const char *fmt,...)
static VALUE rb_struct_dig(int argc, VALUE *argv, VALUE self)
static VALUE rb_struct_each(VALUE s)
void rb_add_method_iseq(VALUE klass, ID mid, const rb_iseq_t *iseq, rb_cref_t *cref, rb_method_visibility_t visi)
#define RSTRUCT_CONST_PTR(st)
VALUE rb_yield_values(int n,...)
static VALUE rb_struct_select(int argc, VALUE *argv, VALUE s)
void rb_undef_alloc_func(VALUE)
void rb_define_singleton_method(VALUE obj, const char *name, VALUE(*func)(ANYARGS), int argc)
Defines a singleton method for obj.
VALUE rb_struct_define(const char *name,...)
static VALUE anonymous_struct(VALUE klass)
static VALUE rb_struct_ref3(VALUE obj)
VALUE rb_struct_initialize(VALUE self, VALUE values)
static void define_aref_method(VALUE nstr, VALUE name, VALUE off)
static VALUE rb_struct_to_a(VALUE s)
VALUE rb_define_class_id_under(VALUE outer, ID id, VALUE super)
Defines a class under the namespace of outer.
st_index_t rb_hash_end(st_index_t)
#define OBJ_INIT_COPY(obj, orig)
static VALUE rb_struct_eql(VALUE s, VALUE s2)
#define OBJ_FREEZE_RAW(x)
int rb_is_const_id(ID id)
void rb_mem_clear(register VALUE *mem, register long size)
VALUE rb_ary_push(VALUE ary, VALUE item)
SSL_METHOD *(* func)(void)
static VALUE rb_struct_lookup_default(VALUE s, VALUE idx, VALUE notfound)
static VALUE rb_struct_equal(VALUE s, VALUE s2)
VALUE rb_ary_tmp_new(long capa)
const VALUE * rb_struct_ptr(VALUE s)
VALUE rb_struct_getmember(VALUE obj, ID id)
VALUE rb_struct_aset(VALUE s, VALUE idx, VALUE val)
static VALUE rb_struct_ref0(VALUE obj)
VALUE rb_define_class_under(VALUE outer, const char *name, VALUE super)
Defines a class under the namespace of outer.
void rb_raise(VALUE exc, const char *fmt,...)
VALUE rb_exec_recursive(VALUE(*)(VALUE, VALUE, int), VALUE, VALUE)
void rb_define_alloc_func(VALUE, rb_alloc_func_t)
VALUE rb_struct_alloc(VALUE klass, VALUE values)
void rb_include_module(VALUE klass, VALUE module)
static VALUE inspect_struct(VALUE s, VALUE dummy, int recur)
static VALUE setup_struct(VALUE nstr, VALUE members)
static VALUE struct_define_without_accessor(VALUE outer, const char *class_name, VALUE super, rb_alloc_func_t alloc, VALUE members)
#define rb_name_err_raise(mesg, recv, name)
VALUE rb_hash_keys(VALUE hash)
NORETURN(static void invalid_struct_pos(VALUE s, VALUE idx))
#define NEWOBJ_OF(obj, type, klass, flags)
VALUE rb_struct_aref(VALUE s, VALUE idx)
#define RB_TYPE_P(obj, type)
VALUE rb_get_values_at(VALUE obj, long olen, int argc, const VALUE *argv, VALUE(*func)(VALUE, long))
VALUE rb_class_inherited(VALUE super, VALUE klass)
Calls Class::inherited.
static VALUE rb_struct_ref2(VALUE obj)
static long num_members(VALUE klass)
#define RGENGC_WB_PROTECTED_STRUCT
static VALUE recursive_eql(VALUE s, VALUE s2, int recur)
int rb_block_given_p(void)
VALUE rb_hash_aset(VALUE hash, VALUE key, VALUE val)
static VALUE rb_struct_hash(VALUE s)
static VALUE rb_struct_ref6(VALUE obj)
RUBY_EXTERN VALUE rb_cObject
VALUE rb_exec_recursive_paired(VALUE(*)(VALUE, VALUE, int), VALUE, VALUE, VALUE)
VALUE rb_str_cat2(VALUE, const char *)
void rb_check_trusted(VALUE obj)
VALUE rb_define_class(const char *name, VALUE super)
Defines a top-level class.
VALUE rb_struct_define_without_accessor_under(VALUE outer, const char *class_name, VALUE super, rb_alloc_func_t alloc,...)
void rb_ary_store(VALUE ary, long idx, VALUE val)
char ary[RSTRING_EMBED_LEN_MAX+1]
VALUE rb_struct_define_under(VALUE outer, const char *name,...)
static VALUE recursive_equal(VALUE s, VALUE s2, int recur)
VALUE rb_struct_new(VALUE klass,...)
static VALUE rb_struct_ref8(VALUE obj)
VALUE rb_class_new_instance(int, const VALUE *, VALUE)
static VALUE rb_struct_ref9(VALUE obj)
static long struct_member_pos_probe(long prev, long mask)
void rb_define_alias(VALUE klass, const char *name1, const char *name2)
Defines an alias of a method.
static VALUE rb_struct_s_members_m(VALUE klass)
#define RARRAY_CONST_PTR(a)
static int struct_member_pos(VALUE s, VALUE name)
static VALUE struct_enum_size(VALUE s, VALUE args, VALUE eobj)
int rb_is_const_name(VALUE name)
VALUE rb_to_symbol(VALUE name)
static VALUE rb_struct_ref4(VALUE obj)
static VALUE struct_alloc(VALUE)
VALUE rb_class_path(VALUE)
VALUE rb_mod_module_eval(int, const VALUE *, VALUE)
VALUE rb_struct_size(VALUE s)
VALUE rb_ivar_set(VALUE, ID, VALUE)
VALUE rb_assoc_new(VALUE car, VALUE cdr)
rb_control_frame_t *FUNC_FASTCALL() rb_vm_opt_struct_aref(rb_thread_t *th, rb_control_frame_t *reg_cfp)
#define RETURN_SIZED_ENUMERATOR(obj, argc, argv, size_fn)
VALUE rb_struct_define_without_accessor(const char *class_name, VALUE super, rb_alloc_func_t alloc,...)
static void invalid_struct_pos(VALUE s, VALUE idx)
const rb_iseq_t * rb_method_for_self_aset(VALUE name, VALUE arg, rb_insn_func_t func)
VALUE rb_make_metaclass(VALUE obj, VALUE unused)
#define RARRAY_LENINT(ary)
static VALUE(*const ref_func[])(VALUE)
static ID id_back_members
VALUE rb_sym_intern_ascii_cstr(const char *ptr)
register unsigned int len
static VALUE rb_struct_values_at(int argc, VALUE *argv, VALUE s)
#define RSTRUCT_SET(st, idx, v)
int rb_const_defined_at(VALUE, ID)
VALUE rb_equal(VALUE, VALUE)
void rb_define_method_id(VALUE klass, ID mid, VALUE(*func)(ANYARGS), int argc)
VALUE rb_ident_hash_new(void)
#define RSTRUCT_GET(st, idx)
#define UNLIMITED_ARGUMENTS
static VALUE rb_struct_s_def(int argc, VALUE *argv, VALUE klass)
static void rb_struct_modify(VALUE s)
#define RARRAY_AREF(a, i)
VALUE rb_obj_dig(int argc, VALUE *argv, VALUE self, VALUE notfound)
static VALUE rb_struct_ref7(VALUE obj)
const rb_iseq_t * rb_method_for_self_aref(VALUE name, VALUE arg, rb_insn_func_t func)
rb_control_frame_t *FUNC_FASTCALL rb_insn_func_t(rb_thread_t *, rb_control_frame_t *)
VALUE rb_mod_remove_const(VALUE, VALUE)
st_index_t rb_hash_uint(st_index_t, st_index_t)
struct rb_encoding_entry * list
VALUE rb_ary_dup(VALUE ary)
int rb_is_local_id(ID id)
VALUE rb_check_symbol(volatile VALUE *namep)
static VALUE rb_struct_ref1(VALUE obj)
static long struct_member_pos_ideal(VALUE name, long mask)
VALUE rb_struct_alloc_noinit(VALUE klass)
static VALUE rb_struct_initialize_m(int argc, const VALUE *argv, VALUE self)
VALUE rb_struct_members(VALUE s)
void st_clear(st_table *)
#define rb_check_frozen(obj)
rb_control_frame_t *FUNC_FASTCALL() rb_vm_opt_struct_aset(rb_thread_t *th, rb_control_frame_t *reg_cfp)
static VALUE rb_struct_inspect(VALUE s)
static VALUE rb_struct_ref5(VALUE obj)
VALUE(* rb_alloc_func_t)(VALUE)
static void define_aset_method(VALUE nstr, VALUE name, VALUE off)
static VALUE rb_struct_members_m(VALUE obj)
VALUE rb_struct_lookup(VALUE s, VALUE idx)
VALUE rb_class_new(VALUE super)
Creates a new class.
void rb_define_method(VALUE klass, const char *name, VALUE(*func)(ANYARGS), int argc)
VALUE rb_str_append(VALUE, VALUE)
void rb_warn(const char *fmt,...)
VALUE rb_str_to_str(VALUE)
static VALUE new_struct(VALUE name, VALUE super)
static int rb_struct_pos(VALUE s, VALUE *name)
static VALUE struct_make_members_list(va_list ar)
st_index_t rb_hash_start(st_index_t)
VALUE rb_attr_get(VALUE, ID)
VALUE rb_struct_init_copy(VALUE copy, VALUE s)
VALUE rb_obj_class(VALUE)