diff options
-rw-r--r-- | ChangeLog | 20 | ||||
-rw-r--r-- | class.c | 4 | ||||
-rw-r--r-- | doc/NEWS | 603 | ||||
-rw-r--r-- | eval.c | 8 | ||||
-rw-r--r-- | hash.c | 54 | ||||
-rw-r--r-- | lib/test/unit.rb | 3 |
6 files changed, 404 insertions, 288 deletions
@@ -1,3 +1,15 @@ +Sat Aug 2 03:30:25 2003 Yukihiro Matsumoto <matz@ruby-lang.org> + + * class.c (rb_obj_singleton_methods): should not go up to + ancestors unless the recursive flag is set. [ruby-list:38007] + + * hash.c (env_each_key): use env_keys to avoid environment modify + on the fly. + + * hash.c (env_each_value): use env_values for safety. + + * hash.c (env_each): allocate environment array first. + Fri Aug 2 03:20:00 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net> * lib/yaml/store.rb (YAML::Store#initialize): filename is first @@ -65,9 +77,6 @@ Fri Aug 1 13:45:14 2003 Nobuyoshi Nakada <nobu@ruby-lang.org> Fri Aug 1 09:54:38 2003 Yukihiro Matsumoto <matz@ruby-lang.org> - * eval.c (BEGIN_CALLARGS): should not always reset ruby_iter, - need to restore previous value. [ruby-talk:77577] - * array.c (rb_ary_fill): array length may be changed during the block execution. [ruby-talk:77579] @@ -114,6 +123,11 @@ Thu Jul 31 04:59:10 2003 Yukihiro Matsumoto <matz@ruby-lang.org> * numeric.c (rb_num_coerce_relop): export function. +Thu Jul 31 08:18:00 2003 Nathaniel Talbott <ntalbott@ruby-lang.org> + + * lib/test/unit.rb: A useful return code is now set if tests fail when + running automatically using the Console::TestRunner. + Thu Jul 31 00:17:19 2003 Shugo Maeda <shugo@ruby-lang.org> * lib/net/ftp.rb (return_code): obsolete. @@ -622,12 +622,12 @@ rb_obj_singleton_methods(argc, argv, obj) } klass = CLASS_OF(obj); list = st_init_numtable(); - while (klass && FL_TEST(klass, FL_SINGLETON)) { + if (klass && FL_TEST(klass, FL_SINGLETON)) { st_foreach(RCLASS(klass)->m_tbl, method_entry, (st_data_t)list); klass = RCLASS(klass)->super; } if (RTEST(recur)) { - while (klass && TYPE(klass) == T_ICLASS) { + while (klass && (FL_TEST(klass, FL_SINGLETON) || TYPE(klass) == T_ICLASS)) { st_foreach(RCLASS(klass)->m_tbl, method_entry, (st_data_t)list); klass = RCLASS(klass)->super; } @@ -1,92 +1,145 @@ -This file is not actively maintained. See ChangeLog for recent changes. += command line options : -W option new option to specify warning level. -W0 to shut up warnings, -W1 for normal level, -W2 for verbose level. -w equals to -W2. -: Marshal to use marshal_dump and marshal_load += language syntax - if a dumping object responds to 'marshal_dump', Marshal.dump calls - it, and dumps object returned. Marshal.load allocates a new instance - using "allocate", then calls its "marshal_load" with dumped data. +: arbitrary delimited string array -: lib/un + %W(...) notation, word list literal like %w(...) with the + exception that #{} interpolation is allowed. - Imported. Used like 'ruby -run -e cp -- -p foo bar'. Nest, isn't it? +: expression interpolation in strings -: lib/webrick + Now arbitrary statements are allowed inside #{} interpolation + without escapes. In other hand, they can no longer access to + variables defined in eval. + +: negative number literals + + Digits preceded minus sign is a literal integer. + +: array expansion + + Fixed with the following behavior: + + a = *[1] + p a #=> [1] + + Now 1-element array in rhs is expanded properly. + + a = *[1] + p a #=> 1 + +: break and next + + Extended to take an optional expression, which is used as a value + for termination. - Imported. Generic Internet server kit. += language core : $stdin, $stdout, $stderr can be assignable again. the original stdio are preserved as STDIN, STDOUT, STDERR. -: multiple Tk interpreter +: allocation framework - to allow safe Tk, etc. + any instance of class can be allocated by class.allocate, + (except for a few classes). -: ext/openssl +: comparison of exception classes in a rescue clause - Imported. + changed to use Module#=== for comparing $! with the exception + class specified in each rescue clause. -: ext/io/wait + as the previous behavior was to use kind_of?, the effect is limited + to the SystemCallError case. SystemCallError.=== has been newly + defined to return true when the two have the same errno. With this + change, SystemCallError's with the same errno, such as Errno::EAGAIN + and Errno::EWOULDBLOCK, can both be rescued by listing just one of + them. - Imported. +: constants lookup -: ext/bigdecimal + improved at the performance of searching by using an internal hash + table. - Imported. +: expression parenthesis in the first argument -: Thread#group + altered to get the following code (note the space after p): - new method to get belonging ThreadGroup. + p ("xx"*2).to_i -: Kernel#warn(message) + Interpreted as: - a method to give warnings. + p (("xx"*2).to_i) -: Process::detach(pid) + Instead of: - new method to detach child process. child process will be "wait"ed - automagically. + (p("xx"*2)).to_i -: Object#instance_variable_set, Object#instance_variable_get +: implicit comparison in conditional expressions - added. + Obsoleted except when it is used in -e. -: ext/Win32API/lib/win32/registry + : between Range and $. + Use explicit comparison instead. - added. + : between Regexp and $_ + Use the unary method ~/re/ instead. -: lib/open-uri +: to_str - Imported. This is an easy-to-use wrapper for net/http and net/ftp. + added to get objects which define to_str() treated as String's. -: lib/tmpdir + now almost all the built-in methods try each argument with to_str() + when they expect it to be a String. - imported. add Dir::tmpdir() to determine the temporary directory. + foo = Object.new + class <<foo + def to_str + "foo" + end + end + p File.open(foo) + => -:7:in `open': wrong argument type Object (expected String) (TypeError) + ruby 1.6.4 (2001-04-19) [i586-linux] + => -:7:in `open': No such file or directory - "foo" (Errno::ENOENT) + ruby 1.7.0 (2001-05-02) [i586-linux] -: lib/cgi.rb +: multiple assignment behavior - cgi[name] returns CGI::QueryExtension::Value that wraps string - value, no longer array. + Fixed so that "*a = nil" results in "a == []". -: ext/syck -: lib/yaml += changes in core class library - Imported. +: Marshal to use marshal_dump and marshal_load -: lib/rexml + if a dumping object responds to 'marshal_dump', Marshal.dump calls + it, and dumps object returned. Marshal.load allocates a new instance + using "allocate", then calls its "marshal_load" with dumped data. + Marshal format version is now 4.8 (was 4.6 in 1.6.8). - Imported. +: Thread#group -: lib/xmlrpc -: lib/gserver + new method to get belonging ThreadGroup. + +: Kernel#warn(message) + + a method to give warnings. + +: Process::detach(pid) + + new method to detach child process. child process will be "wait"ed + automagically. - Imported +: Object#instance_variable_set, Object#instance_variable_get + + added. : Class#inherited @@ -119,50 +172,48 @@ This file is not actively maintained. See ChangeLog for recent changes. "101".to_i(0) => 101 "0b101".to_i(0) => 5 "0101".to_i(0) => 65 - "0x101".to_i(0) => 1 + "0x101".to_i(0) => 257 -: Set class (set.rb) +: SystemCallError - Imported. + SystemCallError's "===" match (used in rescue also) is now based on its errno. -: OptionParser module - - Imported. Command line options utility library. - -: parser - - %W(...) notation, word list literal like %w(...) with the - exception that #{} interpolation is allowed. - -: parser +: IO::sysopen - Now arbitrary statements are allowed inside #{} interpolation - without escapes. In other hand, they can no longer access to - variables defined in eval. + New method to get a raw file descriptor. -: parser +: open - Digits preceded minus sign is a literal integer. + Extended so that when the third argument is permission flags it + calls open(2) instead of fopen(3). -: IO::sysopen +: Array#fetch(index [, default]) - New method to get a raw file descriptor. + Added. If a default value isn't given, raises index error if index + is out of range. -: TCPServer#accept, UNIXServer#accept, Socket#accept +: Array#insert(n, other, ...) - New methods to return an accepted socket fd. + Added. [ruby-talk:14289] -: Date and DateTime + This is much the same as (({ary[n,0] = [other,...]})) except + returing self. - lib/date.rb now provides both Date and DateTime. + ary = [0,1,2,3] + ary[2, 0] = [4, 5, 6] + p ary - Some methods have been renamed. But the old names are still alive. + ary = [0,1,2,3] + ary.insert(2, 4, 5, 6) + p ary - Some new methods have been added (Date::parse, Date#strftime, etc.). +: Array#sort! - Date#mjd now returns the chronological modified Julian day number. + Changed to always return self without checking whether the sequence + of the elements was modified or not. - All facilities about tjd have been removed. + Beware that this behavior is not guaranteed to continue in the + future. Do not rely on its return value. [ruby-dev:12506] : Thread#join @@ -173,10 +224,6 @@ This file is not actively maintained. See ChangeLog for recent changes. Previously deprecated, now removed. Use Array#collect!. -: dl module - - Imported. An interface to the dynamic linker. - : IO#sysseek Added. @@ -189,14 +236,10 @@ This file is not actively maintained. See ChangeLog for recent changes. Takes optional terminate message argument. -: iconv module - - Imported. Wrapper library of (({iconv})). - : IO.fsync New method that copies all in-memory parts of a file to disk and - waits until the deice reports that all parts are on stable storage. + waits until the device reports that all parts are on stable storage. Implemented with fsync(2) or equivalent. : Dir#pos= @@ -210,26 +253,6 @@ This file is not actively maintained. See ChangeLog for recent changes. Dir.glob("makefile", File::FNM_CASEFOLD) #=> ['Makefile', 'makefile'] -: fileutils module - - Imported. File utility library. - -: racc runtime module - - Imported. Racc runtime library. (Racc is a parser generator for ruby) - -: lib/tsort - - Imported. Topological sorting library. - -: ext/stringio - - Imported. Pseudo (({IO})) class from/to (({String})). - -: strscan module - - Imported. Fast string scanner library. - : Array#pack, String#unpack Allows comment in template strings. @@ -261,131 +284,6 @@ This file is not actively maintained. See ChangeLog for recent changes. Added. -: Array expansion - - Fixed with the following behavior: - - a = *[1] - p a #=> [1] - - Now 1-element array in rhs is expanded properly. - - a = *[1] - p a #=> 1 - -: allocation framework - - any instance of class can be allocated by class.allocate, - (except a few classes). - -: break and next - - Extended to take an optional expression, which is used as a value - for termination. [experimental] - -: comparison of exception classes in a rescue clause - - Changed to use Module#=== for comparing $! with the exception - class specified in each rescue clause. - - As the previous behavior was to use kind_of?, the effect is limited - to the SystemCallError case. SystemCallError.=== has been newly - defined to return true when the two have the same errno. With this - change, SystemCallError's with the same errno, such as Errno::EAGAIN - and Errno::EWOULDBLOCK, can both be rescued by listing just one of - them. - -: constants lookup - - Improved at the performance of searching by using an internal hash - table. - -: expression parenthesis in the first argument - - Experimentally altered to get the following code (note the space - after p): - - p ("xx"*2).to_i - - Interpreted as: - - p (("xx"*2).to_i) - - Instead of: - - (p("xx"*2)).to_i - -: implicit comparison in conditional expressions - - Obsoleted except when it is used in -e. - - : between Range and $. - Use explicit comparison instead. - - : between Regexp and $_ - Use the unary method ~/re/ instead. - -: to_str - - Added to get objects which define to_str() treated as String's. - - Now almost all the built-in methods try each argument with to_str() - when they expect it to be a String. - - foo = Object.new - class <<foo - def to_str - "foo" - end - end - p File.open(foo) - => -:7:in `open': wrong argument type Object (expected String) (TypeError) - ruby 1.6.4 (2001-04-19) [i586-linux] - => -:7:in `open': No such file or directory - "foo" (Errno::ENOENT) - ruby 1.7.0 (2001-05-02) [i586-linux] - -: pp module - - Imported. Prity Printing library. - -: open - - Extended so that when the third argument is permission flags it - calls open(2) instead of fopen(3). - -: Array#fetch(index [, default]) - - Added. If a default value isn't given, raises index error if index - is out of range. - -: Array#insert(n, other, ...) - - Added. [ruby-talk:14289] - - This is much the same as (({ary[n,0] = [other,...]})) except - returing self. - - ary = [0,1,2,3] - ary[2, 0] = [4, 5, 6] - p ary - - ary = [0,1,2,3] - ary.insert(2, 4, 5, 6) - p ary - -: Array#sort! - - Changed to always return self without checking whether the sequence - of the elements was modified or not. - - Beware that this behavior is not guaranteed to continue in the - future. Do not rely on its return value. [ruby-dev:12506] - -: Curses - - Updated. New methods and constants for using the mouse, character - attributes, colors and key codes have been added. - : Dir#path Added. @@ -501,15 +399,6 @@ This file is not actively maintained. See ChangeLog for recent changes. Extended to take block. -: Multiple assignment behavior - - Fixed so that "*a = nil" results in "a == []". - -: Net::HTTP - - New version of Net::HTTP has introduced seriously incompatible - changes. For details, see document embedded in net/http.rb itself. - : NameError and NoMethodError Moved and now NoMethodError < NameError < StandardError. @@ -560,14 +449,6 @@ This file is not actively maintained. See ChangeLog for recent changes. Added. This module has module functions Signal.trap and Signal.list. -: Socket.pack_sockaddr_in, Socket.unpack_sockaddr_in - - Added. Utility for direct Socket access. - -: Socket.pack_sockaddr_un, Socket.unpack_sockaddr_un - - Added. Utility for direct Socket access. - : String#[regexp, nth] Extended to accepts optional second argument. @@ -627,6 +508,65 @@ This file is not actively maintained. See ChangeLog for recent changes. Added. +: Time + + Extended to accept a negative time_t. (Only when the platform + supports it) + + p Time.at(-1) + => Thu Jan 01 08:59:59 JST 1970 + +: Time#to_a +: Time#zone + + Made to return "UTC" under gmtime. It used to return a platform + dependent value, typically "GMT", in 1.6 and prior. + += changes in bundled libraries + +: lib/cgi.rb + + cgi[name] returns CGI::QueryExtension::Value that wraps string + value, no longer array. + +: lib/timeout + + timeout "function" wrapped in Timeout module. + +: TCPServer#accept, UNIXServer#accept, Socket#accept + + New methods to return an accepted socket fd. + +: Date and DateTime + + lib/date.rb now provides both Date and DateTime. + + Some methods have been renamed. But the old names are still alive. + + Some new methods have been added (Date::parse, Date#strftime, etc.). + + Date#mjd now returns the chronological modified Julian day number. + + All facilities about tjd have been removed. + +: Curses + + Updated. New methods and constants for using the mouse, character + attributes, colors and key codes have been added. + +: Net::HTTP + + New version of Net::HTTP has introduced seriously incompatible + changes. For details, see document embedded in net/http.rb itself. + +: Socket.pack_sockaddr_in, Socket.unpack_sockaddr_in + + Added. Utility for direct Socket access. + +: Socket.pack_sockaddr_un, Socket.unpack_sockaddr_un + + Added. Utility for direct Socket access. + : TCPServer#listen, UNIXServer#listen Added. @@ -637,16 +577,177 @@ This file is not actively maintained. See ChangeLog for recent changes. Extended to take an address and a port number for the local side in optional 3rd and 4th arguments. -: Time += new bundled library - Extended to accept a negative time_t. (Only when the platform - supports it) +: ext/bigdecimal - p Time.at(-1) - => Thu Jan 01 08:59:59 JST 1970 + variable precision decimal number -: Time#to_a -: Time#zone +: ext/dl - Made to return "UTC" under gmtime. It used to return a platform - dependent value, typically "GMT", in 1.6 and prior. + an interface to the dynamic linker. + +: ext/io/wait + + IO wait methods. + +: ext/iconv + + wrapper library of (({iconv})). + +: ext/openssl + + OpenSSL for Ruby + +: ext/racc/cparse + + Racc runtime library in C. (Racc is a parser generator for ruby) + +: ext/stringio + + Pseudo (({IO})) class from/to (({String})). + +: ext/strscan + + Fast string scanner library. + +: ext/syck + + fast YAML parser. + +: lib/benchmark + + Ruby scripts benchmarker + +: lib/cgi/session/pstore + + cgi/session back-end using pstore + +: lib/csv + + reads/writes CVS files. + +: lib/date/format + + strftime for Date class + +: lib/drb + + dRuby or distributed Ruby + +: lib/fileutils + + file utility library. + +: lib/gserver + + generic server used by xmlrpc + +: lib/ipaddr + + manipulates IP address. + +: lib/multi-tk + + to allow safe Tk, etc. + +: lib/open-uri + + easy-to-use wrapper for net/http and net/ftp + +: lib/optparse + + command line options utility library + +: lib/pathname + + handles pathname in OO manner. + +: lib/pp + + prettyprinter for Ruby objects + +: lib/prettyprint + + implements prettyprint algorithm. + +: lib/profiler + + library to implement -r "profile" + +: lib/racc/parser + + RACC parser generator runtime in Ruby. + +: lib/scanf + + scan string and retrieve object with format + +: lib/set + + Set class + +: lib/runit + + RubyUnit compatible layer for test/unit + +: lib/test/unit + + unit testing framework for Ruby + +: lib/tmpdir + + get temporary directory path. + +: lib/tsort + + topological sorting library. + +: lib/rexml + + REXML XML library + +: lib/webrick + + generic internet server kit + +: lib/xmlrpc + + simple RPC via XML + +: lib/un + + used like 'ruby -run -e cp -- -p foo bar'. neat, isn't it? + +: lib/win32/registry + + win32/registry is registry accessor + +: lib/yaml + + YAML Ain't Mark-up Language + += removed libraries + +: lib/ftplib + + use net/ftp instead. + +: lib/telnet + + use net/telnet instead. + += new port + +: WindowsCE port +: Win32 BCC + += interpreter implementation + +: garbage collector + + faster, but uses more memory for the worst case. + +: string concatenation + + faster by avoiding too frequent realloc(3). @@ -4099,16 +4099,20 @@ rb_yield_0(val, self, klass, flags, avalue) int len = 0; if (avalue) { len = RARRAY(val)->len; + if (len == 0) { + val = Qnil; + goto multi_values; + } if (len == 1) { val = RARRAY(val)->ptr[0]; } else { - goto mult_values; + goto multi_values; } } else if (val == Qundef) { val = Qnil; - mult_values: + multi_values: { NODE *curr = ruby_current_node; ruby_current_node = block->var; @@ -1296,21 +1296,16 @@ env_keys() } static VALUE -env_each_key(hash) - VALUE hash; +env_each_key(ehash) + VALUE ehash; { - char **env; + VALUE keys = env_keys(); + long i; - env = GET_ENVIRON(environ); - while (*env) { - char *s = strchr(*env, '='); - if (s) { - rb_yield(env_str_new(*env, s-*env)); - } - env++; + for (i=0; i<RARRAY(keys)->len; i++) { + rb_yield(RARRAY(keys)->ptr[i]); } - FREE_ENVIRON(environ); - return Qnil; + return ehash; } static VALUE @@ -1332,40 +1327,41 @@ env_values() } static VALUE -env_each_value(hash) - VALUE hash; +env_each_value(ehash) + VALUE ehash; { - char **env; + VALUE values = env_values(); + long i; - env = GET_ENVIRON(environ); - while (*env) { - char *s = strchr(*env, '='); - if (s) { - rb_yield(env_str_new2(s+1)); - } - env++; + for (i=0; i<RARRAY(values)->len; i++) { + rb_yield(RARRAY(values)->ptr[i]); } - FREE_ENVIRON(environ); - return Qnil; + return ehash; } static VALUE -env_each(hash) - VALUE hash; +env_each(ehash) + VALUE ehash; { char **env; + VALUE ary = rb_ary_new(); + long i; env = GET_ENVIRON(environ); while (*env) { char *s = strchr(*env, '='); if (s) { - rb_yield_values(2, env_str_new(*env, s-*env), - env_str_new2(s+1)); + rb_ary_push(ary, env_str_new(*env, s-*env)); + rb_ary_push(ary, env_str_new2(s+1)); } env++; } FREE_ENVIRON(environ); - return Qnil; + + for (i=0; i<RARRAY(ary)->len; i+=2) { + rb_yield_values(2, RARRAY(ary)->ptr[i], RARRAY(ary)->ptr[i+1]); + } + return ehash; } static VALUE diff --git a/lib/test/unit.rb b/lib/test/unit.rb index f4202c5294..6c12f85c62 100644 --- a/lib/test/unit.rb +++ b/lib/test/unit.rb @@ -175,7 +175,8 @@ at_exit { runners = { '--console' => proc do |suite| require 'test/unit/ui/console/testrunner' - Test::Unit::UI::Console::TestRunner.run(suite) + passed = Test::Unit::UI::Console::TestRunner.run(suite).passed? + exit(passed ? 0 : 1) end, '--gtk' => proc do |suite| require 'test/unit/ui/gtk/testrunner' |