1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

ruby/ruby.h: RB_BLOCK_CALL_FUNC_ARGLIST

* include/ruby/ruby.h (RB_BLOCK_CALL_FUNC_ARGLIST): for declaration
  argument list of rb_block_call_func.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43910 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2013-11-29 07:59:14 +00:00
parent f0e73fc986
commit 7566c49068
20 changed files with 100 additions and 92 deletions

View file

@ -1,3 +1,8 @@
Fri Nov 29 16:59:07 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
* include/ruby/ruby.h (RB_BLOCK_CALL_FUNC_ARGLIST): for declaration
argument list of rb_block_call_func.
Fri Nov 29 11:26:43 2013 Nobuyoshi Nakada <nobu@ruby-lang.org> Fri Nov 29 11:26:43 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
* include/ruby/ruby.h (rb_block_call_func): add blockarg. block * include/ruby/ruby.h (rb_block_call_func): add blockarg. block

View file

@ -2616,7 +2616,7 @@ rb_ary_bsearch(VALUE ary)
static VALUE static VALUE
sort_by_i(VALUE i, VALUE dummy, int argc, VALUE *argv, VALUE blockarg) sort_by_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, dummy))
{ {
return rb_yield(i); return rb_yield(i);
} }
@ -3169,7 +3169,7 @@ rb_ary_delete_if(VALUE ary)
} }
static VALUE static VALUE
take_i(VALUE val, VALUE cbarg, int argc, const VALUE *argv, VALUE blockarg) take_i(RB_BLOCK_CALL_FUNC_ARGLIST(val, cbarg))
{ {
VALUE *args = (VALUE *)cbarg; VALUE *args = (VALUE *)cbarg;
if (args[1]-- == 0) rb_iter_break(); if (args[1]-- == 0) rb_iter_break();

96
enum.c
View file

@ -44,7 +44,7 @@ rb_enum_values_pack(int argc, VALUE *argv)
#define enum_yield rb_yield_values2 #define enum_yield rb_yield_values2
static VALUE static VALUE
grep_i(VALUE i, VALUE args, int argc, VALUE *argv, VALUE blockarg) grep_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
{ {
NODE *memo = RNODE(args); NODE *memo = RNODE(args);
ENUM_WANT_SVALUE(); ENUM_WANT_SVALUE();
@ -56,7 +56,7 @@ grep_i(VALUE i, VALUE args, int argc, VALUE *argv, VALUE blockarg)
} }
static VALUE static VALUE
grep_iter_i(VALUE i, VALUE args, int argc, VALUE *argv, VALUE blockarg) grep_iter_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
{ {
NODE *memo = RNODE(args); NODE *memo = RNODE(args);
ENUM_WANT_SVALUE(); ENUM_WANT_SVALUE();
@ -97,7 +97,7 @@ enum_grep(VALUE obj, VALUE pat)
} }
static VALUE static VALUE
count_i(VALUE i, VALUE memop, int argc, VALUE *argv, VALUE blockarg) count_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, memop))
{ {
NODE *memo = RNODE(memop); NODE *memo = RNODE(memop);
@ -110,7 +110,7 @@ count_i(VALUE i, VALUE memop, int argc, VALUE *argv, VALUE blockarg)
} }
static VALUE static VALUE
count_iter_i(VALUE i, VALUE memop, int argc, VALUE *argv, VALUE blockarg) count_iter_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, memop))
{ {
NODE *memo = RNODE(memop); NODE *memo = RNODE(memop);
@ -121,7 +121,7 @@ count_iter_i(VALUE i, VALUE memop, int argc, VALUE *argv, VALUE blockarg)
} }
static VALUE static VALUE
count_all_i(VALUE i, VALUE memop, int argc, VALUE *argv, VALUE blockarg) count_all_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, memop))
{ {
NODE *memo = RNODE(memop); NODE *memo = RNODE(memop);
@ -176,7 +176,7 @@ enum_count(int argc, VALUE *argv, VALUE obj)
} }
static VALUE static VALUE
find_i(VALUE i, VALUE memop, int argc, VALUE *argv, VALUE blockarg) find_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, memop))
{ {
ENUM_WANT_SVALUE(); ENUM_WANT_SVALUE();
@ -228,7 +228,7 @@ enum_find(int argc, VALUE *argv, VALUE obj)
} }
static VALUE static VALUE
find_index_i(VALUE i, VALUE memop, int argc, VALUE *argv, VALUE blockarg) find_index_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, memop))
{ {
NODE *memo = RNODE(memop); NODE *memo = RNODE(memop);
@ -243,7 +243,7 @@ find_index_i(VALUE i, VALUE memop, int argc, VALUE *argv, VALUE blockarg)
} }
static VALUE static VALUE
find_index_iter_i(VALUE i, VALUE memop, int argc, VALUE *argv, VALUE blockarg) find_index_iter_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, memop))
{ {
NODE *memo = RNODE(memop); NODE *memo = RNODE(memop);
@ -299,7 +299,7 @@ enum_find_index(int argc, VALUE *argv, VALUE obj)
} }
static VALUE static VALUE
find_all_i(VALUE i, VALUE ary, int argc, VALUE *argv, VALUE blockarg) find_all_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, ary))
{ {
ENUM_WANT_SVALUE(); ENUM_WANT_SVALUE();
@ -351,7 +351,7 @@ enum_find_all(VALUE obj)
} }
static VALUE static VALUE
reject_i(VALUE i, VALUE ary, int argc, VALUE *argv, VALUE blockarg) reject_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, ary))
{ {
ENUM_WANT_SVALUE(); ENUM_WANT_SVALUE();
@ -392,7 +392,7 @@ enum_reject(VALUE obj)
} }
static VALUE static VALUE
collect_i(VALUE i, VALUE ary, int argc, VALUE *argv, VALUE blockarg) collect_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, ary))
{ {
rb_ary_push(ary, enum_yield(argc, argv)); rb_ary_push(ary, enum_yield(argc, argv));
@ -400,7 +400,7 @@ collect_i(VALUE i, VALUE ary, int argc, VALUE *argv, VALUE blockarg)
} }
static VALUE static VALUE
collect_all(VALUE i, VALUE ary, int argc, VALUE *argv, VALUE blockarg) collect_all(RB_BLOCK_CALL_FUNC_ARGLIST(i, ary))
{ {
rb_thread_check_ints(); rb_thread_check_ints();
rb_ary_push(ary, rb_enum_values_pack(argc, argv)); rb_ary_push(ary, rb_enum_values_pack(argc, argv));
@ -439,7 +439,7 @@ enum_collect(VALUE obj)
} }
static VALUE static VALUE
flat_map_i(VALUE i, VALUE ary, int argc, VALUE *argv, VALUE blockarg) flat_map_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, ary))
{ {
VALUE tmp; VALUE tmp;
@ -510,7 +510,7 @@ enum_to_a(int argc, VALUE *argv, VALUE obj)
} }
static VALUE static VALUE
enum_to_h_i(VALUE i, VALUE hash, int argc, VALUE *argv, VALUE blockarg) enum_to_h_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, hash))
{ {
ENUM_WANT_SVALUE(); ENUM_WANT_SVALUE();
rb_thread_check_ints(); rb_thread_check_ints();
@ -543,7 +543,7 @@ enum_to_h(int argc, VALUE *argv, VALUE obj)
} }
static VALUE static VALUE
inject_i(VALUE i, VALUE p, int argc, VALUE *argv, VALUE blockarg) inject_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, p))
{ {
NODE *memo = RNODE(p); NODE *memo = RNODE(p);
@ -560,7 +560,7 @@ inject_i(VALUE i, VALUE p, int argc, VALUE *argv, VALUE blockarg)
} }
static VALUE static VALUE
inject_op_i(VALUE i, VALUE p, int argc, VALUE *argv, VALUE blockarg) inject_op_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, p))
{ {
NODE *memo = RNODE(p); NODE *memo = RNODE(p);
VALUE name; VALUE name;
@ -662,7 +662,7 @@ enum_inject(int argc, VALUE *argv, VALUE obj)
} }
static VALUE static VALUE
partition_i(VALUE i, VALUE arys, int argc, VALUE *argv, VALUE blockarg) partition_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, arys))
{ {
NODE *memo = RNODE(arys); NODE *memo = RNODE(arys);
VALUE ary; VALUE ary;
@ -707,7 +707,7 @@ enum_partition(VALUE obj)
} }
static VALUE static VALUE
group_by_i(VALUE i, VALUE hash, int argc, VALUE *argv, VALUE blockarg) group_by_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, hash))
{ {
VALUE group; VALUE group;
VALUE values; VALUE values;
@ -756,7 +756,7 @@ enum_group_by(VALUE obj)
} }
static VALUE static VALUE
first_i(VALUE i, VALUE params, int argc, VALUE *argv, VALUE blockarg) first_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, params))
{ {
NODE *memo = RNODE(params); NODE *memo = RNODE(params);
ENUM_WANT_SVALUE(); ENUM_WANT_SVALUE();
@ -832,7 +832,7 @@ struct sort_by_data {
}; };
static VALUE static VALUE
sort_by_i(VALUE i, VALUE _data, int argc, VALUE *argv, VALUE blockarg) sort_by_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, _data))
{ {
struct sort_by_data *data = (struct sort_by_data *)&RNODE(_data)->u1; struct sort_by_data *data = (struct sort_by_data *)&RNODE(_data)->u1;
VALUE ary = data->ary; VALUE ary = data->ary;
@ -1003,13 +1003,13 @@ enum_sort_by(VALUE obj)
static VALUE enum_##name##_func(VALUE result, NODE *memo); \ static VALUE enum_##name##_func(VALUE result, NODE *memo); \
\ \
static VALUE \ static VALUE \
name##_i(VALUE i, VALUE memo, int argc, VALUE *argv, VALUE blockarg) \ name##_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, memo)) \
{ \ { \
return enum_##name##_func(rb_enum_values_pack(argc, argv), RNODE(memo)); \ return enum_##name##_func(rb_enum_values_pack(argc, argv), RNODE(memo)); \
} \ } \
\ \
static VALUE \ static VALUE \
name##_iter_i(VALUE i, VALUE memo, int argc, VALUE *argv, VALUE blockarg) \ name##_iter_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, memo)) \
{ \ { \
return enum_##name##_func(enum_yield(argc, argv), RNODE(memo)); \ return enum_##name##_func(enum_yield(argc, argv), RNODE(memo)); \
} \ } \
@ -1162,7 +1162,7 @@ enum_none(VALUE obj)
} }
static VALUE static VALUE
min_i(VALUE i, VALUE args, int argc, VALUE *argv, VALUE blockarg) min_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
{ {
VALUE cmp; VALUE cmp;
NODE *memo = RNODE(args); NODE *memo = RNODE(args);
@ -1182,7 +1182,7 @@ min_i(VALUE i, VALUE args, int argc, VALUE *argv, VALUE blockarg)
} }
static VALUE static VALUE
min_ii(VALUE i, VALUE args, int argc, VALUE *argv, VALUE blockarg) min_ii(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
{ {
VALUE cmp; VALUE cmp;
NODE *memo = RNODE(args); NODE *memo = RNODE(args);
@ -1234,7 +1234,7 @@ enum_min(VALUE obj)
} }
static VALUE static VALUE
max_i(VALUE i, VALUE args, int argc, VALUE *argv, VALUE blockarg) max_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
{ {
NODE *memo = RNODE(args); NODE *memo = RNODE(args);
VALUE cmp; VALUE cmp;
@ -1254,7 +1254,7 @@ max_i(VALUE i, VALUE args, int argc, VALUE *argv, VALUE blockarg)
} }
static VALUE static VALUE
max_ii(VALUE i, VALUE args, int argc, VALUE *argv, VALUE blockarg) max_ii(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
{ {
NODE *memo = RNODE(args); NODE *memo = RNODE(args);
VALUE cmp; VALUE cmp;
@ -1334,7 +1334,7 @@ minmax_i_update(VALUE i, VALUE j, struct minmax_t *memo)
} }
static VALUE static VALUE
minmax_i(VALUE i, VALUE _memo, int argc, VALUE *argv, VALUE blockarg) minmax_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, _memo))
{ {
struct minmax_t *memo = (struct minmax_t *)&RNODE(_memo)->u1.value; struct minmax_t *memo = (struct minmax_t *)&RNODE(_memo)->u1.value;
int n; int n;
@ -1386,7 +1386,7 @@ minmax_ii_update(VALUE i, VALUE j, struct minmax_t *memo)
} }
static VALUE static VALUE
minmax_ii(VALUE i, VALUE _memo, int argc, VALUE *argv, VALUE blockarg) minmax_ii(RB_BLOCK_CALL_FUNC_ARGLIST(i, _memo))
{ {
struct minmax_t *memo = (struct minmax_t *)&RNODE(_memo)->u1.value; struct minmax_t *memo = (struct minmax_t *)&RNODE(_memo)->u1.value;
int n; int n;
@ -1458,7 +1458,7 @@ enum_minmax(VALUE obj)
} }
static VALUE static VALUE
min_by_i(VALUE i, VALUE args, int argc, VALUE *argv, VALUE blockarg) min_by_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
{ {
NODE *memo = RNODE(args); NODE *memo = RNODE(args);
VALUE v; VALUE v;
@ -1504,7 +1504,7 @@ enum_min_by(VALUE obj)
} }
static VALUE static VALUE
max_by_i(VALUE i, VALUE args, int argc, VALUE *argv, VALUE blockarg) max_by_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
{ {
NODE *memo = RNODE(args); NODE *memo = RNODE(args);
VALUE v; 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 static VALUE
minmax_by_i(VALUE i, VALUE _memo, int argc, VALUE *argv, VALUE blockarg) minmax_by_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, _memo))
{ {
struct minmax_by_t *memo = MEMO_FOR(struct minmax_by_t, _memo); struct minmax_by_t *memo = MEMO_FOR(struct minmax_by_t, _memo);
VALUE vi, vj, j; VALUE vi, vj, j;
@ -1656,7 +1656,7 @@ enum_minmax_by(VALUE obj)
} }
static VALUE static VALUE
member_i(VALUE iter, VALUE args, int argc, VALUE *argv, VALUE blockarg) member_i(RB_BLOCK_CALL_FUNC_ARGLIST(iter, args))
{ {
NODE *memo = RNODE(args); NODE *memo = RNODE(args);
@ -1690,7 +1690,7 @@ enum_member(VALUE obj, VALUE val)
} }
static VALUE static VALUE
each_with_index_i(VALUE i, VALUE memo, int argc, VALUE *argv, VALUE blockarg) each_with_index_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, memo))
{ {
long n = RNODE(memo)->u3.cnt++; long n = RNODE(memo)->u3.cnt++;
@ -1766,7 +1766,7 @@ enum_reverse_each(int argc, VALUE *argv, VALUE obj)
static VALUE static VALUE
each_val_i(VALUE i, VALUE p, int argc, VALUE *argv, VALUE blockarg) each_val_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, p))
{ {
ENUM_WANT_SVALUE(); ENUM_WANT_SVALUE();
rb_yield(i); rb_yield(i);
@ -1811,7 +1811,7 @@ enum_each_entry(int argc, VALUE *argv, VALUE obj)
} }
static VALUE static VALUE
each_slice_i(VALUE i, VALUE m, int argc, VALUE *argv, VALUE blockarg) each_slice_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, m))
{ {
NODE *memo = RNODE(m); NODE *memo = RNODE(m);
VALUE ary = memo->u1.value; VALUE ary = memo->u1.value;
@ -1878,7 +1878,7 @@ enum_each_slice(VALUE obj, VALUE n)
} }
static VALUE static VALUE
each_cons_i(VALUE i, VALUE args, int argc, VALUE *argv, VALUE blockarg) each_cons_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
{ {
NODE *memo = RNODE(args); NODE *memo = RNODE(args);
VALUE ary = memo->u1.value; VALUE ary = memo->u1.value;
@ -1946,7 +1946,7 @@ enum_each_cons(VALUE obj, VALUE n)
} }
static VALUE static VALUE
each_with_object_i(VALUE i, VALUE memo, int argc, VALUE *argv, VALUE blockarg) each_with_object_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, memo))
{ {
ENUM_WANT_SVALUE(); ENUM_WANT_SVALUE();
return rb_yield_values(2, i, memo); return rb_yield_values(2, i, memo);
@ -1977,7 +1977,7 @@ enum_each_with_object(VALUE obj, VALUE memo)
} }
static VALUE static VALUE
zip_ary(VALUE val, VALUE memoval, int argc, VALUE *argv, VALUE blockarg) zip_ary(RB_BLOCK_CALL_FUNC_ARGLIST(val, memoval))
{ {
NODE *memo = (NODE *)memoval; NODE *memo = (NODE *)memoval;
volatile VALUE result = memo->u1.value; volatile VALUE result = memo->u1.value;
@ -2020,7 +2020,7 @@ call_stop(VALUE *v)
} }
static VALUE static VALUE
zip_i(VALUE val, VALUE memoval, int argc, VALUE *argv, VALUE blockarg) zip_i(RB_BLOCK_CALL_FUNC_ARGLIST(val, memoval))
{ {
NODE *memo = (NODE *)memoval; NODE *memo = (NODE *)memoval;
volatile VALUE result = memo->u1.value; volatile VALUE result = memo->u1.value;
@ -2118,7 +2118,7 @@ enum_zip(int argc, VALUE *argv, VALUE obj)
} }
static VALUE static VALUE
take_i(VALUE i, VALUE args, int argc, VALUE *argv, VALUE blockarg) take_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
{ {
NODE *memo = RNODE(args); NODE *memo = RNODE(args);
rb_ary_push(memo->u1.value, rb_enum_values_pack(argc, argv)); rb_ary_push(memo->u1.value, rb_enum_values_pack(argc, argv));
@ -2157,7 +2157,7 @@ enum_take(VALUE obj, VALUE n)
static VALUE static VALUE
take_while_i(VALUE i, VALUE ary, int argc, VALUE *argv, VALUE blockarg) take_while_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, ary))
{ {
if (!RTEST(enum_yield(argc, argv))) rb_iter_break(); if (!RTEST(enum_yield(argc, argv))) rb_iter_break();
rb_ary_push(ary, rb_enum_values_pack(argc, argv)); rb_ary_push(ary, rb_enum_values_pack(argc, argv));
@ -2191,7 +2191,7 @@ enum_take_while(VALUE obj)
} }
static VALUE static VALUE
drop_i(VALUE i, VALUE args, int argc, VALUE *argv, VALUE blockarg) drop_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
{ {
NODE *memo = RNODE(args); NODE *memo = RNODE(args);
if (memo->u3.cnt == 0) { if (memo->u3.cnt == 0) {
@ -2234,7 +2234,7 @@ enum_drop(VALUE obj, VALUE n)
static VALUE static VALUE
drop_while_i(VALUE i, VALUE args, int argc, VALUE *argv, VALUE blockarg) drop_while_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
{ {
NODE *memo = RNODE(args); NODE *memo = RNODE(args);
ENUM_WANT_SVALUE(); ENUM_WANT_SVALUE();
@ -2278,7 +2278,7 @@ enum_drop_while(VALUE obj)
} }
static VALUE static VALUE
cycle_i(VALUE i, VALUE ary, int argc, VALUE *argv, VALUE blockarg) cycle_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, ary))
{ {
ENUM_WANT_SVALUE(); ENUM_WANT_SVALUE();
@ -2365,7 +2365,7 @@ struct chunk_arg {
}; };
static VALUE static VALUE
chunk_ii(VALUE i, VALUE _argp, int argc, VALUE *argv, VALUE blockarg) chunk_ii(RB_BLOCK_CALL_FUNC_ARGLIST(i, _argp))
{ {
struct chunk_arg *argp = MEMO_FOR(struct chunk_arg, _argp); struct chunk_arg *argp = MEMO_FOR(struct chunk_arg, _argp);
VALUE v; VALUE v;
@ -2415,7 +2415,7 @@ chunk_ii(VALUE i, VALUE _argp, int argc, VALUE *argv, VALUE blockarg)
} }
static VALUE static VALUE
chunk_i(VALUE yielder, VALUE enumerator, int argc, VALUE *argv, VALUE blockarg) chunk_i(RB_BLOCK_CALL_FUNC_ARGLIST(yielder, enumerator))
{ {
VALUE enumerable; VALUE enumerable;
VALUE arg; VALUE arg;
@ -2560,7 +2560,7 @@ struct slicebefore_arg {
}; };
static VALUE static VALUE
slicebefore_ii(VALUE i, VALUE _argp, int argc, VALUE *argv, VALUE blockarg) slicebefore_ii(RB_BLOCK_CALL_FUNC_ARGLIST(i, _argp))
{ {
struct slicebefore_arg *argp = MEMO_FOR(struct slicebefore_arg, _argp); struct slicebefore_arg *argp = MEMO_FOR(struct slicebefore_arg, _argp);
VALUE header_p; VALUE header_p;
@ -2589,7 +2589,7 @@ slicebefore_ii(VALUE i, VALUE _argp, int argc, VALUE *argv, VALUE blockarg)
} }
static VALUE static VALUE
slicebefore_i(VALUE yielder, VALUE enumerator, int argc, VALUE *argv, VALUE blockarg) slicebefore_i(RB_BLOCK_CALL_FUNC_ARGLIST(yielder, enumerator))
{ {
VALUE enumerable; VALUE enumerable;
VALUE arg; VALUE arg;

View file

@ -493,7 +493,7 @@ enumerator_each(int argc, VALUE *argv, VALUE obj)
} }
static VALUE static VALUE
enumerator_with_index_i(VALUE val, VALUE m, int argc, VALUE *argv, VALUE blockarg) enumerator_with_index_i(RB_BLOCK_CALL_FUNC_ARGLIST(val, m))
{ {
VALUE *memo = (VALUE *)m; VALUE *memo = (VALUE *)m;
VALUE idx = *memo; VALUE idx = *memo;
@ -557,7 +557,7 @@ enumerator_each_with_index(VALUE obj)
} }
static VALUE static VALUE
enumerator_with_object_i(VALUE val, VALUE memo, int argc, VALUE *argv, VALUE blockarg) enumerator_with_object_i(RB_BLOCK_CALL_FUNC_ARGLIST(val, memo))
{ {
if (argc <= 1) if (argc <= 1)
return rb_yield_values(2, val, memo); return rb_yield_values(2, val, memo);
@ -604,7 +604,7 @@ enumerator_with_object(VALUE obj, VALUE memo)
} }
static VALUE static VALUE
next_ii(VALUE i, VALUE obj, int argc, VALUE *argv, VALUE blockarg) next_ii(RB_BLOCK_CALL_FUNC_ARGLIST(i, obj))
{ {
struct enumerator *e = enumerator_ptr(obj); struct enumerator *e = enumerator_ptr(obj);
VALUE feedvalue = Qnil; VALUE feedvalue = Qnil;
@ -1147,7 +1147,7 @@ static VALUE yielder_yield_push(VALUE obj, VALUE args)
} }
static VALUE static VALUE
yielder_yield_i(VALUE obj, VALUE memo, int argc, VALUE *argv, VALUE blockarg) yielder_yield_i(RB_BLOCK_CALL_FUNC_ARGLIST(obj, memo))
{ {
return rb_yield_values2(argc, argv); return rb_yield_values2(argc, argv);
} }
@ -1318,7 +1318,7 @@ lazy_receiver_size(VALUE generator, VALUE args, VALUE lazy)
} }
static VALUE static VALUE
lazy_init_iterator(VALUE val, VALUE m, int argc, VALUE *argv, VALUE blockarg) lazy_init_iterator(RB_BLOCK_CALL_FUNC_ARGLIST(val, m))
{ {
VALUE result; VALUE result;
if (argc == 1) { if (argc == 1) {
@ -1344,7 +1344,7 @@ lazy_init_iterator(VALUE val, VALUE m, int argc, VALUE *argv, VALUE blockarg)
} }
static VALUE static VALUE
lazy_init_block_i(VALUE val, VALUE m, int argc, VALUE *argv, VALUE blockarg) lazy_init_block_i(RB_BLOCK_CALL_FUNC_ARGLIST(val, m))
{ {
rb_block_call(m, id_each, argc-1, argv+1, lazy_init_iterator, val); rb_block_call(m, id_each, argc-1, argv+1, lazy_init_iterator, val);
return Qnil; return Qnil;
@ -1504,7 +1504,7 @@ lazy_to_enum(int argc, VALUE *argv, VALUE self)
} }
static VALUE static VALUE
lazy_map_func(VALUE val, VALUE m, int argc, VALUE *argv, VALUE blockarg) lazy_map_func(RB_BLOCK_CALL_FUNC_ARGLIST(val, m))
{ {
VALUE result = rb_yield_values2(argc - 1, &argv[1]); VALUE result = rb_yield_values2(argc - 1, &argv[1]);
@ -1525,7 +1525,7 @@ lazy_map(VALUE obj)
} }
static VALUE static VALUE
lazy_flat_map_i(VALUE i, VALUE yielder, int argc, VALUE *argv, VALUE blockarg) lazy_flat_map_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, yielder))
{ {
return rb_funcall2(yielder, id_yield, argc, argv); return rb_funcall2(yielder, id_yield, argc, argv);
} }
@ -1554,7 +1554,7 @@ lazy_flat_map_to_ary(VALUE obj, VALUE yielder)
} }
static VALUE static VALUE
lazy_flat_map_func(VALUE val, VALUE m, int argc, VALUE *argv, VALUE blockarg) lazy_flat_map_func(RB_BLOCK_CALL_FUNC_ARGLIST(val, m))
{ {
VALUE result = rb_yield_values2(argc - 1, &argv[1]); VALUE result = rb_yield_values2(argc - 1, &argv[1]);
if (RB_TYPE_P(result, T_ARRAY)) { if (RB_TYPE_P(result, T_ARRAY)) {
@ -1610,7 +1610,7 @@ lazy_flat_map(VALUE obj)
} }
static VALUE static VALUE
lazy_select_func(VALUE val, VALUE m, int argc, VALUE *argv, VALUE blockarg) lazy_select_func(RB_BLOCK_CALL_FUNC_ARGLIST(val, m))
{ {
VALUE element = rb_enum_values_pack(argc - 1, argv + 1); VALUE element = rb_enum_values_pack(argc - 1, argv + 1);
@ -1633,7 +1633,7 @@ lazy_select(VALUE obj)
} }
static VALUE static VALUE
lazy_reject_func(VALUE val, VALUE m, int argc, VALUE *argv, VALUE blockarg) lazy_reject_func(RB_BLOCK_CALL_FUNC_ARGLIST(val, m))
{ {
VALUE element = rb_enum_values_pack(argc - 1, argv + 1); VALUE element = rb_enum_values_pack(argc - 1, argv + 1);
@ -1656,7 +1656,7 @@ lazy_reject(VALUE obj)
} }
static VALUE static VALUE
lazy_grep_func(VALUE val, VALUE m, int argc, VALUE *argv, VALUE blockarg) lazy_grep_func(RB_BLOCK_CALL_FUNC_ARGLIST(val, m))
{ {
VALUE i = rb_enum_values_pack(argc - 1, argv + 1); VALUE i = rb_enum_values_pack(argc - 1, argv + 1);
VALUE result = rb_funcall(m, id_eqq, 1, i); VALUE result = rb_funcall(m, id_eqq, 1, i);
@ -1668,7 +1668,7 @@ lazy_grep_func(VALUE val, VALUE m, int argc, VALUE *argv, VALUE blockarg)
} }
static VALUE static VALUE
lazy_grep_iter(VALUE val, VALUE m, int argc, VALUE *argv, VALUE blockarg) lazy_grep_iter(RB_BLOCK_CALL_FUNC_ARGLIST(val, m))
{ {
VALUE i = rb_enum_values_pack(argc - 1, argv + 1); VALUE i = rb_enum_values_pack(argc - 1, argv + 1);
VALUE result = rb_funcall(m, id_eqq, 1, i); VALUE result = rb_funcall(m, id_eqq, 1, i);
@ -1702,7 +1702,7 @@ next_stopped(VALUE obj)
} }
static VALUE static VALUE
lazy_zip_arrays_func(VALUE val, VALUE arrays, int argc, VALUE *argv, VALUE blockarg) lazy_zip_arrays_func(RB_BLOCK_CALL_FUNC_ARGLIST(val, arrays))
{ {
VALUE yielder, ary, memo; VALUE yielder, ary, memo;
long i, count; long i, count;
@ -1722,7 +1722,7 @@ lazy_zip_arrays_func(VALUE val, VALUE arrays, int argc, VALUE *argv, VALUE block
} }
static VALUE static VALUE
lazy_zip_func(VALUE val, VALUE zip_args, int argc, VALUE *argv, VALUE blockarg) lazy_zip_func(RB_BLOCK_CALL_FUNC_ARGLIST(val, zip_args))
{ {
VALUE yielder, ary, arg, v; VALUE yielder, ary, arg, v;
long i; long i;
@ -1787,7 +1787,7 @@ lazy_zip(int argc, VALUE *argv, VALUE obj)
} }
static VALUE static VALUE
lazy_take_func(VALUE val, VALUE args, int argc, VALUE *argv, VALUE blockarg) lazy_take_func(RB_BLOCK_CALL_FUNC_ARGLIST(val, args))
{ {
long remain; long remain;
VALUE memo = rb_attr_get(argv[0], id_memo); VALUE memo = rb_attr_get(argv[0], id_memo);
@ -1836,7 +1836,7 @@ lazy_take(VALUE obj, VALUE n)
} }
static VALUE static VALUE
lazy_take_while_func(VALUE val, VALUE args, int argc, VALUE *argv, VALUE blockarg) lazy_take_while_func(RB_BLOCK_CALL_FUNC_ARGLIST(val, args))
{ {
VALUE result = rb_yield_values2(argc - 1, &argv[1]); VALUE result = rb_yield_values2(argc - 1, &argv[1]);
if (!RTEST(result)) return Qundef; if (!RTEST(result)) return Qundef;
@ -1870,7 +1870,7 @@ lazy_drop_size(VALUE generator, VALUE args, VALUE lazy)
} }
static VALUE static VALUE
lazy_drop_func(VALUE val, VALUE args, int argc, VALUE *argv, VALUE blockarg) lazy_drop_func(RB_BLOCK_CALL_FUNC_ARGLIST(val, args))
{ {
long remain; long remain;
VALUE memo = rb_attr_get(argv[0], id_memo); VALUE memo = rb_attr_get(argv[0], id_memo);
@ -1900,7 +1900,7 @@ lazy_drop(VALUE obj, VALUE n)
} }
static VALUE static VALUE
lazy_drop_while_func(VALUE val, VALUE args, int argc, VALUE *argv, VALUE blockarg) lazy_drop_while_func(RB_BLOCK_CALL_FUNC_ARGLIST(val, args))
{ {
VALUE memo = rb_attr_get(argv[0], id_memo); VALUE memo = rb_attr_get(argv[0], id_memo);
if (NIL_P(memo) && !RTEST(rb_yield_values2(argc - 1, &argv[1]))) { if (NIL_P(memo) && !RTEST(rb_yield_values2(argc - 1, &argv[1]))) {

View file

@ -1,7 +1,7 @@
#include <ruby.h> #include <ruby.h>
static VALUE static VALUE
bug_i(VALUE i, VALUE arg) bug_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, arg))
{ {
rb_notimplement(); rb_notimplement();
return ID2SYM(rb_frame_this_func()); return ID2SYM(rb_frame_this_func());

View file

@ -574,7 +574,7 @@ fdbm_invert(VALUE obj)
static VALUE fdbm_store(VALUE,VALUE,VALUE); static VALUE fdbm_store(VALUE,VALUE,VALUE);
static VALUE static VALUE
update_i(VALUE pair, VALUE dbm) update_i(RB_BLOCK_CALL_FUNC_ARGLIST(pair, dbm))
{ {
Check_Type(pair, T_ARRAY); Check_Type(pair, T_ARRAY);
if (RARRAY_LEN(pair) < 2) { if (RARRAY_LEN(pair) < 2) {

View file

@ -724,7 +724,7 @@ fgdbm_store(VALUE obj, VALUE keystr, VALUE valstr)
} }
static VALUE static VALUE
update_i(VALUE pair, VALUE dbm) update_i(RB_BLOCK_CALL_FUNC_ARGLIST(pair, dbm))
{ {
Check_Type(pair, T_ARRAY); Check_Type(pair, T_ARRAY);
if (RARRAY_LEN(pair) < 2) { if (RARRAY_LEN(pair) < 2) {

View file

@ -733,7 +733,7 @@ ossl_asn1data_initialize(VALUE self, VALUE value, VALUE tag, VALUE tag_class)
} }
static VALUE static VALUE
join_der_i(VALUE i, VALUE str) join_der_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, str))
{ {
i = ossl_to_der_if_possible(i); i = ossl_to_der_if_possible(i);
StringValue(i); StringValue(i);

View file

@ -624,7 +624,7 @@ pkcs7_get_crls(VALUE self)
} }
static VALUE static VALUE
ossl_pkcs7_set_certs_i(VALUE i, VALUE arg) ossl_pkcs7_set_certs_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, arg))
{ {
return ossl_pkcs7_add_certificate(arg, i); return ossl_pkcs7_add_certificate(arg, i);
} }
@ -664,7 +664,7 @@ ossl_pkcs7_add_crl(VALUE self, VALUE crl)
} }
static VALUE static VALUE
ossl_pkcs7_set_crls_i(VALUE i, VALUE arg) ossl_pkcs7_set_crls_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, arg))
{ {
return ossl_pkcs7_add_crl(arg, i); return ossl_pkcs7_add_crl(arg, i);
} }

View file

@ -477,7 +477,7 @@ ossl_sslctx_session_remove_cb(SSL_CTX *ctx, SSL_SESSION *sess)
} }
static VALUE static VALUE
ossl_sslctx_add_extra_chain_cert_i(VALUE i, VALUE arg) ossl_sslctx_add_extra_chain_cert_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, arg))
{ {
X509 *x509; X509 *x509;
SSL_CTX *ctx; SSL_CTX *ctx;

View file

@ -92,7 +92,7 @@ static VALUE ossl_x509name_add_entry(int, VALUE*, VALUE);
#define rb_aref(obj, key) rb_funcall((obj), id_aref, 1, (key)) #define rb_aref(obj, key) rb_funcall((obj), id_aref, 1, (key))
static VALUE static VALUE
ossl_x509name_init_i(VALUE i, VALUE args) ossl_x509name_init_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
{ {
VALUE self = rb_ary_entry(args, 0); VALUE self = rb_ary_entry(args, 0);
VALUE template = rb_ary_entry(args, 1); VALUE template = rb_ary_entry(args, 1);

View file

@ -968,7 +968,7 @@ path_zero_p(VALUE self)
} }
static VALUE static VALUE
glob_i(VALUE elt, VALUE klass, int argc, VALUE *argv) glob_i(RB_BLOCK_CALL_FUNC_ARGLIST(elt, klass))
{ {
return rb_yield(rb_class_new_instance(1, &elt, klass)); return rb_yield(rb_class_new_instance(1, &elt, klass));
} }
@ -1106,7 +1106,7 @@ path_opendir(VALUE self)
} }
static VALUE static VALUE
each_entry_i(VALUE elt, VALUE klass, int argc, VALUE *argv) each_entry_i(RB_BLOCK_CALL_FUNC_ARGLIST(elt, klass))
{ {
return rb_yield(rb_class_new_instance(1, &elt, klass)); return rb_yield(rb_class_new_instance(1, &elt, klass));
} }

