Ruby  2.1.10p492(2016-04-01revision54464)
Data Structures | Macros | Functions | Variables
enumerator.c File Reference
#include "ruby/ruby.h"
#include "node.h"
#include "internal.h"

Go to the source code of this file.

Data Structures

struct  enumerator
 
struct  generator
 
struct  yielder
 

Macros

#define enumerator_free   RUBY_TYPED_DEFAULT_FREE
 
#define yielder_free   RUBY_TYPED_DEFAULT_FREE
 
#define generator_free   RUBY_TYPED_DEFAULT_FREE
 

Functions

static VALUE generator_allocate (VALUE klass)
 
static VALUE generator_init (VALUE obj, VALUE proc)
 
static void enumerator_mark (void *p)
 
static size_t enumerator_memsize (const void *p)
 
static struct enumeratorenumerator_ptr (VALUE obj)
 
static VALUE obj_to_enum (int argc, VALUE *argv, VALUE obj)
 
static VALUE enumerator_allocate (VALUE klass)
 
static VALUE enumerator_init (VALUE enum_obj, VALUE obj, VALUE meth, int argc, VALUE *argv, rb_enumerator_size_func *size_fn, VALUE size)
 
static VALUE enumerator_initialize (int argc, VALUE *argv, VALUE obj)
 
static VALUE enumerator_init_copy (VALUE obj, VALUE orig)
 
VALUE rb_enumeratorize (VALUE obj, VALUE meth, int argc, VALUE *argv)
 
static VALUE lazy_to_enum_i (VALUE self, VALUE meth, int argc, VALUE *argv, rb_enumerator_size_func *size_fn)
 
VALUE rb_enumeratorize_with_size (VALUE obj, VALUE meth, int argc, VALUE *argv, rb_enumerator_size_func *size_fn)
 
static VALUE enumerator_block_call (VALUE obj, rb_block_call_func *func, VALUE arg)
 
static VALUE enumerator_each (int argc, VALUE *argv, VALUE obj)
 
return rb_yield_values (2, val, idx)
 
return rb_yield_values (2, rb_ary_new4(argc, argv), idx)
 
static VALUE enumerator_size (VALUE obj)
 
static VALUE enumerator_enum_size (VALUE obj, VALUE args, VALUE eobj)
 
static VALUE enumerator_with_index (int argc, VALUE *argv, VALUE obj)
 
static VALUE enumerator_each_with_index (VALUE obj)
 
return rb_yield_values (2, rb_ary_new4(argc, argv), memo)
 
static VALUE enumerator_with_object (VALUE obj, VALUE memo)
 
 rb_fiber_yield (1,&args)
 
 if (e->feedvalue!=Qundef)
 
static VALUE next_i (VALUE curr, VALUE obj)
 
static void next_init (VALUE obj, struct enumerator *e)
 
static VALUE get_next_values (VALUE obj, struct enumerator *e)
 
static VALUE enumerator_next_values (VALUE obj)
 
static VALUE ary2sv (VALUE args, int dup)
 
static VALUE enumerator_next (VALUE obj)
 
static VALUE enumerator_peek_values (VALUE obj)
 
static VALUE enumerator_peek_values_m (VALUE obj)
 
static VALUE enumerator_peek (VALUE obj)
 
static VALUE enumerator_feed (VALUE obj, VALUE v)
 
static VALUE enumerator_rewind (VALUE obj)
 
static VALUE append_method (VALUE obj, VALUE str, ID default_method, VALUE default_args)
 
static VALUE inspect_enumerator (VALUE obj, VALUE dummy, int recur)
 
static VALUE enumerator_inspect (VALUE obj)
 
static void yielder_mark (void *p)
 
static size_t yielder_memsize (const void *p)
 
static struct yielderyielder_ptr (VALUE obj)
 
static VALUE yielder_allocate (VALUE klass)
 
static VALUE yielder_init (VALUE obj, VALUE proc)
 
static VALUE yielder_initialize (VALUE obj)
 
static VALUE yielder_yield (VALUE obj, VALUE args)
 
static VALUE yielder_yield_push (VALUE obj, VALUE args)
 
static VALUE yielder_new (void)
 
static void generator_mark (void *p)
 
static size_t generator_memsize (const void *p)
 
static struct generatorgenerator_ptr (VALUE obj)
 
static VALUE generator_initialize (int argc, VALUE *argv, VALUE obj)
 
static VALUE generator_init_copy (VALUE obj, VALUE orig)
 
static VALUE generator_each (int argc, VALUE *argv, VALUE obj)
 
static VALUE enum_size (VALUE self)
 
static VALUE lazyenum_size (VALUE self, VALUE args, VALUE eobj)
 
static VALUE lazy_size (VALUE self)
 
static VALUE lazy_receiver_size (VALUE generator, VALUE args, VALUE lazy)
 
 if (argc==1)
 
 rb_ary_push (args, m)
 
 if (argc > 0)
 
 RB_GC_GUARD (args)
 
 if (result==Qundef)
 
static VALUE lazy_initialize (int argc, VALUE *argv, VALUE self)
 
static VALUE lazy_set_method (VALUE lazy, VALUE args, rb_enumerator_size_func *size_fn)
 
static VALUE enumerable_lazy (VALUE obj)
 
static VALUE lazy_to_enum (int argc, VALUE *argv, VALUE self)
 
 rb_funcall (argv[0], id_yield, 1, result)
 
static VALUE lazy_map (VALUE obj)
 
static VALUE lazy_flat_map_each (VALUE obj, VALUE yielder)
 
