1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

matz: 1.6.0 final (hopufully)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@934 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2000-09-12 05:37:38 +00:00
parent 9d823983dc
commit fbcc6dea0c
20 changed files with 135 additions and 78 deletions

View file

@ -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>
@ -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>
@ -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>

View file

@ -355,7 +355,10 @@ 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 */
@ -363,7 +366,6 @@ rb_ary_unshift_m(argc, argv, ary)
/* sliding items */
MEMMOVE(RARRAY(ary)->ptr + argc, RARRAY(ary)->ptr, VALUE, len);
MEMCPY(RARRAY(ary)->ptr, argv, VALUE, argc);
}
return ary;

View file

@ -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;
@ -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

View file

@ -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")

28
eval.c
View file

@ -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
@ -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;
@ -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;
@ -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++;
@ -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");
@ -5961,8 +5981,6 @@ callargs(args)
case 0:
return Qundef;
break;
case 1:
return RARRAY(args)->ptr[0];
default:
return args;
}

View file

@ -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>

View file

@ -6,6 +6,7 @@ if have_library("gdbm", "dbm_open")
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")

2
gc.c
View file

@ -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;

6
hash.c
View file

@ -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++;
@ -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

View file

@ -276,7 +276,7 @@ module Net
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"}
@ -300,7 +300,7 @@ module Net
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)
@ -319,7 +319,7 @@ module Net
end
def storlines(cmd, file, callback = nil)
if iterator?
if block_given?
callback = Proc.new
end
use_callback = callback.is_a?(Proc)
@ -342,7 +342,7 @@ module Net
def getbinaryfile(remotefile, localfile,
blocksize = DEFAULT_BLOCKSIZE, callback = nil)
if iterator?
if block_given?
callback = Proc.new
end
use_callback = callback.is_a?(Proc)
@ -365,7 +365,7 @@ module Net
end
def gettextfile(remotefile, localfile, callback = nil)
if iterator?
if block_given?
callback = Proc.new
end
use_callback = callback.is_a?(Proc)
@ -383,7 +383,7 @@ module Net
def putbinaryfile(localfile, remotefile,
blocksize = DEFAULT_BLOCKSIZE, callback = nil)
if iterator?
if block_given?
callback = Proc.new
end
use_callback = callback.is_a?(Proc)
@ -404,7 +404,7 @@ module Net
end
def puttextfile(localfile, remotefile, callback = nil)
if iterator?
if block_given?
callback = Proc.new
end
use_callback = callback.is_a?(Proc)

View file

@ -33,7 +33,7 @@ the terms of the Ruby Distribute License.
: 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 = '' )
@ -46,7 +46,7 @@ the terms of the Ruby Distribute License.
# 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
@ -81,7 +81,7 @@ the terms of the Ruby Distribute License.
"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".
@ -165,7 +165,7 @@ All "key" is case-insensitive.
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".
@ -350,11 +350,13 @@ module Net
@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

View file

@ -31,7 +31,7 @@ Net::Protocol
: 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| .... }
@ -80,7 +80,7 @@ Object
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
@ -180,7 +180,7 @@ module Net
end
def all( dest = '' )
if iterator? then
if block_given? then
dest = NetPrivate::ReadAdapter.new( Proc.new )
end
@command.retr( @num, dest )

View file

@ -46,7 +46,7 @@ Object
'*args' are specified in subclasses.
When is called as iterator, gives Protocol object to block and
When is called with a block, gives Protocol object to block and
close session when block finished.
: finish
@ -73,7 +73,7 @@ module Net
def start( address = 'localhost', port = nil, *args )
instance = new( address, port )
if iterator? then
if block_given? then
instance.start( *args ) { yield instance }
else
instance.start( *args )
@ -167,9 +167,9 @@ module Net
connect
do_start( *args )
@active = true
yield self if iterator?
yield self if block_given?
ensure
finish if iterator?
finish if block_given?
end
end
@ -561,7 +561,7 @@ module Net
while (str = readuntil( "\r\n" )) != ".\r\n" do
str.chop!
arr.push str
yield str if iterator?
yield str if block_given?
end
@pipe << "read #{arr.size} lines\n" if pipeon

View file

@ -33,7 +33,7 @@ Net::Protocol
opens TCP connection and starts SMTP session.
If protocol had been started, do nothing and return false.
When this methods is called as iterator, give a SMTP object to block and
When this methods is called with a block, give a SMTP object to block and
close session after block call finished.
If account and password are given, is trying to get authentication
@ -42,7 +42,7 @@ Net::Protocol
: send_mail( mailsrc, from_addr, *to_addrs )
: sendmail( mailsrc, from_addr, *to_addrs )
This method sends 'mailsrc' as mail. SMTP read strings
from 'mailsrc' by calling 'each' iterator, and convert them
from 'mailsrc' by calling 'each' method, and convert them
into "\r\n" terminated string when write.
from_addr must be String.
@ -62,7 +62,7 @@ Net::Protocol
: ready( from_addr, to_addrs ) {|adapter| .... }
This method stands by the SMTP object for sending mail.
In the block of this iterator, you can call ONLY 'write' method
In the block of this method, you can call ONLY 'write' method
for 'adapter'.
# usage example

View file

