Ruby 2.7.0p0(2019-12-25revision647ee6f091eafcce70ffb75ddf7e121e192ab217)

Modules | Functions
CRuby Embedding APIs
deprecated macro APIs

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. More...

## Modules
| ruby(1) implementation
| A part of the implementation of ruby(1) command. Other programs that embed Ruby interpreter do not always need to use these functions.

## Functions
void | ruby_init_stack (volatile VALUE *)
int | ruby_setup (void)
| Initializes the VM and builtin libraries. More...
int | ruby_cleanup (volatile int)
| Destructs the VM. More...
void | ruby_finalize (void)
| Runs the VM finalization processes. More...
void | ruby_set_stack_size (size_t)
int | ruby_stack_check (void)
size_t | ruby_stack_length (VALUE **)
int | ruby_exec_node (void *n)
| Runs the given compiled source. More...
void | ruby_script (const char *name)
| Sets the current script name to this value. More...
void | ruby_set_script_name (VALUE name)
| Sets the current script name to this value. More...
void | ruby_prog_init (void)
| Defines built-in variables. More...
void | ruby_set_argv (int, char **)
void * | ruby_process_options (int, char **)
void | ruby_init_loadpath (void)
void | ruby_incpush (const char *)
void | ruby_sig_finalize (void)
| NORETURN (void rb_vm_jump_tag_but_local_jump(int))

## Detailed Description

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.

## Function Documentation

## ◆ NORETURN()

NORETURN | ( | void | rb_vm_jump_tag_but_local_jumpint | ) |

## ◆ ruby_cleanup()

int ruby_cleanup | ( | volatile int | ex | ) |

Destructs the VM.

Runs the VM finalization processes as well as ruby_finalize(), and frees resources used by the VM.

Parameters

  ex | Default value to the return value.

Returns
  If an error occurred returns a non-zero. If otherwise, returns the given ex.

Note
  This function does not raise any exception.

Definition at line 180 of file eval.c.

## ◆ ruby_exec_node()

int ruby_exec_node | ( | void * | n | ) |

Runs the given compiled source.

Definition at line 340 of file eval.c.

## ◆ ruby_finalize()

void ruby_finalize | ( | void |  | ) |

Runs the VM finalization processes.

`END{}` and procs registered by `Kernel.#at_exit` are executed here. See the Ruby language spec for more details.

Note
  This function is allowed to raise an exception if an error occurred.

Definition at line 162 of file eval.c.

## ◆ ruby_incpush()

void ruby_incpush | ( | const char * |  | ) |

Definition at line 426 of file ruby.c.

## ◆ ruby_init_loadpath()

void ruby_init_loadpath | ( | void |  | ) |

Definition at line 582 of file ruby.c.

## ◆ ruby_init_stack()

void ruby_init_stack | ( | volatile VALUE * |  | ) |

Referenced by ruby_exec_node(), ruby_options(), and ruby_setup().

## ◆ ruby_process_options()

void* ruby_process_options | ( | int | ,
|  | char ** |
| ) |  |

Definition at line 2387 of file ruby.c.

Referenced by ruby_options().

## ◆ ruby_prog_init()

void ruby_prog_init | ( | void |  | ) |

Defines built-in variables.

Definition at line 2341 of file ruby.c.

Referenced by ruby_setup().

## ◆ ruby_script()

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.

Definition at line 2277 of file ruby.c.

## ◆ ruby_set_argv()

void ruby_set_argv | ( | int | ,
|  | char ** |
| ) |  |

Definition at line 2366 of file ruby.c.

## ◆ ruby_set_script_name()

void ruby_set_script_name | ( | VALUE | name | ) |

Sets the current script name to this value.

Same as ruby_script() but accepts a VALUE.

Definition at line 2290 of file ruby.c.

## ◆ ruby_set_stack_size()

void ruby_set_stack_size | ( | size_t |  | ) |

## ◆ ruby_setup()

int ruby_setup | ( | void |  | ) |

Initializes the VM and builtin libraries.

Return values

  0 | if succeeded.
  non-zero | an error occurred.

Definition at line 55 of file eval.c.

## ◆ ruby_sig_finalize()

void ruby_sig_finalize | ( | void |  | ) |

Definition at line 1470 of file signal.c.

## ◆ ruby_stack_check()

int ruby_stack_check | ( | void |  | ) |

Definition at line 4671 of file gc.c.

## ◆ ruby_stack_length()

size_t ruby_stack_length | ( | VALUE ** |  | ) |

Definition at line 4631 of file gc.c.