Ruby
2.4.2p198(2017-09-14revision59899)
|
Go to the source code of this file.
Macros | |
#define | N_REF_FUNC numberof(ref_func) |
Enumerations | |
enum | { AREF_HASH_UNIT = 5, AREF_HASH_THRESHOLD = 10 } |
Variables | |
VALUE | rb_cStruct |
static ID | id_members |
static ID | id_back_members |
static VALUE(*const | ref_func [])(VALUE) |
Definition at line 228 of file struct.c.
Referenced by rb_struct_new(), and setup_struct().
Definition at line 251 of file struct.c.
References rb_class_inherited(), rb_class_new(), rb_make_metaclass(), and RBASIC.
Referenced by rb_struct_define(), rb_struct_s_def(), and struct_define_without_accessor().
Definition at line 280 of file struct.c.
References FUNC_FASTCALL, METHOD_VISI_PUBLIC, NULL, rb_add_method_iseq(), rb_method_for_self_aref(), rb_vm_opt_struct_aref(), and SYM2ID.
Referenced by setup_struct().
Definition at line 289 of file struct.c.
References FUNC_FASTCALL, METHOD_VISI_PUBLIC, NULL, rb_add_method_iseq(), rb_method_for_self_aset(), rb_vm_opt_struct_aset(), and SYM2ID.
Referenced by setup_struct().
FUNC_MINIMIZED | ( | VALUE | rb_struct_lookupVALUE s, VALUE idx | ) |
Referenced by rb_struct_aset().
void Init_Struct | ( | void | ) |
Definition at line 1231 of file struct.c.
References id_back_members, id_members, InitVM, and rb_intern.
void InitVM_Struct | ( | void | ) |
Definition at line 1195 of file struct.c.
References rb_cObject, rb_cStruct, rb_define_alias(), rb_define_class(), rb_define_method(), rb_define_singleton_method(), rb_include_module(), rb_mEnumerable, rb_struct_aref(), rb_struct_aset(), rb_struct_dig(), rb_struct_each(), rb_struct_each_pair(), rb_struct_eql(), rb_struct_equal(), rb_struct_hash(), rb_struct_init_copy(), rb_struct_initialize_m(), rb_struct_inspect(), rb_struct_members_m(), rb_struct_s_def(), rb_struct_select(), rb_struct_size(), rb_struct_to_a(), rb_struct_to_h(), rb_struct_values_at(), and rb_undef_alloc_func().
Definition at line 707 of file struct.c.
References id, len, OBJ_INFECT, RARRAY_AREF, rb_class_path(), rb_id2str, rb_inspect(), rb_is_const_id(), rb_is_local_id(), rb_obj_class(), rb_str_append(), rb_str_cat2(), rb_str_new2, rb_struct_members(), RSTRING_PTR, RSTRUCT_GET, RSTRUCT_LEN, and SYM2ID.
Referenced by rb_struct_inspect().
Definition at line 860 of file struct.c.
References FIX2INT, FIXNUM_P, len, rb_eIndexError, rb_name_err_raise, rb_raise(), and RSTRUCT_LEN.
Referenced by rb_struct_aref(), rb_struct_aset(), and rb_struct_pos().
Definition at line 262 of file struct.c.
References id, ID2SYM, PRIsVALUE, rb_const_defined_at(), rb_define_class_id_under(), rb_is_const_name(), rb_mod_remove_const(), rb_name_err_raise, rb_str_to_str(), rb_to_id(), and rb_warn().
Referenced by rb_struct_define(), and rb_struct_s_def().
NOINLINE | ( | static VALUE | rb_struct_lookup_defaultVALUE s, VALUE idx, VALUE notfound | ) |
Referenced by rb_struct_aset().
NORETURN | ( | static void | invalid_struct_posVALUE s, VALUE idx | ) |
Referenced by rb_struct_pos().
|
static |
Definition at line 537 of file struct.c.
References id_members, RARRAY_LEN, rb_eTypeError, rb_raise(), RB_TYPE_P, struct_ivar_get(), and T_ARRAY.
Referenced by rb_struct_initialize_m(), rb_struct_new(), and struct_alloc().
const rb_iseq_t* rb_method_for_self_aref | ( | VALUE | name, |
VALUE | arg, | ||
rb_insn_func_t | func | ||
) |
Definition at line 7144 of file compile.c.
References for_self_aref(), and method_for_self().
Referenced by define_aref_method().
const rb_iseq_t* rb_method_for_self_aset | ( | VALUE | name, |
VALUE | arg, | ||
rb_insn_func_t | func | ||
) |
Definition at line 7153 of file compile.c.
References for_self_aset(), and method_for_self().
Referenced by define_aset_method().
Definition at line 599 of file struct.c.
References RARRAY_CONST_PTR, RARRAY_LENINT, and rb_class_new_instance().
Definition at line 328 of file struct.c.
References struct_alloc().
Referenced by Init_thread_sync(), and range_alloc().
Definition at line 896 of file struct.c.
References invalid_struct_pos(), rb_struct_pos(), and RSTRUCT_GET.
Referenced by InitVM_Struct(), rb_vm_opt_struct_aref(), and struct_entry().
Definition at line 923 of file struct.c.
References FUNC_MINIMIZED(), invalid_struct_pos(), NOINLINE(), rb_struct_lookup(), rb_struct_lookup_default(), rb_struct_modify(), rb_struct_pos(), RSTRUCT_SET, and val.
Referenced by InitVM_Struct(), and rb_vm_opt_struct_aset().
Definition at line 410 of file struct.c.
References anonymous_struct(), RString::ary, new_struct(), rb_cStruct, rb_str_new2, setup_struct(), and struct_make_members_list().
Definition at line 425 of file struct.c.
References RString::ary, rb_cStruct, rb_define_class_under(), setup_struct(), and struct_make_members_list().
Referenced by Init_etc(), and InitVM_process().
VALUE rb_struct_define_without_accessor | ( | const char * | class_name, |
VALUE | super, | ||
rb_alloc_func_t | alloc, | ||
... | |||
) |
Definition at line 397 of file struct.c.
References struct_define_without_accessor(), and struct_make_members_list().
Referenced by Init_Range().
VALUE rb_struct_define_without_accessor_under | ( | VALUE | outer, |
const char * | class_name, | ||
VALUE | super, | ||
rb_alloc_func_t | alloc, | ||
... | |||
) |
Definition at line 384 of file struct.c.
References struct_define_without_accessor(), and struct_make_members_list().
Referenced by Init_thread_sync().
Definition at line 1158 of file struct.c.
References argv, Qnil, rb_check_arity, rb_obj_dig(), rb_struct_lookup(), and UNLIMITED_ARGUMENTS.
Referenced by InitVM_Struct().
Definition at line 651 of file struct.c.
References rb_yield(), RETURN_SIZED_ENUMERATOR, RSTRUCT_GET, RSTRUCT_LEN, and struct_enum_size().
Referenced by InitVM_Struct().
Definition at line 682 of file struct.c.
References key, rb_ary_entry(), rb_assoc_new(), rb_block_arity(), rb_struct_members(), rb_yield(), rb_yield_values(), RETURN_SIZED_ENUMERATOR, RSTRUCT_GET, RSTRUCT_LEN, and struct_enum_size().
Referenced by InitVM_Struct().
Definition at line 1105 of file struct.c.
References Qfalse, Qtrue, rb_bug(), rb_exec_recursive_paired(), rb_obj_class(), RB_TYPE_P, recursive_eql(), RSTRUCT_LEN, and T_STRUCT.
Referenced by InitVM_Struct().
Definition at line 1039 of file struct.c.
References Qfalse, Qtrue, rb_bug(), rb_exec_recursive_paired(), rb_obj_class(), RB_TYPE_P, recursive_equal(), RSTRUCT_LEN, and T_STRUCT.
Referenced by InitVM_Struct().
Definition at line 205 of file struct.c.
References ID2SYM, rb_name_err_raise, RSTRUCT_GET, struct_member_pos(), and UNREACHABLE.
Definition at line 1061 of file struct.c.
References INT2FIX, len, NUM2LONG, RString::ptr, rb_hash(), rb_hash_end(), rb_hash_start(), rb_hash_uint(), rb_obj_class(), RSTRUCT_CONST_PTR, and RSTRUCT_LEN.
Referenced by InitVM_Struct().
Definition at line 809 of file struct.c.
References len, OBJ_INIT_COPY, rb_eTypeError, rb_raise(), RSTRUCT_GET, RSTRUCT_LEN, and RSTRUCT_SET.
Referenced by InitVM_Struct(), and range_initialize_copy().
Definition at line 571 of file struct.c.
References RARRAY_CONST_PTR, RARRAY_LENINT, and rb_struct_initialize_m().
Referenced by r_object0().
Definition at line 551 of file struct.c.
References argc, num_members(), Qnil, rb_eArgError, rb_mem_clear(), rb_obj_class(), rb_raise(), rb_struct_modify(), RSTRUCT_CONST_PTR, and RSTRUCT_SET.
Referenced by InitVM_Struct(), and rb_struct_initialize().
Definition at line 760 of file struct.c.
References inspect_struct(), and rb_exec_recursive().
Referenced by InitVM_Struct().
Definition at line 936 of file struct.c.
References Qnil, and rb_struct_lookup_default().
Referenced by rb_obj_dig(), rb_struct_aset(), and rb_struct_dig().
Definition at line 942 of file struct.c.
References rb_struct_pos(), and RSTRUCT_GET.
Referenced by rb_struct_aset(), and rb_struct_lookup().
Definition at line 65 of file struct.c.
References RARRAY_LEN, rb_eTypeError, rb_obj_class(), rb_raise(), rb_struct_s_members(), and RSTRUCT_LEN.
Referenced by inspect_struct(), rb_struct_each_pair(), rb_struct_to_h(), and w_object().
Definition at line 199 of file struct.c.
References rb_obj_class(), and rb_struct_s_members_m().
Referenced by InitVM_Struct().
|
static |
Definition at line 244 of file struct.c.
References rb_check_frozen, and rb_check_trusted().
Referenced by rb_struct_aset(), and rb_struct_initialize_m().
Definition at line 605 of file struct.c.
References N_REF_FUNC, num_members(), numberof, RARRAY_PTR, rb_ary_tmp_new(), rb_class_new_instance(), rb_long2int, and size.
Referenced by etc_getlogin(), etc_getpwent(), and p_gid_switch().
Definition at line 826 of file struct.c.
References invalid_struct_pos(), len, LONG2FIX, name, NIL_P, NORETURN(), NUM2LONG, rb_check_symbol(), RB_TYPE_P, RSTRUCT_LEN, struct_member_pos(), T_STRING, and T_SYMBOL.
Referenced by rb_struct_aref(), rb_struct_aset(), and rb_struct_lookup_default().
Definition at line 1136 of file struct.c.
References RSTRUCT_CONST_PTR.
Definition at line 217 of file struct.c.
References RSTRUCT_GET.
Definition at line 218 of file struct.c.
References RSTRUCT_GET.
Definition at line 219 of file struct.c.
References RSTRUCT_GET.
Definition at line 220 of file struct.c.
References RSTRUCT_GET.
Definition at line 221 of file struct.c.
References RSTRUCT_GET.
Definition at line 222 of file struct.c.
References RSTRUCT_GET.
Definition at line 223 of file struct.c.
References RSTRUCT_GET.
Definition at line 224 of file struct.c.
References RSTRUCT_GET.
Definition at line 225 of file struct.c.
References RSTRUCT_GET.
Definition at line 226 of file struct.c.
References RSTRUCT_GET.
Definition at line 493 of file struct.c.
References anonymous_struct(), argc, argv, name, new_struct(), NIL_P, OBJ_FREEZE_RAW, PRIsVALUE, Qnil, Qtrue, rb_block_given_p(), rb_check_arity, rb_eArgError, rb_hash_keys(), rb_ident_hash_new(), rb_mod_module_eval(), rb_raise(), rb_to_symbol(), RBASIC_CLEAR_CLASS, RHASH_TBL, setup_struct(), st_clear(), st_insert, SYMBOL_P, and UNLIMITED_ARGUMENTS.
Referenced by InitVM_Struct().
Definition at line 51 of file struct.c.
References id_members, NIL_P, rb_eTypeError, rb_raise(), RB_TYPE_P, struct_ivar_get(), and T_ARRAY.
Referenced by r_object0(), rb_struct_members(), and rb_struct_s_members_m().
Definition at line 180 of file struct.c.
References rb_ary_dup(), and rb_struct_s_members().
Referenced by rb_struct_members_m(), and setup_struct().
Definition at line 990 of file struct.c.
References rb_ary_new(), rb_ary_push(), rb_check_arity, rb_yield(), result, RETURN_SIZED_ENUMERATOR, RSTRUCT_GET, RSTRUCT_LEN, RTEST, and struct_enum_size().
Referenced by InitVM_Struct().
Definition at line 1130 of file struct.c.
References LONG2FIX, and RSTRUCT_LEN.
Referenced by InitVM_Struct(), and struct_enum_size().
Definition at line 778 of file struct.c.
References rb_ary_new4, RSTRUCT_CONST_PTR, and RSTRUCT_LEN.
Referenced by InitVM_Struct().
Definition at line 795 of file struct.c.
References rb_ary_entry(), rb_hash_aset(), rb_hash_new(), rb_struct_members(), RSTRUCT_GET, and RSTRUCT_LEN.
Referenced by InitVM_Struct().
Definition at line 970 of file struct.c.
References rb_get_values_at(), RSTRUCT_LEN, and struct_entry().
Referenced by InitVM_Struct().
Definition at line 1080 of file struct.c.
References len, RString::ptr, Qfalse, Qtrue, rb_eql(), RSTRUCT_CONST_PTR, and RSTRUCT_LEN.
Referenced by rb_struct_eql().
Definition at line 1008 of file struct.c.
References len, RString::ptr, Qfalse, Qtrue, rb_equal(), RSTRUCT_CONST_PTR, and RSTRUCT_LEN.
Referenced by rb_struct_equal().
Definition at line 298 of file struct.c.
References define_aref_method(), define_aset_method(), ID2SYM, len, LONG2NUM, N_REF_FUNC, RARRAY_CONST_PTR, RARRAY_LEN, rb_class_new_instance(), rb_define_alloc_func(), rb_define_method_id(), rb_define_singleton_method(), rb_id_attrset(), rb_struct_s_members_m(), ref_func, struct_alloc(), struct_set_members(), and SYM2ID.
Referenced by rb_struct_define(), rb_struct_define_under(), and rb_struct_s_def().
Definition at line 577 of file struct.c.
References ALLOC_N, FL_WB_PROTECTED, NEWOBJ_OF, num_members(), rb_mem_clear(), RBASIC, RGENGC_WB_PROTECTED_STRUCT, RSTRUCT_EMBED_LEN_MASK, RSTRUCT_EMBED_LEN_MAX, RSTRUCT_EMBED_LEN_SHIFT, and T_STRUCT.
Referenced by rb_struct_alloc_noinit(), setup_struct(), and struct_define_without_accessor().
|
static |
Definition at line 355 of file struct.c.
References anonymous_struct(), rb_define_alloc_func(), rb_define_class(), rb_define_class_under(), struct_alloc(), and struct_set_members().
Referenced by rb_struct_define_without_accessor(), and rb_struct_define_without_accessor_under().
Definition at line 950 of file struct.c.
References LONG2NUM, and rb_struct_aref().
Referenced by rb_struct_values_at().
Definition at line 626 of file struct.c.
References rb_struct_size().
Referenced by rb_struct_each(), rb_struct_each_pair(), and rb_struct_select().
Definition at line 31 of file struct.c.
References NIL_P, Qnil, rb_attr_get(), rb_cStruct, rb_ivar_set(), and RCLASS_SUPER.
Referenced by num_members(), rb_struct_s_members(), and struct_member_pos().
|
static |
Definition at line 334 of file struct.c.
References RString::ary, list, OBJ_FREEZE_RAW, Qtrue, rb_eArgError, rb_hash_keys(), rb_ident_hash_new(), rb_raise(), rb_sym_intern_ascii_cstr(), RBASIC_CLEAR_CLASS, RHASH_TBL, st_clear(), st_insert, and sym.
Referenced by rb_struct_define(), rb_struct_define_under(), rb_struct_define_without_accessor(), and rb_struct_define_without_accessor_under().
Definition at line 132 of file struct.c.
References AREF_HASH_THRESHOLD, FIX2INT, id_back_members, NIL_P, RARRAY_AREF, RARRAY_CONST_PTR, RARRAY_LEN, rb_eTypeError, rb_obj_class(), rb_raise(), RB_TYPE_P, RSTRUCT_LEN, RTEST, struct_ivar_get(), struct_member_pos_ideal(), struct_member_pos_probe(), T_ARRAY, and UNLIKELY.
Referenced by rb_struct_getmember(), and rb_struct_pos().
|
static |
Definition at line 77 of file struct.c.
References ID_SCOPE_SHIFT, and SYM2ID.
Referenced by struct_member_pos(), and struct_set_members().
|
static |
Definition at line 84 of file struct.c.
References AREF_HASH_UNIT.
Referenced by struct_member_pos(), and struct_set_members().
Definition at line 91 of file struct.c.
References AREF_HASH_THRESHOLD, AREF_HASH_UNIT, id_back_members, id_members, INT2FIX, name, OBJ_FREEZE_RAW, RARRAY_AREF, RARRAY_LEN, rb_ary_store(), rb_ary_tmp_new(), rb_ivar_set(), RTEST, struct_member_pos_ideal(), and struct_member_pos_probe().
Referenced by setup_struct(), and struct_define_without_accessor().
|
static |
Definition at line 26 of file struct.c.
Referenced by Init_Struct(), struct_member_pos(), and struct_set_members().
|
static |
Definition at line 26 of file struct.c.
Referenced by Init_Struct(), num_members(), rb_struct_s_members(), and struct_set_members().
VALUE rb_cStruct |
Definition at line 25 of file struct.c.
Referenced by InitVM_Struct(), rb_struct_define(), rb_struct_define_under(), and struct_ivar_get().