Ruby  3.1.0dev(2021-09-10revisionb76ad15ed0da636161de0243c547ee1e6fc95681)
Data Structures | Macros | Typedefs | Enumerations | Functions
load.c File Reference

(b76ad15ed0da636161de0243c547ee1e6fc95681)

#include "dln.h"
#include "eval_intern.h"
#include "internal.h"
#include "internal/dir.h"
#include "internal/error.h"
#include "internal/file.h"
#include "internal/load.h"
#include "internal/parse.h"
#include "internal/thread.h"
#include "internal/variable.h"
#include "iseq.h"
#include "probes.h"
#include "ruby/encoding.h"
#include "ruby/util.h"
Include dependency graph for load.c:

Go to the source code of this file.

Data Structures

struct  loaded_feature_searching
 

Macros

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

Typedefs

typedef int(* feature_func) (const char *feature, const char *ext, int rb, int expanded, const char **fn)
 

Enumerations

enum  expand_type { EXPAND_ALL, EXPAND_RELATIVE, EXPAND_HOME, EXPAND_NON_CACHE }
 

Functions

VALUE rb_get_expanded_load_path (void)
 
int rb_provided (const char *feature)
 
int rb_feature_provided (const char *feature, const char **loading)
 
void rb_provide (const char *feature)
 
void rb_load (VALUE fname, int wrap)
 
void rb_load_protect (VALUE fname, int wrap, int *pstate)
 
VALUE rb_f_require (VALUE obj, VALUE fname)
 
VALUE rb_f_require_relative (VALUE obj, VALUE fname)
 
VALUE rb_resolve_feature_path (VALUE klass, VALUE fname)
 
void rb_ext_ractor_safe (bool flag)
 
int rb_require_internal (VALUE fname)
 
int ruby_require_internal (const char *fname, unsigned int len)
 
VALUE rb_require_string (VALUE fname)
 
VALUE rb_require (const char *fname)
 
void ruby_init_ext (const char *name, void(*init)(void))
 
void Init_load (void)
 

Macro Definition Documentation

◆ IS_DLEXT

#define IS_DLEXT (   e)    (strcmp((e), DLEXT) == 0)

Definition at line 24 of file load.c.

◆ IS_RBEXT

#define IS_RBEXT (   e)    (strcmp((e), ".rb") == 0)

Definition at line 22 of file load.c.

◆ IS_SOEXT

#define IS_SOEXT (   e)    (strcmp((e), ".so") == 0 || strcmp((e), ".o") == 0)

Definition at line 23 of file load.c.

Typedef Documentation

◆ feature_func

typedef int(* feature_func) (const char *feature, const char *ext, int rb, int expanded, const char **fn)

Definition at line 895 of file load.c.

Enumeration Type Documentation

◆ expand_type

Enumerator
EXPAND_ALL 
EXPAND_RELATIVE 
EXPAND_HOME 
EXPAND_NON_CACHE 

Definition at line 36 of file load.c.

Function Documentation

◆ Init_load()

void Init_load ( void  )

◆ rb_ext_ractor_safe()

void rb_ext_ractor_safe ( bool  flag)

◆ rb_f_require()

VALUE rb_f_require ( VALUE  obj,
VALUE  fname 
)

Definition at line 871 of file load.c.

References rb_require_string().

◆ rb_f_require_relative()

VALUE rb_f_require_relative ( VALUE  obj,
VALUE  fname 
)

◆ rb_feature_provided()

int rb_feature_provided ( const char *  feature,
const char **  loading 
)

Definition at line 563 of file load.c.

References IS_RBEXT, Qnil, rb_file_expand_path_fast(), rb_get_path(), rb_str_new2, RSTRING_PTR, strchr(), and strrchr().

Referenced by rb_provided().

◆ rb_get_expanded_load_path()

VALUE rb_get_expanded_load_path ( void  )

◆ rb_load()

void rb_load ( VALUE  fname,
int  wrap 
)

Definition at line 693 of file load.c.

References FilePathValue, and rb_find_file().

Referenced by rb_load_protect().

◆ rb_load_protect()

void rb_load_protect ( VALUE  fname,
int  wrap,
int *  pstate 
)

Definition at line 701 of file load.c.

References EC_EXEC_TAG, EC_POP_TAG, EC_PUSH_TAG, GET_EC, rb_load(), and TAG_NONE.

◆ rb_provide()

void rb_provide ( const char *  feature)

Definition at line 607 of file load.c.

◆ rb_provided()

int rb_provided ( const char *  feature)

Definition at line 557 of file load.c.

References rb_feature_provided().

◆ rb_require()

VALUE rb_require ( const char *  fname)

Definition at line 1186 of file load.c.

References rb_require_string(), and rb_str_new_cstr.

Referenced by Init_generator(), Init_ossl_digest(), and Init_parser().

◆ rb_require_internal()

int rb_require_internal ( VALUE  fname)

Definition at line 1152 of file load.c.

References GET_EC.

◆ rb_require_string()

VALUE rb_require_string ( VALUE  fname)

Definition at line 1170 of file load.c.

References GET_EC.

Referenced by rb_f_require(), rb_f_require_relative(), and rb_require().

◆ rb_resolve_feature_path()

VALUE rb_resolve_feature_path ( VALUE  klass,
VALUE  fname 
)

Definition at line 1001 of file load.c.

References rb_get_path(), rb_str_encode_ospath(), and sym.

◆ ruby_init_ext()

void ruby_init_ext ( const char *  name,
void(*)(void)  init 
)

Definition at line 1207 of file load.c.

◆ ruby_require_internal()

int ruby_require_internal ( const char *  fname,
unsigned int  len 
)

Definition at line 1159 of file load.c.

References GET_EC, len, rb_setup_fake_str(), and str.