summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--README.EXT13
-rw-r--r--README.EXT.ja13
-rw-r--r--enumerator.c8
4 files changed, 35 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 66027dbc72..0e4ca43040 100644
--- a/ChangeLog
+++ b/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):
diff --git a/README.EXT b/README.EXT
index 667d551664..da0f6148f1 100644
--- a/README.EXT
+++ b/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.
diff --git a/README.EXT.ja b/README.EXT.ja
index a07fddf09e..c6b5dfed9f 100644
--- a/README.EXT.ja
+++ b/README.EXT.ja
@@ -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を値としてイテレータブロックを呼び出す.
diff --git a/enumerator.c b/enumerator.c
index 6723d72769..355a8f3948 100644
--- a/enumerator.c
+++ b/enumerator.c
@@ -718,12 +718,6 @@ yielder_yield(VALUE obj, VALUE args)
}
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)
{
return rb_yield_values2(argc, 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));
}
/*