Skip to content

Commit

Permalink
matz: 1.6.0 final (hopufully)
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@934 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
matz committed Sep 12, 2000
1 parent 9d82398 commit fbcc6de
Show file tree
Hide file tree
Showing 20 changed files with 135 additions and 78 deletions.
35 changes: 31 additions & 4 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,12 +1,39 @@
Tue Sep 12 14:36:49 2000 Yukihiro Matsumoto <matz@ruby-lang.org>

* stable version 1.6.0 released.

Tue Sep 12 07:05:24 2000 Wakou Aoyama <wakou@fsinet.or.jp>

* lib/cgi.rb: version 2.0.0: require ruby1.5.4 or later.

* lib/net/telnet.rb: version 1.6.0

Wed Sep 6 17:06:59 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
Tue Sep 12 03:26:07 2000 Yukihiro Matsumoto <matz@ruby-lang.org>

* stable version 1.6.0 released.
* eval.c (massign): use to_ary to get an array if available.

* object.c (rb_Array): ditto.

Mon Sep 11 14:24:47 2000 Yukihiro Matsumoto <matz@ruby-lang.org>

* hash.c (ruby_setenv): should not free the element of
origenvironment.

* parse.y (command_call): kYIELD moved to this rule to allow
'a = yield b'. (ruby-bugs-ja:#PR15)

Mon Sep 11 01:27:54 2000 Yukihiro Matsumoto <matz@ruby-lang.org>

* eval.c (rb_yield_0): proc#call([]) should pass single value to
the block.

* eval.c (callargs): reduce array allocation.

* eval.c (massign): precise check for argument number.

Fri Sep 8 10:05:17 2000 Yukihiro Matsumoto <matz@ruby-lang.org>

* gc.c (STR_NO_ORIG): should be FL_USER2.

Thu Sep 7 14:17:51 2000 Yukihiro Matsumoto <matz@ruby-lang.org>

Expand Down Expand Up @@ -163,7 +190,7 @@ Fri Aug 25 15:24:39 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
* variable.c (rb_cvar_declare): ditto.

* variable.c (mod_av_set): second class variable assignment at the
toplevel shoule not give warning.
toplevel should not give warning.

Fri Aug 25 01:18:36 2000 Yukihiro Matsumoto <matz@ruby-lang.org>

Expand Down Expand Up @@ -720,7 +747,7 @@ Sat Jul 1 15:22:35 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
Sat Jul 1 15:22:35 2000 Yukihiro Matsumoto <matz@netlab.co.jp>

* eval.c (rb_eval): the value from RTEST() is not valid Ruby
objct. result shoule be either true or false.
objct. result should be either true or false.

Sat Jul 1 09:30:06 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp>

Expand Down
6 changes: 4 additions & 2 deletions array.c
Original file line number Diff line number Diff line change
Expand Up @@ -355,15 +355,17 @@ rb_ary_unshift_m(argc, argv, ary)
VALUE *argv;
VALUE ary;
{
if (argc > 0) {
if (argc == 0) {
rb_raise(rb_eArgError, "wrong # of arguments(at least 1)");
}
if (argc > 1) {
long len = RARRAY(ary)->len;

/* make rooms by setting the last item */
rb_ary_store(ary, len + argc - 1, Qnil);

/* sliding items */
MEMMOVE(RARRAY(ary)->ptr + argc, RARRAY(ary)->ptr, VALUE, len);

MEMCPY(RARRAY(ary)->ptr, argv, VALUE, argc);
}
return ary;
Expand Down
11 changes: 2 additions & 9 deletions compar.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,6 @@ cmp_failed()
return Qfalse;
}

static VALUE
cmp_eq2(a)
VALUE *a;
{
return rb_rescue2(cmp_eq, (VALUE)a, cmp_failed, 0,
rb_eStandardError, rb_eNameError, 0);
}

static VALUE
cmp_equal(x, y)
VALUE x, y;
Expand All @@ -50,7 +42,8 @@ cmp_equal(x, y)
if (x == y) return Qtrue;

a[0] = x; a[1] = y;
return rb_rescue2(cmp_eq2, (VALUE)a, cmp_failed, 0, rb_eScriptError, 0);
return rb_rescue2(cmp_eq, (VALUE)a, cmp_failed, 0,
rb_eStandardError, rb_eNameError, 0);
}

static VALUE
Expand Down
2 changes: 1 addition & 1 deletion configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -945,7 +945,7 @@ AC_DEFINE_UNQUOTED(RUBY_ARCHLIB, "${RUBY_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],
[--with-search-path=DIR specify the additional search path],
[search_path=$withval])
if test "$search_path" != ""; then
AC_DEFINE_UNQUOTED(RUBY_SEARCH_PATH,"$search_path")
Expand Down
28 changes: 23 additions & 5 deletions eval.c
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,8 @@ rb_method_boundp(klass, id, ex)
return Qfalse;
}

