93 VALUE members, slot, *ptr, *ptr_members;
101 for (i=0; i<len; i++) {
102 if (ptr_members[i] == slot) {
128 #define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
129 #define N_REF_FUNC numberof(ref_func)
154 VALUE members, slot, *ptr, *ptr_members;
162 for (i=0; i<len; i++) {
163 slot = ptr_members[
i];
177 VALUE nstr, *ptr_members;
208 for (i=0; i< len; i++) {
238 while ((name = va_arg(ar,
char*)) !=
NULL) {
270 if (!name) nm =
Qnil;
275 while ((mem = va_arg(ar,
char*)) != 0) {
432 va_start(args, klass);
433 for (i=0; i<
size; i++) {
434 mem[
i] = va_arg(args,
VALUE);
519 VALUE *ptr, *ptr_members;
523 if (recur || first !=
'#') {
534 for (i=0; i<len; i++) {
541 else if (first !=
'#') {
544 slot = ptr_members[
i];
634 VALUE *ptr, members, *ptr_members;
641 for (i=0; i<len; i++) {
642 if (
SYM2ID(ptr_members[i]) ==
id) {
693 VALUE members, *ptr, *ptr_members;
705 for (i=0; i<len; i++) {
706 if (
SYM2ID(ptr_members[i]) ==
id) {
827 if (recur)
return Qtrue;
831 for (i=0; i<len; i++) {
857 if (s == s2)
return Qtrue;
861 rb_bug(
"inconsistent struct");
878 for (i = 0; i < len; i++) {
906 if (recur)
return Qtrue;
910 for (i=0; i<len; i++) {
927 if (s == s2)
return Qtrue;
931 rb_bug(
"inconsistent struct");
static VALUE struct_entry(VALUE s, long n)
static VALUE rb_struct_each_pair(VALUE s)
static VALUE struct_ivar_get(VALUE c, ID id)
VALUE rb_ary_unshift(VALUE ary, VALUE item)
static VALUE rb_struct_to_h(VALUE s)
VALUE rb_struct_s_members(VALUE klass)
VALUE rb_struct_iv_get(VALUE c, const char *name)
VALUE rb_ary_new4(long n, const VALUE *elts)
VALUE rb_ary_entry(VALUE ary, long offset)
void rb_bug(const char *fmt,...)
static VALUE rb_struct_each(VALUE s)
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,...)
VALUE rb_exec_recursive_outer(VALUE(*)(VALUE, VALUE, int), VALUE, VALUE)
static VALUE make_struct(VALUE name, VALUE members, VALUE klass)
static VALUE rb_struct_ref3(VALUE obj)
VALUE rb_struct_initialize(VALUE self, VALUE values)
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)
ID rb_frame_this_func(void)
void rb_mem_clear(register VALUE *mem, register long size)
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 rb_check_trusted(obj)
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)
void rb_raise(VALUE exc, const char *fmt,...)
VALUE rb_ivar_get(VALUE, ID)
VALUE rb_mod_module_eval(int, VALUE *, VALUE)
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)
static VALUE rb_struct_aref_id(VALUE s, ID id)
#define RSTRUCT_EMBED_LEN_MASK
void rb_include_module(VALUE klass, VALUE module)
static VALUE inspect_struct(VALUE s, VALUE dummy, int recur)
static VALUE rb_struct_initialize_m(int argc, VALUE *argv, VALUE self)
VALUE rb_ivar_defined(VALUE, ID)
void rb_name_error(ID id, const char *fmt,...)
#define NEWOBJ_OF(obj, type, klass, flags)
VALUE rb_struct_aref(VALUE s, VALUE idx)
int rb_is_const_id(ID id)
#define RB_TYPE_P(obj, type)
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)
static VALUE recursive_eql(VALUE s, VALUE s2, int recur)
VALUE rb_class_new_instance(int, VALUE *, VALUE)
VALUE rb_class_name(VALUE)
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)
RUBY_EXTERN VALUE rb_cObject
VALUE rb_exec_recursive_paired(VALUE(*)(VALUE, VALUE, int), VALUE, VALUE, VALUE)
VALUE rb_str_cat2(VALUE, const char *)
VALUE rb_define_class(const char *name, VALUE super)
Defines a top-level class.
static VALUE recursive_hash(VALUE s, VALUE dummy, int recur)
#define MEMCPY(p1, p2, type, n)
static VALUE recursive_equal(VALUE s, VALUE s2, int recur)
VALUE rb_struct_new(VALUE klass,...)
static VALUE rb_struct_ref8(VALUE obj)
static VALUE rb_struct_ref9(VALUE obj)
static VALUE rb_struct_set(VALUE obj, VALUE val)
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 rb_struct_ref4(VALUE obj)
static VALUE struct_alloc(VALUE)
int rb_is_local_id(ID id)
int rb_scan_args(int argc, const VALUE *argv, const char *fmt,...)
VALUE rb_ivar_set(VALUE, ID, VALUE)
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))
#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,...)
VALUE rb_make_metaclass(VALUE obj, VALUE unused)
#define RARRAY_LENINT(ary)
static VALUE(*const ref_func[])(VALUE)
#define RSTRUCT_EMBED_LEN_MAX
static VALUE rb_struct_size(VALUE s)
static VALUE rb_struct_values_at(int argc, VALUE *argv, VALUE s)
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)
#define rb_check_arity(argc, min, max)
static VALUE rb_struct_s_def(int argc, VALUE *argv, VALUE klass)
static void rb_struct_modify(VALUE s)
static VALUE rb_struct_ref7(VALUE obj)
VALUE rb_mod_remove_const(VALUE, VALUE)
st_index_t rb_hash_uint(st_index_t, st_index_t)
VALUE rb_ary_dup(VALUE ary)
static VALUE rb_struct_ref1(VALUE obj)
VALUE rb_ary_new2(long capa)
const char * rb_id2name(ID id)
#define StringValuePtr(v)
VALUE rb_struct_alloc_noinit(VALUE klass)
VALUE rb_struct_members(VALUE s)
#define rb_check_frozen(obj)
static VALUE rb_struct_inspect(VALUE s)
static VALUE rb_struct_ref5(VALUE obj)
VALUE(* rb_alloc_func_t)(VALUE)
VALUE rb_hash_aset(VALUE, VALUE, VALUE)
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)
VALUE rb_str_append(VALUE, VALUE)
VALUE rb_str_new2(const char *)
void rb_warn(const char *fmt,...)
VALUE rb_str_to_str(VALUE)
#define RSTRUCT_EMBED_LEN_SHIFT
st_index_t rb_hash_start(st_index_t)
VALUE rb_struct_init_copy(VALUE copy, VALUE s)
VALUE rb_obj_class(VALUE)