Skip to content

Commit

Permalink
2000-05-01
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@678 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
matz committed May 1, 2000
1 parent 5cffff5 commit 817a62d
Show file tree
Hide file tree
Showing 69 changed files with 1,836 additions and 1,450 deletions.
161 changes: 108 additions & 53 deletions ChangeLog

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions MANIFEST
Expand Up @@ -130,6 +130,7 @@ lib/net/ftp.rb
lib/net/pop.rb
lib/net/protocol.rb
lib/net/smtp.rb
lib/net/telnet.rb
lib/observer.rb
lib/open3.rb
lib/ostruct.rb
Expand Down
2 changes: 1 addition & 1 deletion README
Expand Up @@ -129,7 +129,7 @@ You can redistribute it and/or modify it under either the terms of the GPL

6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE.

* Ruby home-page
Expand Down
2 changes: 1 addition & 1 deletion README.EXT
Expand Up @@ -881,7 +881,7 @@ Returns the name of the class.

int rb_respond_to(VALUE object, ID id)

Returns true if the object reponds to the message specified by id.
Returns true if the object responds to the message specified by id.

** Instance Variables

Expand Down
2 changes: 1 addition & 1 deletion README.jp
Expand Up @@ -172,7 +172,7 @@ Public License)

4. ¾�Υץ������ؤΰ��ѤϤ����ʤ���Ū�Ǥ��켫ͳ�Ǥ�����
�������ܥץ������˴ޤޤ��¾�κ�Ԥˤ�륳���ɤϡ���
�줾��κ�Ԥΰո��ˤ�����¤��ä�����礬����ޤ���
�줾��κ�Ԥΰո��ˤ�����¤��ä�����礬����ޤ���

����Ū�ˤ�gc.c(����)��util.c(����)��st.[ch]��regex.[ch]
����� ./missing�ǥ��쥯�ȥ겼�Υե����뷲���������ޤ���
Expand Down
87 changes: 59 additions & 28 deletions array.c
@@ -1,4 +1,4 @@
/************************************************
/**********************************************************************
array.c -
Expand All @@ -7,8 +7,10 @@
created at: Fri Aug 6 09:46:12 JST 1993
Copyright (C) 1993-2000 Yukihiro Matsumoto
Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
Copyright (C) 2000 Information-technology Promotion Agancy, Japan
************************************************/
**********************************************************************/

#include "ruby.h"
#include "util.h"
Expand Down Expand Up @@ -276,8 +278,15 @@ rb_ary_push_m(argc, argv, ary)
VALUE *argv;
VALUE ary;
{
while (argc--) {
rb_ary_store(ary, RARRAY(ary)->len, *argv++);
if (argc > 0) {
long len = RARRAY(ary)->len;

--argc;
/* make rooms by copying the last item */
rb_ary_store(ary, len + argc, argv[argc]);

if (argc) /* if any rest */
MEMCPY(RARRAY(ary)->ptr + len, argv, VALUE, argc);
}
return ary;
}
Expand Down Expand Up @@ -340,6 +349,26 @@ rb_ary_unshift(ary, item)
return ary;
}

static VALUE
rb_ary_unshift_m(argc, argv, ary)
int argc;
VALUE *argv;
VALUE ary;
{
if (argc > 0) {
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;
}

VALUE
rb_ary_entry(ary, offset)
VALUE ary;
Expand Down Expand Up @@ -980,6 +1009,27 @@ rb_ary_collect(ary)
return collect;
}

static VALUE
rb_ary_collect_bang(ary)
VALUE ary;
{
long i;

rb_ary_modify(ary);
for (i = 0; i < RARRAY(ary)->len; i++) {
RARRAY(ary)->ptr[i] = rb_yield(RARRAY(ary)->ptr[i]);
}
return ary;
}

static VALUE
rb_ary_filter(ary)
VALUE ary;
{
rb_warn("Array#filter is deprecated; use Array#collect!");
return rb_ary_collect_bang(ary);
}

VALUE
rb_ary_delete(ary, item)
VALUE ary;
Expand Down Expand Up @@ -1091,19 +1141,6 @@ rb_ary_delete_if(ary)
return ary;
}

static VALUE
rb_ary_filter(ary)
VALUE ary;
{
long i;

rb_ary_modify(ary);
for (i = 0; i < RARRAY(ary)->len; i++) {
RARRAY(ary)->ptr[i] = rb_yield(RARRAY(ary)->ptr[i]);
}
return ary;
}

static VALUE
rb_ary_replace_m(ary, ary2)
VALUE ary, ary2;
Expand Down Expand Up @@ -1195,17 +1232,9 @@ VALUE
rb_ary_concat(x, y)
VALUE x, y;
{
VALUE *p, *pend;

rb_ary_modify(x);
Check_Type(y, T_ARRAY);

p = RARRAY(y)->ptr;
pend = p + RARRAY(y)->len;
while (p < pend) {
rb_ary_store(x, RARRAY(x)->len, *p);
p++;
}
rb_ary_push_m(RARRAY(y)->len, RARRAY(y)->ptr, x);
return x;
}

