13 #define IS_RBEXT(e) (strcmp((e), ".rb") == 0)
14 #define IS_SOEXT(e) (strcmp((e), ".so") == 0 || strcmp((e), ".o") == 0)
16 #define IS_DLEXT(e) (strcmp((e), DLEXT) == 0 || strcmp((e), DLEXT2) == 0)
18 #define IS_DLEXT(e) (strcmp((e), DLEXT) == 0)
63 return GET_VM()->loaded_features;
69 return GET_VM()->loading_table;
80 if(vlen < len)
return 0;
81 if (!strncmp(name+(vlen-len),feature,len)){
82 plen = vlen - len - 1;
84 for (e = name + vlen; name != e && *e !=
'.' && *e !=
'/'; --e);
87 strncmp(e-len,feature,len) )
89 plen = e - name - len - 1;
96 if (n != plen )
continue;
97 if (n && (strncmp(name, s, n) || name[n] !=
'/'))
continue;
123 const char *s = (
const char *)v;
133 rb_feature_p(
const char *feature,
const char *ext,
int rb,
int expanded,
const char **fn)
137 long i,
len, elen, n;
145 len =
strlen(feature) - elen;
146 type = rb ?
'r' :
's';
158 if (strncmp(f, feature, len) != 0) {
159 if (expanded)
continue;
166 if (!*(e = f + len)) {
170 if (*e !=
'.')
continue;
174 if ((rb || !ext) && (
IS_RBEXT(e))) {
189 if ((f = fs.result) != 0) {
195 if (fn) *fn = (
const char*)data;
197 if (!ext)
return 'u';
204 if (ext && *ext)
return 0;
207 MEMCPY(buf, feature,
char, len);
212 if (fn) *fn = (
const char*)data;
213 return i ?
's' :
'r';
231 const char *ext =
strrchr(feature,
'.');
232 volatile VALUE fullpath = 0;
234 if (*feature ==
'.' &&
235 (feature[1] ==
'/' || strncmp(feature+1,
"./", 2) == 0)) {
239 if (ext && !
strchr(ext,
'/')) {
259 "$LOADED_FEATURES is frozen; cannot append feature");
279 volatile int loaded =
FALSE;
280 volatile int mild_compile_error;
375 VALUE fname, wrap, path;
403 return (
char *)ftptr;
406 rb_warning(
"loading in progress, circular require considered harmful - %s", ftptr);
420 if (
st_delete(loading_tbl, &key, &data)) {
498 if (ext && !
strchr(ext,
'/')) {
572 return type ?
's' :
'r';
600 char *
volatile ftptr = 0;
663 (*(void (*)(void))
arg)();
768 #define rb_intern(str) rb_intern2((str), strlen(str))
770 static const char var_load_path[] =
"$:";
771 ID id_load_path =
rb_intern2(var_load_path,
sizeof(var_load_path)-1);