Ruby
3.4.0dev (2024-12-06 revision 892c46283a5ea4179500d951c9d4866c0051f27b)
|
Pre-1.9 era evaluator APIs (now considered miscellaneous). 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.
Functions | |
void | rb_exc_raise (VALUE exc) |
Identical to rb_raise(), except it raises the passed exception instance as- is instead of creating new one. More... | |
void | rb_exc_fatal (VALUE exc) |
Identical to rb_fatal(), except it raises the passed exception instance as- is instead of creating new one. More... | |
VALUE | rb_f_exit (int argc, const VALUE *argv) |
Identical to rb_exit(), except how arguments are passed. More... | |
VALUE | rb_f_abort (int argc, const VALUE *argv) |
This is similar to rb_f_exit(). More... | |
void | rb_interrupt (void) |
Raises an instance of rb_eInterrupt. More... | |
ID | rb_frame_this_func (void) |
Queries the name of the Ruby level method that is calling this function. More... | |
void | rb_jump_tag (int state) |
This function is to re-throw global escapes. More... | |
void | rb_obj_call_init (VALUE obj, int argc, const VALUE *argv) |
Calls initialize method of the passed object with the passed arguments. More... | |
void | rb_obj_call_init_kw (VALUE, int, const VALUE *, int) |
Identical to rb_obj_call_init(), except you can specify how to handle the last element of the given array. More... | |
ID | rb_frame_callee (void) |
Identical to rb_frame_this_func(), except it returns the named used to call the method. More... | |
VALUE | rb_make_exception (int argc, const VALUE *argv) |
Constructs an exception object from the list of arguments, in a manner similar to Ruby's raise . More... | |
void | rb_set_end_proc (void(*func)(VALUE arg), VALUE arg) |
Registers a function that shall run on process exit. More... | |
Pre-1.9 era evaluator APIs (now considered miscellaneous).
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 eval.h.
This is similar to rb_f_exit().
In fact on some situation it internally calls rb_exit(). But can be very esoteric on occasions.
It takes up to one argument. If an argument is passed, it tries to display that. Otherwise if there is $!
, displays that exception instead. It finally raise rb_eSystemExit in both cases.
[in] | argc | Number of objects of argv . |
[in] | argv | Contains at most one string-ish object. |
rb_eArgError | Wrong argc . |
rb_eTypeError | No conversion from argv[0] to String. |
rb_eSystemExit | Exception representing EXIT_FAILURE . |
Identical to rb_exit(), except how arguments are passed.
[in] | argc | Number of objects of argv . |
[in] | argv | Contains at most one of the following:
|
rb_eArgError | Wrong argc . |
rb_eSystemExit | Exception representing the exit status. |
ID rb_frame_callee | ( | void | ) |
Identical to rb_frame_this_func(), except it returns the named used to call the method.
0 | There is no method (e.g. toplevel context). |
otherwise | The name of the current method. |
ID rb_frame_this_func | ( | void | ) |
Queries the name of the Ruby level method that is calling this function.
The "name" in this context is the one assigned to the function for the first time (note that methods can have multiple names via aliases).
0 | There is no method (e.g. toplevel context). |
otherwise | The name of the current method. |
Definition at line 1094 of file eval.c.
Referenced by rb_notimplement().
void rb_interrupt | ( | void | ) |
Raises an instance of rb_eInterrupt.
rb_eInterrupt | Always raises this exception. |
void rb_jump_tag | ( | int | state | ) |
This function is to re-throw global escapes.
Such global escapes include exceptions, throw
, break
, for example.
It makes sense only when used in conjunction with "protect" series APIs e.g. rb_protect(), rb_load_protect(), rb_eval_string_protect(), etc. In case these functions experience global escapes, they fill their opaque state
return buffer. You can ignore such escapes. But if you decide otherwise, you have to somehow escape globally again. This function is used for that purpose.
[in] | state | Opaque state of execution. |
Definition at line 907 of file eval.c.
Referenced by rb_f_exec(), and rb_io_open_descriptor().
Constructs an exception object from the list of arguments, in a manner similar to Ruby's raise
.
This function can take:
argc == 0
. This is not a failure. It returns RUBY_Qnil then.exception
method, and optionally its argument, and optionally its backtrace. For example instances of subclasses of rb_eException have this method. What is returned from the method is returned.[in] | argc | Number of objects of argv . |
[in] | argv | 0 up to 3 objects. |
rb_eArgError | Wrong argc . |
rb_eTypeError | argv[0].exception returned non-exception. |
Definition at line 883 of file eval.c.
Referenced by rb_fiber_raise().
Calls initialize
method of the passed object with the passed arguments.
It also forwards the implicitly passed block to the method.
[in] | obj | Receiver object. |
[in] | argc | Number of objects of argv . |
[in] | argv | Passed as-is to obj.initialize . |
rb_eException | Any exceptions happen inside. |
Identical to rb_obj_call_init(), except you can specify how to handle the last element of the given array.
[in] | obj | Receiver object. |
[in] | argc | Number of objects of argv . |
[in] | argv | Passed as-is to obj.initialize . |
[in] | kw_splat | Handling of keyword parameters:
|
rb_eNoMethodError | No such method. |
rb_eException | Any exceptions happen inside. |
Definition at line 1728 of file eval.c.
Referenced by rb_obj_call_init().
Registers a function that shall run on process exit.
Registered functions run in reverse-chronological order, mixed with syntactic END
block and Kernel#at_exit
.
[in] | func | Function to run at process exit. |
[in] | arg | Passed as-is to func . |