#include "ruby/ruby.h"
#include "ruby/util.h"
#include "dln.h"
#include "eval_intern.h"
Include dependency graph for load.c:
Go to the source code of this file.
Data Structures | |
struct | loaded_feature_searching |
Defines | |
#define | IS_RBEXT(e) (strcmp(e, ".rb") == 0) |
#define | IS_SOEXT(e) (strcmp(e, ".so") == 0 || strcmp(e, ".o") == 0) |
#define | IS_DLEXT(e) (strcmp(e, DLEXT) == 0) |
#define | rb_intern(str) rb_intern2(str, strlen(str)) |
Functions | |
VALUE | rb_get_load_path (void) |
VALUE | rb_get_expanded_load_path (void) |
static VALUE | load_path_getter (ID id, rb_vm_t *vm) |
static VALUE | get_loaded_features (void) |
static st_table * | get_loading_table (void) |
static VALUE | loaded_feature_path (const char *name, long vlen, const char *feature, long len, int type, VALUE load_path) |
static int | loaded_feature_path_i (st_data_t v, st_data_t b, st_data_t f) |
static int | rb_feature_p (const char *feature, const char *ext, int rb, int expanded, const char **fn) |
int | rb_provided (const char *feature) |
int | rb_feature_provided (const char *feature, const char **loading) |
static void | rb_provide_feature (VALUE feature) |
void | rb_provide (const char *feature) |
NORETURN (static void load_failed(VALUE)) | |
static void | rb_load_internal (VALUE fname, int wrap) |
void | rb_load (VALUE fname, int wrap) |
void | rb_load_protect (VALUE fname, int wrap, int *state) |
static VALUE | rb_f_load (int argc, VALUE *argv) |
static char * | load_lock (const char *ftptr) |
static void | load_unlock (const char *ftptr, int done) |
VALUE | rb_f_require (VALUE obj, VALUE fname) |
VALUE | rb_f_require_relative (VALUE obj, VALUE fname) |
static int | search_required (VALUE fname, volatile VALUE *path, int safe_level) |
static void | load_failed (VALUE fname) |
static VALUE | load_ext (VALUE path) |
VALUE | rb_require_safe (VALUE fname, int safe) |
VALUE | rb_require (const char *fname) |
static VALUE | init_ext_call (VALUE arg) |
void | ruby_init_ext (const char *name, void(*init)(void)) |
static VALUE | rb_mod_autoload (VALUE mod, VALUE sym, VALUE file) |
static VALUE | rb_mod_autoload_p (VALUE mod, VALUE sym) |
static VALUE | rb_f_autoload (VALUE obj, VALUE sym, VALUE file) |
static VALUE | rb_f_autoload_p (VALUE obj, VALUE sym) |
void | Init_load () |
Variables | |
VALUE | ruby_dln_librefs |
static const char *const | loadable_ext [] |
#define IS_DLEXT | ( | e | ) | (strcmp(e, DLEXT) == 0) |
Definition at line 17 of file load.c.
Referenced by loaded_feature_path(), rb_feature_p(), rb_feature_provided(), and search_required().
#define IS_RBEXT | ( | e | ) | (strcmp(e, ".rb") == 0) |
Definition at line 12 of file load.c.
Referenced by loaded_feature_path(), rb_feature_p(), rb_feature_provided(), and search_required().
#define IS_SOEXT | ( | e | ) | (strcmp(e, ".so") == 0 || strcmp(e, ".o") == 0) |
Definition at line 13 of file load.c.
Referenced by rb_feature_p(), rb_feature_provided(), and search_required().
#define rb_intern | ( | str | ) | rb_intern2(str, strlen(str)) |
static VALUE get_loaded_features | ( | void | ) | [static] |
Definition at line 68 of file load.c.
References GET_VM.
Referenced by Init_load(), rb_feature_p(), and rb_provide_feature().
static st_table* get_loading_table | ( | void | ) | [static] |
Definition at line 74 of file load.c.
References GET_VM.
Referenced by load_lock(), load_unlock(), and rb_feature_p().
Definition at line 635 of file load.c.
References NOEX_PUBLIC, Qnil, and SCOPE_SET.
Referenced by ruby_init_ext().
void Init_load | ( | ) |
Definition at line 740 of file load.c.
References get_loaded_features(), GET_VM, load_path_getter(), rb_alias_variable(), rb_ary_new(), rb_cModule, rb_define_global_function(), rb_define_hooked_variable(), rb_define_method(), rb_define_virtual_variable(), rb_f_autoload(), rb_f_autoload_p(), rb_f_load(), rb_f_require(), rb_f_require_relative(), rb_gc_register_mark_object(), rb_gvar_readonly_setter(), rb_intern, rb_intern2(), rb_mod_autoload(), rb_mod_autoload_p(), and ruby_dln_librefs.
Definition at line 559 of file load.c.
References dln_load(), NOEX_PUBLIC, RSTRING_PTR, and SCOPE_SET.
Referenced by rb_require_safe().
static void load_failed | ( | VALUE | fname | ) | [static] |
Definition at line 551 of file load.c.
References rb_eLoadError, rb_exc_new3(), rb_exc_raise(), rb_str_append(), and rb_str_buf_new_cstr().
Referenced by rb_f_load(), rb_load(), and rb_require_safe().
static char* load_lock | ( | const char * | ftptr | ) | [static] |
Definition at line 380 of file load.c.
References get_loading_table(), GET_VM, rb_backtrace(), rb_barrier_new(), rb_barrier_wait(), rb_warning(), RTEST, ruby_strdup(), ruby_verbose, st_init_strtable, st_insert, and st_lookup.
Referenced by rb_require_safe(), and ruby_init_ext().
Definition at line 62 of file load.c.
References rb_vm_struct::load_path.
Referenced by Init_load().
static void load_unlock | ( | const char * | ftptr, | |
int | done | |||
) | [static] |
Definition at line 404 of file load.c.
References get_loading_table(), rb_barrier_destroy(), rb_barrier_release(), st_delete, and xfree.
Referenced by rb_require_safe(), and ruby_init_ext().
static VALUE loaded_feature_path | ( | const char * | name, | |
long | vlen, | |||
const char * | feature, | |||
long | len, | |||
int | type, | |||
VALUE | load_path | |||
) | [static] |
Definition at line 80 of file load.c.
References IS_DLEXT, IS_RBEXT, RARRAY_LEN, RARRAY_PTR, RSTRING_LEN, and StringValuePtr.
Referenced by loaded_feature_path_i(), and rb_feature_p().
Definition at line 117 of file load.c.
References loaded_feature_searching::len, loaded_feature_searching::load_path, loaded_feature_path(), loaded_feature_searching::name, loaded_feature_searching::result, ST_CONTINUE, ST_STOP, and loaded_feature_searching::type.
Referenced by rb_feature_p().
NORETURN | ( | static void | load_failed(VALUE) | ) |
Definition at line 708 of file load.c.
References NIL_P, rb_eTypeError, rb_mod_autoload(), rb_raise(), and rb_vm_cbase().
Referenced by Init_load().
Definition at line 729 of file load.c.
References NIL_P, Qnil, rb_mod_autoload_p(), and rb_vm_cbase().
Referenced by Init_load().
Definition at line 364 of file load.c.
References FilePathValue, load_failed(), Qtrue, rb_file_load_ok(), rb_find_file(), rb_load_internal(), rb_scan_args(), RSTRING_PTR, and RTEST.
Referenced by Init_load().
Definition at line 446 of file load.c.
References rb_require_safe(), and rb_safe_level.
Referenced by Init_load().
Definition at line 452 of file load.c.
References NIL_P, rb_current_realfilepath(), rb_eLoadError, rb_file_absolute_path(), rb_file_dirname(), rb_raise(), rb_require_safe(), and rb_safe_level.
Referenced by Init_load().
static int rb_feature_p | ( | const char * | feature, | |
const char * | ext, | |||
int | rb, | |||
int | expanded, | |||
const char ** | fn | |||
) | [static] |
Definition at line 129 of file load.c.
References buf, DLEXT_MAXLEN, get_loaded_features(), get_loading_table(), IS_DLEXT, IS_RBEXT, IS_SOEXT, loaded_feature_searching::len, len, loaded_feature_searching::load_path, loadable_ext, loaded_feature_path(), loaded_feature_path_i(), MEMCPY, loaded_feature_searching::name, RARRAY_LEN, RARRAY_PTR, rb_get_expanded_load_path(), rb_get_load_path(), rb_str_resize(), rb_str_tmp_new(), loaded_feature_searching::result, RSTRING_LEN, RSTRING_PTR, st_foreach, st_get_key(), StringValuePtr, strlcpy(), loaded_feature_searching::type, and type.
Referenced by rb_feature_provided(), and search_required().
int rb_feature_provided | ( | const char * | feature, | |
const char ** | loading | |||
) |
Definition at line 225 of file load.c.
References FALSE, IS_DLEXT, IS_RBEXT, IS_SOEXT, Qnil, rb_feature_p(), rb_file_expand_path(), rb_str_new2, RSTRING_PTR, strchr(), strrchr(), and TRUE.
Referenced by autoload_provided(), and rb_provided().
VALUE rb_get_expanded_load_path | ( | void | ) |
Definition at line 37 of file load.c.
References NIL_P, Qnil, RARRAY_LEN, RARRAY_PTR, rb_ary_new2(), rb_ary_push(), rb_check_string_type(), rb_file_expand_path(), rb_get_load_path(), rb_is_absolute_path(), rb_obj_freeze(), rb_str_freeze(), and RSTRING_PTR.
Referenced by rb_feature_p().
void rb_load | ( | VALUE | fname, | |
int | wrap | |||
) |
Definition at line 328 of file load.c.
References FilePathValue, load_failed(), rb_find_file(), and rb_load_internal().
Referenced by rb_load_protect().
static void rb_load_internal | ( | VALUE | fname, | |
int | wrap | |||
) | [static] |
Definition at line 265 of file load.c.
References rb_thread_struct::errinfo, EXEC_TAG, FALSE, GET_THREAD, rb_thread_struct::mild_compile_error, NIL_P, POP_TAG, PUSH_TAG, Qfalse, Qnil, Qundef, rb_exc_raise(), rb_extend_object(), RB_GC_GUARD, rb_iseq_eval(), rb_iseq_new_top(), rb_load_file(), rb_module_new(), rb_obj_clone(), rb_secure(), rb_str_new2, rb_vm_jump_tag_but_local_jump(), rb_vm_top_self(), RSTRING_PTR, rb_thread_struct::top_self, rb_thread_struct::top_wrapper, and TRUE.
Referenced by rb_f_load(), rb_load(), and rb_require_safe().
void rb_load_protect | ( | VALUE | fname, | |
int | wrap, | |||
int * | state | |||
) |
Definition at line 668 of file load.c.
References FilePathValue, Qnil, rb_autoload(), rb_to_id(), and RSTRING_PTR.
Referenced by Init_load(), and rb_f_autoload().
Definition at line 691 of file load.c.
References rb_autoload_p(), and rb_to_id().
Referenced by Init_load(), and rb_f_autoload_p().
void rb_provide | ( | const char * | feature | ) |
Definition at line 257 of file load.c.
References rb_provide_feature(), and rb_usascii_str_new2.
Referenced by Init_Enumerator(), and ruby_init_ext().
static void rb_provide_feature | ( | VALUE | feature | ) | [static] |
Definition at line 251 of file load.c.
References get_loaded_features(), and rb_ary_push().
Referenced by rb_provide(), and rb_require_safe().
int rb_provided | ( | const char * | feature | ) |
VALUE rb_require | ( | const char * | fname | ) |
Definition at line 627 of file load.c.
References OBJ_FREEZE, rb_require_safe(), rb_safe_level, and rb_str_new2.
Referenced by GetVpValue(), Init_bubblebabble(), Init_generator(), Init_md5(), Init_ossl_digest(), Init_parser(), Init_rmd160(), Init_sha1(), Init_sha2(), Init_tkutil(), load_transcoder_entry(), mktime_r(), and yaml_org_handler().
Definition at line 566 of file load.c.
References rb_thread_struct::errinfo, EXEC_TAG, FilePathValue, GET_THREAD, JUMP_TAG, load_ext(), load_failed(), load_lock(), load_unlock(), LONG2NUM, NIL_P, POP_TAG, PUSH_TAG, Qfalse, Qnil, Qtrue, rb_ary_push(), rb_load_internal(), rb_provide_feature(), rb_safe_level, rb_set_safe_level_force(), rb_vm_call_cfunc(), rb_vm_top_self(), result, RSTRING_PTR, ruby_dln_librefs, and search_required().
Referenced by rb_autoload_load(), rb_f_require(), rb_f_require_relative(), rb_require(), and require_enc().
void ruby_init_ext | ( | const char * | name, | |
void(*)(void) | init | |||
) |
Definition at line 643 of file load.c.
References init_ext_call(), load_lock(), load_unlock(), Qnil, rb_provide(), rb_str_new2, rb_vm_call_cfunc(), and rb_vm_top_self().
Referenced by init_golf().
Definition at line 464 of file load.c.
References DLEXT, FALSE, IS_DLEXT, IS_RBEXT, IS_SOEXT, loadable_ext, OBJ_FREEZE, rb_feature_p(), rb_find_file_ext_safe(), rb_find_file_safe(), rb_str_cat2(), rb_str_new(), rb_str_new2, RSTRING_PTR, strchr(), strrchr(), TRUE, and type.
Referenced by rb_require_safe().
const char* const loadable_ext[] [static] |
Initial value:
{ ".rb", DLEXT, 0 }
Definition at line 21 of file load.c.
Referenced by rb_feature_p(), and search_required().