Skip to content

Commit

Permalink
matz
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@964 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
matz committed Sep 22, 2000
1 parent 2feb327 commit 238245b
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 10 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -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>

* lib/net/http.rb: too early parameter expantion in string.
Expand Down
5 changes: 3 additions & 2 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -913,8 +913,9 @@ RUBY_LIB_PATH="${RUBY_LIB_PREFIX}/${MAJOR}.${MINOR}"
sitedir='${prefix}/lib/ruby/site_ruby'
AC_ARG_WITH(sitedir,
[--with-sitedir=DIR site libraries in DIR [PREFIX/lib/ruby/site_ruby]],
[sitedir=$withval])
RUBY_SITE_LIB_PATH=`eval "echo ${SITEDIR}"`
[sitedir=$withval],
[sitedir=`eval "echo ${SITEDIR}"`])
RUBY_SITE_LIB_PATH="${sitedir}"
RUBY_SITE_LIB_PATH2="${RUBY_SITE_LIB_PATH}/${MAJOR}.${MINOR}"

AC_DEFINE_UNQUOTED(RUBY_LIB, "${RUBY_LIB_PATH}")
Expand Down
18 changes: 14 additions & 4 deletions eval.c
Original file line number Diff line number Diff line change
Expand Up @@ -5025,8 +5025,9 @@ static VALUE rb_features;
static st_table *loading_tbl;

static int
rb_provided(feature)
rb_feature_p(feature, wait)
const char *feature;
int wait;
{
VALUE *p, *pend;
char *f;
Expand All @@ -5045,7 +5046,8 @@ rb_provided(feature)
return Qtrue;
}
if (strcmp(f+len, ".rb") == 0) {
goto load_wait;
if (wait) goto load_wait;
return Qtrue;
}
}
p++;
Expand All @@ -5070,6 +5072,13 @@ rb_provided(feature)
return Qtrue;
}

int
rb_provided(feature)
const char *feature;
{
return rb_feature_p(feature, Qfalse);
}

void
rb_provide(feature)
const char *feature;
Expand All @@ -5088,7 +5097,7 @@ rb_provide(feature)
strcpy(ext, ".so");
feature = buf;
}
if (rb_provided(feature)) return;
if (rb_feature_p(feature, Qtrue)) return;
rb_ary_push(rb_features, rb_str_new2(feature));
}

Expand All @@ -5102,7 +5111,8 @@ rb_f_require(obj, fname)
volatile int safe = ruby_safe_level;

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, '.');
if (ext) {
feature = file = RSTRING(fname)->ptr;
Expand Down
16 changes: 14 additions & 2 deletions ext/tcltklib/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,16 @@
stubs = enable_config("tcltk_stubs") || with_config("tcltk_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"
if tcllib
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
find_library("tcl", func, *paths) or
find_library("tcl8.3", func, *paths) or
Expand All @@ -32,10 +38,16 @@ def find_tcl(tcllib, stubs)
end

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"
if tklib
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
find_library("tk", func, *paths) or
find_library("tk8.3", func, *paths) or
Expand Down
1 change: 1 addition & 0 deletions intern.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ VALUE rb_obj_instance_eval _((int, VALUE*, VALUE));
void rb_load _((VALUE, int));
void rb_load_protect _((VALUE, int, int*));
void rb_jump_tag _((int)) NORETURN;
int rb_provided _((const char*));
void rb_provide _((const char*));
VALUE rb_f_require _((VALUE, VALUE));
void rb_obj_call_init _((VALUE, int, VALUE*));
Expand Down
6 changes: 4 additions & 2 deletions parse.y
Original file line number Diff line number Diff line change
Expand Up @@ -1204,12 +1204,13 @@ primary : literal
class_nest++;
cref_push();
local_push();
$<num>$ = ruby_sourceline;
}
compstmt
kEND
{
$$ = NEW_CLASS($2, $5, $3);
fixpos($$, $3);
nd_set_line($$, $<num>4);
local_pop();
cref_pop();
class_nest--;
Expand All @@ -1236,12 +1237,13 @@ primary : literal
class_nest++;
cref_push();
local_push();
$<num>$ = ruby_sourceline;
}
compstmt
kEND
{
$$ = NEW_MODULE($2, $4);
fixpos($$, $4);
nd_set_line($$, $<num>3);
local_pop();
cref_pop();
class_nest--;
Expand Down
4 changes: 4 additions & 0 deletions variable.c
Original file line number Diff line number Diff line change
Expand Up @@ -1053,6 +1053,10 @@ rb_autoload_load(id)
VALUE module;

st_delete(autoload_tbl, &id, &modname);
if (rb_provided(modname)) {
free(modname);
return;
}
module = rb_str_new2(modname);
free(modname);
FL_UNSET(module, FL_TAINT);
Expand Down

0 comments on commit 238245b

Please sign in to comment.