From e4fae8da4beeb7b61a9c3b58d66a4e594f0e73fa Mon Sep 17 00:00:00 2001 From: matz Date: Fri, 22 Sep 2000 18:15:52 +0000 Subject: [PATCH] matz git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@964 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ configure.in | 5 +++-- eval.c | 18 ++++++++++++++---- ext/tcltklib/extconf.rb | 16 ++++++++++++++-- intern.h | 1 + parse.y | 6 ++++-- variable.c | 4 ++++ 7 files changed, 45 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index c3876ae2156b87..41f225b564aeca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sat Sep 23 03:06:25 2000 Yukihiro Matsumoto + + * variable.c (rb_autoload_load): should not require already + provided features. + Fri Sep 22 15:46:21 2000 Minero Aoki * lib/net/http.rb: too early parameter expantion in string. diff --git a/configure.in b/configure.in index 0e3d27b0da60d2..023ede70802ab9 100644 --- a/configure.in +++ b/configure.in @@ -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}") diff --git a/eval.c b/eval.c index f42c86cec23e18..770dd920ffa341 100644 --- a/eval.c +++ b/eval.c @@ -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; @@ -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++; @@ -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; @@ -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)); } @@ -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; diff --git a/ext/tcltklib/extconf.rb b/ext/tcltklib/extconf.rb index 58f2708c7919bd..c958755c6efe75 100644 --- a/ext/tcltklib/extconf.rb +++ b/ext/tcltklib/extconf.rb @@ -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 @@ -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 diff --git a/intern.h b/intern.h index d651b408c4fce4..6fe2783f23241e 100644 --- a/intern.h +++ b/intern.h @@ -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*)); diff --git a/parse.y b/parse.y index cf0687609a26cf..85cc49bcebfd4e 100644 --- a/parse.y +++ b/parse.y @@ -1204,12 +1204,13 @@ primary : literal class_nest++; cref_push(); local_push(); + $$ = ruby_sourceline; } compstmt kEND { $$ = NEW_CLASS($2, $5, $3); - fixpos($$, $3); + nd_set_line($$, $4); local_pop(); cref_pop(); class_nest--; @@ -1236,12 +1237,13 @@ primary : literal class_nest++; cref_push(); local_push(); + $$ = ruby_sourceline; } compstmt kEND { $$ = NEW_MODULE($2, $4); - fixpos($$, $4); + nd_set_line($$, $3); local_pop(); cref_pop(); class_nest--; diff --git a/variable.c b/variable.c index cd9fe0d48eb316..871f715d03e313 100644 --- a/variable.c +++ b/variable.c @@ -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);