зеркало из https://github.com/github/ruby.git
* enumerator.c (enumerator_iter_i): adjusted for rb_block_call_func.
* include/ruby/ruby.h (rb_block_call_func): function to be called back as block. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14416 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
968eb8beac
Коммит
e791259e00
|
@ -1,3 +1,10 @@
|
|||
Fri Dec 21 16:33:28 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* enumerator.c (enumerator_iter_i): adjusted for rb_block_call_func.
|
||||
|
||||
* include/ruby/ruby.h (rb_block_call_func): function to be called back
|
||||
as block.
|
||||
|
||||
Fri Dec 21 16:25:25 2007 Martin Duerst <duerst@it.aoyama.ac.jp>
|
||||
|
||||
* common.mk, transcode_data_iso_8859.c: renamed to
|
||||
|
@ -36,7 +43,6 @@ Fri Dec 21 15:31:59 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
|
|||
* encoding.c (rb_to_encoding): returns default encoding if no
|
||||
corresponding encoding found.
|
||||
|
||||
>>>>>>> .r14414
|
||||
Fri Dec 21 15:24:22 2007 Shugo Maeda <shugo@ruby-lang.org>
|
||||
|
||||
* lib/net/imap.rb (initialize): accept service name. changed
|
||||
|
@ -73,7 +79,6 @@ Fri Dec 21 13:54:05 2007 Tanaka Akira <akr@fsij.org>
|
|||
|
||||
* re.c: change "character encodings differ" error messages.
|
||||
|
||||
>>>>>>> .r14409
|
||||
Fri Dec 21 13:46:58 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* encoding.c (rb_enc_register): set encoding constant.
|
||||
|
|
11
enumerator.c
11
enumerator.c
|
@ -35,14 +35,11 @@ proc_call(VALUE proc, VALUE args)
|
|||
return rb_proc_call(proc, args);
|
||||
}
|
||||
|
||||
struct enumerator;
|
||||
typedef VALUE enum_iter(VALUE, struct enumerator *, VALUE);
|
||||
|
||||
struct enumerator {
|
||||
VALUE method;
|
||||
VALUE proc;
|
||||
VALUE args;
|
||||
enum_iter *iter;
|
||||
rb_block_call_func *iter;
|
||||
VALUE fib;
|
||||
VALUE dst;
|
||||
VALUE no_next;
|
||||
|
@ -77,8 +74,9 @@ enumerator_ptr(VALUE obj)
|
|||
}
|
||||
|
||||
static VALUE
|
||||
enumerator_iter_i(VALUE i, struct enumerator *e, VALUE argc)
|
||||
enumerator_iter_i(VALUE i, VALUE enum_obj, int argc, VALUE *argv)
|
||||
{
|
||||
struct enumerator *e = (struct enumerator *)enum_obj;
|
||||
return rb_yield(proc_call(e->proc, i));
|
||||
}
|
||||
|
||||
|
@ -241,7 +239,7 @@ enumerator_init(VALUE enum_obj, VALUE obj, VALUE meth, int argc, VALUE *argv)
|
|||
ptr->iter = enumerator_iter_i;
|
||||
}
|
||||
else {
|
||||
ptr->iter = (enum_iter *)enumerator_each_i;
|
||||
ptr->iter = enumerator_each_i;
|
||||
}
|
||||
if (argc) ptr->args = rb_ary_new4(argc, argv);
|
||||
ptr->fib = 0;
|
||||
|
@ -369,7 +367,6 @@ enumerator_with_index(VALUE obj)
|
|||
static VALUE
|
||||
next_ii(VALUE i, VALUE obj)
|
||||
{
|
||||
struct enumerator *e = enumerator_ptr(obj);
|
||||
rb_fiber_yield(1, &i);
|
||||
return Qnil;
|
||||
}
|
||||
|
|
|
@ -772,6 +772,8 @@ PRINTF_ARGS(void rb_sys_warning(const char*, ...), 1, 2);
|
|||
PRINTF_ARGS(void rb_warn(const char*, ...), 1, 2);
|
||||
PRINTF_ARGS(void rb_compile_warn(const char *, int, const char*, ...), 3, 4);
|
||||
|
||||
typedef VALUE rb_block_call_func(VALUE, VALUE, int, VALUE*);
|
||||
|
||||
VALUE rb_each(VALUE);
|
||||
VALUE rb_yield(VALUE);
|
||||
VALUE rb_yield_values(int n, ...);
|
||||
|
|
Загрузка…
Ссылка в новой задаче