static VALUE lazy_flat_map_to_ary (VALUE obj, VALUE yielder)
 
 if (RB_TYPE_P(result, T_ARRAY))
 
static VALUE lazy_flat_map (VALUE obj)
 
 if (RTEST(rb_yield(element)))
 
static VALUE lazy_select (VALUE obj)
 
 if (!RTEST(rb_yield(element)))
 
static VALUE lazy_reject (VALUE obj)
 
 if (RTEST(result))
 
static VALUE lazy_grep (VALUE obj, VALUE pattern)
 
static VALUE call_next (VALUE obj)
 
static VALUE next_stopped (VALUE obj)
 
 rb_ary_push (ary, argv[1])
 
 for (i=0;i< RARRAY_LEN(arrays);i++)
 
 rb_funcall (yielder, id_yield, 1, ary)
 
 rb_ivar_set (yielder, id_memo, LONG2NUM(++count))
 
 if (NIL_P(arg))
 
 if (--argc > 0)
 
 rb_ary_push (ary, v)
 
static VALUE lazy_zip (int argc, VALUE *argv, VALUE obj)
 
 if (NIL_P(memo))
 
 rb_funcall2 (argv[0], id_yield, argc-1, argv+1)
 
 if ((remain=NUM2LONG(memo)-1)==0)
 
static VALUE lazy_take_size (VALUE generator, VALUE args, VALUE lazy)
 
static VALUE lazy_take (VALUE obj, VALUE n)
 
 if (!RTEST(result)) return Qundef
 
static VALUE lazy_take_while (VALUE obj)
 
static VALUE lazy_drop_size (VALUE generator, VALUE args, VALUE lazy)
 
 if ((remain=NUM2LONG(memo))==0)
 
static VALUE lazy_drop (VALUE obj, VALUE n)
 
 if (NIL_P(memo)&&!RTEST(rb_yield_values2(argc-1,&argv[1])))
 
 if (memo==Qtrue)
 
static VALUE lazy_drop_while (VALUE obj)
 
static VALUE lazy_super (int argc, VALUE *argv, VALUE lazy)
 
static VALUE lazy_lazy (VALUE obj)
 
static VALUE stop_result (VALUE self)
 
void InitVM_Enumerator (void)
 
void Init_Enumerator (void)
 

Variables

VALUE rb_cEnumerator
 
VALUE rb_cLazy
 
static ID id_rewind
 
static ID id_each
 
static ID id_new
 
static ID id_initialize
 
static ID id_yield
 
static ID id_call
 
static ID id_size
 
static ID id_to_enum
 
static ID id_eqq
 
static ID id_next
 
static ID id_result
 
static ID id_lazy
 
static ID id_receiver
 
static ID id_arguments
 
static ID id_memo
 
static ID id_method
 
static ID id_force
 
static VALUE sym_each
 
static VALUE sym_cycle
 
VALUE rb_eStopIteration
 
static VALUE rb_cGenerator
 
static VALUE rb_cYielder
 
static const rb_data_type_t enumerator_data_type
 
static VALUE
 
VALUE idx = memo->u1.value
 
memo u1 value = rb_int_succ(idx)
 
VALUE feedvalue = Qnil
 
VALUE args = rb_ary_new4(argc, argv)
 
static const rb_data_type_t yielder_data_type
 
static const rb_data_type_t generator_data_type
 
 else
 
int len = rb_long2int((long)argc + 1)
 
 result = rb_yield_values2(len, RARRAY_CONST_PTR(args))
 
return Qnil
 
long i
 
long count = NIL_P(memo) ? 0 : NUM2LONG(memo)
 
 yielder = argv[0]
 
 memo = rb_attr_get(yielder, id_memo)
 
 ary = rb_ary_new2(RARRAY_LEN(arrays) + 1)
 
 arg = rb_attr_get(yielder, id_memo)
 
 v = Qnil
 

Macro Definition Documentation

#define enumerator_free   RUBY_TYPED_DEFAULT_FREE

Definition at line 156 of file enumerator.c.

#define generator_free   RUBY_TYPED_DEFAULT_FREE

Definition at line 1171 of file enumerator.c.

#define yielder_free   RUBY_TYPED_DEFAULT_FREE

Definition at line 1065 of file enumerator.c.

Function Documentation

static VALUE append_method ( VALUE  obj,
VALUE  str,
ID  default_method,
VALUE  default_args 
)
static
static VALUE ary2sv ( VALUE  args,
int  dup 
)
static

Definition at line 730 of file enumerator.c.

References args, Qnil, RARRAY_AREF, RARRAY_LEN, rb_ary_dup(), RB_TYPE_P, and T_ARRAY.

Referenced by enumerator_next(), and enumerator_peek().

static VALUE call_next ( VALUE  obj)
static

Definition at line 1693 of file enumerator.c.

References id_next, and rb_funcall().

static VALUE enum_size ( VALUE  self)
static

Definition at line 1296 of file enumerator.c.

References id_size, Qnil, Qundef, r, and rb_check_funcall().

Referenced by lazy_size(), and lazyenum_size().

static VALUE enumerable_lazy ( VALUE  obj)
static

Definition at line 1452 of file enumerator.c.

References id_method, lazy_to_enum_i(), lazyenum_size(), Qfalse, rb_ivar_set(), result, and sym_each.

Referenced by InitVM_Enumerator(), and lazy_super().

static VALUE enumerator_allocate ( VALUE  klass)
static
static VALUE enumerator_block_call ( VALUE  obj,
rb_block_call_func func,
VALUE  arg 
)
static
static VALUE enumerator_each ( int  argc,
VALUE argv,
VALUE  obj 
)
static
static VALUE enumerator_each_with_index ( VALUE  obj)
static

