ruby-changes:17599
From: naruse <ko1@a...>
Date: Wed, 27 Oct 2010 09:26:38 +0900 (JST)
Subject: [ruby-changes:17599] Ruby:r29604 (trunk): * cont.c: apply documentation patch by Run Paint Run Run.
naruse 2010-10-27 09:26:29 +0900 (Wed, 27 Oct 2010) New Revision: 29604 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=29604 Log: * cont.c: apply documentation patch by Run Paint Run Run. [ruby-core:32915] Modified files: trunk/ChangeLog trunk/cont.c Index: ChangeLog =================================================================== --- ChangeLog (revision 29603) +++ ChangeLog (revision 29604) @@ -1,3 +1,8 @@ +Wed Oct 27 09:25:46 2010 NARUSE, Yui <naruse@r...> + + * cont.c: apply documentation patch by Run Paint Run Run. + [ruby-core:32915] + Wed Oct 27 02:12:10 2010 Yusuke Endoh <mame@t...> * object.c (Init_Object), constant.h, variable.c Index: cont.c =================================================================== --- cont.c (revision 29603) +++ cont.c (revision 29604) @@ -752,18 +752,19 @@ /* * Document-class: Continuation * - * Continuation objects are generated by - * <code>Kernel#callcc</code>. They hold a return address and execution - * context, allowing a nonlocal return to the end of the - * <code>callcc</code> block from anywhere within a program. - * Continuations are somewhat analogous to a structured version of C's - * <code>setjmp/longjmp</code> (although they contain more state, so - * you might consider them closer to threads). + * Continuation objects are generated by <code>Kernel#callcc</code>, + * after having <code>require</code>d <i>continuation</i>. They hold + * a return address and execution context, allowing a nonlocal return + * to the end of the <code>callcc</code> block from anywhere within a + * program. Continuations are somewhat analogous to a structured + * version of C's <code>setjmp/longjmp</code> (although they contain + * more state, so you might consider them closer to threads). * * For instance: * + * require "continuation" * arr = [ "Freddie", "Herbie", "Ron", "Max", "Ringo" ] - * callcc{|$cc|} + * callcc{|cc| $cc = cc} * puts(message = arr.shift) * $cc.call unless message =~ /Max/ * @@ -777,6 +778,7 @@ * This (somewhat contrived) example allows the inner loop to abandon * processing early: * + * require "continuation" * callcc {|cont| * for i in 0..4 * print "\n#{i}: " @@ -786,7 +788,7 @@ * end * end * } - * print "\n" + * puts * * <em>produces:</em> * @@ -800,14 +802,16 @@ * call-seq: * callcc {|cont| block } -> obj * - * Generates a <code>Continuation</code> object, which it passes to the - * associated block. Performing a <em>cont</em><code>.call</code> will - * cause the <code>callcc</code> to return (as will falling through the - * end of the block). The value returned by the <code>callcc</code> is - * the value of the block, or the value passed to - * <em>cont</em><code>.call</code>. See class <code>Continuation</code> - * for more details. Also see <code>Kernel::throw</code> for - * an alternative mechanism for unwinding a call stack. + * Generates a <code>Continuation</code> object, which it passes to + * the associated block. You need to <code>require + * 'continuation'</code> before using this method. Performing a + * <em>cont</em><code>.call</code> will cause the <code>callcc</code> + * to return (as will falling through the end of the block). The + * value returned by the <code>callcc</code> is the value of the + * block, or the value passed to <em>cont</em><code>.call</code>. See + * class <code>Continuation</code> for more details. Also see + * <code>Kernel::throw</code> for an alternative mechanism for + * unwinding a call stack. */ static VALUE @@ -1305,9 +1309,10 @@ * call-seq: * fiber.alive? -> true or false * - * Returns true if the fiber can still be resumed (or transferred to). - * After finishing execution of the fiber block this method will always - * return false. + * Returns true if the fiber can still be resumed (or transferred + * to). After finishing execution of the fiber block this method will + * always return false. You need to <code>require 'fiber'</code> + * before using this method. */ VALUE rb_fiber_alive_p(VALUE fibval) @@ -1344,7 +1349,9 @@ * * Transfer control to another fiber, resuming it from where it last * stopped or starting it if it was not resumed before. The calling - * fiber will be suspended much like in a call to <code>Fiber.yield</code>. + * fiber will be suspended much like in a call to + * <code>Fiber.yield</code>. You need to <code>require 'fiber'</code> + * before using this method. * * The fiber which receives the transfer call is treats it much like * a resume call. Arguments passed to transfer are treated like those -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/