View file

@ -192,7 +192,7 @@ static VALUE racc_yyparse _((VALUE parser, VALUE lexer, VALUE lexmid,
VALUE arg, VALUE sysdebug)); VALUE arg, VALUE sysdebug));
static void call_lexer _((struct cparse_params *v)); static void call_lexer _((struct cparse_params *v));
static VALUE lexer_i _((VALUE block_args, VALUE data, VALUE self)); static VALUE lexer_i _((RB_BLOCK_CALL_FUNC_ARGLIST(block_args, data)));
static VALUE assert_array _((VALUE a)); static VALUE assert_array _((VALUE a));
static long assert_integer _((VALUE n)); static long assert_integer _((VALUE n));
@ -282,7 +282,7 @@ call_lexer(struct cparse_params *v)
#endif #endif
static VALUE static VALUE
lexer_i(VALUE block_args, VALUE data, VALUE self) lexer_i(RB_BLOCK_CALL_FUNC_ARGLIST(block_args, data))
{ {
struct cparse_params *v; struct cparse_params *v;
VALUE tok, val; VALUE tok, val;

View file

@ -632,7 +632,7 @@ fsdbm_store(VALUE obj, VALUE keystr, VALUE valstr)
} }
static VALUE static VALUE
update_i(VALUE pair, VALUE dbm) update_i(RB_BLOCK_CALL_FUNC_ARGLIST(pair, dbm))
{ {
Check_Type(pair, T_ARRAY); Check_Type(pair, T_ARRAY);
if (RARRAY_LEN(pair) < 2) { if (RARRAY_LEN(pair) < 2) {

View file

@ -3302,8 +3302,9 @@ fole_initialize(int argc, VALUE *argv, VALUE self)
} }
static VALUE static VALUE
hash2named_arg(VALUE pair, struct oleparam* pOp) hash2named_arg(RB_BLOCK_CALL_FUNC_ARGLIST(pair, op))
{ {
struct oleparam* pOp = (struct oleparam *)op;
unsigned int index, i; unsigned int index, i;
VALUE key, value; VALUE key, value;
index = pOp->dp.cNamedArgs; index = pOp->dp.cNamedArgs;

View file

@ -1493,8 +1493,10 @@ PRINTF_ARGS(void rb_compile_warn(const char *, int, const char*, ...), 3, 4);
#define RB_IO_WAIT_READABLE 0 #define RB_IO_WAIT_READABLE 0
#define RB_IO_WAIT_WRITABLE 1 #define RB_IO_WAIT_WRITABLE 1
typedef VALUE rb_block_call_func(VALUE, VALUE, int, VALUE*, VALUE);
#define RUBY_BLOCK_CALL_FUNC_TAKES_BLOCKARG 1 #define RUBY_BLOCK_CALL_FUNC_TAKES_BLOCKARG 1
#define RB_BLOCK_CALL_FUNC_ARGLIST(yielded_arg, callback_arg) \
VALUE yielded_arg, VALUE callback_arg, int argc, VALUE *argv, VALUE blockarg
typedef VALUE rb_block_call_func(RB_BLOCK_CALL_FUNC_ARGLIST(yielded_arg, callback_arg));
#if defined RB_BLOCK_CALL_FUNC_STRICT && RB_BLOCK_CALL_FUNC_STRICT #if defined RB_BLOCK_CALL_FUNC_STRICT && RB_BLOCK_CALL_FUNC_STRICT
typedef rb_block_call_func *rb_block_call_func_t; typedef rb_block_call_func *rb_block_call_func_t;

2
io.c
View file

@ -11127,7 +11127,7 @@ argf_readbyte(VALUE argf)
#define FOREACH_ARGF() while (next_argv()) #define FOREACH_ARGF() while (next_argv())
static VALUE static VALUE
argf_block_call_i(VALUE i, VALUE argf, int argc, VALUE *argv, VALUE blockarg) argf_block_call_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, argf))
{ {
const VALUE current = ARGF.current_file; const VALUE current = ARGF.current_file;
rb_yield_values2(argc, argv); rb_yield_values2(argc, argv);

View file

@ -2888,7 +2888,7 @@ run_exec_rlimit(VALUE ary, struct rb_execarg *sargp, char *errmsg, size_t errmsg
#if !defined(HAVE_FORK) #if !defined(HAVE_FORK)
static VALUE static VALUE
save_env_i(VALUE i, VALUE ary, int argc, VALUE *argv, VALUE blockarg) save_env_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, ary))
{ {
rb_ary_push(ary, hide_obj(rb_ary_dup(argv[0]))); rb_ary_push(ary, hide_obj(rb_ary_dup(argv[0])));
return Qnil; return Qnil;

10
range.c
View file

@ -302,7 +302,7 @@ range_each_func(VALUE range, rb_block_call_func *func, VALUE arg)
} }
static VALUE static VALUE
sym_step_i(VALUE i, VALUE arg, int argc, VALUE *argv, VALUE blockarg) sym_step_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, arg))
{ {
VALUE *iter = (VALUE *)arg; VALUE *iter = (VALUE *)arg;
@ -320,7 +320,7 @@ sym_step_i(VALUE i, VALUE arg, int argc, VALUE *argv, VALUE blockarg)
} }
static VALUE static VALUE
step_i(VALUE i, VALUE arg, int argc, VALUE *argv, VALUE blockarg) step_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, arg))
{ {
VALUE *iter = (VALUE *)arg; VALUE *iter = (VALUE *)arg;
@ -702,14 +702,14 @@ range_bsearch(VALUE range)
} }
static VALUE static VALUE
each_i(VALUE v, VALUE arg, int argc, VALUE *argv, VALUE blockarg) each_i(RB_BLOCK_CALL_FUNC_ARGLIST(v, arg))
{ {
rb_yield(v); rb_yield(v);
return Qnil; return Qnil;
} }
static VALUE static VALUE
sym_each_i(VALUE v, VALUE arg, int argc, VALUE *argv, VALUE blockarg) sym_each_i(RB_BLOCK_CALL_FUNC_ARGLIST(v, arg))
{ {
rb_yield(rb_str_intern(v)); rb_yield(rb_str_intern(v));
return Qnil; return Qnil;
@ -844,7 +844,7 @@ range_end(VALUE range)
static VALUE static VALUE
first_i(VALUE i, VALUE cbarg, int argc, VALUE *argv, VALUE blockarg) first_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, cbarg))
{ {
VALUE *ary = (VALUE *)cbarg; VALUE *ary = (VALUE *)cbarg;
long n = NUM2LONG(ary[0]); long n = NUM2LONG(ary[0]);

View file

@ -4867,7 +4867,7 @@ struct exec_recursive_params {
}; };
static VALUE static VALUE
exec_recursive_i(VALUE tag, VALUE data, int argc, VALUE *argv, VALUE blockarg) exec_recursive_i(RB_BLOCK_CALL_FUNC_ARGLIST(tag, data))
{ {
struct exec_recursive_params *p = (void *)data; struct exec_recursive_params *p = (void *)data;
VALUE result = Qundef; VALUE result = Qundef;