100 VALUE members, slot, *
ptr, *ptr_members;
108 for (i=0; i<
len; i++) {
109 if (ptr_members[i] == slot) {
135 #define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
136 #define N_REF_FUNC numberof(ref_func)
161 VALUE members, slot, *
ptr, *ptr_members;
170 for (i=0; i<
len; i++) {
171 slot = ptr_members[
i];
225 for (i=0; i<
len; i++) {
255 while ((name = va_arg(ar,
char*)) !=
NULL) {
288 while ((mem = va_arg(ar,
char*)) != 0) {
362 for (i=0; i<
argc; i++) {
459 va_start(args, klass);
460 for (i=0; i<
size; i++) {
461 mem[
i] = va_arg(args,
VALUE);
550 if (recur || first !=
'#') {
561 for (i=0; i<
len; i++) {
568 else if (first !=
'#') {
571 slot = ptr_members[
i];
668 for (i=0; i<
len; i++) {
669 if (
SYM2ID(ptr_members[i]) ==
id) {
740 for (i=0; i<
len; i++) {
741 if (
SYM2ID(ptr_members[i]) ==
id) {
870 if (recur)
return Qtrue;
874 for (i=0; i<
len; i++) {
900 if (s == s2)
return Qtrue;
904 rb_bug(
"inconsistent struct");
921 for (i = 0; i <
len; i++) {
949 if (recur)
return Qtrue;
953 for (i=0; i<
len; i++) {
970 if (s == s2)
return Qtrue;
974 rb_bug(
"inconsistent struct");
static VALUE struct_entry(VALUE s, long n)
static VALUE rb_struct_each_pair(VALUE s)
#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_new4(long n, const VALUE *elts)
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_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)
ID rb_check_id(volatile VALUE *namep)
Returns ID for the given name if it is interned already, or 0.
static VALUE rb_struct_initialize_m(int argc, VALUE *argv, VALUE self)
VALUE rb_str_append(VALUE, VALUE)
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)
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)
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 OBJ_INIT_COPY(obj, orig)
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)
static VALUE rb_struct_ref9(VALUE obj)
static VALUE rb_struct_set(VALUE obj, VALUE val)
VALUE rb_struct_s_members(VALUE)
VALUE rb_hash_aset(VALUE, VALUE, 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 rb_struct_ref4(VALUE obj)
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)
void rb_undef_alloc_func(VALUE)
VALUE rb_make_metaclass(VALUE obj, VALUE unused)
VALUE rb_exec_recursive_outer(VALUE(*)(VALUE, VALUE, int), VALUE, VALUE)
static VALUE(*const ref_func[])(VALUE)
VALUE rb_ivar_defined(VALUE, ID)
#define MEMCPY(p1, p2, type, n)
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)
VALUE rb_ivar_set(VALUE, ID, VALUE)
#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)
static VALUE rb_struct_ref1(VALUE obj)
VALUE rb_struct_getmember(VALUE, ID)
const char * rb_id2name(ID id)
#define rb_check_arity(argc, min, max)
static VALUE rb_struct_inspect(VALUE s)
static VALUE rb_struct_ref5(VALUE obj)
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)
RUBY_EXTERN VALUE rb_cStruct