102 VALUE members, slot, *ptr, *ptr_members;
110 for (i=0; i<
len; i++) {
111 if (ptr_members[i] == slot) {
136 #define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
137 #define N_REF_FUNC numberof(ref_func)
163 VALUE members, slot, *ptr, *ptr_members;
171 for (i=0; i<
len; i++) {
172 slot = ptr_members[
i];
185 VALUE nstr, *ptr_members;
216 for (i=0; i<
len; i++) {
248 while ((name = va_arg(ar,
char*)) !=
NULL) {
280 if (!name) nm =
Qnil;
285 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);
514 VALUE *ptr, *ptr_members;
518 if (recur || first !=
'#') {
529 for (i=0; i<
len; i++) {
536 else if (first !=
'#') {
539 slot = ptr_members[
i];
592 if (copy == s)
return copy;
608 VALUE *ptr, members, *ptr_members;
615 for (i=0; i<
len; i++) {
616 if (
SYM2ID(ptr_members[i]) ==
id) {
666 VALUE members, *ptr, *ptr_members;
678 for (i=0; i<
len; i++) {
679 if (
SYM2ID(ptr_members[i]) ==
id) {
800 if (recur)
return Qtrue;
804 for (i=0; i<
len; i++) {
830 if (s == s2)
return Qtrue;
834 rb_bug(
"inconsistent struct");
851 for (i = 0; i <
len; i++) {
879 if (recur)
return Qtrue;
883 for (i=0; i<
len; i++) {
900 if (s == s2)
return Qtrue;
904 rb_bug(
"inconsistent struct");
static VALUE struct_entry(VALUE s, long n)
VALUE(* rb_alloc_func_t)(VALUE)
static VALUE rb_struct_each_pair(VALUE s)
static VALUE struct_ivar_get(VALUE c, ID id)
static long NUM2LONG(VALUE x)
VALUE rb_ary_unshift(VALUE ary, VALUE item)
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)
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,...)
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)
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 RSTRING_PTR(string)
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)
#define RARRAY_LEN(ARRAY)
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,...)
VALUE rb_struct_aref(VALUE s, VALUE idx)
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)
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.
#define NEWOBJ(obj, type)
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_get_values_at(VALUE obj, long olen, int argc, VALUE *argv, VALUE(*func)(VALUE, long))
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)
register unsigned int len
#define RARRAY_PTR(ARRAY)
#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)
VALUE rb_obj_is_instance_of(VALUE, VALUE)
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)
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)
#define RETURN_ENUMERATOR(obj, argc, argv)
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)
static VALUE rb_struct_members_m(VALUE obj)
#define OBJSETUP(obj, c, t)
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)