git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@964 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2000-09-22 18:15:52 +00:00
parent 77f8b0db8d
commit e4fae8da4b
7 changed files with 45 additions and 10 deletions

View File

@ -1,3 +1,8 @@
Sat Sep 23 03:06:25 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
* variable.c (rb_autoload_load): should not require already
provided features.
Fri Sep 22 15:46:21 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp> Fri Sep 22 15:46:21 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
* lib/net/http.rb: too early parameter expantion in string. * lib/net/http.rb: too early parameter expantion in string.

View File

@ -913,8 +913,9 @@ RUBY_LIB_PATH="${RUBY_LIB_PREFIX}/${MAJOR}.${MINOR}"
sitedir='${prefix}/lib/ruby/site_ruby' sitedir='${prefix}/lib/ruby/site_ruby'
AC_ARG_WITH(sitedir, AC_ARG_WITH(sitedir,
[--with-sitedir=DIR site libraries in DIR [PREFIX/lib/ruby/site_ruby]], [--with-sitedir=DIR site libraries in DIR [PREFIX/lib/ruby/site_ruby]],
[sitedir=$withval]) [sitedir=$withval],
RUBY_SITE_LIB_PATH=`eval "echo ${SITEDIR}"` [sitedir=`eval "echo ${SITEDIR}"`])
RUBY_SITE_LIB_PATH="${sitedir}"
RUBY_SITE_LIB_PATH2="${RUBY_SITE_LIB_PATH}/${MAJOR}.${MINOR}" RUBY_SITE_LIB_PATH2="${RUBY_SITE_LIB_PATH}/${MAJOR}.${MINOR}"
AC_DEFINE_UNQUOTED(RUBY_LIB, "${RUBY_LIB_PATH}") AC_DEFINE_UNQUOTED(RUBY_LIB, "${RUBY_LIB_PATH}")

18
eval.c
View File

