105 for (i=0; i<
len; i++) {
132 #define N_REF_FUNC numberof(ref_func)
164 for (i=0; i<
len; i++) {
208 const VALUE *ptr_members;
220 for (i=0; i<
len; i++) {
278 while ((name = va_arg(ar,
char*)) !=
NULL) {
296 while ((name = va_arg(ar,
char*)) !=
NULL) {
315 while ((mem = va_arg(ar,
char*)) != 0) {
336 while ((mem = va_arg(ar,
char*)) != 0) {
412 for (i=0; i<
argc; i++) {
456 for (i=0; i<
argc; i++) {
511 va_start(args, klass);
512 for (i=0; i<
size; i++) {
513 mem[
i] = va_arg(args,
VALUE);
612 if (recur || first !=
'#') {
622 for (i=0; i<
len; i++) {
629 else if (first !=
'#') {
729 for (i=0; i<
len; i++) {
795 for (i=0; i<
len; i++) {
922 if (recur)
return Qtrue;
926 for (i=0; i<
len; i++) {
950 if (s == s2)
return Qtrue;
954 rb_bug(
"inconsistent struct");
978 for (i = 0; i <
len; i++) {
992 if (recur)
return Qtrue;
996 for (i=0; i<
len; i++) {
1014 if (s == s2)
return Qtrue;
1018 rb_bug(
"inconsistent struct");
static VALUE struct_entry(VALUE s, long n)
static VALUE rb_struct_each_pair(VALUE s)
VALUE rb_struct_define_without_accessor_under(VALUE outer, const char *class_name, VALUE super, rb_alloc_func_t alloc,...)
#define RB_TYPE_P(obj, type)
static VALUE struct_ivar_get(VALUE c, ID id)
static VALUE rb_struct_to_h(VALUE s)
VALUE rb_struct_iv_get(VALUE c, const char *name)
VALUE rb_ary_entry(VALUE ary, long offset)
void rb_bug(const char *fmt,...)
VALUE(* rb_alloc_func_t)(VALUE)
VALUE rb_struct_members(VALUE)
static VALUE rb_struct_each(VALUE s)
VALUE rb_class_new_instance(int, VALUE *, VALUE)
VALUE rb_mod_module_eval(int, VALUE *, VALUE)
#define UNLIMITED_ARGUMENTS
static VALUE rb_struct_select(int argc, VALUE *argv, VALUE s)
#define rb_check_trusted(obj)
void rb_define_singleton_method(VALUE obj, const char *name, VALUE(*func)(ANYARGS), int argc)
Defines a singleton method for obj.
static VALUE anonymous_struct(VALUE klass)
static VALUE rb_struct_ref3(VALUE obj)
static void not_a_member(ID id)
VALUE rb_struct_define(const char *,...)
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.
#define rb_check_frozen(obj)
static VALUE rb_struct_eql(VALUE s, VALUE s2)
#define RSTRUCT_EMBED_LEN_MASK
ID rb_frame_this_func(void)
void rb_mem_clear(register VALUE *mem, register long size)
void rb_define_alloc_func(VALUE, rb_alloc_func_t)
VALUE rb_ary_push(VALUE ary, VALUE item)
static VALUE rb_struct_equal(VALUE s, VALUE s2)
VALUE rb_ary_tmp_new(long capa)
#define RSTRUCT_EMBED_LEN_MAX
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.
VALUE rb_struct_new(VALUE,...)
void rb_raise(VALUE exc, const char *fmt,...)
VALUE rb_obj_class(VALUE)
VALUE rb_class_name(VALUE)
VALUE rb_struct_alloc(VALUE, VALUE)
static VALUE rb_struct_aref_id(VALUE s, ID id)
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)
ID rb_check_id(volatile VALUE *namep)
Returns ID for the given name if it is interned already, or 0.
VALUE rb_ivar_get(VALUE, ID)
VALUE rb_equal(VALUE, VALUE)
VALUE rb_str_to_str(VALUE)
void rb_name_error_str(VALUE str, const char *fmt,...)
void rb_name_error(ID id, const char *fmt,...)
st_index_t rb_hash_start(st_index_t)
#define RSTRUCT_EMBED_LEN_SHIFT
int rb_is_const_id(ID id)
static VALUE rb_struct_ref(VALUE obj)
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)
static VALUE rb_struct_aset_id(VALUE s, ID id, VALUE val)
static VALUE rb_struct_hash(VALUE s)
static VALUE rb_struct_ref6(VALUE obj)
#define RARRAY_CONST_PTR(a)
#define RARRAY_AREF(a, i)
VALUE rb_str_cat2(VALUE, const char *)
VALUE rb_define_class(const char *name, VALUE super)
Defines a top-level class.
#define OBJ_INIT_COPY(obj, orig)
VALUE rb_struct_define_under(VALUE, const char *,...)
VALUE rb_struct_define_without_accessor(const char *, VALUE, rb_alloc_func_t,...)
static VALUE recursive_equal(VALUE s, VALUE s2, int recur)
static VALUE rb_struct_ref8(VALUE obj)
#define RSTRUCT_SET(st, idx, v)
static VALUE rb_struct_ref9(VALUE obj)
static VALUE rb_struct_set(VALUE obj, VALUE val)
VALUE rb_struct_s_members(VALUE)
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)
static VALUE struct_enum_size(VALUE s, VALUE args, VALUE eobj)
static VALUE rb_struct_ref4(VALUE obj)
#define RSTRUCT_CONST_PTR(st)
static VALUE struct_alloc(VALUE)
int rb_is_local_id(ID id)
VALUE rb_assoc_new(VALUE car, VALUE cdr)
VALUE rb_get_values_at(VALUE obj, long olen, int argc, VALUE *argv, VALUE(*func)(VALUE, long))
int rb_const_defined_at(VALUE, ID)
rb_hash_aset(hash, RARRAY_AREF(key_value_pair, 0), RARRAY_AREF(key_value_pair, 1))
void rb_undef_alloc_func(VALUE)
VALUE rb_make_metaclass(VALUE obj, VALUE unused)
static VALUE(*const ref_func[])(VALUE)
VALUE rb_ivar_defined(VALUE, ID)
static VALUE rb_struct_size(VALUE s)
static VALUE rb_struct_values_at(int argc, VALUE *argv, VALUE s)
int rb_is_const_name(VALUE name)
#define NEWOBJ_OF(obj, type, klass, flags)
void rb_define_method_id(VALUE klass, ID mid, VALUE(*func)(ANYARGS), int argc)
VALUE rb_struct_aref(VALUE, VALUE)
#define RETURN_SIZED_ENUMERATOR(obj, argc, argv, size_fn)
static VALUE rb_struct_s_def(int argc, VALUE *argv, VALUE klass)
static void rb_struct_modify(VALUE s)
VALUE rb_mod_remove_const(VALUE, VALUE)
VALUE rb_exec_recursive_paired(VALUE(*)(VALUE, VALUE, int), VALUE, VALUE, VALUE)
VALUE rb_struct_initialize(VALUE, VALUE)
static VALUE rb_struct_ref7(VALUE obj)
RUBY_EXTERN VALUE rb_cObject
#define RARRAY_LENINT(ary)
VALUE rb_struct_aset(VALUE, VALUE, VALUE)
VALUE rb_ary_dup(VALUE ary)
VALUE rb_exec_recursive(VALUE(*)(VALUE, VALUE, int), VALUE, VALUE)
rb_ivar_set(yielder, id_memo, LONG2NUM(++count))
static VALUE rb_struct_ref1(VALUE obj)
VALUE rb_struct_getmember(VALUE, ID)
const char * rb_id2name(ID id)
static VALUE rb_struct_initialize_m(int argc, const VALUE *argv, VALUE self)
static VALUE rb_struct_inspect(VALUE s)
static VALUE rb_struct_ref5(VALUE obj)
#define RARRAY_ASET(a, i, v)
return rb_yield_values(2, rb_enum_values_pack(argc, argv), INT2NUM(n))
VALUE rb_struct_init_copy(VALUE copy, VALUE s)
static VALUE rb_struct_members_m(VALUE obj)
VALUE rb_class_new(VALUE super)
Creates a new class.
void rb_define_method(VALUE klass, const char *name, VALUE(*func)(ANYARGS), int argc)
void rb_warn(const char *fmt,...)
static VALUE new_struct(VALUE name, VALUE super)
VALUE rb_struct_alloc_noinit(VALUE)
#define rb_hash_uint(h, i)
void rb_ary_set_len(VALUE ary, long len)
#define RSTRUCT_GET(st, idx)
RUBY_EXTERN VALUE rb_cStruct