Expand Down Expand Up @@ -1575,7 +1604,7 @@ Init_Array()
rb_define_method(rb_cArray, "push", rb_ary_push_m, -1);
rb_define_method(rb_cArray, "pop", rb_ary_pop, 0);
rb_define_method(rb_cArray, "shift", rb_ary_shift, 0);
rb_define_method(rb_cArray, "unshift", rb_ary_unshift, 1);
rb_define_method(rb_cArray, "unshift", rb_ary_unshift_m, -1);
rb_define_method(rb_cArray, "each", rb_ary_each, 0);
rb_define_method(rb_cArray, "each_index", rb_ary_each_index, 0);
rb_define_method(rb_cArray, "reverse_each", rb_ary_reverse_each, 0);
Expand All @@ -1594,11 +1623,13 @@ Init_Array()
rb_define_method(rb_cArray, "sort", rb_ary_sort, 0);
rb_define_method(rb_cArray, "sort!", rb_ary_sort_bang, 0);
rb_define_method(rb_cArray, "collect", rb_ary_collect, 0);
rb_define_method(rb_cArray, "collect!", rb_ary_collect_bang, 0);
rb_define_method(rb_cArray, "map!", rb_ary_collect_bang, 0);
rb_define_method(rb_cArray, "filter", rb_ary_filter, 0);
rb_define_method(rb_cArray, "delete", rb_ary_delete, 1);
rb_define_method(rb_cArray, "delete_at", rb_ary_delete_at_m, -1);
rb_define_method(rb_cArray, "delete_if", rb_ary_delete_if, 0);
rb_define_method(rb_cArray, "reject!", rb_ary_delete_if, 0);
rb_define_method(rb_cArray, "filter", rb_ary_filter, 0);
rb_define_method(rb_cArray, "replace", rb_ary_replace_m, 1);
rb_define_method(rb_cArray, "clear", rb_ary_clear, 0);
rb_define_method(rb_cArray, "fill", rb_ary_fill, -1);
Expand Down
6 changes: 4 additions & 2 deletions bignum.c
@@ -1,12 +1,14 @@
/************************************************
/**********************************************************************
bignum.c -
$Author$
$Date$
created at: Fri Jun 10 00:48:55 JST 1994
************************************************/
Copyright (C) 1993-2000 Yukihiro Matsumoto
**********************************************************************/

#include "ruby.h"
#include <math.h>
Expand Down
21 changes: 18 additions & 3 deletions class.c
@@ -1,4 +1,4 @@
/************************************************
/**********************************************************************
class.c -
Expand All @@ -8,7 +8,7 @@
Copyright (C) 1993-2000 Yukihiro Matsumoto
************************************************/
**********************************************************************/

#include "ruby.h"
#include "node.h"
Expand Down Expand Up @@ -502,15 +502,30 @@ rb_undef_method(klass, name)
rb_add_method(klass, rb_intern(name), 0, NOEX_UNDEF);
}

#define SPECIAL_SINGLETON(x,c) if (obj == (x)) {\
if (!FL_TEST(c, FL_SINGLETON)) {\
c = rb_singleton_class_new(c);\
rb_singleton_class_attached(c,obj);\
}\
return c;\
}

VALUE
rb_singleton_class(obj)
VALUE obj;
{
VALUE klass;

if (rb_special_const_p(obj)) {
if (FIXNUM_P(obj) || SYMBOL_P(obj)) {
rb_raise(rb_eTypeError, "can't define singleton");
}
if (rb_special_const_p(obj)) {
SPECIAL_SINGLETON(Qnil, rb_cNilClass);
SPECIAL_SINGLETON(Qfalse, rb_cFalseClass);
SPECIAL_SINGLETON(Qtrue, rb_cTrueClass);
rb_bug("unknown immediate %d", obj);
}

if (FL_TEST(RBASIC(obj)->klass, FL_SINGLETON)) {
klass = RBASIC(obj)->klass;
}
Expand Down
4 changes: 2 additions & 2 deletions compar.c
@@ -1,4 +1,4 @@
/************************************************
/**********************************************************************
compar.c -
Expand All @@ -8,7 +8,7 @@
Copyright (C) 1993-2000 Yukihiro Matsumoto
************************************************/
**********************************************************************/

#include "ruby.h"

Expand Down
4 changes: 4 additions & 0 deletions config.guess
Expand Up @@ -969,6 +969,10 @@ EOF
*:Rhapsody:*:*)
echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
exit 0 ;;
*:"Mac OS":*:*)
echo `uname -p`-apple-macos${UNAME_RELEASE}
exit 0 ;;

esac

#echo '(No uname command or uname output not recognized.)' 1>&2
Expand Down
2 changes: 1 addition & 1 deletion config.sub
Expand Up @@ -910,7 +910,7 @@ case $os in
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -linux* | -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* | -rhapsody* | -openstep* | -oskit*)
| -interix* | -uwin* | -rhapsody* | -openstep* | -macos | -oskit*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
Expand Down

0 comments on commit 817a62d

Please sign in to comment.