Definition at line 554 of file enumerator.c.

References enumerator_with_index(), and NULL.

Referenced by InitVM_Enumerator().

static VALUE enumerator_enum_size ( VALUE  obj,
VALUE  args,
VALUE  eobj 
)
static

Definition at line 512 of file enumerator.c.

References enumerator_size().

Referenced by enumerator_with_index(), and enumerator_with_object().

static VALUE enumerator_feed ( VALUE  obj,
VALUE  v 
)
static

Definition at line 899 of file enumerator.c.

References enumerator_ptr(), enumerator::feedvalue, Qnil, Qundef, rb_eTypeError, rb_raise(), and v.

Referenced by InitVM_Enumerator().

static VALUE enumerator_init ( VALUE  enum_obj,
VALUE  obj,
VALUE  meth,
int  argc,
VALUE argv,
rb_enumerator_size_func size_fn,
VALUE  size 
)
static
static VALUE enumerator_init_copy ( VALUE  obj,
VALUE  orig 
)
static
static VALUE enumerator_initialize ( int  argc,
VALUE argv,
VALUE  obj 
)
static
static VALUE enumerator_inspect ( VALUE  obj)
static

Definition at line 1019 of file enumerator.c.

References inspect_enumerator(), and rb_exec_recursive().

Referenced by InitVM_Enumerator().

static void enumerator_mark ( void p)
static
static size_t enumerator_memsize ( const void p)
static

Definition at line 159 of file enumerator.c.

static VALUE enumerator_next ( VALUE  obj)
static

Definition at line 772 of file enumerator.c.

References ary2sv(), and enumerator_next_values().

Referenced by InitVM_Enumerator().

static VALUE enumerator_next_values ( VALUE  obj)
static

Definition at line 715 of file enumerator.c.

References enumerator_ptr(), get_next_values(), enumerator::lookahead, and Qundef.

Referenced by enumerator_next(), and InitVM_Enumerator().

static VALUE enumerator_peek ( VALUE  obj)
static

Definition at line 846 of file enumerator.c.

References ary2sv(), and enumerator_peek_values().

Referenced by InitVM_Enumerator().

static VALUE enumerator_peek_values ( VALUE  obj)
static
static VALUE enumerator_peek_values_m ( VALUE  obj)
static

Definition at line 818 of file enumerator.c.

References enumerator_peek_values(), and rb_ary_dup().

Referenced by InitVM_Enumerator().

static struct enumerator* enumerator_ptr ( VALUE  obj)
static
static VALUE enumerator_rewind ( VALUE  obj)
static
static VALUE enumerator_size ( VALUE  obj)
static
static VALUE enumerator_with_index ( int  argc,
VALUE argv,
VALUE  obj 
)
static
static VALUE enumerator_with_object ( VALUE  obj,
VALUE  memo 
)
static
for ( )

Definition at line 1716 of file enumerator.c.

static VALUE generator_allocate ( VALUE  klass)
static
static VALUE generator_each ( int  argc,
VALUE argv,
VALUE  obj 
)
static
static VALUE generator_init ( VALUE  obj,
VALUE  proc 
)
static
static VALUE generator_init_copy ( VALUE  obj,
VALUE  orig 
)
static
static VALUE generator_initialize ( int  argc,
VALUE argv,
VALUE  obj 
)
static
static void generator_mark ( void p)
static

Definition at line 1165 of file enumerator.c.

References p, generator::proc, ptr, and rb_gc_mark().

static size_t generator_memsize ( const void p)
static

Definition at line 1174 of file enumerator.c.

static struct generator* generator_ptr ( VALUE  obj)
static
static VALUE get_next_values ( VALUE  obj,
struct enumerator e 
)
static
if ( e->feedvalue!  = Qundef)

Definition at line 613 of file enumerator.c.

References enumerator::feedvalue, and Qundef.

if ( argc  = = 1)

Definition at line 1324 of file enumerator.c.

References m, rb_yield_values2(), and val.

if ( argc  ,
 
)

Definition at line 1336 of file enumerator.c.

References argc, argv, and rb_ary_cat().

if ( result  = Qundef)

Definition at line 1342 of file enumerator.c.

