[#25272] [Feature #2032] Change the license to "GPLv2+ or Ruby's original". — Yui NARUSE <redmine@...>

Feature #2032: Change the license to "GPLv2+ or Ruby's original".

51 messages 2009/09/02
[#25368] [Feature #2032] Change the license to "GPLv2+ or Ruby's original". — Kazuhiko Shiozaki <redmine@...> 2009/09/04

Issue #2032 has been updated by Kazuhiko Shiozaki.

[#25461] Re: [Feature #2032] Change the license to "GPLv2+ or Ruby's original". — Gregory Brown <gregory.t.brown@...> 2009/09/07

On Fri, Sep 4, 2009 at 1:10 PM, Kazuhiko Shiozaki<redmine@ruby-lang.org> wrote:

[#25463] Re: [Feature #2032] Change the license to "GPLv2+ or Ruby's original". — Yukihiro Matsumoto <matz@...> 2009/09/08

Hi,

[#30610] [Feature #2032] Change the license to "GPLv2+ or Ruby's original". — Shyouhei Urabe <redmine@...> 2010/06/06

Issue #2032 has been updated by Shyouhei Urabe.

[#30611] Re: [Feature #2032] Change the license to "GPLv2+ or Ruby's original". — Yusuke ENDOH <mame@...> 2010/06/06

Hi,

[#30614] Re: [Feature #2032] Change the license to "GPLv2+ or Ruby's original". — Urabe Shyouhei <shyouhei@...> 2010/06/06

> To avoid enbugging a new bug, we must choose the another solutions.

[#30616] Re: [Feature #2032] Change the license to "GPLv2+ or Ruby's original". — Yusuke ENDOH <mame@...> 2010/06/06

2010/6/6 Urabe Shyouhei <shyouhei@ruby-lang.org>:

[#30652] Re: [Feature #2032] Change the license to "GPLv2+ or Ruby's original". — Urabe Shyouhei <shyouhei@...> 2010/06/08

(2010/06/06 20:27), Yusuke ENDOH wrote:

[#25285] [Feature #2033] Move Core Development to Git — Run Paint Run Run <redmine@...>

Feature #2033: Move Core Development to Git

75 messages 2009/09/02
[#25290] [Feature #2033] Move Core Development to Git — Yui NARUSE <redmine@...> 2009/09/02

Issue #2033 has been updated by Yui NARUSE.

[#25297] Re: [Feature #2033] Move Core Development to Git — Jon <jon.forums@...> 2009/09/02

> Some commiter of Ruby live on Windows.

[#25342] Re: [Feature #2033] Move Core Development to Git — Urabe Shyouhei <shyouhei@...> 2009/09/03

Jon wrote:

[#25343] Re: [Feature #2033] Move Core Development to Git — Michal Suchanek <hramrach@...> 2009/09/03

2009/9/4 Urabe Shyouhei <shyouhei@ruby-lang.org>:

[#25345] Re: [Feature #2033] Move Core Development to Git — Urabe Shyouhei <shyouhei@...> 2009/09/03

Michal Suchanek wrote:

[#25299] Re: [Feature #2033] Move Core Development to Git — Eric Hodel <drbrain@...7.net> 2009/09/02

On Sep 2, 2009, at 11:19, Run Paint Run Run wrote:

[#25306] [Feature #2034] Consider the ICU Library for Improving and Expanding Unicode Support — Run Paint Run Run <redmine@...>

Feature #2034: Consider the ICU Library for Improving and Expanding Unicode Support

16 messages 2009/09/03

[#25394] Unmaintained code (Was: Move Core Development to Git) — Eric Hodel <drbrain@...7.net>

On Sep 4, 2009, at 02:16, Urabe Shyouhei wrote:

10 messages 2009/09/05

[#25420] [Bug #2054] Onigurma Isn't Documented — Run Paint Run Run <redmine@...>

Bug #2054: Onigurma Isn't Documented

17 messages 2009/09/05

[#25442] turning off indentation warnings — Aaron Patterson <aaron@...>

Is there a way in 1.9 to turn off only indentation warnings? I like

19 messages 2009/09/06
[#25510] Re: turning off indentation warnings — Nobuyoshi Nakada <nobu@...> 2009/09/10

Hi,

[#25511] [Bug #2079] win32ole's OLEGEN does not create all classes needed when a TLB has more than one class defined — Bruno Antunes <redmine@...>

Bug #2079: win32ole's OLEGEN does not create all classes needed when a TLB has more than one class defined

18 messages 2009/09/10

[#25644] [Bug #2121] mathn/rational destroys Fixnum#/, Fixnum#quo and Bignum#/, Bignum#quo — Charles Nutter <redmine@...>

Bug #2121: mathn/rational destroys Fixnum#/, Fixnum#quo and Bignum#/, Bignum#quo

12 messages 2009/09/19

[#25709] [Bug #2131] f(not x) => syntax error — "James M. Lawrence" <redmine@...>

Bug #2131: f(not x) => syntax error

16 messages 2009/09/22

[#25769] A challenge: Enumerator#next in JRuby — Charles Oliver Nutter <headius@...>

I have a challenge for anyone who wants to discuss, propose

25 messages 2009/09/25
[#25782] Re: A challenge: Enumerator#next in JRuby — Tanaka Akira <akr@...> 2009/09/26

In article <f04d2210909251312q46bd51c0teacc4b0a8c417f0c@mail.gmail.com>,

[#25820] [Feature #2152] Split functionality of Float#inspect and Float#to_s — Roger Pack <redmine@...>

Feature #2152: Split functionality of Float#inspect and Float#to_s

32 messages 2009/09/28

[#25853] [Bug #2160] JSON can't parse input where top-level object is a string — caleb clausen <redmine@...>

Bug #2160: JSON can't parse input where top-level object is a string

11 messages 2009/09/29

[ruby-core:25789] Re: A challenge: Enumerator#next in JRuby

From: Nobuyoshi Nakada <nobu@...>
Date: 2009-09-26 05:44:17 UTC
List: ruby-core #25789
Hi,

At Sat, 26 Sep 2009 10:57:19 +0900,
Tanaka Akira wrote in [ruby-core:25782]:
> I think Enumerator.new (and possibly to_enum, enum_for)
> should be able to take an array consists of two method names
> for internal and external iteration as:
>   Enumerator.new(obj, [method1, method2], *args)
> method1 is for internal iteration and method2 is for
> external iteration.  The enumerator created by
> Enumerator.new uses method2 when next method is called if
> method2 is provided.  obj.method2 should return an object
> for external iteration. 

Interesting.


Index: include/ruby/intern.h
===================================================================
--- include/ruby/intern.h	(revision 25098)
+++ include/ruby/intern.h	(working copy)
@@ -189,4 +189,5 @@ VALUE rb_enumeratorize(VALUE, VALUE, int
 				    argc, argv);			\
     } while (0)
+NORETURN(void rb_stop_iteration(void));
 /* error.c */
 VALUE rb_exc_new(VALUE, const char*, long);
Index: enumerator.c
===================================================================
--- enumerator.c	(revision 25098)
+++ enumerator.c	(working copy)
@@ -85,4 +85,5 @@ struct enumerator {
     VALUE obj;
     ID    meth;
+    ID    meth_ext;
     VALUE args;
     VALUE fib;
@@ -340,4 +341,5 @@ enumerator_init(VALUE enum_obj, VALUE ob
 {
     struct enumerator *ptr;
+    VALUE methpair;
 
     TypedData_Get_Struct(enum_obj, struct enumerator, &enumerator_data_type, ptr);
@@ -348,5 +350,17 @@ enumerator_init(VALUE enum_obj, VALUE ob
 
     ptr->obj  = obj;
-    ptr->meth = rb_to_id(meth);
+    if (!NIL_P(methpair = rb_check_array_type(meth)) && RARRAY_LEN(methpair) == 2) {
+	VALUE meth_ext = RARRAY_PTR(methpair)[1];
+	ptr->meth = rb_to_id(RARRAY_PTR(methpair)[0]);
+	ptr->meth_ext = rb_to_id(meth_ext);
+    }
+    else {
+	ptr->meth = rb_to_id(meth);
+	meth = rb_usascii_str_new_cstr("external_iterator_for_");
+	rb_str_append(meth, rb_id2str(ptr->meth));
+	ptr->meth_ext = rb_intern_str(meth);
+	if (!rb_obj_respond_to(obj, ptr->meth_ext, TRUE))
+	    ptr->meth_ext = 0;
+    }
     if (argc) ptr->args = rb_ary_new4(argc, argv);
     ptr->fib = 0;
@@ -401,5 +415,6 @@ enumerator_initialize(int argc, VALUE *a
 
 	recv = generator_init(generator_allocate(rb_cGenerator), rb_block_proc());
-    } else {
+    }
+    else {
 	recv = *argv++;
 	if (--argc) {
@@ -432,4 +447,5 @@ enumerator_init_copy(VALUE obj, VALUE or
     ptr1->obj  = ptr0->obj;
     ptr1->meth = ptr0->meth;
+    ptr1->meth_ext = ptr0->meth_ext;
     ptr1->args = ptr0->args;
     ptr1->fib  = 0;
@@ -585,4 +601,16 @@ next_ii(VALUE i, VALUE obj, int argc, VA
 
 static VALUE
+make_stopper(void)
+{
+    return rb_exc_new2(rb_eStopIteration, "iteration reached an end");
+}
+
+void
+rb_stop_iteration(void)
+{
+    rb_exc_raise(make_stopper());
+}
+
+static VALUE
 next_i(VALUE curr, VALUE obj)
 {
@@ -592,5 +620,5 @@ next_i(VALUE curr, VALUE obj)
 
     result = rb_block_call(obj, id_each, 0, 0, next_ii, obj);
-    e->stop_exc = rb_exc_new2(rb_eStopIteration, "iteration reached an end");
+    e->stop_exc = make_stopper();
     rb_ivar_set(e->stop_exc, rb_intern("result"), result);
     return rb_fiber_yield(1, &nil);
@@ -611,4 +639,14 @@ get_next_values(VALUE obj, struct enumer
     VALUE curr, vs;
 
+    if (e->meth_ext) {
+	int argc = 0;
+	VALUE *argv = 0;
+	if (e->args) {
+	    argc = RARRAY_LENINT(e->args);
+	    argv = RARRAY_PTR(e->args);
+	}
+	return rb_funcall2(e->obj, e->meth_ext, argc, argv);
+    }
+
     if (e->stop_exc)
 	rb_exc_raise(e->stop_exc);
Index: io.c
===================================================================
--- io.c	(revision 25098)
+++ io.c	(working copy)
@@ -2617,4 +2617,17 @@ rb_io_each_line(int argc, VALUE *argv, V
 }
 
+NORETURN(void rb_stop_iteration(void));
+
+static VALUE
+rb_io_external_iterator_for_each_line(int argc, VALUE *argv, VALUE io)
+{
+    VALUE line = rb_io_gets_m(argc, argv, io);
+
+    if (NIL_P(line)) {
+	rb_stop_iteration();
+    }
+    return line;
+}
+
 /*
  *  call-seq:
@@ -9704,4 +9717,6 @@ Init_IO(void)
     rb_define_method(rb_cIO, "each",  rb_io_each_line, -1);
     rb_define_method(rb_cIO, "each_line",  rb_io_each_line, -1);
+    rb_define_private_method(rb_cIO, "external_iterator_for_each", rb_io_external_iterator_for_each_line, -1);
+    rb_define_private_method(rb_cIO, "external_iterator_for_each_line", rb_io_external_iterator_for_each_line, -1);
     rb_define_method(rb_cIO, "each_byte",  rb_io_each_byte, 0);
     rb_define_method(rb_cIO, "each_char",  rb_io_each_char, 0);


-- 
Nobu Nakada

In This Thread