@ -5025,8 +5025,9 @@ static VALUE rb_features;
static st_table *loading_tbl; static st_table *loading_tbl;
static int static int
rb_provided(feature) rb_feature_p(feature, wait)
const char *feature; const char *feature;
int wait;
{ {
VALUE *p, *pend; VALUE *p, *pend;
char *f; char *f;
@ -5045,7 +5046,8 @@ rb_provided(feature)
return Qtrue; return Qtrue;
} }
if (strcmp(f+len, ".rb") == 0) { if (strcmp(f+len, ".rb") == 0) {
goto load_wait; if (wait) goto load_wait;
return Qtrue;
} }
} }
p++; p++;
@ -5070,6 +5072,13 @@ rb_provided(feature)
return Qtrue; return Qtrue;
} }
int
rb_provided(feature)
const char *feature;
{
return rb_feature_p(feature, Qfalse);
}
void void
rb_provide(feature) rb_provide(feature)
const char *feature; const char *feature;
@ -5088,7 +5097,7 @@ rb_provide(feature)
strcpy(ext, ".so"); strcpy(ext, ".so");
feature = buf; feature = buf;
} }
if (rb_provided(feature)) return; if (rb_feature_p(feature, Qtrue)) return;
rb_ary_push(rb_features, rb_str_new2(feature)); rb_ary_push(rb_features, rb_str_new2(feature));
} }
@ -5102,7 +5111,8 @@ rb_f_require(obj, fname)
volatile int safe = ruby_safe_level; volatile int safe = ruby_safe_level;
Check_SafeStr(fname); Check_SafeStr(fname);
if (rb_provided(RSTRING(fname)->ptr)) return Qfalse; if (rb_feature_p(RSTRING(fname)->ptr, Qtrue))
return Qfalse;
ext = strrchr(RSTRING(fname)->ptr, '.'); ext = strrchr(RSTRING(fname)->ptr, '.');
if (ext) { if (ext) {
feature = file = RSTRING(fname)->ptr; feature = file = RSTRING(fname)->ptr;

View File

@ -18,10 +18,16 @@ tcllib = with_config("tcllib")
stubs = enable_config("tcltk_stubs") || with_config("tcltk_stubs") stubs = enable_config("tcltk_stubs") || with_config("tcltk_stubs")
def find_tcl(tcllib, stubs) def find_tcl(tcllib, stubs)
paths = ["/usr/local/lib", "/usr/pkg"] paths = ["/usr/local/lib", "/usr/pkg", "/usr/lib"]
func = stubs ? "Tcl_InitStubs" : "Tcl_FindExecutable" func = stubs ? "Tcl_InitStubs" : "Tcl_FindExecutable"
if tcllib if tcllib
find_library(tcllib, func, *paths) find_library(tcllib, func, *paths)
elsif RUBY_PLATFORM =~ /mswin32|mingw|cygwin/
find_library("tcl", func, *paths) or
find_library("tcl83", func, *paths) or
find_library("tcl82", func, *paths) or
find_library("tcl80", func, *paths) or
find_library("tcl76", func, *paths)
else else
find_library("tcl", func, *paths) or find_library("tcl", func, *paths) or
find_library("tcl8.3", func, *paths) or find_library("tcl8.3", func, *paths) or
@ -32,10 +38,16 @@ def find_tcl(tcllib, stubs)
end end
def find_tk(tklib, stubs) def find_tk(tklib, stubs)
paths = ["/usr/local/lib", "/usr/pkg"] paths = ["/usr/local/lib", "/usr/pkg", "/usr/lib"]
func = stubs ? "Tk_InitStubs" : "Tk_Init" func = stubs ? "Tk_InitStubs" : "Tk_Init"
if tklib if tklib
find_library(tklib, func, *paths) find_library(tklib, func, *paths)
elsif RUBY_PLATFORM =~ /mswin32|mingw|cygwin/
find_library("tk", func, *paths) or
find_library("tk83", func, *paths) or
find_library("tk82", func, *paths) or
find_library("tk80", func, *paths) or
find_library("tk42", func, *paths)
else else
find_library("tk", func, *paths) or find_library("tk", func, *paths) or
find_library("tk8.3", func, *paths) or find_library("tk8.3", func, *paths) or

View File

@ -132,6 +132,7 @@ VALUE rb_obj_instance_eval _((int, VALUE*, VALUE));
void rb_load _((VALUE, int)); void rb_load _((VALUE, int));
void rb_load_protect _((VALUE, int, int*)); void rb_load_protect _((VALUE, int, int*));
void rb_jump_tag _((int)) NORETURN; void rb_jump_tag _((int)) NORETURN;
int rb_provided _((const char*));
void rb_provide _((const char*)); void rb_provide _((const char*));
VALUE rb_f_require _((VALUE, VALUE)); VALUE rb_f_require _((VALUE, VALUE));
void rb_obj_call_init _((VALUE, int, VALUE*)); void rb_obj_call_init _((VALUE, int, VALUE*));

View File

@ -1204,12 +1204,13 @@ primary : literal
class_nest++; class_nest++;
cref_push(); cref_push();
local_push(); local_push();
$<num>$ = ruby_sourceline;
} }
compstmt compstmt
kEND kEND
{ {
$$ = NEW_CLASS($2, $5, $3); $$ = NEW_CLASS($2, $5, $3);
fixpos($$, $3); nd_set_line($$, $<num>4);
local_pop(); local_pop();
cref_pop(); cref_pop();
class_nest--; class_nest--;
@ -1236,12 +1237,13 @@ primary : literal
class_nest++; class_nest++;
cref_push(); cref_push();
local_push(); local_push();
$<num>$ = ruby_sourceline;
} }
compstmt compstmt
kEND kEND
{ {
$$ = NEW_MODULE($2, $4); $$ = NEW_MODULE($2, $4);
fixpos($$, $4); nd_set_line($$, $<num>3);
local_pop(); local_pop();
cref_pop(); cref_pop();
class_nest--; class_nest--;

View File

@ -1053,6 +1053,10 @@ rb_autoload_load(id)
VALUE module; VALUE module;
st_delete(autoload_tbl, &id, &modname); st_delete(autoload_tbl, &id, &modname);
if (rb_provided(modname)) {
free(modname);
return;
}
module = rb_str_new2(modname); module = rb_str_new2(modname);
free(modname); free(modname);
FL_UNSET(module, FL_TAINT); FL_UNSET(module, FL_TAINT);