1 #ifndef RBIMPL_INTERN_ENUMERATOR_H
2 #define RBIMPL_INTERN_ENUMERATOR_H
156 # define rb_enumeratorize_with_size(obj, id, argc, argv, size_fn) \
157 rb_enumeratorize_with_size(obj, id, argc, argv, (rb_enumerator_size_func *)(size_fn))
158 # define rb_enumeratorize_with_size_kw(obj, id, argc, argv, size_fn, kw_splat) \
159 rb_enumeratorize_with_size_kw(obj, id, argc, argv, (rb_enumerator_size_func *)(size_fn), kw_splat)
174 #define SIZED_ENUMERATOR(obj, argc, argv, size_fn) \
175 rb_enumeratorize_with_size((obj), ID2SYM(rb_frame_this_func()), \
176 (argc), (argv), (size_fn))
193 #define SIZED_ENUMERATOR_KW(obj, argc, argv, size_fn, kw_splat) \
194 rb_enumeratorize_with_size_kw((obj), ID2SYM(rb_frame_this_func()), \
195 (argc), (argv), (size_fn), (kw_splat))
206 #define RETURN_SIZED_ENUMERATOR(obj, argc, argv, size_fn) do { \
207 if (!rb_block_given_p()) \
208 return SIZED_ENUMERATOR(obj, argc, argv, size_fn); \
226 #define RETURN_SIZED_ENUMERATOR_KW(obj, argc, argv, size_fn, kw_splat) do { \
227 if (!rb_block_given_p()) \
228 return SIZED_ENUMERATOR_KW(obj, argc, argv, size_fn, kw_splat); \
239 #define RETURN_ENUMERATOR(obj, argc, argv) \
240 RETURN_SIZED_ENUMERATOR(obj, argc, argv, 0)
256 #define RETURN_ENUMERATOR_KW(obj, argc, argv, kw_splat) \
257 RETURN_SIZED_ENUMERATOR_KW(obj, argc, argv, 0, kw_splat)
Tweaking visibility of C variables/functions.
#define RBIMPL_SYMBOL_EXPORT_END()
Counterpart of RBIMPL_SYMBOL_EXPORT_BEGIN.
#define RBIMPL_SYMBOL_EXPORT_BEGIN()
Shortcut macro equivalent to RUBY_SYMBOL_EXPORT_BEGIN extern "C" {.
VALUE rb_arithmetic_sequence_beg_len_step(VALUE as, long *begp, long *lenp, long *stepp, long len, int err)
Identical to rb_range_beg_len(), except it takes an instance of Enumerator::ArithmericSequence.
VALUE rb_enumeratorize_with_size(VALUE recv, VALUE meth, int argc, const VALUE *argv, rb_enumerator_size_func *func)
Identical to rb_enumeratorize(), except you can additionally specify the size function of return valu...
VALUE rb_enumeratorize(VALUE recv, VALUE meth, int argc, const VALUE *argv)
Constructs an enumerator.
VALUE rb_enumeratorize_with_size_kw(VALUE recv, VALUE meth, int argc, const VALUE *argv, rb_enumerator_size_func *func, int kw_splat)
Identical to rb_enumeratorize_with_func(), except you can specify how to handle the last element of t...
int rb_arithmetic_sequence_extract(VALUE as, rb_arithmetic_sequence_components_t *buf)
Extracts components of the passed arithmetic sequence.
VALUE rb_enumerator_size_func(VALUE recv, VALUE argv, VALUE eobj)
This is the type of functions that rb_enumeratorize_with_size() expects.
Pre-1.9 era evaluator APIs (now considered miscellaneous).
int len
Length of the buffer.
Defines RBIMPL_ATTR_NONNULL.
#define RBIMPL_ATTR_NONNULL(list)
Wraps (or simulates) __attribute__((nonnull))
Decomposed Enumerator::ArithmeicSequence.
int exclude_end
Whether the endpoint is open or closed.
VALUE end
"Right" or "highest" endpoint of the sequence.
VALUE step
Step between a sequence.
VALUE begin
"Left" or "lowest" endpoint of the sequence.
uintptr_t VALUE
Type that represents a Ruby object.