static ID init, eqq, each, aref, aset, match, missing, added, singleton_added;
static ID init, eqq, each, aref, aset, match, to_ary;
static ID missing, added, singleton_added;
static ID __id__, __send__;

void
Expand Down Expand Up @@ -3425,8 +3426,13 @@ rb_yield_0(val, self, klass, acheck)
if ((state = EXEC_TAG()) == 0) {
if (nd_type(block->var) == NODE_MASGN)
massign(self, block->var, val, acheck);
else
else {
if (val != Qundef &&
TYPE(val) == T_ARRAY && RARRAY(val)->len == 1) {
val = RARRAY(val)->ptr[0];
}
assign(self, block->var, val, acheck);
}
}
POP_TAG();
if (state) goto pop_state;
Expand Down Expand Up @@ -3524,7 +3530,17 @@ massign(self, node, val, check)
val = rb_ary_new2(0);
}
else if (TYPE(val) != T_ARRAY) {
val = rb_ary_new3(1, val);
if (rb_respond_to(val, to_ary)) {
VALUE ary = rb_funcall(val, to_ary, 0);
if (TYPE(ary) != T_ARRAY) {
rb_raise(rb_eTypeError, "%s#to_ary should return Array",
rb_class2name(CLASS_OF(val)));
}
val = ary;
}
else {
val = rb_ary_new3(1, val);
}
}
len = RARRAY(val)->len;
list = node->nd_head;
Expand All @@ -3546,6 +3562,9 @@ massign(self, node, val, check)
assign(self, node->nd_args, rb_ary_new2(0), check);
}
}
else if (check && i < len) {
goto arg_error;
}

