Ruby
3.1.4p223 (2023-03-30 revision HEAD)
|
CRuby interpreter APIs. More...
Modules | |
ruby(1) implementation | |
A part of the implementation of ruby(1) command. | |
Functions | |
void | ruby_init_stack (volatile VALUE *addr) |
Set stack bottom of Ruby implementation. More... | |
int | ruby_setup (void) |
Initializes the VM and builtin libraries. More... | |
int | ruby_cleanup (int ex) |
Destructs the VM. More... | |
void | ruby_finalize (void) |
Runs the VM finalization processes. More... | |
void | ruby_stop (int) |
Calls ruby_cleanup() and exits the process. More... | |
int | ruby_stack_check (void) |
Checks for stack overflow. More... | |
size_t | ruby_stack_length (VALUE **topnotch) |
Queries what Ruby thinks is the machine stack. More... | |
int | ruby_exec_node (void *n) |
Identical to ruby_run_node(), except it returns an opaque execution status. More... | |
void | ruby_script (const char *name) |
Sets the current script name to this value. More... | |
void | ruby_set_script_name (VALUE name) |
Identical to ruby_script(), except it takes the name as a Ruby String instance. More... | |
void | ruby_prog_init (void) |
Defines built-in variables. More... | |
void | ruby_set_argv (int argc, char **argv) |
Sets argv that ruby understands. More... | |
void * | ruby_process_options (int argc, char **argv) |
Identical to ruby_options(), except it raises ruby-level exceptions on failure. More... | |
void | ruby_init_loadpath (void) |
Sets up $LOAD_PATH . More... | |
void | ruby_incpush (const char *path) |
Appends the given path to the end of the load path. More... | |
void | ruby_sig_finalize (void) |
Clear signal handlers. More... | |
CRuby interpreter APIs.
These are APIs to embed MRI interpreter into your program. These functions are not a part of Ruby extension library API. Extension libraries of Ruby should not depend on these functions.
int ruby_cleanup | ( | int | ex | ) |
Destructs the VM.
Runs the VM finalization processes as well as ruby_finalize(), and frees resources used by the VM.
[in] | ex | Default value to the return value. |
EXIT_FAILURE | An error occurred. |
ex | Successful cleanup. |
Definition at line 176 of file eval.c.
Referenced by ruby_stop().
int ruby_exec_node | ( | void * | n | ) |
Identical to ruby_run_node(), except it returns an opaque execution status.
You can pass it to rb_cleanup().
[in] | n | Opaque "node" pointer. |
0 | Successful end-of-execution. |
otherwise | An error occurred. |
void ruby_finalize | ( | void | ) |
void ruby_incpush | ( | const char * | path | ) |
Appends the given path to the end of the load path.
[in] | path | The path you want to push to the load path. |
void ruby_init_stack | ( | volatile VALUE * | addr | ) |
Set stack bottom of Ruby implementation.
You must call this function before any heap allocation by Ruby implementation. Or GC will break living objects.
[in] | addr | A pointer somewhere on the stack, near its bottom. |
Referenced by ruby_exec_node(), ruby_options(), ruby_run_node(), and ruby_setup().
void* ruby_process_options | ( | int | argc, |
char ** | argv | ||
) |
Identical to ruby_options(), except it raises ruby-level exceptions on failure.
[in] | argc | Process main's argc . |
[in] | argv | Process main's argv . |
Definition at line 2730 of file ruby.c.
Referenced by ruby_options().
void ruby_prog_init | ( | void | ) |
void ruby_script | ( | const char * | name | ) |
Sets the current script name to this value.
This is similar to $0 = name
in Ruby level but also affects Method#location
and others.
[in] | name | File name to set. |
Definition at line 2600 of file ruby.c.
Referenced by ruby_process_options().
void ruby_set_argv | ( | int | argc, |
char ** | argv | ||
) |
void ruby_set_script_name | ( | VALUE | name | ) |
Identical to ruby_script(), except it takes the name as a Ruby String instance.
[in] | name | File name to set. |
Identical to ruby_script(), except it takes the name as a Ruby String instance.
Same as ruby_script() but accepts a VALUE.
int ruby_setup | ( | void | ) |
Initializes the VM and builtin libraries.
0 | Initialization succeeded. |
otherwise | An error occurred. |
Definition at line 65 of file eval.c.
Referenced by ruby_init().
void ruby_sig_finalize | ( | void | ) |
int ruby_stack_check | ( | void | ) |
size_t ruby_stack_length | ( | VALUE ** | topnotch | ) |
Queries what Ruby thinks is the machine stack.
Ruby manages a region of memory. It calls that area the "machine stack". By calling this function, in spite of its name, you can obtain both one end of the stack and its length at once. Which means you can know the entire region.
[out] | topnotch | On return the pointer points to the upmost address of the macihne stack that Ruby knows. |
void ruby_stop | ( | int | ex | ) |
Calls ruby_cleanup() and exits the process.
Definition at line 289 of file eval.c.
Referenced by rb_exit().