ÿØÿà JFIF    ÿÛ „ ( %!1!%*+...983,7(-.- call-i.ri000064400000001470152353035600006245 0ustar00U:RDoc::AnyMethod[iI" call:ETI"Continuation#call;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [ I"EInvokes the continuation. The program continues from the end of ;TI"Hthe #callcc block. If no arguments are given, the original #callcc ;TI">returns +nil+. If one argument is given, #callcc returns ;TI"@it. Otherwise, an array containing args is returned.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [I"3callcc {|cont| cont.call } #=> nil ;TI"1callcc {|cont| cont.call 1 } #=> 1 ;TI"8callcc {|cont| cont.call 1, 2, 3 } #=> [1, 2, 3];T: @format0: @fileI" cont.c;T:0@omit_headings_from_table_of_contents_below0I"*cont.call(args, ...) cont[args, ...] ;T0[[I"[];T@ I" (*args);T@FI"Continuation;TcRDoc::NormalClass00%5b%5d-i.ri000064400000001413152353035600006200 0ustar00U:RDoc::AnyMethod[iI"[]:ETI"Continuation#[];TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [ I"EInvokes the continuation. The program continues from the end of ;TI"Hthe #callcc block. If no arguments are given, the original #callcc ;TI">returns +nil+. If one argument is given, #callcc returns ;TI"@it. Otherwise, an array containing args is returned.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [I"3callcc {|cont| cont.call } #=> nil ;TI"1callcc {|cont| cont.call 1 } #=> 1 ;TI"8callcc {|cont| cont.call 1, 2, 3 } #=> [1, 2, 3];T: @format0: @fileI" cont.c;T:0@omit_headings_from_table_of_contents_below000[I" (*args);T@FI"Continuation;TcRDoc::NormalClass0[@FI" call;Tcdesc-Continuation.ri000064400000004171152353035600010636 0ustar00U:RDoc::NormalClass[iI"Continuation:ET@I" Object;To:RDoc::Markup::Document: @parts[o;;[o:RDoc::Markup::Paragraph;[ I":Continuation objects are generated by Kernel#callcc, ;TI"continuation. They hold ;TI"Ha return address and execution context, allowing a nonlocal return ;TI"setjmp/longjmp (although they contain ;TI"?more state, so you might consider them closer to threads).;To:RDoc::Markup::BlankLineo; ;[I"For instance:;T@o:RDoc::Markup::Verbatim;[ I"require "continuation" ;TI":arr = [ "Freddie", "Herbie", "Ron", "Max", "Ringo" ] ;TI"callcc{|cc| $cc = cc} ;TI"puts(message = arr.shift) ;TI"&$cc.call unless message =~ /Max/ ;T: @format0o; ;[I"produces:;T@o; ;[ I" Freddie ;TI" Herbie ;TI" Ron ;TI" Max ;T; 0o; ;[I"/Also you can call callcc in other methods:;T@o; ;[I"require "continuation" ;TI" ;TI" def g ;TI"< arr = [ "Freddie", "Herbie", "Ron", "Max", "Ringo" ] ;TI" cc = callcc { |cc| cc } ;TI" puts arr.shift ;TI" return cc, arr.size ;TI" end ;TI" ;TI" def f ;TI" c, size = g ;TI" c.call(c) if size > 1 ;TI" end ;TI" ;TI"f ;T; 0o; ;[I"HThis (somewhat contrived) example allows the inner loop to abandon ;TI"processing early:;T@o; ;[I"require "continuation" ;TI"callcc {|cont| ;TI" for i in 0..4 ;TI" print "#{i}: " ;TI" for j in i*5...(i+1)*5 ;TI"" cont.call() if j == 17 ;TI" printf "%3d", j ;TI" end ;TI" end ;TI"} ;TI" puts ;T; 0o; ;[I"produces:;T@o; ;[ I"0: 0 1 2 3 4 ;TI"1: 5 6 7 8 9 ;TI"2: 10 11 12 13 14 ;TI"3: 15 16;T; 0: @fileI" cont.c;T:0@omit_headings_from_table_of_contents_below0; 0;0[[[[[I" class;T[[: public[[:protected[[: private[[I" instance;T[[;[[;[[;[[I"[];TI" cont.c;T[I" call;T@q[[U:RDoc::Context::Section[i0o;;[; 0;0[I" cont.c;T@XcRDoc::TopLevel