mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* enumerator.c (yielder_yield_i): use rb_proc_new instead of
rb_iterate. [ruby-dev:38518] * README.EXT: rb_iterate is obsolete since 1.9; use rb_block_call instead. * README.EXT.ja: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24094 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9e6a1e1479
commit
cb46d98caa
4 changed files with 35 additions and 9 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
Tue Jul 14 01:06:31 2009 Yusuke Endoh <mame@tsg.ne.jp>
|
||||
|
||||
* enumerator.c (yielder_yield_i): use rb_proc_new instead of
|
||||
rb_iterate. [ruby-dev:38518]
|
||||
|
||||
* README.EXT: rb_iterate is obsolete since 1.9; use rb_block_call
|
||||
instead.
|
||||
|
||||
* README.EXT.ja: ditto.
|
||||
|
||||
Tue Jul 14 00:45:41 2009 Yuki Sonoda (Yugui) <yugui@yugui.jp>
|
||||
|
||||
* test/ruby/test_case.rb (TestCase#test_deoptimization):
|
||||
|
|
13
README.EXT
13
README.EXT
|
@ -1159,12 +1159,23 @@ Sets the value of the instance variable.
|
|||
|
||||
** Control Structure
|
||||
|
||||
VALUE rb_iterate(VALUE (*func1)(), void *arg1, VALUE (*func2)(), void *arg2)
|
||||
VALUE rb_block_call(VALUE recv, ID mid, int argc, VALUE * argv,
|
||||
VALUE (*func) (ANYARGS), VALUE data2)
|
||||
|
||||
Calls a method on the recv, with the method name specified by the
|
||||
symbol mid, supplying func as the block. func will receive the
|
||||
value from yield as the first argument, data2 as the second, and
|
||||
argc/argv as the third/fourth arguments.
|
||||
|
||||
[OBSOLETE] VALUE rb_iterate(VALUE (*func1)(), void *arg1, VALUE (*func2)(), void *arg2)
|
||||
|
||||
Calls the function func1, supplying func2 as the block. func1 will be
|
||||
called with the argument arg1. func2 receives the value from yield as
|
||||
the first argument, arg2 as the second argument.
|
||||
|
||||
When rb_iterate is used in 1.9, func1 has to call some Ruby-level method.
|
||||
This function is obsolete since 1.9; use rb_block_call instead.
|
||||
|
||||
VALUE rb_yield(VALUE val)
|
||||
|
||||
Evaluates the block with value val.
|
||||
|
|
|
@ -1258,12 +1258,23 @@ VALUE rb_iv_set(VALUE obj, const char *name, VALUE val)
|
|||
|
||||
** 制御構造
|
||||
|
||||
VALUE rb_iterate(VALUE (*func1)(), VALUE arg1, VALUE (*func2)(), VALUE arg2)
|
||||
VALUE rb_block_call(VALUE obj, ID mid, int argc, VALUE * argv,
|
||||
VALUE (*func) (ANYARGS), VALUE data2)
|
||||
|
||||
funcをブロックとして設定し, objをレシーバ, argcとargvを引
|
||||
数としてmidメソッドを呼び出す. funcは第一引数にyieldされた
|
||||
値, 第二引数にdata2, 第三, 第四引数にargcとargvを受け取る.
|
||||
|
||||
[OBSOLETE] VALUE rb_iterate(VALUE (*func1)(), VALUE arg1, VALUE (*func2)(), VALUE arg2)
|
||||
|
||||
func2をブロックとして設定し, func1をイテレータとして呼ぶ.
|
||||
func1には arg1が引数として渡され, func2には第1引数にイテレー
|
||||
タから与えられた値, 第2引数にarg2が渡される.
|
||||
|
||||
1.9でrb_iterateを使う場合は, func1の中でRubyレベルのメソッド
|
||||
を呼び出さなければならない.
|
||||
1.9でobsoleteとなった. 代わりにrb_block_callが用意された.
|
||||
|
||||
VALUE rb_yield(VALUE val)
|
||||
|
||||
valを値としてイテレータブロックを呼び出す.
|
||||
|
|
|
@ -717,12 +717,6 @@ yielder_yield(VALUE obj, VALUE args)
|
|||
return obj;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
yielder_new_i(VALUE dummy)
|
||||
{
|
||||
return yielder_init(yielder_allocate(rb_cYielder), rb_block_proc());
|
||||
}
|
||||
|
||||
static VALUE
|
||||
yielder_yield_i(VALUE obj, VALUE memo, int argc, VALUE *argv)
|
||||
{
|
||||
|
@ -732,7 +726,7 @@ yielder_yield_i(VALUE obj, VALUE memo, int argc, VALUE *argv)
|
|||
static VALUE
|
||||
yielder_new(void)
|
||||
{
|
||||
return rb_iterate(yielder_new_i, (VALUE)0, yielder_yield_i, (VALUE)0);
|
||||
return yielder_init(yielder_allocate(rb_cYielder), rb_proc_new(yielder_yield_i, 0));
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue