#include "ruby/ruby.h"
#include "ruby/util.h"
#include "node.h"
Go to the source code of this file.
#define DEFINE_ENUMFUNCS | ( | name | ) |
static VALUE enum_##name##_func(VALUE result, VALUE *memo); \ \ static VALUE \ name##_i(VALUE i, VALUE *memo, int argc, VALUE *argv) \ { \ return enum_##name##_func(enum_values_pack(argc, argv), memo); \ } \ \ static VALUE \ name##_iter_i(VALUE i, VALUE *memo, int argc, VALUE *argv) \ { \ return enum_##name##_func(enum_yield(argc, argv), memo); \ } \ \ static VALUE \ enum_##name##_func(VALUE result, VALUE *memo)
#define ENUM_WANT_SVALUE | ( | ) |
do { \ i = enum_values_pack(argc, argv); \ } while (0)
Definition at line 27 of file enum.c.
Referenced by chunk_ii(), count_i(), cycle_i(), drop_while_i(), each_cons_i(), each_slice_i(), each_val_i(), each_with_object_i(), find_all_i(), find_i(), find_index_i(), first_i(), grep_i(), grep_iter_i(), group_by_i(), inject_i(), inject_op_i(), max_by_i(), max_i(), max_ii(), min_by_i(), min_i(), min_ii(), minmax_by_i(), minmax_i(), minmax_ii(), partition_i(), reject_i(), slicebefore_ii(), and sort_by_i().
#define enum_yield rb_yield_values2 |
Definition at line 31 of file enum.c.
Referenced by collect_i(), count_iter_i(), find_index_iter_i(), flat_map_i(), and take_while_i().
Definition at line 896 of file enum.c.
Referenced by enum_all(), enum_any(), enum_none(), and enum_one().
#define rb_intern | ( | str | ) | rb_intern_const(str) |
Definition at line 1859 of file enum.c.
References id_next, and rb_funcall().
Referenced by zip_i().
Definition at line 2237 of file enum.c.
References chunk_arg::categorize, chunk_ii(), id_each, NIL_P, chunk_arg::prev_elts, chunk_arg::prev_value, rb_assoc_new(), rb_block_call, rb_funcall(), rb_intern, rb_ivar_get(), rb_obj_dup(), chunk_arg::state, and chunk_arg::yielder.
Referenced by enum_chunk().
Definition at line 2187 of file enum.c.
References chunk_arg::categorize, ENUM_WANT_SVALUE, ID2SYM, NIL_P, chunk_arg::prev_elts, chunk_arg::prev_value, rb_ary_new3(), rb_ary_push(), rb_assoc_new(), rb_equal(), rb_eRuntimeError, rb_funcall(), rb_id2name(), rb_intern, rb_raise(), separator, chunk_arg::state, SYM2ID, SYMBOL_P, and chunk_arg::yielder.
Referenced by chunk_i().
Definition at line 377 of file enum.c.
References enum_values_pack(), rb_ary_push(), and rb_thread_check_ints().
Referenced by enum_to_a().
Definition at line 369 of file enum.c.
References enum_yield, and rb_ary_push().
Referenced by enum_collect().
Definition at line 90 of file enum.c.
References ENUM_WANT_SVALUE, and rb_equal().
Definition at line 103 of file enum.c.
References enum_yield, and RTEST.
Definition at line 2118 of file enum.c.
References ENUM_WANT_SVALUE, rb_ary_push(), and rb_yield().
Referenced by enum_cycle().
DEFINE_ENUMFUNCS | ( | any | ) |
Definition at line 951 of file enum.c.
References rb_iter_break(), result, and RTEST.
DEFINE_ENUMFUNCS | ( | all | ) |
Definition at line 916 of file enum.c.
References rb_iter_break(), result, and RTEST.
DEFINE_ENUMFUNCS | ( | none | ) |
Definition at line 1029 of file enum.c.
References rb_iter_break(), result, and RTEST.
DEFINE_ENUMFUNCS | ( | one | ) |
Definition at line 2035 of file enum.c.
References enum_values_pack(), and rb_ary_push().
Referenced by enum_drop().
Definition at line 2076 of file enum.c.
References ENUM_WANT_SVALUE, rb_ary_push(), rb_yield(), and RTEST.
Referenced by enum_drop_while().
Definition at line 1742 of file enum.c.
References ENUM_WANT_SVALUE, RARRAY_LEN, rb_ary_dup(), rb_ary_push(), rb_ary_shift(), rb_yield(), and size.
Referenced by enum_each_cons().
Definition at line 1688 of file enum.c.
References ENUM_WANT_SVALUE, RARRAY_LEN, rb_ary_new2(), rb_ary_push(), rb_yield(), and size.
Referenced by enum_each_slice().
Definition at line 1647 of file enum.c.
References ENUM_WANT_SVALUE, and rb_yield().
Referenced by enum_each_entry().
Definition at line 1578 of file enum.c.
References enum_values_pack(), INT2NUM(), and rb_yield_values().
Referenced by enum_each_with_index().
Definition at line 1797 of file enum.c.
References ENUM_WANT_SVALUE, and rb_yield_values().
Referenced by enum_each_with_object().
Definition at line 943 of file enum.c.
References ENUMFUNC, id_each, rb_block_call, and result.
Referenced by Init_Enumerable().
Definition at line 979 of file enum.c.
References ENUMFUNC, id_each, rb_block_call, and result.
Referenced by Init_Enumerable().
Definition at line 2356 of file enum.c.
References chunk_i(), rb_block_call, rb_block_given_p(), rb_block_proc(), rb_cEnumerator, rb_eArgError, rb_intern, rb_ivar_set(), rb_obj_alloc(), rb_raise(), and rb_scan_args().
Referenced by Init_Enumerable().
Definition at line 403 of file enum.c.
References collect_i(), id_each, rb_ary_new(), rb_block_call, and RETURN_ENUMERATOR.
Referenced by Init_Enumerable().
Definition at line 142 of file enum.c.
References func, id_each, INT2NUM(), rb_block_call, rb_block_given_p(), rb_scan_args(), and rb_warn().
Referenced by Init_Enumerable().
Definition at line 2149 of file enum.c.
References cycle_i(), id_each, len, NIL_P, NUM2LONG(), RARRAY_LEN, RARRAY_PTR, rb_ary_new(), rb_block_call, rb_scan_args(), rb_yield(), RBASIC, and RETURN_ENUMERATOR.
Referenced by Init_Enumerable().
Definition at line 2059 of file enum.c.
References drop_i(), id_each, len, NUM2LONG(), rb_ary_new(), rb_block_call, rb_eArgError, and rb_raise().
Referenced by Init_Enumerable().
Definition at line 2106 of file enum.c.
References drop_while_i(), id_each, rb_ary_new(), rb_block_call, and RETURN_ENUMERATOR.
Referenced by Init_Enumerable().
Definition at line 1781 of file enum.c.
References each_cons_i(), id_each, NUM2LONG(), rb_ary_new2(), rb_block_call, rb_eArgError, rb_raise(), RETURN_ENUMERATOR, and size.
Referenced by Init_Enumerable().
Definition at line 1680 of file enum.c.
References each_val_i(), id_each, rb_block_call, and RETURN_ENUMERATOR.
Referenced by Init_Enumerable().
Definition at line 1723 of file enum.c.
References each_slice_i(), id_each, NUM2LONG(), RARRAY_LEN, rb_ary_new2(), rb_block_call, rb_eArgError, rb_raise(), rb_yield(), RETURN_ENUMERATOR, and size.
Referenced by Init_Enumerable().
Definition at line 1605 of file enum.c.
References each_with_index_i(), id_each, rb_block_call, and RETURN_ENUMERATOR.
Referenced by Init_Enumerable().
Definition at line 1819 of file enum.c.
References each_with_object_i(), id_each, rb_block_call, and RETURN_ENUMERATOR.
Referenced by Init_Enumerable().
Definition at line 200 of file enum.c.
References find_i(), id_each, NIL_P, Qundef, rb_block_call, rb_funcall(), rb_intern, rb_scan_args(), and RETURN_ENUMERATOR.
Referenced by Init_Enumerable().
Definition at line 318 of file enum.c.
References find_all_i(), id_each, rb_ary_new(), rb_block_call, and RETURN_ENUMERATOR.
Referenced by Init_Enumerable().
Definition at line 265 of file enum.c.
References func, id_each, rb_block_call, rb_block_given_p(), rb_scan_args(), rb_warn(), and RETURN_ENUMERATOR.
Referenced by Init_Enumerable().
Definition at line 716 of file enum.c.
References first_i(), id_each, len, NUM2LONG(), rb_ary_new2(), rb_block_call, rb_eArgError, rb_raise(), and rb_scan_args().
Referenced by Init_Enumerable().
Definition at line 449 of file enum.c.
References flat_map_i(), id_each, rb_ary_new(), rb_block_call, and RETURN_ENUMERATOR.
Referenced by Init_Enumerable().
Definition at line 76 of file enum.c.
References grep_i(), grep_iter_i(), id_each, rb_ary_new(), rb_block_call, and rb_block_given_p().
Referenced by Init_Enumerable().
Definition at line 669 of file enum.c.
References group_by_i(), id_each, OBJ_INFECT, rb_block_call, rb_hash_new(), and RETURN_ENUMERATOR.
Referenced by Init_Enumerable().
Definition at line 560 of file enum.c.
References id_each, inject_i(), Qundef, rb_block_call, rb_block_given_p(), rb_scan_args(), rb_to_id(), and rb_warning().
Referenced by Init_Enumerable().
Definition at line 1183 of file enum.c.
References id_each, max_i(), max_ii(), Qundef, rb_block_call, rb_block_given_p(), and result.
Referenced by Init_Enumerable().
Definition at line 1427 of file enum.c.
References id_each, max_by_i(), rb_block_call, and RETURN_ENUMERATOR.
Referenced by Init_Enumerable().
Definition at line 1567 of file enum.c.
References id_each, member_i(), and rb_block_call.
Referenced by Init_Enumerable().
Definition at line 1116 of file enum.c.
References id_each, min_i(), min_ii(), Qundef, rb_block_call, rb_block_given_p(), and result.
Referenced by Init_Enumerable().
Definition at line 1381 of file enum.c.
References id_each, min_by_i(), rb_block_call, and RETURN_ENUMERATOR.
Referenced by Init_Enumerable().
Definition at line 1323 of file enum.c.
References id_each, minmax_t::last, minmax_t::max, minmax_t::min, minmax_i(), minmax_i_update(), minmax_ii(), minmax_ii_update(), Qnil, Qundef, rb_ary_new3(), rb_ary_store(), rb_block_call, and rb_block_given_p().
Referenced by Init_Enumerable().
Definition at line 1525 of file enum.c.
References id_each, minmax_by_t::last, minmax_by_t::last_bv, minmax_by_t::max, minmax_by_t::max_bv, minmax_by_t::min, minmax_by_t::min_bv, minmax_by_i(), minmax_by_i_update(), Qundef, rb_assoc_new(), rb_block_call, and RETURN_ENUMERATOR.
Referenced by Init_Enumerable().
Definition at line 1054 of file enum.c.
References ENUMFUNC, id_each, rb_block_call, and result.
Referenced by Init_Enumerable().
Definition at line 1020 of file enum.c.
References ENUMFUNC, id_each, one(), Qundef, rb_block_call, and result.
Referenced by Init_Enumerable().
Definition at line 620 of file enum.c.
References id_each, partition_i(), rb_ary_new(), rb_assoc_new(), rb_block_call, and RETURN_ENUMERATOR.
Referenced by Init_Enumerable().
Definition at line 356 of file enum.c.
References id_each, rb_ary_new(), rb_block_call, reject_i(), and RETURN_ENUMERATOR.
Referenced by Init_Enumerable().
Definition at line 1629 of file enum.c.
References enum_to_a(), RARRAY_LEN, RARRAY_PTR, rb_yield(), and RETURN_ENUMERATOR.
Referenced by Init_Enumerable().
Definition at line 2572 of file enum.c.
References rb_block_call, rb_block_given_p(), rb_block_proc(), rb_cEnumerator, rb_intern, rb_ivar_set(), rb_obj_alloc(), rb_scan_args(), slicebefore_arg::sep_pat, and slicebefore_i().
Referenced by Init_Enumerable().
Definition at line 759 of file enum.c.
References enum_to_a(), and rb_ary_sort().
Referenced by Init_Enumerable().
Definition at line 865 of file enum.c.
References id_each, OBJ_INFECT, RARRAY_LEN, RARRAY_PTR, rb_ary_new(), rb_ary_new2(), rb_block_call, rb_cArray, rb_eRuntimeError, rb_raise(), RBASIC, RETURN_ENUMERATOR, RNODE, ruby_qsort(), sort_by_cmp(), sort_by_i(), T_ARRAY, and TYPE.
Referenced by Init_Enumerable().
Definition at line 1983 of file enum.c.
References id_each, len, NUM2LONG(), rb_ary_new(), rb_ary_new2(), rb_block_call, rb_eArgError, rb_raise(), and take_i().
Referenced by Init_Enumerable().
Definition at line 2024 of file enum.c.
References id_each, rb_ary_new(), rb_block_call, RETURN_ENUMERATOR, and take_while_i().
Referenced by Init_Enumerable().
Definition at line 472 of file enum.c.
References collect_all(), id_each, OBJ_INFECT, rb_ary_new(), and rb_block_call.
Referenced by enum_reverse_each(), enum_sort(), and Init_Enumerable().
Definition at line 20 of file enum.c.
References rb_ary_new4().
Referenced by collect_all(), drop_i(), each_with_index_i(), member_i(), take_i(), take_while_i(), zip_ary(), and zip_i().
Definition at line 1929 of file enum.c.
References CONST_ID, ID2SYM, id_each, NIL_P, NODE_DOT2, RARRAY_PTR, rb_ary_new(), rb_ary_new4(), rb_block_call, rb_block_given_p(), rb_check_array_type(), rb_funcall(), rb_node_newnode, result, zip_ary(), and zip_i().
Referenced by Init_Enumerable().
Definition at line 289 of file enum.c.
References ENUM_WANT_SVALUE, rb_ary_push(), rb_yield(), and RTEST.
Referenced by enum_find_all().
Definition at line 169 of file enum.c.
References ENUM_WANT_SVALUE, rb_iter_break(), rb_yield(), and RTEST.
Referenced by enum_find().
Definition at line 218 of file enum.c.
References ENUM_WANT_SVALUE, rb_equal(), rb_iter_break(), and UINT2NUM().
Definition at line 233 of file enum.c.
References enum_yield, rb_iter_break(), RTEST, and UINT2NUM().
Definition at line 683 of file enum.c.
References ENUM_WANT_SVALUE, NIL_P, rb_ary_push(), and rb_iter_break().
Referenced by enum_first().
Definition at line 416 of file enum.c.
References enum_yield, NIL_P, rb_ary_concat(), rb_ary_push(), and rb_check_array_type().
Referenced by enum_flat_map().
Definition at line 34 of file enum.c.
References ENUM_WANT_SVALUE, id_eqq, rb_ary_push(), rb_funcall(), and RTEST.
Referenced by enum_grep().
Definition at line 46 of file enum.c.
References ENUM_WANT_SVALUE, id_eqq, rb_ary_push(), rb_funcall(), rb_yield(), and RTEST.
Referenced by enum_grep().
Definition at line 634 of file enum.c.
References ENUM_WANT_SVALUE, NIL_P, rb_ary_new3(), rb_ary_push(), rb_hash_aref(), rb_hash_aset(), and rb_yield().
Referenced by enum_group_by().
void Init_Enumerable | ( | void | ) |
Definition at line 2606 of file enum.c.
References enum_all(), enum_any(), enum_chunk(), enum_collect(), enum_count(), enum_cycle(), enum_drop(), enum_drop_while(), enum_each_cons(), enum_each_entry(), enum_each_slice(), enum_each_with_index(), enum_each_with_object(), enum_find(), enum_find_all(), enum_find_index(), enum_first(), enum_flat_map(), enum_grep(), enum_group_by(), enum_inject(), enum_max(), enum_max_by(), enum_member(), enum_min(), enum_min_by(), enum_minmax(), enum_minmax_by(), enum_none(), enum_one(), enum_partition(), enum_reject(), enum_reverse_each(), enum_slice_before(), enum_sort(), enum_sort_by(), enum_take(), enum_take_while(), enum_to_a(), enum_zip(), id_cmp, id_each, id_eqq, id_next, id_size, rb_define_method(), rb_define_module(), rb_intern, and rb_mEnumerable.
Definition at line 483 of file enum.c.
References ENUM_WANT_SVALUE, Qundef, and rb_yield_values().
Referenced by enum_inject().
Definition at line 499 of file enum.c.
References ENUM_WANT_SVALUE, Qundef, and rb_funcall().
Definition at line 1394 of file enum.c.
References ENUM_WANT_SVALUE, id_cmp, Qundef, rb_cmpint(), rb_funcall(), and rb_yield().
Referenced by enum_max_by().
Definition at line 1131 of file enum.c.
References cmp, ENUM_WANT_SVALUE, id_cmp, Qundef, rb_cmpint(), and rb_funcall().
Referenced by enum_max().
Definition at line 1150 of file enum.c.
References cmp, ENUM_WANT_SVALUE, Qundef, rb_cmpint(), and rb_yield_values().
Referenced by enum_max().
Definition at line 1544 of file enum.c.
References enum_values_pack(), rb_equal(), and rb_iter_break().
Referenced by enum_member().
Definition at line 1348 of file enum.c.
References ENUM_WANT_SVALUE, id_cmp, Qundef, rb_cmpint(), rb_funcall(), and rb_yield().
Referenced by enum_min_by().
Definition at line 1063 of file enum.c.
References cmp, ENUM_WANT_SVALUE, id_cmp, Qundef, rb_cmpint(), and rb_funcall().
Referenced by enum_min().
Definition at line 1082 of file enum.c.
References cmp, ENUM_WANT_SVALUE, Qundef, rb_cmpint(), and rb_yield_values().
Referenced by enum_min().
Definition at line 1470 of file enum.c.
References ENUM_WANT_SVALUE, id_cmp, minmax_by_t::last, minmax_by_t::last_bv, minmax_by_i_update(), Qundef, rb_cmpint(), rb_funcall(), and rb_yield().
Referenced by enum_minmax_by().
static void minmax_by_i_update | ( | VALUE | v1, | |
VALUE | v2, | |||
VALUE | i1, | |||
VALUE | i2, | |||
struct minmax_by_t * | memo | |||
) | [static] |
Definition at line 1449 of file enum.c.
References id_cmp, minmax_by_t::max, minmax_by_t::max_bv, minmax_by_t::min, minmax_by_t::min_bv, Qundef, rb_cmpint(), and rb_funcall().
Referenced by enum_minmax_by(), and minmax_by_i().
Definition at line 1225 of file enum.c.
References ENUM_WANT_SVALUE, id_cmp, minmax_t::last, minmax_i_update(), Qundef, rb_cmpint(), and rb_funcall().
Referenced by enum_minmax().
Definition at line 1204 of file enum.c.
References id_cmp, minmax_t::max, minmax_t::min, Qundef, rb_cmpint(), and rb_funcall().
Referenced by enum_minmax(), and minmax_i().
Definition at line 1277 of file enum.c.
References ENUM_WANT_SVALUE, minmax_t::last, minmax_ii_update(), Qundef, rb_cmpint(), and rb_yield_values().
Referenced by enum_minmax().
Definition at line 1256 of file enum.c.
References minmax_t::max, minmax_t::min, Qundef, rb_cmpint(), and rb_yield_values().
Referenced by enum_minmax(), and minmax_ii().
Definition at line 591 of file enum.c.
References ENUM_WANT_SVALUE, rb_ary_push(), rb_yield(), and RTEST.
Referenced by enum_partition().
Definition at line 331 of file enum.c.
References ENUM_WANT_SVALUE, rb_ary_push(), rb_yield(), and RTEST.
Referenced by enum_reject().
Definition at line 2412 of file enum.c.
References id_each, NIL_P, slicebefore_arg::prev_elts, rb_attr_get(), rb_block_call, rb_funcall(), rb_intern, rb_ivar_get(), rb_obj_dup(), slicebefore_arg::sep_pat, slicebefore_arg::sep_pred, slicebefore_ii(), slicebefore_arg::state, and slicebefore_arg::yielder.
Referenced by enum_slice_before().
Definition at line 2383 of file enum.c.
References ENUM_WANT_SVALUE, id_eqq, NIL_P, slicebefore_arg::prev_elts, rb_ary_new3(), rb_ary_push(), rb_funcall(), rb_intern, RTEST, slicebefore_arg::sep_pat, slicebefore_arg::sep_pred, slicebefore_arg::state, and slicebefore_arg::yielder.
Referenced by slicebefore_i().
static int sort_by_cmp | ( | const void * | ap, | |
const void * | bp, | |||
void * | data | |||
) | [static] |
Definition at line 781 of file enum.c.
References id_cmp, rb_cmpint(), rb_eRuntimeError, rb_funcall(), rb_raise(), and RBASIC.
Referenced by enum_sort_by().
Definition at line 765 of file enum.c.
References ENUM_WANT_SVALUE, NODE_DOT2, rb_ary_push(), rb_eRuntimeError, rb_node_newnode, rb_raise(), rb_yield(), and RBASIC.
Referenced by enum_sort_by().
Definition at line 1964 of file enum.c.
References enum_values_pack(), rb_ary_push(), and rb_iter_break().
Referenced by enum_take().
Definition at line 2001 of file enum.c.
References enum_values_pack(), enum_yield, rb_ary_push(), rb_iter_break(), and RTEST.
Referenced by enum_take_while().
Definition at line 1829 of file enum.c.
References RNode::cnt, enum_values_pack(), NIL_P, Qnil, RARRAY_LEN, RARRAY_PTR, rb_ary_new2(), rb_ary_push(), rb_ary_store(), rb_yield(), result, RNode::u1, RNode::u2, RNode::u3, and RNode::value.
Referenced by enum_zip().
Definition at line 1871 of file enum.c.
References call_next(), call_stop(), enum_values_pack(), NIL_P, Qnil, Qundef, RARRAY_LEN, RARRAY_PTR, rb_ary_new2(), rb_ary_push(), rb_ary_store(), rb_eStopIteration, rb_rescue2(), rb_yield(), result, RNode::u1, RNode::u2, and RNode::value.
Referenced by enum_zip().
Definition at line 17 of file enum.c.
Referenced by Init_Enumerable(), max_by_i(), max_i(), min_by_i(), min_i(), minmax_by_i(), minmax_by_i_update(), minmax_i(), minmax_i_update(), and sort_by_cmp().
Definition at line 17 of file enum.c.
Referenced by chunk_i(), enum_all(), enum_any(), enum_collect(), enum_count(), enum_cycle(), enum_drop(), enum_drop_while(), enum_each_cons(), enum_each_entry(), enum_each_slice(), enum_each_with_index(), enum_each_with_object(), enum_find(), enum_find_all(), enum_find_index(), enum_first(), enum_flat_map(), enum_grep(), enum_group_by(), enum_inject(), enum_max(), enum_max_by(), enum_member(), enum_min(), enum_min_by(), enum_minmax(), enum_minmax_by(), enum_none(), enum_one(), enum_partition(), enum_reject(), enum_sort_by(), enum_take(), enum_take_while(), enum_to_a(), enum_zip(), Init_Enumerable(), and slicebefore_i().
Definition at line 17 of file enum.c.
Referenced by grep_i(), grep_iter_i(), Init_Enumerable(), and slicebefore_ii().
Definition at line 17 of file enum.c.
Referenced by call_next(), and Init_Enumerable().
Definition at line 17 of file enum.c.
Referenced by Init_Enumerable().
Definition at line 16 of file enum.c.
Referenced by Init_Array(), Init_dbm(), Init_Dir(), Init_Enumerable(), Init_Enumerator(), Init_etc(), Init_gdbm(), Init_Hash(), Init_IO(), Init_ossl_asn1(), Init_ossl_config(), Init_Range(), Init_readline(), Init_sdbm(), Init_stringio(), Init_Struct(), and Init_zlib().