Ruby  2.5.0dev(2017-10-22revision60238)
Data Structures | Macros | Typedefs | Functions | Variables
enumerator.c File Reference
#include "internal.h"

Go to the source code of this file.

Data Structures

struct  enumerator
 
struct  generator
 
struct  yielder
 
struct  lazyenum_funcs
 
struct  proc_entry
 

Macros

#define enumerator_free   RUBY_TYPED_DEFAULT_FREE
 
#define proc_entry_free   RUBY_TYPED_DEFAULT_FREE
 
#define yielder_free   RUBY_TYPED_DEFAULT_FREE
 
#define generator_free   RUBY_TYPED_DEFAULT_FREE
 
#define memo_value   v2
 
#define memo_flags   u3.state
 
#define LAZY_MEMO_BREAK   1
 
#define LAZY_MEMO_PACKED   2
 
#define LAZY_MEMO_BREAK_P(memo)   ((memo)->memo_flags & LAZY_MEMO_BREAK)
 
#define LAZY_MEMO_PACKED_P(memo)   ((memo)->memo_flags & LAZY_MEMO_PACKED)
 
#define LAZY_MEMO_SET_BREAK(memo)   ((memo)->memo_flags |= LAZY_MEMO_BREAK)
 
#define LAZY_MEMO_SET_VALUE(memo, value)   MEMO_V2_SET(memo, value)
 
#define LAZY_MEMO_SET_PACKED(memo)   ((memo)->memo_flags |= LAZY_MEMO_PACKED)
 
#define LAZY_MEMO_RESET_PACKED(memo)   ((memo)->memo_flags &= ~LAZY_MEMO_PACKED)
 

Typedefs

typedef struct MEMOlazyenum_proc_func(VALUE, struct MEMO *, VALUE, long)
 
typedef VALUE lazyenum_size_func(VALUE, VALUE)
 

Functions

VALUE rb_enumeratorize (VALUE obj, VALUE meth, int argc, const VALUE *argv)
 
VALUE rb_enumeratorize_with_size (VALUE obj, VALUE meth, int argc, const VALUE *argv, rb_enumerator_size_func *size_fn)
 
void InitVM_Enumerator (void)
 
void Init_Enumerator (void)
 

Variables

VALUE rb_cEnumerator
 
VALUE rb_cLazy
 
VALUE rb_eStopIteration
 

Macro Definition Documentation

◆ enumerator_free

#define enumerator_free   RUBY_TYPED_DEFAULT_FREE

Definition at line 170 of file enumerator.c.

◆ generator_free

#define generator_free   RUBY_TYPED_DEFAULT_FREE

Definition at line 1261 of file enumerator.c.

◆ LAZY_MEMO_BREAK

#define LAZY_MEMO_BREAK   1

Definition at line 1445 of file enumerator.c.

◆ LAZY_MEMO_BREAK_P

#define LAZY_MEMO_BREAK_P (   memo)    ((memo)->memo_flags & LAZY_MEMO_BREAK)

Definition at line 1447 of file enumerator.c.

◆ LAZY_MEMO_PACKED

#define LAZY_MEMO_PACKED   2

Definition at line 1446 of file enumerator.c.

◆ LAZY_MEMO_PACKED_P

#define LAZY_MEMO_PACKED_P (   memo)    ((memo)->memo_flags & LAZY_MEMO_PACKED)

Definition at line 1448 of file enumerator.c.

◆ LAZY_MEMO_RESET_PACKED

#define LAZY_MEMO_RESET_PACKED (   memo)    ((memo)->memo_flags &= ~LAZY_MEMO_PACKED)

Definition at line 1452 of file enumerator.c.

◆ LAZY_MEMO_SET_BREAK

#define LAZY_MEMO_SET_BREAK (   memo)    ((memo)->memo_flags |= LAZY_MEMO_BREAK)

Definition at line 1449 of file enumerator.c.

◆ LAZY_MEMO_SET_PACKED

#define LAZY_MEMO_SET_PACKED (   memo)    ((memo)->memo_flags |= LAZY_MEMO_PACKED)

Definition at line 1451 of file enumerator.c.

◆ LAZY_MEMO_SET_VALUE

#define LAZY_MEMO_SET_VALUE (   memo,
  value 
)    MEMO_V2_SET(memo, value)

Definition at line 1450 of file enumerator.c.

◆ memo_flags

#define memo_flags   u3.state

Definition at line 1444 of file enumerator.c.

◆ memo_value

#define memo_value   v2

Definition at line 1443 of file enumerator.c.

◆ proc_entry_free

#define proc_entry_free   RUBY_TYPED_DEFAULT_FREE

Definition at line 208 of file enumerator.c.

◆ yielder_free

#define yielder_free   RUBY_TYPED_DEFAULT_FREE

Definition at line 1153 of file enumerator.c.

Typedef Documentation

◆ lazyenum_proc_func

typedef struct MEMO* lazyenum_proc_func(VALUE, struct MEMO *, VALUE, long)

Definition at line 136 of file enumerator.c.

◆ lazyenum_size_func

typedef VALUE lazyenum_size_func(VALUE, VALUE)

Definition at line 137 of file enumerator.c.

Function Documentation

◆ Init_Enumerator()

void Init_Enumerator ( void  )

Definition at line 2414 of file enumerator.c.

◆ InitVM_Enumerator()

void InitVM_Enumerator ( void  )

Definition at line 2336 of file enumerator.c.

References rb_define_method(), and rb_mKernel.

◆ rb_enumeratorize()

VALUE rb_enumeratorize ( VALUE  obj,
VALUE  meth,
int  argc,
const VALUE argv 
)

Definition at line 450 of file enumerator.c.

References rb_enumeratorize_with_size().

◆ rb_enumeratorize_with_size()

VALUE rb_enumeratorize_with_size ( VALUE  obj,
VALUE  meth,
int  argc,
const VALUE argv,
rb_enumerator_size_func size_fn 
)

Definition at line 459 of file enumerator.c.

References rb_cLazy, rb_obj_is_kind_of(), and RTEST.

Referenced by rb_enumeratorize().

Variable Documentation

◆ rb_cEnumerator

VALUE rb_cEnumerator

Definition at line 103 of file enumerator.c.

◆ rb_cLazy

VALUE rb_cLazy

Definition at line 104 of file enumerator.c.

Referenced by rb_enumeratorize_with_size().

◆ rb_eStopIteration

VALUE rb_eStopIteration

Definition at line 109 of file enumerator.c.