Ruby 2.7.0p0(2019-12-25revision647ee6f091eafcce70ffb75ddf7e121e192ab217)

Data Structures | Macros | Typedefs | Enumerations | Functions
load.c File Reference
`#include "ruby/encoding.h"`
`#include "ruby/util.h"`
`#include "internal.h"`
`#include "dln.h"`
`#include "eval_intern.h"`
`#include "probes.h"`
`#include "iseq.h"`

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)
#define | rb_intern(str) rb_intern2((str), strlen(str))

## 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)
| NORETURN (static void load_failed(VALUE))
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)
int | rb_require_internal (VALUE fname)
int | ruby_require_internal (const char *fname, unsigned int len)
VALUE | rb_require_safe (VALUE fname, int safe)
VALUE | rb_require_string (VALUE fname)
VALUE | rb_require (const char *fname)
RUBY_FUNC_EXPORTED 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 20 of file load.c.

## ◆ IS_RBEXT

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

Definition at line 15 of file load.c.

## ◆ IS_SOEXT

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

Definition at line 16 of file load.c.

## ◆ rb_intern

#define rb_intern | ( |  | str | ) | rb_intern2((str), strlen(str))

## Typedef Documentation

## ◆ feature_func

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

Definition at line 833 of file load.c.

## Enumeration Type Documentation

## ◆ expand_type

enum expand_type

Enumerator
EXPAND_ALL |
EXPAND_RELATIVE |
EXPAND_HOME |
EXPAND_NON_CACHE |

Definition at line 31 of file load.c.

## Function Documentation

## ◆ Init_load()

void Init_load | ( | void |  | ) |

Definition at line 1255 of file load.c.

References GET_VM, ruby::backward::cxxanyargs::rb_define_hooked_variable(), and rb_intern2().

## ◆ NORETURN()

NORETURN | ( | static void | load_failedVALUE | ) |

## ◆ rb_f_require()

VALUE rb_f_require | ( | VALUE | obj,
|  | VALUE | fname
| ) |  |

Definition at line 809 of file load.c.

References rb_require_string().

## ◆ rb_f_require_relative()

VALUE rb_f_require_relative | ( | VALUE | obj,
|  | VALUE | fname
| ) |  |

Definition at line 823 of file load.c.

References NIL_P, rb_current_realfilepath(), rb_file_absolute_path(), rb_file_dirname(), rb_loaderror(), and rb_require_string().

## ◆ rb_feature_provided()

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

Definition at line 519 of file load.c.

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

Referenced by rb_provided().

## ◆ rb_get_expanded_load_path()

VALUE rb_get_expanded_load_path | ( | void |  | ) |

Definition at line 92 of file load.c.

References GET_VM, rb_vm_struct::load_path, rb_vm_struct::load_path_snapshot, Qtrue, and rb_ary_shared_with_p().

## ◆ rb_load()

void rb_load | ( | VALUE | fname,
|  | int | wrap
| ) |  |

Definition at line 649 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 657 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 563 of file load.c.

## ◆ rb_provided()

int rb_provided | ( | const char * | feature | ) |

Definition at line 513 of file load.c.

References rb_feature_provided().

## ◆ rb_require_internal()

int rb_require_internal | ( | VALUE | fname | ) |

Definition at line 1067 of file load.c.

References GET_EC.

## ◆ rb_require_safe()

VALUE rb_require_safe | ( | VALUE | fname,
|  | int | safe
| ) |  |

Definition at line 1085 of file load.c.

References GET_EC, and rb_warn().

## ◆ rb_require_string()

VALUE rb_require_string | ( | VALUE | fname | ) |

Definition at line 1102 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 947 of file load.c.

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

## ◆ ruby_init_ext()

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

Definition at line 1139 of file load.c.

## ◆ ruby_require_internal()

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

Definition at line 1074 of file load.c.

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