while (list) {
i++;
Expand Down Expand Up @@ -5567,6 +5586,7 @@ Init_eval()
aref = rb_intern("[]");
aset = rb_intern("[]=");
match = rb_intern("=~");
to_ary = rb_intern("to_ary");
missing = rb_intern("method_missing");
added = rb_intern("method_added");
singleton_added = rb_intern("singleton_method_added");
Expand Down Expand Up @@ -5961,8 +5981,6 @@ callargs(args)
case 0:
return Qundef;
break;
case 1:
return RARRAY(args)->ptr[0];
default:
return args;
}
Expand Down
3 changes: 3 additions & 0 deletions ext/dbm/dbm.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
#ifdef HAVE_CDEFS_H
# include <cdefs.h>
#endif
#ifdef HAVE_SYS_CDEFS_H
# include <sys/cdefs.h>
#endif
#include <ndbm.h>
#include <fcntl.h>
#include <errno.h>
Expand Down
1 change: 1 addition & 0 deletions ext/dbm/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
end
gdbm or have_library("db", "dbm_open") or have_library("dbm", "dbm_open")
have_header("cdefs.h")
have_header("sys/cdefs.h")
if have_header("ndbm.h") and have_func("dbm_open")
have_func("dbm_clearerr") unless gdbm
create_makefile("dbm")
Expand Down
2 changes: 1 addition & 1 deletion gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ obj_free(obj)
}
break;
case T_STRING:
#define STR_NO_ORIG FL_USER3 /* copied from string.c */
#define STR_NO_ORIG FL_USER2 /* copied from string.c */
if (!RANY(obj)->as.string.orig || FL_TEST(obj, STR_NO_ORIG))
free(RANY(obj)->as.string.ptr);
break;
Expand Down
6 changes: 4 additions & 2 deletions hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -1055,7 +1055,8 @@ ruby_setenv(name, value)
environ = tmpenv; /* tell exec where it is now */
}
if (!value) {
free(environ[i]);
if (environ[i] != origenviron[i])
free(environ[i]);
while (environ[i]) {
environ[i] = environ[i+1];
i++;
Expand All @@ -1067,7 +1068,8 @@ ruby_setenv(name, value)
environ[i+1] = 0; /* make sure it's null terminated */
}
else {
free(environ[i]);
if (environ[i] != origenviron[i])
free(environ[i]);
}
environ[i] = ALLOC_N(char, strlen(name) + strlen(value) + 2);
#ifndef MSDOS
Expand Down
14 changes: 7 additions & 7 deletions lib/net/ftp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ def retrbinary(cmd, blocksize, rest_offset = nil, callback = Proc.new)
end

def retrlines(cmd, callback = nil)
if iterator?
if block_given?
callback = Proc.new
elsif not callback.is_a?(Proc)
callback = Proc.new {|line| print line, "\n"}
Expand All @@ -300,7 +300,7 @@ def retrlines(cmd, callback = nil)
end

def storbinary(cmd, file, blocksize, rest_offset = nil, callback = nil)
if iterator?
if block_given?
callback = Proc.new
end
use_callback = callback.is_a?(Proc)
Expand All @@ -319,7 +319,7 @@ def storbinary(cmd, file, blocksize, rest_offset = nil, callback = nil)
end

def storlines(cmd, file, callback = nil)
if iterator?
if block_given?
callback = Proc.new
end
use_callback = callback.is_a?(Proc)
Expand All @@ -342,7 +342,7 @@ def storlines(cmd, file, callback = nil)

def getbinaryfile(remotefile, localfile,
blocksize = DEFAULT_BLOCKSIZE, callback = nil)
if iterator?
if block_given?
callback = Proc.new
end
use_callback = callback.is_a?(Proc)
Expand All @@ -365,7 +365,7 @@ def getbinaryfile(remotefile, localfile,
end

def gettextfile(remotefile, localfile, callback = nil)
if iterator?
if block_given?
callback = Proc.new
end
use_callback = callback.is_a?(Proc)
Expand All @@ -383,7 +383,7 @@ def gettextfile(remotefile, localfile, callback = nil)

def putbinaryfile(localfile, remotefile,
blocksize = DEFAULT_BLOCKSIZE, callback = nil)
if iterator?
if block_given?
callback = Proc.new
end
use_callback = callback.is_a?(Proc)
Expand All @@ -404,7 +404,7 @@ def putbinaryfile(localfile, remotefile,
end

def puttextfile(localfile, remotefile, callback = nil)
if iterator?
if block_given?
callback = Proc.new
end
use_callback = callback.is_a?(Proc)
Expand Down
12 changes: 7 additions & 5 deletions lib/net/http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
: start {|http| .... }
creates a new Net::HTTP object and starts HTTP session.
When this method is called as iterator, gives HTTP object to block
When this method is called with a block, gives HTTP object to block
and close HTTP session after block call finished.
: get( path, header = nil, dest = '' )
Expand All @@ -46,7 +46,7 @@
# example
response, body = http.get( '/index.html' )
If called as iterator, give a part String of entity body.
If called with a block, give a part String of entity body.
Note:
If status is not 2xx(success), ProtocolError exception is
Expand Down Expand Up @@ -81,7 +81,7 @@
"header" must be a Hash like { 'Accept' => '*/*', ... }.
This method returns Net::HTTPResponse object and "dest".
If called as iterator, gives a part String of entity body.
If called with a block, gives a part String of entity body.
: get2( path, header = nil ) {|adapter| .... }
send GET request for "path".
Expand Down Expand Up @@ -165,7 +165,7 @@
entity body. A body is written to "dest" using "<<" method.
: body {|str| ... }
get entity body by using iterator.
get entity body by using block.
If this method is called twice, block is not called and
returns first "dest".
Expand Down Expand Up @@ -350,11 +350,13 @@ def connecting( u_header, ublock )
@socket.reopen
end

resp = yield( u_header )
yield( u_header )
if ublock then
adapter = HTTPReadAdapter.new( @command )
ublock.call adapter
resp = adapter.off
else
resp = @command.get_response
end

unless keep_alive? u_header, resp then
Expand Down
6 changes: 3 additions & 3 deletions lib/net/pop.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
: start( account, password ) {|pop| .... }
starts POP3 session.
When called as iterator, give a POP3 object to block and
When called with a block, give a POP3 object to block and
close session after block call is finished.
: each {|popmail| .... }
Expand Down Expand Up @@ -80,7 +80,7 @@
end
: all {|str| .... }
You can use all/pop/mail as the iterator.
You can use all/pop/mail with a block.
argument 'str' is a read string (a part of mail).
# usage example
Expand Down Expand Up @@ -180,7 +180,7 @@ def inspect
end

def all( dest = '' )
if iterator? then
if block_given? then
dest = NetPrivate::ReadAdapter.new( Proc.new )
end
@command.retr( @num, dest )
Expand Down
Loading

0 comments on commit fbcc6de

Please sign in to comment.