summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--array.c4
-rw-r--r--enum.c84
-rw-r--r--enumerator.c38
-rw-r--r--include/ruby/ruby.h3
-rw-r--r--io.c2
-rw-r--r--process.c2
-rw-r--r--range.c22
-rw-r--r--thread.c5
9 files changed, 87 insertions, 78 deletions
diff --git a/ChangeLog b/ChangeLog
index 420ed9e..cdb3a14 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Fri Nov 29 11:26:43 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * include/ruby/ruby.h (rb_block_call_func): add blockarg. block
+ function can take block argument, e.g., proc {|&blockarg| ...}.
+
Thu Nov 28 21:43:48 2013 Zachary Scott <e@zzak.io>
* doc/dtrace_probes.rdoc: [DOC] Import dtrace probes doc from wiki
diff --git a/array.c b/array.c
index b27ae29..83a7274 100644
--- a/array.c
+++ b/array.c
@@ -2616,7 +2616,7 @@ rb_ary_bsearch(VALUE ary)
static VALUE
-sort_by_i(VALUE i)
+sort_by_i(VALUE i, VALUE dummy, int argc, VALUE *argv, VALUE blockarg)
{
return rb_yield(i);
}
@@ -3169,7 +3169,7 @@ rb_ary_delete_if(VALUE ary)
}
static VALUE
-take_i(VALUE val, VALUE *args, int argc, VALUE *argv)
+take_i(VALUE val, VALUE *args, int argc, VALUE *argv, VALUE blockarg)
{
if (args[1]-- == 0) rb_iter_break();
if (argc > 1) val = rb_ary_new4(argc, argv);
diff --git a/enum.c b/enum.c
index ce7d224..02c48ca 100644
--- a/enum.c
+++ b/enum.c
@@ -44,7 +44,7 @@ rb_enum_values_pack(int argc, VALUE *argv)
#define enum_yield rb_yield_values2
static VALUE
-grep_i(VALUE i, VALUE args, int argc, VALUE *argv)
+grep_i(VALUE i, VALUE args, int argc, VALUE *argv, VALUE blockarg)
{
NODE *memo = RNODE(args);
ENUM_WANT_SVALUE();
@@ -56,7 +56,7 @@ grep_i(VALUE i, VALUE args, int argc, VALUE *argv)
}
static VALUE
-grep_iter_i(VALUE i, VALUE args, int argc, VALUE *argv)
+grep_iter_i(VALUE i, VALUE args, int argc, VALUE *argv, VALUE blockarg)
{
NODE *memo = RNODE(args);
ENUM_WANT_SVALUE();
@@ -97,7 +97,7 @@ enum_grep(VALUE obj, VALUE pat)
}
static VALUE
-count_i(VALUE i, VALUE memop, int argc, VALUE *argv)
+count_i(VALUE i, VALUE memop, int argc, VALUE *argv, VALUE blockarg)
{
NODE *memo = RNODE(memop);
@@ -110,7 +110,7 @@ count_i(VALUE i, VALUE memop, int argc, VALUE *argv)
}
static VALUE
-count_iter_i(VALUE i, VALUE memop, int argc, VALUE *argv)
+count_iter_i(VALUE i, VALUE memop, int argc, VALUE *argv, VALUE blockarg)
{
NODE *memo = RNODE(memop);
@@ -121,7 +121,7 @@ count_iter_i(VALUE i, VALUE memop, int argc, VALUE *argv)
}
static VALUE
-count_all_i(VALUE i, VALUE memop, int argc, VALUE *argv)
+count_all_i(VALUE i, VALUE memop, int argc, VALUE *argv, VALUE blockarg)
{
NODE *memo = RNODE(memop);
@@ -176,7 +176,7 @@ enum_count(int argc, VALUE *argv, VALUE obj)
}
static VALUE
-find_i(VALUE i, VALUE memop, int argc, VALUE *argv)
+find_i(VALUE i, VALUE memop, int argc, VALUE *argv, VALUE blockarg)
{
ENUM_WANT_SVALUE();
@@ -228,7 +228,7 @@ enum_find(int argc, VALUE *argv, VALUE obj)
}
static VALUE
-find_index_i(VALUE i, VALUE memop, int argc, VALUE *argv)
+find_index_i(VALUE i, VALUE memop, int argc, VALUE *argv, VALUE blockarg)
{
NODE *memo = RNODE(memop);
@@ -243,7 +243,7 @@ find_index_i(VALUE i, VALUE memop, int argc, VALUE *argv)
}
static VALUE
-find_index_iter_i(VALUE i, VALUE memop, int argc, VALUE *argv)
+find_index_iter_i(VALUE i, VALUE memop, int argc, VALUE *argv, VALUE blockarg)
{
NODE *memo = RNODE(memop);
@@ -299,7 +299,7 @@ enum_find_index(int argc, VALUE *argv, VALUE obj)
}
static VALUE
-find_all_i(VALUE i, VALUE ary, int argc, VALUE *argv)
+find_all_i(VALUE i, VALUE ary, int argc, VALUE *argv, VALUE blockarg)
{
ENUM_WANT_SVALUE();
@@ -351,7 +351,7 @@ enum_find_all(VALUE obj)
}
static VALUE
-reject_i(VALUE i, VALUE ary, int argc, VALUE *argv)
+reject_i(VALUE i, VALUE ary, int argc, VALUE *argv, VALUE blockarg)
{
ENUM_WANT_SVALUE();
@@ -392,7 +392,7 @@ enum_reject(VALUE obj)
}
static VALUE
-collect_i(VALUE i, VALUE ary, int argc, VALUE *argv)
+collect_i(VALUE i, VALUE ary, int argc, VALUE *argv, VALUE blockarg)
{
rb_ary_push(ary, enum_yield(argc, argv));
@@ -439,7 +439,7 @@ enum_collect(VALUE obj)
}
static VALUE
-flat_map_i(VALUE i, VALUE ary, int argc, VALUE *argv)
+flat_map_i(VALUE i, VALUE ary, int argc, VALUE *argv, VALUE blockarg)
{
VALUE tmp;
@@ -510,7 +510,7 @@ enum_to_a(int argc, VALUE *argv, VALUE obj)
}
static VALUE
-enum_to_h_i(VALUE i, VALUE hash, int argc, VALUE *argv)
+enum_to_h_i(VALUE i, VALUE hash, int argc, VALUE *argv, VALUE blockarg)
{
ENUM_WANT_SVALUE();
rb_thread_check_ints();
@@ -543,7 +543,7 @@ enum_to_h(int argc, VALUE *argv, VALUE obj)
}
static VALUE
-inject_i(VALUE i, VALUE p, int argc, VALUE *argv)
+inject_i(VALUE i, VALUE p, int argc, VALUE *argv, VALUE blockarg)
{
NODE *memo = RNODE(p);
@@ -560,7 +560,7 @@ inject_i(VALUE i, VALUE p, int argc, VALUE *argv)
}
static VALUE
-inject_op_i(VALUE i, VALUE p, int argc, VALUE *argv)
+inject_op_i(VALUE i, VALUE p, int argc, VALUE *argv, VALUE blockarg)
{
NODE *memo = RNODE(p);
VALUE name;
@@ -631,7 +631,7 @@ enum_inject(int argc, VALUE *argv, VALUE obj)
{
NODE *memo;
VALUE init, op;
- VALUE (*iter)(VALUE, VALUE, int, VALUE*) = inject_i;
+ rb_block_call_func *iter = inject_i;
ID id;
switch (rb_scan_args(argc, argv, "02", &init, &op)) {
@@ -662,7 +662,7 @@ enum_inject(int argc, VALUE *argv, VALUE obj)
}
static VALUE
-partition_i(VALUE i, VALUE arys, int argc, VALUE *argv)
+partition_i(VALUE i, VALUE arys, int argc, VALUE *argv, VALUE blockarg)
{
NODE *memo = RNODE(arys);
VALUE ary;
@@ -707,7 +707,7 @@ enum_partition(VALUE obj)
}
static VALUE
-group_by_i(VALUE i, VALUE hash, int argc, VALUE *argv)
+group_by_i(VALUE i, VALUE hash, int argc, VALUE *argv, VALUE blockarg)
{
VALUE group;
VALUE values;
@@ -756,7 +756,7 @@ enum_group_by(VALUE obj)
}
static VALUE
-first_i(VALUE i, VALUE params, int argc, VALUE *argv)
+first_i(VALUE i, VALUE params, int argc, VALUE *argv, VALUE blockarg)
{
NODE *memo = RNODE(params);
ENUM_WANT_SVALUE();
@@ -832,7 +832,7 @@ struct sort_by_data {
};
static VALUE
-sort_by_i(VALUE i, VALUE _data, int argc, VALUE *argv)
+sort_by_i(VALUE i, VALUE _data, int argc, VALUE *argv, VALUE blockarg)
{
struct sort_by_data *data = (struct sort_by_data *)&RNODE(_data)->u1;
VALUE ary = data->ary;
@@ -1162,7 +1162,7 @@ enum_none(VALUE obj)
}
static VALUE
-min_i(VALUE i, VALUE args, int argc, VALUE *argv)
+min_i(VALUE i, VALUE args, int argc, VALUE *argv, VALUE blockarg)
{
VALUE cmp;
NODE *memo = RNODE(args);
@@ -1234,7 +1234,7 @@ enum_min(VALUE obj)
}
static VALUE
-max_i(VALUE i, VALUE args, int argc, VALUE *argv)
+max_i(VALUE i, VALUE args, int argc, VALUE *argv, VALUE blockarg)
{
NODE *memo = RNODE(args);
VALUE cmp;
@@ -1334,7 +1334,7 @@ minmax_i_update(VALUE i, VALUE j, struct minmax_t *memo)
}
static VALUE
-minmax_i(VALUE i, VALUE _memo, int argc, VALUE *argv)
+minmax_i(VALUE i, VALUE _memo, int argc, VALUE *argv, VALUE blockarg)
{
struct minmax_t *memo = (struct minmax_t *)&RNODE(_memo)->u1.value;
int n;
@@ -1458,7 +1458,7 @@ enum_minmax(VALUE obj)
}
static VALUE
-min_by_i(VALUE i, VALUE args, int argc, VALUE *argv)
+min_by_i(VALUE i, VALUE args, int argc, VALUE *argv, VALUE blockarg)
{
NODE *memo = RNODE(args);
VALUE v;
@@ -1504,7 +1504,7 @@ enum_min_by(VALUE obj)
}
static VALUE
-max_by_i(VALUE i, VALUE args, int argc, VALUE *argv)
+max_by_i(VALUE i, VALUE args, int argc, VALUE *argv, VALUE blockarg)
{
NODE *memo = RNODE(args);
VALUE v;
@@ -1580,7 +1580,7 @@ minmax_by_i_update(VALUE v1, VALUE v2, VALUE i1, VALUE i2, struct minmax_by_t *m
}
static VALUE
-minmax_by_i(VALUE i, VALUE _memo, int argc, VALUE *argv)
+minmax_by_i(VALUE i, VALUE _memo, int argc, VALUE *argv, VALUE blockarg)
{
struct minmax_by_t *memo = MEMO_FOR(struct minmax_by_t, _memo);
VALUE vi, vj, j;
@@ -1656,7 +1656,7 @@ enum_minmax_by(VALUE obj)
}
static VALUE
-member_i(VALUE iter, VALUE args, int argc, VALUE *argv)
+member_i(VALUE iter, VALUE args, int argc, VALUE *argv, VALUE blockarg)
{
NODE *memo = RNODE(args);
@@ -1690,7 +1690,7 @@ enum_member(VALUE obj, VALUE val)
}
static VALUE
-each_with_index_i(VALUE i, VALUE memo, int argc, VALUE *argv)
+each_with_index_i(VALUE i, VALUE memo, int argc, VALUE *argv, VALUE blockarg)
{
long n = RNODE(memo)->u3.cnt++;
@@ -1766,7 +1766,7 @@ enum_reverse_each(int argc, VALUE *argv, VALUE obj)
static VALUE
-each_val_i(VALUE i, VALUE p, int argc, VALUE *argv)
+each_val_i(VALUE i, VALUE p, int argc, VALUE *argv, VALUE blockarg)
{
ENUM_WANT_SVALUE();
rb_yield(i);
@@ -1811,7 +1811,7 @@ enum_each_entry(int argc, VALUE *argv, VALUE obj)
}
static VALUE
-each_slice_i(VALUE i, VALUE m, int argc, VALUE *argv)
+each_slice_i(VALUE i, VALUE m, int argc, VALUE *argv, VALUE blockarg)
{
NODE *memo = RNODE(m);
VALUE ary = memo->u1.value;
@@ -1878,7 +1878,7 @@ enum_each_slice(VALUE obj, VALUE n)
}
static VALUE
-each_cons_i(VALUE i, VALUE args, int argc, VALUE *argv)
+each_cons_i(VALUE i, VALUE args, int argc, VALUE *argv, VALUE blockarg)
{
NODE *memo = RNODE(args);
VALUE ary = memo->u1.value;
@@ -1946,7 +1946,7 @@ enum_each_cons(VALUE obj, VALUE n)
}
static VALUE
-each_with_object_i(VALUE i, VALUE memo, int argc, VALUE *argv)
+each_with_object_i(VALUE i, VALUE memo, int argc, VALUE *argv, VALUE blockarg)
{
ENUM_WANT_SVALUE();
return rb_yield_values(2, i, memo);
@@ -1977,8 +1977,9 @@ enum_each_with_object(VALUE obj, VALUE memo)
}
static VALUE
-zip_ary(VALUE val, NODE *memo, int argc, VALUE *argv)
+zip_ary(VALUE val, VALUE memoval, int argc, VALUE *argv, VALUE blockarg)
{
+ NODE *memo = (NODE *)memoval;
volatile VALUE result = memo->u1.value;
volatile VALUE args = memo->u2.value;
long n = memo->u3.cnt++;
@@ -2019,8 +2020,9 @@ call_stop(VALUE *v)
}
static VALUE
-zip_i(VALUE val, NODE *memo, int argc, VALUE *argv)
+zip_i(VALUE val, VALUE memoval, int argc, VALUE *argv, VALUE blockarg)
{
+ NODE *memo = (NODE *)memoval;
volatile VALUE result = memo->u1.value;
volatile VALUE args = memo->u2.value;
volatile VALUE tmp;
@@ -2116,7 +2118,7 @@ enum_zip(int argc, VALUE *argv, VALUE obj)
}
static VALUE
-take_i(VALUE i, VALUE args, int argc, VALUE *argv)
+take_i(VALUE i, VALUE args, int argc, VALUE *argv, VALUE blockarg)
{
NODE *memo = RNODE(args);
rb_ary_push(memo->u1.value, rb_enum_values_pack(argc, argv));
@@ -2155,7 +2157,7 @@ enum_take(VALUE obj, VALUE n)
static VALUE
-take_while_i(VALUE i, VALUE ary, int argc, VALUE *argv)
+take_while_i(VALUE i, VALUE ary, int argc, VALUE *argv, VALUE blockarg)
{
if (!RTEST(enum_yield(argc, argv))) rb_iter_break();
rb_ary_push(ary, rb_enum_values_pack(argc, argv));
@@ -2189,7 +2191,7 @@ enum_take_while(VALUE obj)
}
static VALUE
-drop_i(VALUE i, VALUE args, int argc, VALUE *argv)
+drop_i(VALUE i, VALUE args, int argc, VALUE *argv, VALUE blockarg)
{
NODE *memo = RNODE(args);
if (memo->u3.cnt == 0) {
@@ -2232,7 +2234,7 @@ enum_drop(VALUE obj, VALUE n)
static VALUE
-drop_while_i(VALUE i, VALUE args, int argc, VALUE *argv)
+drop_while_i(VALUE i, VALUE args, int argc, VALUE *argv, VALUE blockarg)
{
NODE *memo = RNODE(args);
ENUM_WANT_SVALUE();
@@ -2276,7 +2278,7 @@ enum_drop_while(VALUE obj)
}
static VALUE
-cycle_i(VALUE i, VALUE ary, int argc, VALUE *argv)
+cycle_i(VALUE i, VALUE ary, int argc, VALUE *argv, VALUE blockarg)
{
ENUM_WANT_SVALUE();
@@ -2413,7 +2415,7 @@ chunk_ii(VALUE i, VALUE _argp, int argc, VALUE *argv)
}
static VALUE
-chunk_i(VALUE yielder, VALUE enumerator, int argc, VALUE *argv)
+chunk_i(VALUE yielder, VALUE enumerator, int argc, VALUE *argv, VALUE blockarg)
{
VALUE enumerable;
VALUE arg;
@@ -2587,7 +2589,7 @@ slicebefore_ii(VALUE i, VALUE _argp, int argc, VALUE *argv)
}
static VALUE
-slicebefore_i(VALUE yielder, VALUE enumerator, int argc, VALUE *argv)
+slicebefore_i(VALUE yielder, VALUE enumerator, int argc, VALUE *argv, VALUE blockarg)
{
VALUE enumerable;
VALUE arg;
diff --git a/enumerator.c b/enumerator.c
index a3022ce..038773e 100644
--- a/enumerator.c
+++ b/enumerator.c
@@ -493,7 +493,7 @@ enumerator_each(int argc, VALUE *argv, VALUE obj)
}
static VALUE
-enumerator_with_index_i(VALUE val, VALUE m, int argc, VALUE *argv)
+enumerator_with_index_i(VALUE val, VALUE m, int argc, VALUE *argv, VALUE blockarg)
{
VALUE *memo = (VALUE *)m;
VALUE idx = *memo;
@@ -557,7 +557,7 @@ enumerator_each_with_index(VALUE obj)
}
static VALUE
-enumerator_with_object_i(VALUE val, VALUE memo, int argc, VALUE *argv)
+enumerator_with_object_i(VALUE val, VALUE memo, int argc, VALUE *argv, VALUE blockarg)
{
if (argc <= 1)
return rb_yield_values(2, val, memo);
@@ -604,7 +604,7 @@ enumerator_with_object(VALUE obj, VALUE memo)
}
static VALUE
-next_ii(VALUE i, VALUE obj, int argc, VALUE *argv)
+next_ii(VALUE i, VALUE obj, int argc, VALUE *argv, VALUE blockarg)
{
struct enumerator *e = enumerator_ptr(obj);
VALUE feedvalue = Qnil;
@@ -1147,7 +1147,7 @@ static VALUE yielder_yield_push(VALUE obj, VALUE args)
}
static VALUE
-yielder_yield_i(VALUE obj, VALUE memo, int argc, VALUE *argv)
+yielder_yield_i(VALUE obj, VALUE memo, int argc, VALUE *argv, VALUE blockarg)
{
return rb_yield_values2(argc, argv);
}
@@ -1318,7 +1318,7 @@ lazy_receiver_size(VALUE generator, VALUE args, VALUE lazy)
}
static VALUE
-lazy_init_iterator(VALUE val, VALUE m, int argc, VALUE *argv)
+lazy_init_iterator(VALUE val, VALUE m, int argc, VALUE *argv, VALUE blockarg)
{
VALUE result;
if (argc == 1) {
@@ -1344,7 +1344,7 @@ lazy_init_iterator(VALUE val, VALUE m, int argc, VALUE *argv)
}
static VALUE
-lazy_init_block_i(VALUE val, VALUE m, int argc, VALUE *argv)
+lazy_init_block_i(VALUE val, VALUE m, int argc, VALUE *argv, VALUE blockarg)
{
rb_block_call(m, id_each, argc-1, argv+1, lazy_init_iterator, val);
return Qnil;
@@ -1504,7 +1504,7 @@ lazy_to_enum(int argc, VALUE *argv, VALUE self)
}
static VALUE
-lazy_map_func(VALUE val, VALUE m, int argc, VALUE *argv)
+lazy_map_func(VALUE val, VALUE m, int argc, VALUE *argv, VALUE blockarg)
{
VALUE result = rb_yield_values2(argc - 1, &argv[1]);
@@ -1525,7 +1525,7 @@ lazy_map(VALUE obj)
}
static VALUE
-lazy_flat_map_i(VALUE i, VALUE yielder, int argc, VALUE *argv)
+lazy_flat_map_i(VALUE i, VALUE yielder, int argc, VALUE *argv, VALUE blockarg)
{
return rb_funcall2(yielder, id_yield, argc, argv);
}
@@ -1554,7 +1554,7 @@ lazy_flat_map_to_ary(VALUE obj, VALUE yielder)
}
static VALUE
-lazy_flat_map_func(VALUE val, VALUE m, int argc, VALUE *argv)
+lazy_flat_map_func(VALUE val, VALUE m, int argc, VALUE *argv, VALUE blockarg)
{
VALUE result = rb_yield_values2(argc - 1, &argv[1]);
if (RB_TYPE_P(result, T_ARRAY)) {
@@ -1610,7 +1610,7 @@ lazy_flat_map(VALUE obj)
}
static VALUE
-lazy_select_func(VALUE val, VALUE m, int argc, VALUE *argv)
+lazy_select_func(VALUE val, VALUE m, int argc, VALUE *argv, VALUE blockarg)
{
VALUE element = rb_enum_values_pack(argc - 1, argv + 1);
@@ -1633,7 +1633,7 @@ lazy_select(VALUE obj)
}
static VALUE
-lazy_reject_func(VALUE val, VALUE m, int argc, VALUE *argv)
+lazy_reject_func(VALUE val, VALUE m, int argc, VALUE *argv, VALUE blockarg)
{
VALUE element = rb_enum_values_pack(argc - 1, argv + 1);
@@ -1656,7 +1656,7 @@ lazy_reject(VALUE obj)
}
static VALUE
-lazy_grep_func(VALUE val, VALUE m, int argc, VALUE *argv)
+lazy_grep_func(VALUE val, VALUE m, int argc, VALUE *argv, VALUE blockarg)
{
VALUE i = rb_enum_values_pack(argc - 1, argv + 1);
VALUE result = rb_funcall(m, id_eqq, 1, i);
@@ -1668,7 +1668,7 @@ lazy_grep_func(VALUE val, VALUE m, int argc, VALUE *argv)
}
static VALUE
-lazy_grep_iter(VALUE val, VALUE m, int argc, VALUE *argv)
+lazy_grep_iter(VALUE val, VALUE m, int argc, VALUE *argv, VALUE blockarg)
{
VALUE i = rb_enum_values_pack(argc - 1, argv + 1);
VALUE result = rb_funcall(m, id_eqq, 1, i);
@@ -1702,7 +1702,7 @@ next_stopped(VALUE obj)
}
static VALUE
-lazy_zip_arrays_func(VALUE val, VALUE arrays, int argc, VALUE *argv)
+lazy_zip_arrays_func(VALUE val, VALUE arrays, int argc, VALUE *argv, VALUE blockarg)
{
VALUE yielder, ary, memo;
long i, count;
@@ -1722,7 +1722,7 @@ lazy_zip_arrays_func(VALUE val, VALUE arrays, int argc, VALUE *argv)
}
static VALUE
-lazy_zip_func(VALUE val, VALUE zip_args, int argc, VALUE *argv)
+lazy_zip_func(VALUE val, VALUE zip_args, int argc, VALUE *argv, VALUE blockarg)
{
VALUE yielder, ary, arg, v;
long i;
@@ -1787,7 +1787,7 @@ lazy_zip(int argc, VALUE *argv, VALUE obj)
}
static VALUE
-lazy_take_func(VALUE val, VALUE args, int argc, VALUE *argv)
+lazy_take_func(VALUE val, VALUE args, int argc, VALUE *argv, VALUE blockarg)
{
long remain;
VALUE memo = rb_attr_get(argv[0], id_memo);
@@ -1836,7 +1836,7 @@ lazy_take(VALUE obj, VALUE n)
}
static VALUE
-lazy_take_while_func(VALUE val, VALUE args, int argc, VALUE *argv)
+lazy_take_while_func(VALUE val, VALUE args, int argc, VALUE *argv, VALUE blockarg)
{
VALUE result = rb_yield_values2(argc - 1, &argv[1]);
if (!RTEST(result)) return Qundef;
@@ -1870,7 +1870,7 @@ lazy_drop_size(VALUE generator, VALUE args, VALUE lazy)
}
static VALUE
-lazy_drop_func(VALUE val, VALUE args, int argc, VALUE *argv)
+lazy_drop_func(VALUE val, VALUE args, int argc, VALUE *argv, VALUE blockarg)
{
long remain;
VALUE memo = rb_attr_get(argv[0], id_memo);
@@ -1900,7 +1900,7 @@ lazy_drop(VALUE obj, VALUE n)
}
static VALUE
-lazy_drop_while_func(VALUE val, VALUE args, int argc, VALUE *argv)
+lazy_drop_while_func(VALUE val, VALUE args, int argc, VALUE *argv, VALUE blockarg)
{
VALUE memo = rb_attr_get(argv[0], id_memo);
if (NIL_P(memo) && !RTEST(rb_yield_values2(argc - 1, &argv[1]))) {
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h
index 69e0d6a..5496213 100644
--- a/include/ruby/ruby.h
+++ b/include/ruby/ruby.h
@@ -1493,7 +1493,8 @@ PRINTF_ARGS(void rb_compile_warn(const char *, int, const char*, ...), 3, 4);
#define RB_IO_WAIT_READABLE 0
#define RB_IO_WAIT_WRITABLE 1
-typedef VALUE rb_block_call_func(VALUE, VALUE, int, VALUE*);
+typedef VALUE rb_block_call_func(VALUE, VALUE, int, VALUE*, VALUE);
+#define RUBY_BLOCK_CALL_FUNC_TAKES_BLOCKARG 1
VALUE rb_each(VALUE);
VALUE rb_yield(VALUE);
diff --git a/io.c b/io.c
index 9cdec94..b5ea661 100644
--- a/io.c
+++ b/io.c
@@ -11127,7 +11127,7 @@ argf_readbyte(VALUE argf)
#define FOREACH_ARGF() while (next_argv())
static VALUE
-argf_block_call_i(VALUE i, VALUE argf, int argc, VALUE *argv)
+argf_block_call_i(VALUE i, VALUE argf, int argc, VALUE *argv, VALUE blockarg)
{
const VALUE current = ARGF.current_file;
rb_yield_values2(argc, argv);
diff --git a/process.c b/process.c
index f1482c7..b478b64 100644
--- a/process.c
+++ b/process.c
@@ -2888,7 +2888,7 @@ run_exec_rlimit(VALUE ary, struct rb_execarg *sargp, char *errmsg, size_t errmsg
#if !defined(HAVE_FORK)
static VALUE
-save_env_i(VALUE i, VALUE ary, int argc, VALUE *argv)
+save_env_i(VALUE i, VALUE ary, int argc, VALUE *argv, VALUE blockarg)
{
rb_ary_push(ary, hide_obj(rb_ary_dup(argv[0])));
return Qnil;
diff --git a/range.c b/range.c
index c772347..b0a59e1 100644
--- a/range.c
+++ b/range.c
@@ -278,7 +278,7 @@ range_hash(VALUE range)
}
static void
-range_each_func(VALUE range, VALUE (*func) (VALUE, void *), void *arg)
+range_each_func(VALUE range, rb_block_call_func *func, VALUE arg)
{
int c;
VALUE b = RANGE_BEG(range);
@@ -287,13 +287,13 @@ range_each_func(VALUE range, VALUE (*func) (VALUE, void *), void *arg)
if (EXCL(range)) {
while (r_lt(v, e)) {
- (*func) (v, arg);
+ (*func) (v, arg, 0, 0, 0);
v = rb_funcall(v, id_succ, 0, 0);
}
}
else {
while ((c = r_le(v, e)) != Qfalse) {
- (*func) (v, arg);
+ (*func) (v, arg, 0, 0, 0);
if (c == (int)INT2FIX(0))
break;
v = rb_funcall(v, id_succ, 0, 0);
@@ -302,9 +302,9 @@ range_each_func(VALUE range, VALUE (*func) (VALUE, void *), void *arg)
}
static VALUE
-sym_step_i(VALUE i, void *arg)
+sym_step_i(VALUE i, VALUE arg, int argc, VALUE *argv, VALUE blockarg)
{
- VALUE *iter = arg;
+ VALUE *iter = (VALUE *)arg;
if (FIXNUM_P(iter[0])) {
iter[0] -= INT2FIX(1) & ~FIXNUM_FLAG;
@@ -320,9 +320,9 @@ sym_step_i(VALUE i, void *arg)
}
static VALUE
-step_i(VALUE i, void *arg)
+step_i(VALUE i, VALUE arg, int argc, VALUE *argv, VALUE blockarg)
{
- VALUE *iter = arg;
+ VALUE *iter = (VALUE *)arg;
if (FIXNUM_P(iter[0])) {
iter[0] -= INT2FIX(1) & ~FIXNUM_FLAG;
@@ -488,7 +488,7 @@ range_step(int argc, VALUE *argv, VALUE range)
}
args[0] = INT2FIX(1);
args[1] = step;
- range_each_func(range, step_i, args);
+ range_each_func(range, step_i, (VALUE)args);
}
}
return range;
@@ -702,14 +702,14 @@ range_bsearch(VALUE range)
}
static VALUE
-each_i(VALUE v, void *arg)
+each_i(VALUE v, VALUE arg, int argc, VALUE *argv, VALUE blockarg)
{
rb_yield(v);
return Qnil;
}
static VALUE
-sym_each_i(VALUE v, void *arg)
+sym_each_i(VALUE v, VALUE arg, int argc, VALUE *argv, VALUE blockarg)
{
rb_yield(rb_str_intern(v));
return Qnil;
@@ -803,7 +803,7 @@ range_each(VALUE range)
rb_raise(rb_eTypeError, "can't iterate from %s",
rb_obj_classname(beg));
}
- range_each_func(range, each_i, NULL);
+ range_each_func(range, each_i, 0);
}
}
return range;
diff --git a/thread.c b/thread.c
index b7c7137..905494f 100644
--- a/thread.c
+++ b/thread.c
@@ -4867,8 +4867,9 @@ struct exec_recursive_params {
};
static VALUE
-exec_recursive_i(VALUE tag, struct exec_recursive_params *p)
+exec_recursive_i(VALUE tag, VALUE data, int argc, VALUE *argv, VALUE blockarg)
{
+ struct exec_recursive_params *p = (void *)data;
VALUE result = Qundef;
int state;
@@ -4926,7 +4927,7 @@ exec_recursive(VALUE (*func) (VALUE, VALUE, int), VALUE obj, VALUE pairid, VALUE
}
}
else {
- result = exec_recursive_i(0, &p);
+ result = exec_recursive_i(0, (VALUE)&p, 0, 0, Qnil);
}
}
*(volatile struct exec_recursive_params *)&p;