Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)
|
Block related APIs. More...
#include "ruby/internal/attr/noreturn.h"
#include "ruby/internal/dllexport.h"
#include "ruby/internal/value.h"
Go to the source code of this file.
Macros | |
#define | RB_BLOCK_CALL_FUNC_STRICT 1 |
#define | RUBY_BLOCK_CALL_FUNC_TAKES_BLOCKARG 1 |
#define | RB_BLOCK_CALL_FUNC_ARGLIST(yielded_arg, callback_arg) VALUE yielded_arg, VALUE callback_arg, int argc, const VALUE *argv, VALUE blockarg |
Typedefs | |
typedef VALUE | rb_block_call_func(RB_BLOCK_CALL_FUNC_ARGLIST(yielded_arg, callback_arg)) |
typedef rb_block_call_func * | rb_block_call_func_t |
Block related APIs.
RBIMPL
or rbimpl
are implementation details. Don't take them as canon. They could rapidly appear then vanish. The name (path) of this header file is also an implementation detail. Do not expect it to persist at the place it is now. Developers are free to move it anywhere anytime at will. __VA_ARGS__
is always available. We assume C99 for ruby itself but we don't assume languages of extension libraries. They could be written in C++98. Definition in file iterator.h.
#define RB_BLOCK_CALL_FUNC_ARGLIST | ( | yielded_arg, | |
callback_arg | |||
) | VALUE yielded_arg, VALUE callback_arg, int argc, const VALUE *argv, VALUE blockarg |
Definition at line 31 of file iterator.h.
#define RB_BLOCK_CALL_FUNC_STRICT 1 |
Definition at line 29 of file iterator.h.
#define RUBY_BLOCK_CALL_FUNC_TAKES_BLOCKARG 1 |
Definition at line 30 of file iterator.h.
typedef VALUE rb_block_call_func(RB_BLOCK_CALL_FUNC_ARGLIST(yielded_arg, callback_arg)) |
Definition at line 33 of file iterator.h.
typedef rb_block_call_func* rb_block_call_func_t |
Definition at line 34 of file iterator.h.
VALUE rb_block_call | ( | VALUE | obj, |
ID | mid, | ||
int | argc, | ||
const VALUE * | argv, | ||
rb_block_call_func_t | bl_proc, | ||
VALUE | data2 | ||
) |
Definition at line 1570 of file vm_eval.c.
References argc, iter_method_arg::argc, argv, iter_method_arg::argv, iter_method_arg::kw_splat, iter_method_arg::mid, iter_method_arg::obj, and rb_iterate().
VALUE rb_block_call_kw | ( | VALUE | obj, |
ID | mid, | ||
int | argc, | ||
const VALUE * | argv, | ||
rb_block_call_func_t | bl_proc, | ||
VALUE | data2, | ||
int | kw_splat | ||
) |
Definition at line 1584 of file vm_eval.c.
References argc, iter_method_arg::argc, argv, iter_method_arg::argv, iter_method_arg::kw_splat, iter_method_arg::mid, iter_method_arg::obj, and rb_iterate().
VALUE rb_catch | ( | const char * | tag, |
rb_block_call_func_t | func, | ||
VALUE | data | ||
) |
Definition at line 2385 of file vm_eval.c.
References rb_catch_obj(), rb_cObject, rb_obj_alloc(), rb_sym_intern_ascii_cstr, and rb_vm_tag::tag.
VALUE rb_catch_obj | ( | VALUE | t, |
rb_block_call_func_t | func, | ||
VALUE | data | ||
) |
Definition at line 2427 of file vm_eval.c.
References EC_JUMP_TAG, rb_vm_tag::state, and t.
Referenced by rb_catch().
Definition at line 1639 of file vm_eval.c.
References CALL_FCALL, and iter_method_arg::obj.
VALUE rb_iterate | ( | VALUE(*)(VALUE) | it_proc, |
VALUE | data1, | ||
rb_block_call_func_t | bl_proc, | ||
VALUE | data2 | ||
) |
Definition at line 1544 of file vm_eval.c.
Referenced by rb_block_call(), rb_block_call_kw(), and rb_check_block_call().
int rb_keyword_given_p | ( | void | ) |
Definition at line 948 of file eval.c.
References rb_vm_cframe_keyword_p().
Referenced by rb_arith_seq_new(), rb_enumeratorize_with_size(), and rb_yield_block().
Definition at line 2315 of file vm_eval.c.
References rb_sym_intern_ascii_cstr, rb_throw_obj(), and rb_vm_tag::tag.
Definition at line 2290 of file vm_eval.c.
References EC_JUMP_TAG, rb_execution_context_struct::errinfo, NULL, numberof, rb_vm_tag::prev, rb_class_new_instance(), rb_exc_raise(), rb_str_new_cstr, rb_vm_tag::retval, rb_vm_tag::tag, rb_execution_context_struct::tag, and TAG_THROW.
Referenced by rb_throw().
VALUE rb_vrescue2 | ( | VALUE(*)(VALUE) | b_proc, |
VALUE | data1, | ||
VALUE(*)(VALUE, VALUE) | r_proc, | ||
VALUE | data2, | ||
va_list | args | ||
) |
An equivalent of rescue
clause.
Equivalent to begin .. rescue err_type .. end
[in] | b_proc | a function which potentially raises an exception. |
[in] | data1 | the argument of b_proc |
[in] | r_proc | a function which rescues an exception in b_proc. |
[in] | data2 | the first argument of r_proc |
[in] | ... | 1 or more exception classes. Must be terminated by (VALUE)0. |
First it calls the function b_proc, with data1 as the argument. When b_proc raises an exception, it calls r_proc with data2 and the exception object if the exception is a kind of one of the given exception classes.
[in] | args | exception classes, terminated by (VALUE)0. |
Definition at line 1006 of file eval.c.
References rb_execution_context_struct::cfp, EC_EXEC_TAG, EC_JUMP_TAG, EC_POP_TAG, EC_PUSH_TAG, rb_execution_context_struct::errinfo, FALSE, Qfalse, Qnil, rb_obj_is_kind_of(), rb_vm_rewind_cfp(), TAG_NONE, TAG_RAISE, TAG_RETRY, and TRUE.
Referenced by ruby::backward::cxxanyargs::rb_rescue2(), and rb_rescue2().
Definition at line 1341 of file vm_eval.c.
Referenced by ossl_generate_cb_2(), rb_ary_delete(), rb_ary_each(), and ruby_float_step().
VALUE rb_yield_block | ( | RB_BLOCK_CALL_FUNC_ARGLIST(yielded_arg, callback_arg) | ) |
Definition at line 1387 of file vm_eval.c.
References NIL_P, RARRAY_CONST_PTR, rb_check_array_type(), rb_eArgError, RB_GC_GUARD, rb_raise(), and rb_callcache::v.
Definition at line 1400 of file vm_eval.c.
References NIL_P, RARRAY_CONST_PTR, rb_check_array_type(), rb_eArgError, RB_GC_GUARD, rb_raise(), and rb_callcache::v.