Ruby
2.0.0p247(2013-06-27revision41674)
|
#include "ruby/ruby.h"
#include "ruby/encoding.h"
#include "internal.h"
#include "eval_intern.h"
#include "dln.h"
#include <stdio.h>
#include <sys/types.h>
#include <ctype.h>
#include "ruby/util.h"
Go to the source code of this file.
Data Structures | |
struct | cmdline_options |
struct | load_file_arg |
Macros | |
#define | MAXPATHLEN 1024 |
#define | numberof(array) (int)(sizeof(array) / sizeof((array)[0])) |
#define | DEFAULT_RUBYGEMS_ENABLED "enabled" |
#define | DISABLE_BIT(bit) (1U << disable_##bit) |
#define | DUMP_BIT(bit) (1U << dump_##bit) |
#define | src_encoding_index GET_VM()->src_encoding_index |
#define | forbid_setid(s) forbid_setid((s), opt) |
#define | M(shortopt, longopt, desc) |
#define | SHOW(m) |
#define | rubylib_mangled_path rb_str_new |
#define | RUBY_RELATIVE(path, len) rubylib_mangled_path((path), (len)) |
#define | PREFIX_PATH() RUBY_RELATIVE(exec_prefix, sizeof(exec_prefix)-1) |
#define | NAME_MATCH_P(name, str, len) ((len) < (int)sizeof(name) && strncmp((str), (name), (len)) == 0) |
#define | UNSET_WHEN(name, bit, str, len) |
#define | SET_WHEN(name, bit, str, len) |
#define | UNSET_WHEN_DISABLE(bit) UNSET_WHEN(#bit, DISABLE_BIT(bit), str, len) |
#define | SET_WHEN_DISABLE(bit) SET_WHEN(#bit, DISABLE_BIT(bit), str, len) |
#define | SET_WHEN_DUMP(bit) SET_WHEN(#bit, DUMP_BIT(bit), str, len) |
#define | set_internal_encoding_once(opt, e, elen) set_option_encoding_once("default_internal", &(opt)->intern.enc.name, (e), (elen)) |
#define | set_external_encoding_once(opt, e, elen) set_option_encoding_once("default_external", &(opt)->ext.enc.name, (e), (elen)) |
#define | set_source_encoding_once(opt, e, elen) set_option_encoding_once("source", &(opt)->src.enc.name, (e), (elen)) |
#define | is_option_end(c, allow_hyphen) (!(c) || ((allow_hyphen) && (c) == '-') || (c) == '=') |
#define | check_envopt(name, allow_envopt) |
#define | need_argument(name, s) |
#define | is_option_with_arg(name, allow_hyphen, allow_envopt) |
#define | set_encoding_part(type) |
#define | rb_progname (GET_VM()->progname) |
#define | rb_define_readonly_boolean(name, val) rb_define_virtual_variable((name), (val) ? true_value : false_value, 0) |
#define | PREPARE_PARSE_MAIN(expr) |
Enumerations | |
enum | disable_flag_bits { disable_gems, disable_rubyopt, disable_flag_count } |
enum | dump_flag_bits { dump_version, dump_version_v, dump_copyright, dump_usage, dump_help, dump_yydebug, dump_syntax, dump_parsetree, dump_parsetree_with_comment, dump_insns, dump_flag_count } |
Variables | |
struct { | |
int argc | |
char ** argv | |
} | origarg |
VALUE | rb_argv0 |
#define DEFAULT_RUBYGEMS_ENABLED "enabled" |
#define DISABLE_BIT | ( | bit | ) | (1U << disable_##bit) |
Definition at line 63 of file ruby.c.
Referenced by cmdline_options_init(), and process_options().
#define DUMP_BIT | ( | bit | ) | (1U << dump_##bit) |
Definition at line 70 of file ruby.c.
Referenced by proc_options(), and process_options().
Definition at line 127 of file ruby.c.
Referenced by load_file_internal(), proc_options(), and process_options().
#define is_option_with_arg | ( | name, | |
allow_hyphen, | |||
allow_envopt | |||
) |
Referenced by proc_options().
#define M | ( | shortopt, | |
longopt, | |||
desc | |||
) |
Referenced by usage().
#define MAXPATHLEN 1024 |
Definition at line 46 of file ruby.c.
Referenced by process_options(), and ruby_init_loadpath_safe().
#define NAME_MATCH_P | ( | name, | |
str, | |||
len | |||
) | ((len) < (int)sizeof(name) && strncmp((str), (name), (len)) == 0) |
Definition at line 685 of file ruby.c.
Referenced by disable_option(), and enable_option().
#define PREFIX_PATH | ( | ) | RUBY_RELATIVE(exec_prefix, sizeof(exec_prefix)-1) |
Referenced by ruby_init_loadpath_safe().
#define PREPARE_PARSE_MAIN | ( | expr | ) |
Referenced by process_options().
#define rb_define_readonly_boolean | ( | name, | |
val | |||
) | rb_define_virtual_variable((name), (val) ? true_value : false_value, 0) |
#define rb_progname (GET_VM()->progname) |
Definition at line 1190 of file ruby.c.
Referenced by process_options(), ruby_process_options(), ruby_prog_init(), ruby_script(), ruby_set_script_name(), and set_arg0().
#define RUBY_RELATIVE | ( | path, | |
len | |||
) | rubylib_mangled_path((path), (len)) |
Referenced by ruby_init_loadpath_safe().
#define rubylib_mangled_path rb_str_new |
Definition at line 250 of file ruby.c.
Referenced by push_include(), and ruby_init_loadpath_safe().
#define set_encoding_part | ( | type | ) |
Referenced by proc_options().
#define set_external_encoding_once | ( | opt, | |
e, | |||
elen | |||
) | set_option_encoding_once("default_external", &(opt)->ext.enc.name, (e), (elen)) |
Definition at line 761 of file ruby.c.
Referenced by proc_options().
#define set_internal_encoding_once | ( | opt, | |
e, | |||
elen | |||
) | set_option_encoding_once("default_internal", &(opt)->intern.enc.name, (e), (elen)) |
Definition at line 759 of file ruby.c.
Referenced by proc_options().
#define set_source_encoding_once | ( | opt, | |
e, | |||
elen | |||
) | set_option_encoding_once("source", &(opt)->src.enc.name, (e), (elen)) |
Definition at line 763 of file ruby.c.
Referenced by proc_options().
#define SET_WHEN_DISABLE | ( | bit | ) | SET_WHEN(#bit, DISABLE_BIT(bit), str, len) |
Referenced by disable_option().
Referenced by dump_option().
#define SHOW | ( | m | ) |
#define src_encoding_index GET_VM()->src_encoding_index |
Definition at line 109 of file ruby.c.
Referenced by cmdline_options_init(), load_file_internal(), and process_options().
#define UNSET_WHEN_DISABLE | ( | bit | ) | UNSET_WHEN(#bit, DISABLE_BIT(bit), str, len) |
Referenced by enable_option().
enum disable_flag_bits |
enum dump_flag_bits |
Definition at line 522 of file ruby.c.
References list, rb_ary_new(), rb_ary_push(), rb_str_new2, and RBASIC.
Referenced by proc_options().
|
static |
Definition at line 112 of file ruby.c.
References cmdline_options::disable, DISABLE_BIT, cmdline_options::enc, cmdline_options::ext, init_ids(), cmdline_options::intern, MEMZERO, cmdline_options::src, and src_encoding_index.
Referenced by rb_load_file(), and ruby_process_options().
Definition at line 714 of file ruby.c.
References NAME_MATCH_P, rb_warn(), and SET_WHEN_DISABLE.
Referenced by proc_options().
Definition at line 727 of file ruby.c.
References rb_warn(), SET_WHEN_DUMP, usage(), version(), and yydebug.
Referenced by proc_options().
Definition at line 701 of file ruby.c.
References NAME_MATCH_P, rb_warn(), and UNSET_WHEN_DISABLE.
Referenced by proc_options().
Definition at line 342 of file ruby.c.
References path, Qnil, rb_file_expand_path(), and RSTRING_PTR.
Referenced by ruby_incpush_expand(), and ruby_init_loadpath_safe().
|
static |
Definition at line 1818 of file ruby.c.
References rb_eSecurityError, rb_raise(), cmdline_options::safe_level, and cmdline_options::setids.
char* getenv | ( | ) |
Definition at line 7 of file dmyext.c.
Referenced by init_libraries_internal(), and process_options().
|
static |
Definition at line 1802 of file ruby.c.
References getegid(), geteuid(), getgid(), getuid(), cmdline_options::safe_level, and cmdline_options::setids.
Referenced by cmdline_options_init().
|
static |
Definition at line 1740 of file ruby.c.
References load_file_arg::fname, load_file_internal(), load_file_arg::opt, load_file_arg::parser, parser, rb_ensure(), rb_gv_get(), restore_lineno(), and load_file_arg::script.
Referenced by process_options(), and rb_load_file().
Definition at line 1566 of file ruby.c.
References c, CONST_ID, cmdline_options::enc, enc, errno, cmdline_options::ext, f, FALSE, load_file_arg::fname, forbid_setid, fstat, INT2FIX, cmdline_options::intern, mode, moreswitches(), NIL_P(), O_BINARY, load_file_arg::opt, opt_enc_index(), p, load_file_arg::parser, parser, Qnil, rb_ascii8bit_encoding(), rb_cloexec_open(), rb_define_global_const(), rb_enc_associate(), rb_enc_from_encoding(), rb_enc_from_index(), rb_funcall(), rb_io_close(), rb_io_fdopen(), rb_io_getbyte(), rb_io_gets(), rb_io_ungetbyte(), rb_load_fail(), rb_loaderror(), rb_locale_encoding(), rb_parser_compile_file(), rb_parser_compile_string(), rb_parser_encoding(), rb_parser_end_seen_p(), rb_stdin, rb_str_encode_ospath(), rb_str_new(), rb_str_new2, rb_str_new_cstr(), rb_update_max_fd(), rb_utf8_encoding(), cmdline_options::req_list, require_libraries(), RSTRING_LEN, RSTRING_PTR, ruby_set_script_name(), S_ISDIR, load_file_arg::script, cmdline_options::script_name, cmdline_options::src, src_encoding_index, stat, STRCASECMP, strerror(), StringValueCStr, strrchr(), strstr(), and cmdline_options::xflag.
Referenced by load_file().
Definition at line 329 of file ruby.c.
References path, rb_enc_associate(), and rb_locale_encoding().
Referenced by ruby_incpush().
|
static |
Definition at line 639 of file ruby.c.
References argc, argv, i, ISSPACE, len, memcpy(), p, proc_options(), rb_str_cat(), rb_str_resize(), rb_str_tmp_new(), RSTRING_LEN, RSTRING_PTR, and strlen().
Referenced by load_file_internal(), and process_options().
Definition at line 1176 of file ruby.c.
References i, rb_enc_dummy_p(), rb_enc_find_index(), rb_enc_from_index(), rb_eRuntimeError, rb_raise(), and RSTRING_PTR.
Referenced by load_file_internal(), and process_options().
|
static |
Definition at line 767 of file ruby.c.
References add_modules(), arg, argc, c, cmdline_options::disable, disable_option(), cmdline_options::do_line, cmdline_options::do_loop, cmdline_options::do_print, cmdline_options::do_search, cmdline_options::do_split, cmdline_options::dump, DUMP_BIT, dump_option(), cmdline_options::e_script, enable_option(), cmdline_options::enc, enc_name, cmdline_options::ext, forbid_setid, is_option_with_arg, ISPRINT, n, p, Qfalse, Qnil, Qtrue, rb_eRuntimeError, rb_fatal(), rb_fs, rb_output_rs, rb_raise(), rb_reg_new(), rb_rs, rb_str_cat2(), rb_str_new(), rb_str_new2, cmdline_options::req_list, ruby_debug, ruby_each_words(), ruby_incpush_expand(), ruby_set_inplace_mode(), ruby_verbose, s, cmdline_options::safe_level, scan_oct, cmdline_options::script, set_encoding_part, set_external_encoding_once, set_internal_encoding_once, set_source_encoding_once, cmdline_options::sflag, cmdline_options::src, strlen(), TRUE, usage(), v, cmdline_options::verbose, version(), cmdline_options::xflag, and yydebug.
Referenced by moreswitches(), and process_options().
|
static |
Definition at line 1300 of file ruby.c.
References cmdline_options::disable, DISABLE_BIT, dln_find_file_r(), cmdline_options::do_line, cmdline_options::do_loop, cmdline_options::do_print, cmdline_options::do_search, cmdline_options::do_split, cmdline_options::dump, DUMP_BIT, cmdline_options::e_script, cmdline_options::enc, enc, cmdline_options::ext, fbuf, FL_TAINT, FL_UNSET, forbid_setid, GET_THREAD(), GET_VM, getenv(), i, Init_enc(), int, cmdline_options::intern, load_file(), MAXPATHLEN, moreswitches(), OBJ_TAINT, opt_enc_index(), origarg, parser, PATH_ENV, PREPARE_PARSE_MAIN, proc_options(), process_sflag(), Qfalse, Qnil, Qtrue, Qundef, RARRAY_LEN, RARRAY_PTR(), rb_argv, rb_cObject, rb_const_get(), rb_default_internal_encoding(), rb_define_global_function(), rb_define_module(), rb_enc_associate(), rb_enc_find_index(), rb_enc_from_encoding(), rb_enc_from_index(), rb_enc_set_default_external(), rb_enc_set_default_internal(), rb_f_chomp(), rb_f_chop(), rb_f_gsub(), rb_f_sub(), rb_intern, rb_io_flush(), rb_io_write(), rb_iseq_new_main(), rb_locale_encoding(), rb_obj_freeze(), rb_parser_append_print(), rb_parser_compile_string(), rb_parser_dump_tree(), rb_parser_new(), rb_parser_set_yydebug(), rb_parser_while_loop(), rb_progname, rb_realpath_internal(), rb_require(), rb_stdio_set_default_encoding(), rb_stdout, rb_str_dup(), rb_str_new_cstr(), rb_warning(), cmdline_options::req_list, require_libraries(), RSTRING_PTR, ruby_init_loadpath_safe(), ruby_init_prelude(), ruby_set_argv(), ruby_set_script_name(), ruby_show_copyright(), ruby_show_version(), s, cmdline_options::safe_level, cmdline_options::script, cmdline_options::script_name, cmdline_options::sflag, cmdline_options::src, src_encoding_index, th, usage(), cmdline_options::verbose, version(), cmdline_options::xflag, and yydebug.
Referenced by ruby_process_options().
Definition at line 573 of file ruby.c.
References args, argv, FALSE, ISALNUM, n, p, Qtrue, RARRAY_LEN, RARRAY_PTR(), rb_argv, rb_ary_shift(), rb_class_new_instance(), rb_eNameError, rb_exc_raise(), rb_gv_set(), rb_str_cat(), rb_str_cat2(), rb_str_new2, strchr(), StringValuePtr, TRUE, and v.
Referenced by process_options().
Definition at line 254 of file ruby.c.
References CharNext, GET_VM, p, path, PATH_SEP_CHAR, rb_ary_push(), rubylib_mangled_path, and s.
Referenced by ruby_push_include().
Definition at line 1289 of file ruby.c.
References rb_funcall_passing_block(), rb_intern, rb_lastline_set(), str, and uscore_get().
Referenced by process_options().
Definition at line 1269 of file ruby.c.
References rb_funcall_passing_block(), rb_intern, rb_lastline_set(), str, and uscore_get().
Referenced by process_options().
Definition at line 1251 of file ruby.c.
References rb_funcall_passing_block(), rb_intern, rb_lastline_set(), str, and uscore_get().
Referenced by process_options().
Definition at line 1232 of file ruby.c.
References rb_funcall_passing_block(), rb_intern, rb_lastline_set(), str, and uscore_get().
Referenced by process_options().
Definition at line 1751 of file ruby.c.
References cmdline_options_init(), load_file(), rb_parser_new(), and rb_str_new_cstr().
Referenced by rb_load_internal().
Definition at line 537 of file ruby.c.
References CONST_ID, GET_THREAD(), Init_ext(), list, OBJ_FREEZE, rb_thread_struct::parse_in_eval, RARRAY_LEN, rb_ary_shift(), rb_cString, rb_default_external_encoding(), rb_enc_associate(), rb_funcall2(), rb_vm_top_self(), RBASIC, and th.
Referenced by load_file_internal(), and process_options().
Definition at line 353 of file ruby.c.
References expand_include_path(), and ruby_push_include().
Referenced by proc_options().
Definition at line 385 of file ruby.c.
References dln_find_file_r(), expand_include_path(), f, fbuf, GET_VM, getenv(), identical_path(), MAXPATHLEN, p, PATH_ENV, PREFIX_PATH, Qnil, rb_ary_push(), rb_cObject, rb_const_set(), rb_intern_const, rb_ivar_set(), rb_obj_freeze(), rb_realpath_internal(), rb_str_freeze(), rb_str_new(), rb_str_new_cstr(), rb_str_resize(), RSTRING_PTR, ruby_initial_load_paths, ruby_push_include(), RUBY_RELATIVE, rubylib_mangled_path, STRCASECMP, strlcpy(), strlen(), and strrchr().
Referenced by process_options(), and ruby_init_loadpath().
Definition at line 1169 of file ruby.c.
References Init_prelude(), rb_cObject, rb_const_remove(), and rb_intern_const.
Referenced by process_options().
Definition at line 316 of file ruby.c.
References push_include().
Referenced by ruby_incpush(), ruby_incpush_expand(), and ruby_init_loadpath_safe().
Definition at line 1760 of file ruby.c.
References i, origarg, rb_eRuntimeError, rb_external_str_new(), rb_obj_freeze(), rb_progname, rb_raise(), RSTRING_LEN, RSTRING_PTR, s, setproctitle(), and StringValue.
Referenced by ruby_prog_init().
|
static |
Definition at line 744 of file ruby.c.
References INT2FIX, rb_eRuntimeError, rb_funcall(), rb_intern, rb_raise(), rb_str_new(), RSTRING_PTR, and strlen().
Definition at line 562 of file ruby.c.
References env, rb_binding_t::env, GetBindingPtr, and GetEnvPtr.
Definition at line 135 of file ruby.c.
References DEFAULT_RUBYGEMS_ENABLED, i, M, numberof, SHOW, and str.
Referenced by dump_option(), proc_options(), and process_options().
Definition at line 1209 of file ruby.c.
References NIL_P(), rb_eTypeError, rb_lastline_get(), rb_obj_classname(), rb_raise(), RB_TYPE_P, and T_STRING.
Referenced by rb_f_chomp(), rb_f_chop(), rb_f_gsub(), and rb_f_sub().
struct { ... } origarg |
Referenced by process_options(), ruby_set_argv(), ruby_sysinit(), and set_arg0().