diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-03-23 04:14:31 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-03-23 04:14:31 +0000 |
commit | 6c2be430400d53832eb05d5b617e495121e9241f (patch) | |
tree | 80abe89f64ec3e762f274c6da25385fdd3bfdf1c | |
parent | 8f5c38d5fd0f2ef165a71f44b9c5410d1e0743bb (diff) |
2000-03-23
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_4@647 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 35 | ||||
-rw-r--r-- | array.c | 2 | ||||
-rw-r--r-- | configure | 3 | ||||
-rw-r--r-- | configure.in | 3 | ||||
-rw-r--r-- | eval.c | 11 | ||||
-rw-r--r-- | ext/dbm/extconf.rb | 7 | ||||
-rw-r--r-- | ext/socket/getaddrinfo.c | 6 | ||||
-rw-r--r-- | ext/socket/getnameinfo.c | 6 | ||||
-rw-r--r-- | ext/tk/lib/tk.rb | 8 | ||||
-rw-r--r-- | ext/tk/lib/tktext.rb | 2 | ||||
-rw-r--r-- | hash.c | 31 | ||||
-rw-r--r-- | lib/profile.rb | 25 | ||||
-rw-r--r-- | lib/thread.rb | 53 | ||||
-rw-r--r-- | node.h | 2 | ||||
-rw-r--r-- | object.c | 1 | ||||
-rw-r--r-- | ruby.c | 18 | ||||
-rw-r--r-- | ruby.h | 3 | ||||
-rw-r--r-- | sample/eval.rb | 2 | ||||
-rw-r--r-- | st.c | 2 | ||||
-rw-r--r-- | string.c | 2 | ||||
-rw-r--r-- | variable.c | 14 | ||||
-rw-r--r-- | version.h | 4 | ||||
-rw-r--r-- | win32/Makefile | 2 |
23 files changed, 151 insertions, 91 deletions
@@ -1,3 +1,38 @@ +Wed Mar 22 21:49:36 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp> + + * st.c (st_delete_safe): skip already deleted entry. + + * hash.c (rb_hash_delete): modify brace miss. + +Wed Mar 22 08:53:58 2000 Yukihiro Matsumoto <matz@netlab.co.jp> + + * eval.c (exec_under): do not push cbase if ruby_cbase == under. + + * node.h (NEW_CREF0): preserve cbase nesting. + +Tue Mar 21 12:57:50 2000 Yukihiro Matsumoto <matz@netlab.co.jp> + + * object.c (rb_class_s_new): Class::new should call `inherited'. + +Fri Mar 17 15:02:45 2000 Yukihiro Matsumoto <matz@netlab.co.jp> + + * variable.c (rb_autoload_id): defining new autoload should be + prohibited for $SAFE > 4. + + * variable.c (rb_const_get): autoload should be possible for + $SAFE > 4. + + * eval.c (call_trace_func): should handle T_ICLASS properly. + +Wed Mar 15 21:25:04 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp> + + * array.c (rb_ary_join): 'result' is always duplicated + before concat string. + +Wed Mar 15 13:12:39 2000 Yukihiro Matsumoto <matz@netlab.co.jp> + + * string.c (rb_str_chomp_bang): forgot to call rb_str_modify(). + Mon Mar 13 18:14:52 2000 Yukihiro Matsumoto <matz@netlab.co.jp> * stable version 1.4.4 released. @@ -663,7 +663,7 @@ rb_ary_join(ary, sep) } break; default: - result = rb_obj_as_string(tmp); + result = rb_str_dup(rb_obj_as_string(tmp)); break; } @@ -4722,12 +4722,13 @@ else EOF fi + cat >> confdefs.h <<EOF #define RUBY_ARCHLIB "${RUBY_LIB_PATH}/${arch}" EOF cat >> confdefs.h <<EOF -#define RUBY_SITE_ARCHLIB "${RUBY_SITE_LIB_PATH}/${arch}" +#define RUBY_SITE_ARCHLIB "${RUBY_SITE_LIB_PATH2}/${arch}" EOF diff --git a/configure.in b/configure.in index 632b79bf14..50fb65a1ac 100644 --- a/configure.in +++ b/configure.in @@ -801,8 +801,9 @@ else arch="${host_cpu}-${host_os}" AC_DEFINE_UNQUOTED(RUBY_PLATFORM, "${arch}") fi + AC_DEFINE_UNQUOTED(RUBY_ARCHLIB, "${RUBY_LIB_PATH}/${arch}") -AC_DEFINE_UNQUOTED(RUBY_SITE_ARCHLIB, "${RUBY_SITE_LIB_PATH}/${arch}") +AC_DEFINE_UNQUOTED(RUBY_SITE_ARCHLIB, "${RUBY_SITE_LIB_PATH2}/${arch}") AC_ARG_WITH(search-path, [--with-search-path specify the additional search path], @@ -1736,7 +1736,10 @@ call_trace_func(event, file, line, self, id, klass) ruby_frame->file = ruby_sourcefile = file; } if (klass) { - if (TYPE(klass) == T_ICLASS || FL_TEST(klass, FL_SINGLETON)) { + if (TYPE(klass) == T_ICLASS) { + klass = RBASIC(klass)->klass; + } + else if (FL_TEST(klass, FL_SINGLETON)) { klass = self; } } @@ -3875,7 +3878,7 @@ rb_call0(klass, recv, id, argc, argv, body, nosuper) line = ruby_sourceline; } - call_trace_func("c-call", 0, 0, 0, id, 0); + call_trace_func("c-call", 0, 0, recv, id, klass); PUSH_TAG(PROT_FUNC); if ((state = EXEC_TAG()) == 0) { result = call_cfunc(body->nd_cfnc, recv, len, argc, argv); @@ -4469,7 +4472,9 @@ exec_under(func, under, args) ruby_frame->last_class = _frame.prev->last_class; ruby_frame->argc = _frame.prev->argc; ruby_frame->argv = _frame.prev->argv; - ruby_frame->cbase = (VALUE)rb_node_newnode(NODE_CREF,under,0,cbase); + if (RNODE(ruby_frame->cbase)->nd_clss != under) { + ruby_frame->cbase = (VALUE)rb_node_newnode(NODE_CREF,under,0,ruby_frame->cbase); + } mode = scope_vmode; SCOPE_SET(SCOPE_PUBLIC); PUSH_TAG(PROT_NONE); diff --git a/ext/dbm/extconf.rb b/ext/dbm/extconf.rb index f47287c03e..27842074e7 100644 --- a/ext/dbm/extconf.rb +++ b/ext/dbm/extconf.rb @@ -1,10 +1,11 @@ require 'mkmf' dir_config("dbm") -#if have_library("gdbm", "dbm_open") -# gdbm = true -#end +if have_library("gdbm", "dbm_open") + gdbm = true +else gdbm = false +end gdbm or have_library("db", "dbm_open") or have_library("dbm", "dbm_open") have_header("cdefs.h") if have_header("ndbm.h") and have_func("dbm_open") diff --git a/ext/socket/getaddrinfo.c b/ext/socket/getaddrinfo.c index fbedac4cbb..0b9d9b6afc 100644 --- a/ext/socket/getaddrinfo.c +++ b/ext/socket/getaddrinfo.c @@ -130,12 +130,6 @@ static struct afd { #define PTON_MAX 4 #endif -#ifndef INET6 -#ifndef NT -extern int h_errno; -#endif -#endif - static int get_name __P((const char *, struct afd *, struct addrinfo **, char *, struct addrinfo *, int)); diff --git a/ext/socket/getnameinfo.c b/ext/socket/getnameinfo.c index 774177c8c1..60bd71bac6 100644 --- a/ext/socket/getnameinfo.c +++ b/ext/socket/getnameinfo.c @@ -64,12 +64,6 @@ #include "addrinfo.h" #include "sockport.h" -#ifndef INET6 -#ifndef NT -extern int h_errno; -#endif -#endif - #define SUCCESS 0 #define ANY 0 #define YES 1 diff --git a/ext/tk/lib/tk.rb b/ext/tk/lib/tk.rb index c344a2bf8e..107165f8ba 100644 --- a/ext/tk/lib/tk.rb +++ b/ext/tk/lib/tk.rb @@ -1062,15 +1062,13 @@ module TkSelection tk_call 'selection', 'get', type end def TkSelection.handle(win, func, type=None, format=None) - id = install_cmd(func) - tk_call 'selection', 'handle', win.path, id, type, format + tk_call 'selection', 'handle', win.path, func, type, format end def handle(func, type=None, format=None) TkSelection.handle self, func, type, format end - def TkSelection.own(win, func=None) - id = install_cmd(func) - tk_call 'selection', 'own', win.path, id + def TkSelection.own(win=None, func=None) + window(tk_call 'selection', 'own', win, func) end def own(func=None) TkSelection.own self, func diff --git a/ext/tk/lib/tktext.rb b/ext/tk/lib/tktext.rb index 7872e6a078..9e38db5032 100644 --- a/ext/tk/lib/tktext.rb +++ b/ext/tk/lib/tktext.rb @@ -132,7 +132,7 @@ class TkText<TkTextWin WidgetClassName end - def self.new(*args) + def self.new(*args, &block) obj = super(*args){} obj.init_instance_variable obj.instance_eval &block if defined? yield @@ -238,22 +238,16 @@ rb_hash_s_create(argc, argv, klass) VALUE hash; int i; - if (argc == 1) { - if (TYPE(argv[0]) == T_HASH) { - NEWOBJ(hash, struct RHash); - OBJSETUP(hash, klass, T_HASH); + if (argc == 1 && TYPE(argv[0]) == T_HASH) { + NEWOBJ(hash, struct RHash); + OBJSETUP(hash, klass, T_HASH); - hash->iter_lev = 0; - hash->ifnone = Qnil; - hash->tbl = 0; /* avoid GC crashing */ - hash->tbl = st_copy(RHASH(argv[0])->tbl); + hash->iter_lev = 0; + hash->ifnone = Qnil; + hash->tbl = 0; /* avoid GC crashing */ + hash->tbl = st_copy(RHASH(argv[0])->tbl); - return (VALUE)hash; - } - else { - VALUE a = rb_Array(argv[0]); - return rb_hash_s_create(RARRAY(a)->len, RARRAY(a)->ptr, klass); - } + return (VALUE)hash; } if (argc % 2 != 0) { @@ -431,10 +425,11 @@ rb_hash_delete(hash, key) VALUE val; rb_hash_modify(hash); - if (RHASH(hash)->iter_lev > 0 && - st_delete_safe(RHASH(hash)->tbl, &key, &val, Qnil)) { - FL_SET(hash, HASH_DELETED); - return val; + if (RHASH(hash)->iter_lev > 0) { + if (st_delete_safe(RHASH(hash)->tbl, &key, &val, Qnil)) { + FL_SET(hash, HASH_DELETED); + return val; + } } else if (st_delete(RHASH(hash)->tbl, &key, &val)) return val; diff --git a/lib/profile.rb b/lib/profile.rb index e4b1b4b189..d94b09da9e 100644 --- a/lib/profile.rb +++ b/lib/profile.rb @@ -3,7 +3,7 @@ module Profiler__ Start = Float(Time.times[0]) top = "toplevel".intern Stack = [[0, 0, top]] - MAP = {top => [1, 0, 0, "#toplevel"]} + MAP = {"#toplevel" => [1, 0, 0, "#toplevel"]} p = proc{|event, file, line, id, binding, klass| case event @@ -13,17 +13,18 @@ module Profiler__ when "return", "c-return" now = Float(Time.times[0]) tick = Stack.pop - data = MAP[id] + name = klass.to_s + if name.nil? then name = '' end + if klass.kind_of? Class + name += "#" + else + name += "." + end + name += id.id2name + data = MAP[name] unless data - name = klass.to_s - if name.nil? then name = '' end - if klass.kind_of? Class - name += "#" - else - name += "." - end - data = [0.0, 0.0, 0.0, name+id.id2name] - MAP[id] = data + data = [0.0, 0.0, 0.0, name] + MAP[name] = data end data[0] += 1 cost = now - tick[0] @@ -36,7 +37,7 @@ module Profiler__ set_trace_func nil total = Float(Time.times[0]) - Start if total == 0 then total = 0.01 end - MAP[:toplevel][1] = total + MAP["#toplevel"][1] = total # f = open("./rmon.out", "w") f = STDERR data = MAP.values.sort!{|a,b| b[2] <=> a[2]} diff --git a/lib/thread.rb b/lib/thread.rb index 22610f2992..9edda48abe 100644 --- a/lib/thread.rb +++ b/lib/thread.rb @@ -63,10 +63,14 @@ class Mutex def unlock return unless @locked Thread.critical = true - t = @waiting.shift @locked = false + begin + t = @waiting.shift + t.wakeup if t + rescue ThreadError + retry + end Thread.critical = false - t.run if t self end @@ -82,9 +86,13 @@ class Mutex def exclusive_unlock return unless @locked Thread.exclusive do - t = @waiting.shift @locked = false - t.wakeup if t + begin + t = @waiting.shift + t.wakeup if t + rescue ThreadError + retry + end yield end self @@ -105,8 +113,12 @@ class ConditionVariable end def signal - t = @waiters.shift - t.run if t + begin + t = @waiters.shift + t.run if t + rescue ThreadError + retry + end end def broadcast @@ -116,7 +128,10 @@ class ConditionVariable @waiters.clear end for t in waiters0 - t.run + begin + t.run + rescue ThreadError + end end end end @@ -133,9 +148,13 @@ class Queue def push(obj) Thread.critical = true @que.push obj - t = @waiting.shift + begin + t = @waiting.shift + t.wakeup if t + rescue ThreadError + retry + end Thread.critical = false - t.run if t end alias enq push @@ -201,8 +220,12 @@ class SizedQueue<Queue @max = max Thread.critical = false diff.times do - t = @queue_wait.shift - t.run if t + begin + t = @queue_wait.shift + t.run if t + rescue ThreadError + retry + end end end max @@ -221,8 +244,12 @@ class SizedQueue<Queue def pop(*args) Thread.critical = true if @que.length < @max - t = @queue_wait.shift - t.run if t + begin + t = @queue_wait.shift + t.run if t + rescue ThreadError + retry + end end super end @@ -299,7 +299,7 @@ typedef struct RNode { #define NEW_MODULE(n,b) rb_node_newnode(NODE_MODULE,n,NEW_CBODY(b),0) #define NEW_COLON2(c,i) rb_node_newnode(NODE_COLON2,c,i,0) #define NEW_COLON3(i) rb_node_newnode(NODE_COLON3,0,i,0) -#define NEW_CREF0() (cur_cref=rb_node_newnode(NODE_CREF,RNODE(ruby_frame->cbase)->nd_clss,0,0)) +#define NEW_CREF0() (cur_cref=RNODE(ruby_frame->cbase)) #define NEW_CREF() (cur_cref=rb_node_newnode(NODE_CREF,0,0,cur_cref)) #define NEW_CBODY(b) (cur_cref->nd_body=NEW_SCOPE(b),cur_cref) #define NEW_DOT2(b,e) rb_node_newnode(NODE_DOT2,b,e,0) @@ -591,6 +591,7 @@ rb_class_s_new(argc, argv) /* make metaclass */ RBASIC(klass)->klass = rb_singleton_class_new(RBASIC(super)->klass); rb_singleton_class_attached(RBASIC(klass)->klass, klass); + rb_funcall(super, rb_intern("inherited"), 1, klass); return klass; } @@ -76,7 +76,7 @@ usage(name) const char *name; { /* This message really ought to be max 23 lines. - * Removed -h because the user already knows that opton. Others? */ + * Removed -h because the user already knows that option. Others? */ static char *usage_msg[] = { "-0[octal] specify record separator (\\0, if no argument)", @@ -111,13 +111,6 @@ NULL printf("\n %s", *p++); } -#ifndef RUBY_LIB -#define RUBY_LIB "/usr/local/lib/ruby" -#endif -#ifndef RUBY_SITE_LIB -#define RUBY_SITE_LIB "/usr/local/lib/site_ruby" -#endif - extern VALUE rb_load_path; static FILE *e_fp; @@ -563,10 +556,10 @@ proc_options(argcp, argvp) argv[0][0] = '$'; if (s = strchr(argv[0], '=')) { *s++ = '\0'; - rb_gvar_set2(argv[0], rb_str_new2(s)); + rb_gv_set(argv[0], rb_str_new2(s)); } else { - rb_gvar_set2(argv[0], Qtrue); + rb_gv_set(argv[0], Qtrue); } argv[0][0] = '-'; } @@ -872,17 +865,14 @@ ruby_prog_init() addpath(ruby_libpath()); #endif -#ifdef RUBY_ARCHLIB addpath(RUBY_ARCHLIB); -#endif #ifdef RUBY_THIN_ARCHLIB addpath(RUBY_THIN_ARCHLIB); #endif addpath(RUBY_SITE_LIB); -#ifdef RUBY_SITE_ARCHLIB + addpath(RUBY_SITE_LIB2); addpath(RUBY_SITE_ARCHLIB); -#endif #ifdef RUBY_SITE_THIN_ARCHLIB addpath(RUBY_SITE_THIN_ARCHLIB); #endif @@ -192,6 +192,7 @@ int rb_fix2int _((VALUE)); #define FIX2INT(x) FIX2LONG(x) #define FIX2UINT(x) FIX2ULONG(x) #endif +#define SYM2ID(x) FIX2INT(x) double rb_num2dbl _((VALUE)); #define NUM2DBL(x) rb_num2dbl((VALUE)(x)) @@ -404,6 +405,8 @@ VALUE rb_funcall2 _((VALUE, ID, int, VALUE*)); VALUE rb_funcall3 _((VALUE, ID, int, VALUE*)); int rb_scan_args __((int, VALUE*, const char*, ...)); +VALUE rb_gv_set _((const char*, VALUE)); +VALUE rb_gv_get _((const char*)); VALUE rb_iv_get _((VALUE, const char*)); VALUE rb_iv_set _((VALUE, const char*, VALUE)); VALUE rb_const_get _((VALUE, ID)); diff --git a/sample/eval.rb b/sample/eval.rb index 216bf8ca39..24a352d94f 100644 --- a/sample/eval.rb +++ b/sample/eval.rb @@ -12,7 +12,7 @@ while TRUE print "ruby| " next end - if l =~ /^\s*(class|module|def|if|case|while|for|begin)\b[^_]/ + if l =~ /^\s*(class|module|def|if|unless|case|while|until|for|begin)\b[^_]/ indent += 1 end if l =~ /^\s*end\b[^_]/ @@ -404,7 +404,7 @@ st_delete_safe(table, key, value, never) } for(; ptr != 0; ptr = ptr->next) { - if (EQUAL(table, ptr->key, *key)) { + if ((ptr->key != never) && EQUAL(table, ptr->key, *key)) { table->num_entries--; *key = ptr->key; if (value != 0) *value = ptr->record; @@ -2272,6 +2272,7 @@ rb_str_chomp_bang(argc, argv, str) len--; } if (len < RSTRING(str)->len) { + rb_str_modify(str); RSTRING(str)->len = len; RSTRING(str)->ptr[len] = '\0'; return str; @@ -2284,6 +2285,7 @@ rb_str_chomp_bang(argc, argv, str) if (p[len-1] == newline && (rslen <= 1 || memcmp(RSTRING(rs)->ptr, p+len-rslen, rslen) == 0)) { + rb_str_modify(str); RSTRING(str)->len -= rslen; RSTRING(str)->ptr[RSTRING(str)->len] = '\0'; return str; diff --git a/variable.c b/variable.c index 5e041f876d..50ad3a4b49 100644 --- a/variable.c +++ b/variable.c @@ -226,6 +226,7 @@ rb_autoload_id(id, filename) ID id; const char *filename; { + rb_secure(4); if (!rb_is_const_id(id)) { rb_raise(rb_eNameError, "autoload must be constant name", rb_id2name(id)); @@ -640,7 +641,7 @@ rb_gvar_set(entry, val) } VALUE -rb_gvar_set2(name, val) +rb_gv_set(name, val) const char *name; VALUE val; { @@ -651,6 +652,16 @@ rb_gvar_set2(name, val) } VALUE +rb_gv_get(name) + const char *name; +{ + struct global_entry *entry; + + entry = rb_global_entry(global_id(name)); + return rb_gvar_get(entry); +} + +VALUE rb_gvar_defined(entry) struct global_entry *entry; { @@ -1043,6 +1054,7 @@ rb_const_get(klass, id) st_delete(autoload_tbl, &id, &modname); module = rb_str_new2(modname); + FL_UNSET(module, FL_TAINT); free(modname); rb_f_require(Qnil, module); return rb_const_get(klass, id); @@ -1,4 +1,4 @@ #define RUBY_VERSION "1.4.4" -#define RUBY_RELEASE_DATE "2000-03-14" +#define RUBY_RELEASE_DATE "2000-03-23" #define RUBY_VERSION_CODE 144 -#define RUBY_RELEASE_CODE 20000314 +#define RUBY_RELEASE_CODE 20000323 diff --git a/win32/Makefile b/win32/Makefile index 7573ef62cf..af9349a070 100644 --- a/win32/Makefile +++ b/win32/Makefile @@ -28,7 +28,7 @@ RUBY_INSTALL_NAME=ruby EXEEXT = .exe PROGRAM=$(RUBY_INSTALL_NAME)$(EXEEXT) -STACK = 0x200000 +STACK = 0x2000000 ORGLIBPATH = $(LIB) #### End of system configuration section. #### |