Data Structures | Defines | Functions | Variables

load.c File Reference

#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_tableget_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 Documentation

#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))

Function Documentation

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().

static VALUE init_ext_call ( VALUE  arg  )  [static]

Definition at line 634 of file load.c.

References NOEX_PUBLIC, and SCOPE_SET.

Referenced by ruby_init_ext().

void Init_load (  ) 
static VALUE load_ext ( VALUE  path  )  [static]

Definition at line 558 of file load.c.

References dln_load(), NOEX_PUBLIC, RSTRING_PTR, and SCOPE_SET.

static void load_failed ( VALUE  fname  )  [static]

Definition at line 551 of file load.c.

References rb_eLoadError, rb_raise(), and RSTRING_PTR.

Referenced by rb_f_load(), rb_load(), and rb_require_safe().

static char* load_lock ( const char *  ftptr  )  [static]
static VALUE load_path_getter ( ID  id,
rb_vm_t vm 
) [static]

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]
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().

static int loaded_feature_path_i ( st_data_t  v,
st_data_t  b,
st_data_t  f 
) [static]
NORETURN ( static void   load_failedVALUE  ) 
static VALUE rb_f_autoload ( VALUE  obj,
VALUE  sym,
VALUE  file 
) [static]

Definition at line 707 of file load.c.

References NIL_P, rb_eTypeError, rb_mod_autoload(), rb_raise(), and rb_vm_cbase().

Referenced by Init_load().

static VALUE rb_f_autoload_p ( VALUE  obj,
VALUE  sym 
) [static]

Definition at line 728 of file load.c.

References NIL_P, rb_mod_autoload_p(), and rb_vm_cbase().

Referenced by Init_load().

static VALUE rb_f_load ( int  argc,
VALUE argv 
) [static]
VALUE rb_f_require ( VALUE  obj,
VALUE  fname 
)

Definition at line 446 of file load.c.

References rb_require_safe(), and rb_safe_level.

Referenced by Init_load().

VALUE rb_f_require_relative ( VALUE  obj,
VALUE  fname 
)
static int rb_feature_p ( const char *  feature,
const char *  ext,
int  rb,
int  expanded,
const char **  fn 
) [static]
int rb_feature_provided ( const char *  feature,
const char **  loading 
)
VALUE rb_get_expanded_load_path ( void   ) 
VALUE rb_get_load_path ( void   ) 

Definition at line 30 of file load.c.

References GET_VM.

Referenced by rb_feature_p(), rb_find_file_ext_safe(), rb_find_file_safe(), and rb_get_expanded_load_path().

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]
void rb_load_protect ( VALUE  fname,
int  wrap,
int *  state 
)

Definition at line 336 of file load.c.

References EXEC_TAG, POP_TAG, PUSH_TAG, and rb_load().

static VALUE rb_mod_autoload ( VALUE  mod,
VALUE  sym,
VALUE  file 
) [static]

Definition at line 667 of file load.c.

References FilePathValue, rb_autoload(), rb_to_id(), and RSTRING_PTR.

Referenced by Init_load(), and rb_f_autoload().

static VALUE rb_mod_autoload_p ( VALUE  mod,
VALUE  sym 
) [static]

Definition at line 690 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  ) 

Definition at line 219 of file load.c.

References rb_feature_provided().

VALUE rb_require ( const char *  fname  ) 
VALUE rb_require_safe ( VALUE  fname,
int  safe 
)
void ruby_init_ext ( const char *  name,
void(*)(void)  init 
)
static int search_required ( VALUE  fname,
volatile VALUE path,
int  safe_level 
) [static]

Variable Documentation

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().

Definition at line 10 of file load.c.

Referenced by Init_load(), and rb_require_safe().