if ( RB_TYPE_P(result, T_ARRAY )

Definition at line 1560 of file enumerator.c.

References argv, i, id_yield, RARRAY_AREF, RARRAY_LEN, and rb_funcall().

if ( RTEST(rb_yield(element))  )

Definition at line 1617 of file enumerator.c.

References argv, id_yield, and rb_funcall().

if ( RTESTrb_yield(element))

Definition at line 1640 of file enumerator.c.

References argv, id_yield, and rb_funcall().

if ( RTEST(result )

Definition at line 1664 of file enumerator.c.

References argv, id_yield, and rb_funcall().

if ( NIL_P(arg )
if ( --  argc,
 
)

Definition at line 1742 of file enumerator.c.

References argc, argv, and rb_ary_new_from_values().

if ( NIL_P(memo )

Definition at line 1794 of file enumerator.c.

References args.

if ( (remain=NUM2LONG(memo)-1)  = = 0)

Definition at line 1799 of file enumerator.c.

References Qundef.

if ( RTESTresult)
if ( (remain=NUM2LONG(memo))  = = 0)

Definition at line 1880 of file enumerator.c.

References argc, argv, id_yield, and rb_funcall2().

if ( NIL_P(memo)&&!RTEST(rb_yield_values2(argc-1,&argv[1]))  )

Definition at line 1906 of file enumerator.c.

References argv, id_memo, Qtrue, and rb_ivar_set().

if ( memo  = Qtrue)

Definition at line 1909 of file enumerator.c.

References argc, argv, id_yield, and rb_funcall2().

void Init_Enumerator ( void  )
void InitVM_Enumerator ( void  )
static VALUE inspect_enumerator ( VALUE  obj,
VALUE  dummy,
int  recur 
)
static
static VALUE lazy_drop ( VALUE  obj,
VALUE  n 
)
static
static VALUE lazy_drop_size ( VALUE  generator,
VALUE  args,
VALUE  lazy 
)
static
static VALUE lazy_drop_while ( VALUE  obj)
static
static VALUE lazy_flat_map ( VALUE  obj)
static
static VALUE lazy_flat_map_each ( VALUE  obj,
VALUE  yielder 
)
static

Definition at line 1534 of file enumerator.c.

References id_each, Qnil, and rb_block_call().

static VALUE lazy_flat_map_to_ary ( VALUE  obj,
VALUE  yielder 
)
static

Definition at line 1541 of file enumerator.c.

References ary, i, id_yield, NIL_P(), Qnil, RARRAY_AREF, RARRAY_LEN, rb_check_array_type(), and rb_funcall().

static VALUE lazy_grep ( VALUE  obj,
VALUE  pattern 
)
static

Definition at line 1683 of file enumerator.c.

References id_new, lazy_set_method(), rb_ary_new3, rb_block_call(), rb_block_given_p(), and rb_cLazy.

Referenced by InitVM_Enumerator().

static VALUE lazy_initialize ( int  argc,
VALUE argv,
VALUE  self 
)
static
static VALUE lazy_lazy ( VALUE  obj)
static

Definition at line 1933 of file enumerator.c.

References obj.

Referenced by InitVM_Enumerator().

static VALUE lazy_map ( VALUE  obj)
static
static VALUE lazy_receiver_size ( VALUE  generator,
VALUE  args,
VALUE  lazy 
)
static

Definition at line 1315 of file enumerator.c.

References lazy_size().

Referenced by lazy_map(), and lazy_zip().

static VALUE lazy_reject ( VALUE  obj)
static
static VALUE lazy_select ( VALUE  obj)
static
static VALUE lazy_set_method ( VALUE  lazy,
VALUE  args,
rb_enumerator_size_func size_fn 
)
static
static VALUE lazy_size ( VALUE  self)
static

Definition at line 1309 of file enumerator.c.

References enum_size(), id_receiver, and rb_ivar_get().

Referenced by lazy_drop_size(), lazy_receiver_size(), and lazy_take_size().

static VALUE lazy_super ( int  argc,
VALUE argv,
VALUE  lazy 
)
static

Definition at line 1927 of file enumerator.c.

References enumerable_lazy(), and rb_call_super().

Referenced by InitVM_Enumerator().

static VALUE lazy_take ( VALUE  obj,
VALUE  n 
)
static
static VALUE lazy_take_size ( VALUE  generator,
VALUE  args,
VALUE  lazy 
)
static

Definition at line 1809 of file enumerator.c.

References FIX2LONG, FIXNUM_P, id_arguments, lazy_size(), LONG2NUM, NIL_P(), NUM2LONG, RARRAY_AREF, rb_ivar_get(), and receiver.

Referenced by lazy_take().

static VALUE lazy_take_while ( VALUE  obj)
static
static VALUE lazy_to_enum ( int  argc,
VALUE argv,
VALUE  self 
)
static
static VALUE lazy_to_enum_i ( VALUE  self,
VALUE  meth,
int  argc,
VALUE argv,
rb_enumerator_size_func size_fn 
)
static
static VALUE lazy_zip ( int  argc,
VALUE argv,
VALUE  obj 
)
static
static VALUE lazyenum_size ( VALUE  self,
VALUE  args,
VALUE  eobj 
)
static

Definition at line 1303 of file enumerator.c.

References enum_size().

Referenced by enumerable_lazy().

static VALUE next_i ( VALUE  curr,
VALUE  obj 
)
static
static void next_init ( VALUE  obj,
struct enumerator e 
)
static
static VALUE next_stopped ( VALUE  obj)
static

Definition at line 1699 of file enumerator.c.

References Qnil.

static VALUE obj_to_enum ( int  argc,
VALUE argv,
VALUE  obj 
)
static
rb_ary_push ( args  ,
m   
)
rb_ary_push ( ary  ,
argv  [1] 
)
rb_ary_push ( ary  ,
v   
)
VALUE rb_enumeratorize ( VALUE  obj,
VALUE  meth,
int  argc,
VALUE argv 
)
VALUE rb_enumeratorize_with_size ( VALUE  obj,
VALUE  meth,
int  argc,
VALUE argv,
rb_enumerator_size_func size_fn 
)
rb_fiber_yield ( ,
args 
)
rb_funcall ( argv  [0],
id_yield  ,
,
result   
)
rb_funcall ( yielder  ,
id_yield  ,
,
ary   
)
rb_funcall2 ( argv  [0],
id_yield  ,
argc 1,
argv 1 
)
RB_GC_GUARD ( args  )

Referenced by ary_recycle_hash(), backtrace_to_location_ary(), backtrace_to_str_ary(), big2str_generic(), big_shift3(), bigadd_int(), bigand_int(), BigDecimal_power(), BigMath_s_exp(), BigMath_s_log(), bigmul0(), bigor_int(), bigsq(), bigsub_int(), bigxor_int(), bmcall(), callback(), check_funcall_exec(), clone_method(), d_lite_inspect(), date_zone_to_diff(), econv_init(), establishShell(), eval_string_with_cref(), file_s_fnmatch(), iseq_build_from_ary_body(), iseq_build_from_ary_exception(), marshal_dump(), marshal_load(), mk_inspect(), ossl_asn1_decode(), ossl_asn1_decode_all(), ossl_asn1_traverse(), parse_ddd_cb(), parser_compile_string(), path_check_0(), proc_call(), push_glob(), rand_int(), rb_apply(), rb_ary_sample(), rb_ary_splice(), rb_autoload_load(), rb_big_and(), rb_big_divrem_normal(), rb_big_mul_balance(), rb_big_mul_karatsuba(), rb_big_mul_normal(), rb_big_mul_toom3(), rb_big_or(), rb_big_sq_fast(), rb_big_xor(), rb_check_id(), rb_define_hooked_variable(), rb_econv_substr_append(), rb_exec_fillarg(), rb_execarg_addopt(), rb_execarg_fixup(), rb_execarg_init(), rb_f_exec(), rb_f_spawn(), rb_file_s_basename(), rb_find_file_ext_safe(), rb_find_file_safe(), rb_integer_pack(), rb_io_s_sysopen(), rb_io_syswrite(), rb_iseq_eval(), rb_iseq_eval_main(), rb_load_internal0(), rb_mod_define_method(), rb_name_err_mesg_new(), rb_parser_compile_file_path(), rb_path_to_class(), rb_proc_call(), rb_proc_call_with_block(), rb_reg_check_preprocess(), rb_reg_initialize(), rb_reg_initialize_str(), rb_reg_prepare_re(), rb_spawn_internal(), rb_str2big_karatsuba(), rb_str2big_normal(), rb_str2big_poweroftwo(), rb_str_enumerate_chars(), rb_str_enumerate_codepoints(), rb_str_enumerate_lines(), rb_str_format(), rb_str_intern(), rb_str_subpos(), rb_str_subseq(), rb_str_substr(), rb_str_symname_type(), rb_w32_write_console(), rb_write_error_str(), rb_yield_splat(), realpath_rec(), rmpd_power_by_big_decimal(), strio_ungetbyte(), strio_write(), transcode_string(), vm_backtrace_to_ary(), vm_call0_body(), vm_define_method(), vm_expandarray(), w_object(), and zstream_run().

rb_ivar_set ( yielder  ,
id_memo  ,
LONG2NUM(++count  
)
return rb_yield_values ( ,
val  ,
idx   
)
return rb_yield_values ( ,
rb_ary_new4(argc, argv ,
idx   
)
return rb_yield_values ( ,
rb_ary_new4(argc, argv ,
memo   
)
static VALUE stop_result ( VALUE  self)
static

Definition at line 1986 of file enumerator.c.

References id_result, and rb_attr_get().

Referenced by InitVM_Enumerator().

static VALUE yielder_allocate ( VALUE  klass)
static

Definition at line 1097 of file enumerator.c.

References obj, yielder::proc, ptr, Qundef, TypedData_Make_Struct, and yielder_data_type.

Referenced by InitVM_Enumerator(), and yielder_new().

static VALUE yielder_init ( VALUE  obj,
VALUE  proc 
)
static
static VALUE yielder_initialize ( VALUE  obj)
static

Definition at line 1126 of file enumerator.c.

References rb_block_proc(), rb_need_block(), and yielder_init().

Referenced by InitVM_Enumerator().

static void yielder_mark ( void p)
static

Definition at line 1059 of file enumerator.c.

References p, yielder::proc, ptr, and rb_gc_mark().

static size_t yielder_memsize ( const void p)
static

Definition at line 1068 of file enumerator.c.

static VALUE yielder_new ( void  )
static

Definition at line 1156 of file enumerator.c.

References rb_cYielder, rb_proc_new(), yielder_allocate(), and yielder_init().

Referenced by generator_each().

static struct yielder* yielder_ptr ( VALUE  obj)
static

Definition at line 1084 of file enumerator.c.

References yielder::proc, ptr, Qundef, rb_eArgError, rb_raise(), TypedData_Get_Struct, and yielder_data_type.

Referenced by yielder_yield().

static VALUE yielder_yield ( VALUE  obj,
VALUE  args 
)
static

Definition at line 1135 of file enumerator.c.

References yielder::proc, ptr, rb_proc_call(), and yielder_ptr().

Referenced by InitVM_Enumerator(), and yielder_yield_push().

static VALUE yielder_yield_push ( VALUE  obj,
VALUE  args 
)
static

Definition at line 1143 of file enumerator.c.

References obj, and yielder_yield().

Referenced by InitVM_Enumerator().

Variable Documentation

Definition at line 1731 of file enumerator.c.

args = rb_ary_new4(argc, argv)

Definition at line 611 of file enumerator.c.

ary = rb_ary_new2(RARRAY_LEN(arrays) + 1)

Definition at line 1714 of file enumerator.c.

count = NIL_P(memo) ? 0 : NUM2LONG(memo)

Definition at line 1708 of file enumerator.c.

else
Initial value:
{
args[0]
Definition: enum.c:585
unsigned long VALUE
Definition: ripper.y:88

Definition at line 1330 of file enumerator.c.

const rb_data_type_t enumerator_data_type
static
Initial value:
= {
"enumerator",
{
},
}
static void enumerator_mark(void *p)
Definition: enumerator.c:143
#define enumerator_free
Definition: enumerator.c:156
#define RUBY_TYPED_FREE_IMMEDIATELY
static size_t enumerator_memsize(const void *p)
Definition: enumerator.c:159
#define NULL
Definition: _sdbm.c:102

Definition at line 164 of file enumerator.c.

Referenced by enumerator_allocate(), enumerator_init(), enumerator_init_copy(), enumerator_ptr(), and inspect_enumerator().

return feedvalue = Qnil

Definition at line 610 of file enumerator.c.

const rb_data_type_t generator_data_type
static
Initial value:
= {
"generator",
{
},
}
static void generator_mark(void *p)
Definition: enumerator.c:1165
static size_t generator_memsize(const void *p)
Definition: enumerator.c:1174
#define generator_free
Definition: enumerator.c:1171
#define RUBY_TYPED_FREE_IMMEDIATELY
#define NULL
Definition: _sdbm.c:102

Definition at line 1179 of file enumerator.c.

Referenced by generator_allocate(), generator_init(), generator_init_copy(), and generator_ptr().

long i

Definition at line 1708 of file enumerator.c.

ID id_arguments
static
ID id_call
static

Definition at line 107 of file enumerator.c.

Referenced by enumerator_initialize(), enumerator_size(), and Init_Enumerator().

ID id_each
static

Definition at line 107 of file enumerator.c.

Referenced by Init_Enumerator(), lazy_flat_map_each(), lazy_zip(), and next_i().

ID id_eqq
static

Definition at line 108 of file enumerator.c.

Referenced by Init_Enumerator().

ID id_force
static

Definition at line 108 of file enumerator.c.

Referenced by Init_Enumerator().

ID id_initialize
static

Definition at line 107 of file enumerator.c.

Referenced by Init_Enumerator(), and lazy_initialize().

ID id_lazy
static

Definition at line 108 of file enumerator.c.

Referenced by Init_Enumerator().

ID id_memo
static

Definition at line 108 of file enumerator.c.

Referenced by if(), and Init_Enumerator().

ID id_method
static

Definition at line 108 of file enumerator.c.

Referenced by append_method(), enumerable_lazy(), Init_Enumerator(), and lazy_set_method().

ID id_new
static
ID id_next
static

Definition at line 108 of file enumerator.c.

Referenced by call_next(), and Init_Enumerator().

ID id_receiver
static

Definition at line 108 of file enumerator.c.

Referenced by Init_Enumerator(), inspect_enumerator(), lazy_initialize(), and lazy_size().

ID id_result
static

Definition at line 108 of file enumerator.c.

Referenced by Init_Enumerator(), next_i(), and stop_result().

ID id_rewind
static

Definition at line 107 of file enumerator.c.

Referenced by enumerator_rewind(), and Init_Enumerator().

ID id_size
static

Definition at line 107 of file enumerator.c.

Referenced by enum_size(), and Init_Enumerator().

ID id_to_enum
static

Definition at line 107 of file enumerator.c.

Referenced by if(), and Init_Enumerator().

ID id_yield
static

Definition at line 107 of file enumerator.c.

Referenced by if(), Init_Enumerator(), and lazy_flat_map_to_ary().

long idx = memo->u1.value
register unsigned int len = rb_long2int((long)argc + 1)

Definition at line 1332 of file enumerator.c.

Referenced by add_compile_string_length(), addrinfo_mload(), allocate_converted_string(), alt_merge_opt_exact_info(), append_utf8(), appendline(), ary_ensure_room_for_unshift(), ary_len_of_dim(), ary_make_shared(), ary_make_substitution(), ary_resize_capa(), ary_take_first_or_last(), Balloc(), big2str_2bdigits(), big2str_karatsuba(), bigadd(), BigDecimal_split(), bignew_1(), bigtrunc(), BSD__sfvwrite(), bsock_getpeername(), bsock_getsockname(), bsock_getsockopt(), bsock_local_address(), bsock_remote_address(), bytes_2comp(), check_dirname(), check_type_val2variant(), clsid_from_remote(), coderange_scan(), compile_anchor_node(), compile_array_(), compile_enclose_node(), compile_length_anchor_node(), compile_length_cclass_node(), compile_length_enclose_node(), compile_length_quantifier_node(), compile_length_string_node(), compile_length_tree(), compile_string_node(), compile_tree(), concat_opt_exact_info(), concat_opt_exact_info_str(), CONF_get1_default_config_file(), constat_parse(), convert_encoding(), convert_mb_to_wchar(), convert_UTF32_to_UTF8(), convert_UTF8_to_JSON(), convert_wchar_to_mb(), copy_stream_body(), cState_array_nl_set(), cState_configure(), cState_indent_set(), cState_object_nl_set(), cState_space_before_set(), cState_space_set(), date_strftime_alloc(), date_strftime_internal(), decode_bstr(), decorate_convpath(), dimension(), dlhandle_sym(), enum_cycle(), enum_drop(), enum_take(), env_has_value(), env_key(), env_rassoc(), envix(), error_print(), etc_systmpdir(), expand_case_fold_string(), expand_case_fold_string_alt(), fbuffer_append(), fdbm_delete(), fdbm_fetch(), fdbm_has_key(), fdbm_has_value(), fdbm_key(), fgdbm_has_key(), fiddle_handle_sym(), flo_to_s(), fole_s_create_guid(), foletypelib_guid(), foletypelib_initialize(), folevariant_initialize(), fun_so_universal_newline(), get_char_length_tree1(), get_system_directory(), getnameinfo(), global_id(), gzfile_getc(), gzfile_read_header(), gzfile_ungets(), hash2ptr_dispparams(), home_dir(), i_apply_case_fold(), if(), init_addrinfo(), init_env(), inspect1(), inspect2(), inspect_struct(), intern_str(), io_binwrite(), io_bufread(), io_fread(), io_fwrite(), io_getpartial(), io_nread(), io_read(), io_shift_cbuf(), io_ungetbyte(), ioctl_narg_len(), ip_addr(), ip_peeraddr(), ip_s_getaddress(), is_batch(), is_not_included(), iseq_build_from_ary_body(), iseq_data_to_ary(), iseq_set_sequence(), join_argv(), JSON_parse_float(), JSON_parse_integer(), lazy_drop_size(), limited_big_rand(), load_transcoder_entry(), loaded_feature_path(), make_replacement(), make_seed_value(), make_unique_str(), match_at(), match_inspect(), memcmp(), mime_putc(), mk_ary_of_str(), more_output_buffer(), moreswitches(), nfc_getc(), nkf_buf_at(), nogvl_copy_stream_read_write(), ole_const_load(), ole_mb2wc(), ole_method_params(), ole_search_event(), ole_search_event_at(), ole_type_guid(), ole_val2olevariantdata(), ole_variables(), ole_vstr2wc(), oleparam_ole_param_from_index(), onig_is_code_in_cc(), onig_strcpy(), onigenc_mbn_mbc_case_fold(), onigenc_mbn_mbc_to_code(), onigenc_minimum_property_name_to_ctype(), onigenc_str_bytelen_null(), onigenc_strlen_null(), open_dir_handle(), opendir_internal(), ossl_asn1_decode(), ossl_asn1_decode0(), ossl_asn1_decode_all(), ossl_asn1_traverse(), ossl_asn1prim_to_der(), ossl_bn_initialize(), ossl_bn_to_s(), ossl_dh_compute_key(), ossl_dh_to_der(), ossl_dsa_to_der(), ossl_pem_passwd_cb(), ossl_pkcs12_to_der(), ossl_pkcs7_add_data(), ossl_pkcs7_to_der(), ossl_rsa_to_der(), ossl_spki_to_der(), ossl_ssl_read_internal(), ossl_ssl_session_to_der(), ossl_x509_to_der(), ossl_x509attr_to_der(), ossl_x509ext_to_der(), ossl_x509name_to_der(), ossl_x509req_to_der(), overlapped_socket_io(), pack_pack(), pack_unpack(), parse_char_class(), parse_exp(), parse_mode_enc(), parse_numvar(), parser_encode_length(), parser_here_document(), parser_heredoc_identifier(), parser_magic_comment(), parser_tokadd_mbchar(), parser_tokaddmbc(), parser_whole_match_p(), parser_yyerror(), pruby_var_equal_to_cstr_p(), pruby_var_prefixed_p(), pruby_var_to_cstr(), r_bytes0(), r_bytes1_buffered(), r_ivar(), r_object0(), rand_init(), rb_ary_aref(), rb_ary_aset(), rb_ary_cmp(), rb_ary_combination(), rb_ary_delete_at(), rb_ary_dup(), rb_ary_elt(), rb_ary_fill(), rb_ary_index(), rb_ary_initialize(), rb_ary_join(), rb_ary_last(), rb_ary_length(), rb_ary_modify(), rb_ary_plus(), rb_ary_repeated_combination(), rb_ary_reverse(), rb_ary_reverse_each(), rb_ary_reverse_m(), rb_ary_rindex(), rb_ary_rotate(), rb_ary_rotate_m(), rb_ary_sample(), rb_ary_shift(), rb_ary_shuffle_bang(), rb_ary_slice_bang(), rb_ary_sort_bang(), rb_ary_splice(), rb_ary_store(), rb_ary_take(), rb_ary_times(), rb_ary_unshift_m(), rb_ary_zip(), rb_big_clone(), rb_cstr_to_inum(), rb_dlptr_aref(), rb_dlptr_aset(), rb_dlptr_to_s(), rb_dlptr_to_str(), rb_econv_append(), rb_econv_convert0(), rb_econv_insert_output(), rb_econv_set_replacement(), rb_enc_symname_type(), rb_execarg_fixup(), rb_execarg_run_options(), rb_feature_p(), rb_fiddle_ptr_aref(), rb_fiddle_ptr_aset(), rb_fiddle_ptr_to_s(), rb_fiddle_ptr_to_str(), rb_file_expand_path_internal(), rb_file_join(), rb_file_load_ok(), rb_file_s_extname(), rb_gdbm_delete(), rb_gdbm_fetch2(), rb_gdbm_nextkey(), rb_get_values_at(), rb_gzreader_read(), rb_gzreader_readpartial(), rb_io_advise(), rb_io_getline_fast(), rb_io_s_popen(), rb_io_sysread(), rb_io_ungetc(), rb_iseq_disasm_insn(), rb_iseq_translate_threaded_code(), rb_ivar_lookup(), rb_ivar_set(), rb_load_file(), rb_mod_const_defined(), rb_mod_const_get(), rb_obj_copy_ivar(), rb_queue_length(), rb_queue_num_waiting(), rb_random_bytes(), rb_range_beg_len(), rb_realpath_internal(), rb_reg_expr_str(), rb_reg_init_copy(), rb_reg_initialize_m(), rb_reg_nth_match(), rb_reg_to_s(), rb_str2big_karatsuba(), rb_str2big_normal(), rb_str2big_poweroftwo(), rb_str_append(), rb_str_aref(), rb_str_aset(), rb_str_buf_cat_ascii(), rb_str_buf_new_cstr(), rb_str_casecmp(), rb_str_cat(), rb_str_chomp_bang(), rb_str_chop_bang(), rb_str_concat(), rb_str_conv_enc_opts(), rb_str_drop_bytes(), rb_str_dump(), rb_str_enumerate_chars(), rb_str_enumerate_lines(), rb_str_fill_terminator(), rb_str_format(), rb_str_hash_cmp(), rb_str_index(), rb_str_justify(), rb_str_length(), rb_str_modify_expand(), rb_str_quote_unprintable(), rb_str_resize(), rb_str_rindex(), rb_str_rindex_m(), rb_str_rstrip_bang(), rb_str_scan(), rb_str_split_m(), rb_str_sub_bang(), rb_str_subpat_set(), rb_str_subpos(), rb_str_substr(), rb_str_sum(), rb_str_symname_p(), rb_str_symname_type(), rb_str_times(), rb_str_to_dbl(), rb_str_to_inum(), rb_strftime_alloc(), rb_string_value_cstr(), rb_struct_aref_id(), rb_struct_aset_id(), rb_struct_getmember(), rb_struct_hash(), rb_struct_init_copy(), rb_struct_set(), rb_szqueue_num_waiting(), rb_vm_bugreport(), rb_w32_cmdvector(), rb_w32_conv_from_wchar(), rb_w32_conv_from_wstr(), rb_w32_getcwd(), rb_w32_getppid(), rb_w32_mbstr_to_wstr(), rb_w32_read(), rb_w32_wrap_io_handle(), rb_w32_write(), rb_w32_write_console(), rb_w32_wstr_to_mbstr(), rb_write_error_str(), read_escaped_byte(), recursive_cmp(), recursive_eql(), recursive_equal(), recvmsg(), reduce0(), reg_get_val(), reg_named_capture_assign_iter(), report_bug(), rotate_count(), rsock_connect(), rsock_inspect_sockaddr(), rsock_s_accept(), rsock_s_recvfrom(), rsock_s_recvfrom_nonblock(), ruby__sfvwrite(), ruby_each_words(), ruby_setenv(), ruby_strdup(), ruby_strtoul(), sendmsg(), set_bm_backward_skip(), set_bm_skip(), set_encoding_const(), setproctitle(), setup_fake_str(), setup_look_behind(), setup_narg(), setup_struct(), setup_tree(), SHA1_Update(), sock_accept(), sock_accept_nonblock(), sock_sysaccept(), socketpair_internal(), sockopt_bool(), str_buf_cat(), str_byte_aref(), str_byte_substr(), str_end_with_asciichar(), str_eql(), str_gsub(), str_make_independent_expand(), str_new0(), str_null_char(), str_replace(), str_strlen(), strftimev(), string2hex(), strio_getc(), strio_read(), strio_truncate(), strio_ungetc(), strio_write(), strscan_getch(), strscan_peek(), swap_node(), switch(), sym_inspect(), time_mdump(), time_mload(), time_strftime(), to_ascii(), trans_sweep(), unescape_unicode_bmp(), unescape_unicode_list(), universal_newline_finish(), update_string_node_case_fold(), vm_backtrace_to_ary(), vm_call_cfunc_with_frame(), vm_caller_setup_args(), vm_expandarray(), vm_getivar(), vm_setivar(), vm_yield_setup_block_args_complex(), w32_aspawn_flags(), w32_getenv(), w32_spawn(), w_long(), w_object(), w_objivar(), wstati64(), xmalloc2_size(), zstream_append_buffer(), zstream_buffer_ungets(), zstream_expand_buffer_without_gvl(), and zstream_shift_buffer().

Definition at line 1711 of file enumerator.c.

return Qnil

Definition at line 1512 of file enumerator.c.

VALUE rb_cEnumerator
VALUE rb_cGenerator
static

Definition at line 126 of file enumerator.c.

Referenced by enumerator_initialize(), InitVM_Enumerator(), and lazy_initialize().

VALUE rb_cLazy
VALUE rb_cYielder
static

Definition at line 126 of file enumerator.c.

Referenced by InitVM_Enumerator(), and yielder_new().

VALUE rb_eStopIteration

Definition at line 111 of file enumerator.c.

Referenced by InitVM_Enumerator(), next_i(), and rb_f_loop().

Definition at line 1339 of file enumerator.c.

VALUE sym_cycle
static

Definition at line 109 of file enumerator.c.

Referenced by Init_Enumerator(), and lazy_take().

VALUE sym_each
static
v = Qnil

Definition at line 1741 of file enumerator.c.

VALUE
static
Initial value:
{
NODE *memo = (NODE *)m
Definition: ripper.y:240
BDIGIT m
Definition: bigdecimal.c:5209
NODE * memo
Definition: enum.c:1174

Definition at line 497 of file enumerator.c.

memo u1 value = rb_int_succ(idx)

Definition at line 500 of file enumerator.c.

yielder = argv[0]

Definition at line 1710 of file enumerator.c.

const rb_data_type_t yielder_data_type
static
Initial value:
= {
"yielder",
{
},
}
#define RUBY_TYPED_FREE_IMMEDIATELY
static void yielder_mark(void *p)
Definition: enumerator.c:1059
static size_t yielder_memsize(const void *p)
Definition: enumerator.c:1068
#define yielder_free
Definition: enumerator.c:1065
#define NULL
Definition: _sdbm.c:102

Definition at line 1073 of file enumerator.c.

Referenced by yielder_allocate(), yielder_init(), and yielder_ptr().