⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.93
Server IP:
65.108.141.171
Server:
Linux server.heloix.com 5.4.0-214-generic #234-Ubuntu SMP Fri Mar 14 23:50:27 UTC 2025 x86_64
Server Software:
Apache
PHP Version:
7.4.33
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
share
/
ri
/
2.7.0
/
system
/
Continuation
/
View File Name :
cdesc-Continuation.ri
U: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"<after having +require+d <i>continuation</i>. They hold ;TI"Ha return address and execution context, allowing a nonlocal return ;TI"<to the end of the #callcc block from anywhere within a ;TI"Cprogram. Continuations are somewhat analogous to a structured ;TI"Gversion of C's <code>setjmp/longjmp</code> (although they contain ;TI"?more state, so you might consider them closer to threads).;To:RDoc::Markup::BlankLine o; ;[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"<em>produces:</em>;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"<em>produces:</em>;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@m[;[ [;[ [ [U:RDoc::Context::Section[i 0o;;[ ; 0;0[@X@XcRDoc::TopLevel