Ruby  2.4.2p198(2017-09-14revision59899)
Modules | Macros | Functions
CRuby Embedding APIs

CRuby interpreter APIs. More...

Collaboration diagram for CRuby Embedding APIs:

Modules

 ruby(1) implementation
 A part of the implementation of ruby(1) command.
 

Macros

#define Init_stack(addr)   ruby_init_stack(addr)
 

Functions

void ruby_init_stack (volatile VALUE *)
 
int ruby_setup (void)
 
int ruby_cleanup (volatile int)
 Destructs the VM. More...
 
void ruby_finalize (void)
 Runs the VM finalization processes. More...
 
 NORETURN (void rb_exit(int))
 
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)
 

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.

Macro Definition Documentation

◆ Init_stack

#define Init_stack (   addr)    ruby_init_stack(addr)

Definition at line 2468 of file ruby.h.

Function Documentation

◆ NORETURN()

NORETURN ( void   rb_exitint)

◆ ruby_cleanup()

int ruby_cleanup ( volatile int  ex)

◆ ruby_exec_node()

int ruby_exec_node ( void *  n)

Runs the given compiled source.

Definition at line 305 of file eval.c.

References ruby_exec_internal(), and ruby_init_stack().

Referenced by ruby_run_node().

◆ 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 142 of file eval.c.

References ruby_finalize_0(), and ruby_finalize_1().

Referenced by rescue_callback().

◆ ruby_incpush()

void ruby_incpush ( const char *  )

Definition at line 354 of file ruby.c.

References locale_path(), and ruby_push_include().

Referenced by init_loadpath().

◆ ruby_init_loadpath()

void ruby_init_loadpath ( void  )

◆ ruby_init_stack()

void ruby_init_stack ( volatile VALUE )

◆ ruby_process_options()

void* ruby_process_options ( int  ,
char **   
)

◆ ruby_prog_init()

void ruby_prog_init ( void  )

◆ 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 2084 of file ruby.c.

References external_str_new_cstr(), rb_orig_progname, rb_progname, and rb_vm_set_progname().

Referenced by ruby_process_options().

◆ ruby_set_argv()

void ruby_set_argv ( int  ,
char **   
)

Definition at line 2180 of file ruby.c.

References argc, external_str_new_cstr(), OBJ_FREEZE, origarg, rb_argv, rb_ary_clear(), and rb_ary_push().

Referenced by process_options(), and stub_options().

◆ 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 2097 of file ruby.c.

References rb_orig_progname, rb_progname, rb_str_dup(), and rb_vm_set_progname().

Referenced by Init_version(), load_file_internal(), and process_options().

◆ ruby_set_stack_size()

void ruby_set_stack_size ( size_t  )

◆ ruby_setup()

int ruby_setup ( void  )

◆ ruby_sig_finalize()

void ruby_sig_finalize ( void  )

Definition at line 1405 of file signal.c.

References ruby_signal, sighandler(), sighandler_t, and SIGINT.

Referenced by ruby_finalize_1().

◆ ruby_stack_check()

int ruby_stack_check ( void  )

Definition at line 3976 of file gc.c.

References ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS, stack_check(), and STACKFRAME_FOR_CALL_CFUNC.

Referenced by stack_check().

◆ ruby_stack_length()

size_t ruby_stack_length ( VALUE **  )

Definition at line 3947 of file gc.c.

References GET_THREAD, SET_STACK_END, STACK_END, STACK_LENGTH, STACK_START, and STACK_UPPER.