ruby(1) implementation
[CRuby Embedding APIs]

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

Defines

#define RUBY_INIT_STACK
 A convenience macro to call ruby_init_stack().
#define RUBY_INIT_STACK
 A convenience macro to call ruby_init_stack().
#define RUBY_INIT_STACK
 A convenience macro to call ruby_init_stack().

Functions

void ruby_sysinit (int *argc, char ***argv)
 Initializes the process for ruby(1).
void ruby_init (void)
void * ruby_options (int argc, char **argv)
 Processes command line arguments and compiles the Ruby source to execute.
int ruby_executable_node (void *n, int *status)
 Checks the return value of ruby_options().
int ruby_run_node (void *n)
 Runs the given compiled source and exits this process.
void ruby_show_version (void)
 Prints the version information of the CRuby interpreter to stdout.
void ruby_show_copyright (void)
 Prints the copyright notice of the CRuby interpreter to stdout and exits this process successfully.

Detailed Description

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

Other programs that embed Ruby interpreter do not always need to use these functions.


Define Documentation

#define RUBY_INIT_STACK

Value:

VALUE variable_in_this_stack_frame; \
    ruby_init_stack(&variable_in_this_stack_frame);
A convenience macro to call ruby_init_stack().

Must be placed just after variable declarations

Definition at line 1827 of file ruby.h.

#define RUBY_INIT_STACK

Value:

VALUE variable_in_this_stack_frame; \
    ruby_init_stack(&variable_in_this_stack_frame);
A convenience macro to call ruby_init_stack().

Must be placed just after variable declarations

Definition at line 1827 of file ruby.h.

#define RUBY_INIT_STACK

Value:

VALUE variable_in_this_stack_frame; \
    ruby_init_stack(&variable_in_this_stack_frame);
A convenience macro to call ruby_init_stack().

Must be placed just after variable declarations

Definition at line 1827 of file ruby.h.

Referenced by main(), pruby_eval(), and pruby_init().


Function Documentation

int ruby_executable_node ( void *  n,
int *  status 
)

Checks the return value of ruby_options().

Parameters:
n return value of ruby_options().
status pointer to the exit status of this process.
ruby_options() sometimes returns a special value to indicate this process should immediately exit. This function checks if the case. Also stores the exit status that the caller have to pass to exit(3) into *status.

Return values:
non-zero if the given opaque pointer is actually a compiled source.
0 if the given value is such a special value.

Definition at line 282 of file eval.c.

References EXIT_FAILURE, EXIT_SUCCESS, FALSE, FIX2INT, FIXNUM_P, Qfalse, Qtrue, TRUE, and VALUE.

Referenced by ruby_run_node().

void ruby_init ( void   ) 

Definition at line 73 of file eval.c.

References error_print(), EXIT_FAILURE, and ruby_setup().

Referenced by main(), and pruby_init().

void* ruby_options ( int  argc,
char **  argv 
)

Processes command line arguments and compiles the Ruby source to execute.

This function does:

Returns:
an opaque pointer to the compiled source or an internal special value.
See also:
ruby_executable_node().

Definition at line 93 of file eval.c.

References error_handle(), EXEC_TAG, GET_THREAD(), INT2FIX, POP_TAG, PUSH_TAG, rb_clear_trace_func(), ruby_init_stack(), ruby_process_options(), and SAVE_ROOT_JMPBUF.

int ruby_run_node ( void *  n  ) 

Runs the given compiled source and exits this process.

Return values:
0 if successfully run the source
non-zero if an error occurred.

Definition at line 303 of file eval.c.

References ruby_cleanup(), ruby_exec_node(), and ruby_executable_node().

void ruby_show_copyright ( void   ) 

Prints the copyright notice of the CRuby interpreter to stdout and exits this process successfully.

Definition at line 88 of file version.c.

References EXIT_SUCCESS, and PRINT.

Referenced by process_options().

void ruby_show_version ( void   ) 

Prints the version information of the CRuby interpreter to stdout.

Definition at line 78 of file version.c.

References PRINT.

Referenced by process_options().

void ruby_sysinit ( int *  argc,
char ***  argv 
)

Initializes the process for ruby(1).

This function assumes this process is ruby(1) and it has just started. Usually programs that embeds CRuby interpreter should not call this function, and should do their own initialization.

Definition at line 2018 of file ruby.c.

References fill_standard_fds(), origarg, and rb_w32_sysinit().


Generated on 19 Jul 2016 for Ruby by  doxygen 1.4.7