@ -312,7 +312,7 @@ module Net
end
else
message = "Trying " + @options["Host"] + "...\n"
yield(message) if iterator?
yield(message) if block_given?
@log.write(message) if @options.has_key?("Output_log")
@dumplog.log_dump('#', message) if @options.has_key?("Dump_log")
@ -335,7 +335,7 @@ module Net
@sock.binmode
message = "Connected to " + @options["Host"] + ".\n"
yield(message) if iterator?
yield(message) if block_given?
@log.write(message) if @options.has_key?("Output_log")
@dumplog.log_dump('#', message) if @options.has_key?("Dump_log")
end
@ -489,11 +489,11 @@ module Net
end
@log.print(buf) if @options.has_key?("Output_log")
line.concat(buf)
yield buf if iterator?
yield buf if block_given?
rescue EOFError # End of file reached
if line == ''
line = nil
yield nil if iterator?
yield nil if block_given?
end
break
end
@ -554,7 +554,7 @@ module Net
end
self.puts(string)
if iterator?
if block_given?
waitfor({"Prompt" => match, "Timeout" => time_out}){|c| yield c }
else
waitfor({"Prompt" => match, "Timeout" => time_out})
@ -569,7 +569,7 @@ module Net
username = options
end
if iterator?
if block_given?
line = waitfor(/login[: ]*\z/n){|c| yield c }
if password
line.concat( cmd({"String" => username,
@ -706,7 +706,7 @@ end
* 1999/04/11 - wakou
* version 0.163
* STDOUT.write(message) --> yield(message) if iterator?
* STDOUT.write(message) --> yield(message) if block_given?
* 1999/03/17 - wakou
* version 0.162

View file

@ -544,18 +544,20 @@ The variable ruby-indent-level controls the amount of indentation.
(or (not (eq ?| (char-after (point))))
(save-excursion
(or (eolp) (forward-char -1))
(and (search-backward "|")
(skip-chars-backward " \t\n")
(and (not (eolp))
(progn
(forward-char -1)
(not (looking-at "\\{")))
(progn
(forward-word -1)
(not (looking-at "do\\>[^_]")))))))))
(cond
((search-backward "|" nil t)
(skip-chars-backward " \t\n")
(and (not (eolp))
(progn
(forward-char -1)
(not (looking-at "\\{")))
(progn
(forward-word -1)
(not (looking-at "do\\>[^_]")))))
(t t))))))
(setq indent (+ indent ruby-indent-level)))))))
indent)))
(defun ruby-electric-brace (arg)
(interactive "P")
(self-insert-command (prefix-numeric-value arg))

View file

@ -990,8 +990,16 @@ VALUE
rb_Array(val)
VALUE val;
{
ID to_ary;
if (TYPE(val) == T_ARRAY) return val;
val = rb_funcall(val, rb_intern("to_a"), 0);
to_ary = rb_intern("to_ary");
if (rb_respond_to(val, to_ary)) {
val = rb_funcall(val, to_ary, 0);
}
else {
val = rb_funcall(val, rb_intern("to_a"), 0);
}
if (TYPE(val) != T_ARRAY) {
rb_raise(rb_eTypeError, "`to_a' did not return Array");
}

17
parse.y
View file

@ -190,7 +190,7 @@ static void top_local_setup();
%type <node> aref_args opt_block_arg block_arg stmt_rhs
%type <node> mrhs superclass generic_call block_call var_ref
%type <node> f_arglist f_args f_optarg f_opt f_block_arg opt_f_block_arg
%type <node> array assoc_list assocs assoc undef_list backref
%type <node> assoc_list assocs assoc undef_list backref
%type <node> block_var opt_block_var brace_block do_block lhs none
%type <node> mlhs mlhs_head mlhs_basic mlhs_entry mlhs_item mlhs_node
%type <id> fitem variable sym symbol operation operation2 operation3
@ -421,10 +421,6 @@ expr : mlhs '=' mrhs
yyerror("return appeared outside of method");
$$ = NEW_RETURN($2);
}
| kYIELD ret_args
{
$$ = NEW_YIELD($2);
}
| command_call
| expr kAND expr
{
@ -469,6 +465,12 @@ command_call : operation call_args
$$ = new_super($2);
fixpos($$, $2);
}
| kYIELD ret_args
{
$$ = NEW_YIELD($2);
fixpos($$, $2);
}
mlhs : mlhs_basic
| tLPAREN mlhs_entry ')'
@ -1025,9 +1027,6 @@ ret_args : call_args
}
}
array : none
| args trailer
primary : literal
{
$$ = NEW_LIT($1);
@ -1083,7 +1082,7 @@ primary : literal
value_expr($1);
$$ = NEW_CALL($1, tAREF, $3);
}
| tLBRACK array ']'
| tLBRACK aref_args ']'
{
if ($2 == 0)
$$ = NEW_ZARRAY(); /* zero length array*/

4
ruby.1
View file

@ -1,6 +1,6 @@
.\"Ruby is copyrighted by Yukihiro Matsumoto <matz@zetabits.com>.
.na
.TH RUBY 1 "ruby 1.6" "2000-09-04" "Ruby Programmers Reference Guide"
.TH RUBY 1 "ruby 1.6" "2000-09-11" "Ruby Programmers Reference Guide"
.SH NAME
ruby - Interpreted object-oriented scripting language
.SH SYNOPSIS
@ -195,7 +195,7 @@ used to tell Ruby where to load the library scripts. Directory path
will be added to the load-path variable ($:').
.TP
.B -Kkcode
specifies KANJI (Japanese) code-set.
specifies KANJI (Japanese) encoding.
.TP
.B -l
enables automatic line-ending processing, which means to firstly set

View file

@ -1,4 +1,4 @@
#define RUBY_VERSION "1.6.0"
#define RUBY_RELEASE_DATE "2000-09-07"
#define RUBY_RELEASE_DATE "2000-09-12"
#define RUBY_VERSION_CODE 160
#define RUBY_RELEASE_CODE 20000907
#define RUBY_RELEASE_CODE 20000912