19991029
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@556 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
cd2af215d4
commit
0d684beafb
34
ChangeLog
34
ChangeLog
@ -1,3 +1,37 @@
|
|||||||
|
Fri Oct 29 16:57:30 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||||
|
|
||||||
|
* ext/nkf/lib/kconv.rb: new String methods (kconv, tojis, toeuc,
|
||||||
|
tosjis).
|
||||||
|
|
||||||
|
* time.c (time_s_at): now accepts optional second argument to
|
||||||
|
specify micro second.
|
||||||
|
|
||||||
|
Thu Oct 28 13:35:40 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||||
|
|
||||||
|
* string.c (rb_str_split_method): should be mbchar aware with
|
||||||
|
single char separators.
|
||||||
|
|
||||||
|
Wed Oct 27 12:57:21 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||||
|
|
||||||
|
* random.c (rb_f_srand): random seed should be unsigned.
|
||||||
|
|
||||||
|
Tue Oct 26 23:58:15 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||||
|
|
||||||
|
* array.c (rb_ary_collect): collect for better performance.
|
||||||
|
|
||||||
|
Tue Oct 26 19:20:54 1999 Koji Arai <JCA02266@nifty.ne.jp>
|
||||||
|
|
||||||
|
* marshal.c (r_object): should register class/module objects.
|
||||||
|
|
||||||
|
Sat Oct 23 15:59:39 1999 Takaaki Tateishi <ttate@jaist.ac.jp>
|
||||||
|
|
||||||
|
* process.c (rb_f_system): should require at least one argument.
|
||||||
|
|
||||||
|
Sat Oct 23 12:42:44 1999 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
|
||||||
|
|
||||||
|
* enum.c (enum_collect): collect without block will collect
|
||||||
|
elements in enumerable.
|
||||||
|
|
||||||
Thu Oct 21 16:14:19 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
|
Thu Oct 21 16:14:19 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||||
|
|
||||||
* ruby.c (moreswitches): function to process string option;
|
* ruby.c (moreswitches): function to process string option;
|
||||||
|
@ -10,7 +10,7 @@ Ruby
|
|||||||
によって,より分かりやすいプログラミングが出来ます.
|
によって,より分かりやすいプログラミングが出来ます.
|
||||||
|
|
||||||
|
|
||||||
* Rubyの特長.
|
* Rubyの特長
|
||||||
|
|
||||||
+ シンプルな文法
|
+ シンプルな文法
|
||||||
+ 普通のオブジェクト指向機能(クラス,メソッドコールなど)
|
+ 普通のオブジェクト指向機能(クラス,メソッドコールなど)
|
||||||
|
5
ToDo
5
ToDo
@ -2,6 +2,8 @@ Language Spec.
|
|||||||
|
|
||||||
- def foo; .. rescue .. end
|
- def foo; .. rescue .. end
|
||||||
- compile time string concatenation, "hello" "world" => "helloworld"
|
- compile time string concatenation, "hello" "world" => "helloworld"
|
||||||
|
* objectify symbols
|
||||||
|
* objectify characters
|
||||||
* ../... outside condition invokes operator method too.
|
* ../... outside condition invokes operator method too.
|
||||||
* %w(a\ b\ c abc) => ["a b c", "abc"]
|
* %w(a\ b\ c abc) => ["a b c", "abc"]
|
||||||
* package or access control for global variables
|
* package or access control for global variables
|
||||||
@ -46,6 +48,7 @@ Extension Libraries
|
|||||||
|
|
||||||
- FastCGI ruby
|
- FastCGI ruby
|
||||||
* ptk.rb pTk wrapper that is compatible to tk.rb
|
* ptk.rb pTk wrapper that is compatible to tk.rb
|
||||||
|
* Berkeley DB extension
|
||||||
|
|
||||||
Ruby Libraries
|
Ruby Libraries
|
||||||
|
|
||||||
@ -54,7 +57,7 @@ Ruby Libraries
|
|||||||
|
|
||||||
Tools
|
Tools
|
||||||
|
|
||||||
* extension library maker like XS or SWIG
|
- extension library maker like XS or SWIG
|
||||||
* freeze or undump to bundle everything
|
* freeze or undump to bundle everything
|
||||||
|
|
||||||
Misc
|
Misc
|
||||||
|
20
array.c
20
array.c
@ -934,6 +934,25 @@ rb_ary_sort(ary)
|
|||||||
return ary;
|
return ary;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static VALUE
|
||||||
|
rb_ary_collect(ary)
|
||||||
|
VALUE ary;
|
||||||
|
{
|
||||||
|
long len, i;
|
||||||
|
VALUE collect;
|
||||||
|
|
||||||
|
if (!rb_iterator_p()) {
|
||||||
|
return rb_ary_dup(ary);
|
||||||
|
}
|
||||||
|
|
||||||
|
len = RARRAY(ary)->len;
|
||||||
|
collect = rb_ary_new2(len);
|
||||||
|
for (i=0; i<len; i++) {
|
||||||
|
rb_ary_push(collect, rb_yield(RARRAY(ary)->ptr[i]));
|
||||||
|
}
|
||||||
|
return collect;
|
||||||
|
}
|
||||||
|
|
||||||
VALUE
|
VALUE
|
||||||
rb_ary_delete(ary, item)
|
rb_ary_delete(ary, item)
|
||||||
VALUE ary;
|
VALUE ary;
|
||||||
@ -1494,6 +1513,7 @@ Init_Array()
|
|||||||
rb_define_method(rb_cArray, "reverse!", rb_ary_reverse, 0);
|
rb_define_method(rb_cArray, "reverse!", rb_ary_reverse, 0);
|
||||||
rb_define_method(rb_cArray, "sort", rb_ary_sort, 0);
|
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, "sort!", rb_ary_sort_bang, 0);
|
||||||
|
rb_define_method(rb_cArray, "collect", rb_ary_collect, 0);
|
||||||
rb_define_method(rb_cArray, "delete", rb_ary_delete, 1);
|
rb_define_method(rb_cArray, "delete", rb_ary_delete, 1);
|
||||||
rb_define_method(rb_cArray, "delete_at", rb_ary_delete_at, 1);
|
rb_define_method(rb_cArray, "delete_at", rb_ary_delete_at, 1);
|
||||||
rb_define_method(rb_cArray, "delete_if", rb_ary_delete_if, 0);
|
rb_define_method(rb_cArray, "delete_if", rb_ary_delete_if, 0);
|
||||||
|
2
configure
vendored
2
configure
vendored
@ -4093,7 +4093,7 @@ echo "configure:4028: checking whether OS depend dynamic link works" >&5
|
|||||||
rb_cv_dlopen=yes ;;
|
rb_cv_dlopen=yes ;;
|
||||||
esac ;;
|
esac ;;
|
||||||
bsdi*) LDSHARED="ld -shared"
|
bsdi*) LDSHARED="ld -shared"
|
||||||
LDFLAGS="-rdynamic -Wl,-rpath,/usr/local/lib/ruby/1.4/i386-bsdi4.0"
|
LDFLAGS='-rdynamic -Wl,-rpath,$(prefix)/lib/ruby/$(MAJOR).$(MINOR)/i386-bsdi4.0'
|
||||||
rb_cv_dlopen=yes ;;
|
rb_cv_dlopen=yes ;;
|
||||||
nextstep*) LDSHARED='cc -r -nostdlib'
|
nextstep*) LDSHARED='cc -r -nostdlib'
|
||||||
LDFLAGS="-u libsys_s"
|
LDFLAGS="-u libsys_s"
|
||||||
|
@ -437,7 +437,7 @@ if test "$with_dln_a_out" != yes; then
|
|||||||
rb_cv_dlopen=yes ;;
|
rb_cv_dlopen=yes ;;
|
||||||
esac ;;
|
esac ;;
|
||||||
bsdi*) LDSHARED="ld -shared"
|
bsdi*) LDSHARED="ld -shared"
|
||||||
LDFLAGS="-rdynamic -Wl,-rpath,/usr/local/lib/ruby/1.4/i386-bsdi4.0"
|
LDFLAGS='-rdynamic -Wl,-rpath,$(prefix)/lib/ruby/$(MAJOR).$(MINOR)/i386-bsdi4.0'
|
||||||
rb_cv_dlopen=yes ;;
|
rb_cv_dlopen=yes ;;
|
||||||
nextstep*) LDSHARED='cc -r -nostdlib'
|
nextstep*) LDSHARED='cc -r -nostdlib'
|
||||||
LDFLAGS="-u libsys_s"
|
LDFLAGS="-u libsys_s"
|
||||||
|
24
enum.c
24
enum.c
@ -152,18 +152,6 @@ collect_i(i, tmp)
|
|||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
|
||||||
enum_collect(obj)
|
|
||||||
VALUE obj;
|
|
||||||
{
|
|
||||||
VALUE tmp;
|
|
||||||
|
|
||||||
tmp = rb_ary_new();
|
|
||||||
rb_iterate(rb_each, obj, collect_i, tmp);
|
|
||||||
|
|
||||||
return tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
enum_all(i, ary)
|
enum_all(i, ary)
|
||||||
VALUE i, ary;
|
VALUE i, ary;
|
||||||
@ -184,6 +172,18 @@ enum_to_a(obj)
|
|||||||
return ary;
|
return ary;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static VALUE
|
||||||
|
enum_collect(obj)
|
||||||
|
VALUE obj;
|
||||||
|
{
|
||||||
|
VALUE tmp;
|
||||||
|
|
||||||
|
tmp = rb_ary_new();
|
||||||
|
rb_iterate(rb_each, obj, rb_iterator_p() ? collect_i : enum_all, tmp);
|
||||||
|
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
enum_sort(obj)
|
enum_sort(obj)
|
||||||
VALUE obj;
|
VALUE obj;
|
||||||
|
@ -56,3 +56,18 @@ module Kconv
|
|||||||
end
|
end
|
||||||
module_function :guess
|
module_function :guess
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class String
|
||||||
|
def kconv(out_code, in_code=Kconv::AUTO)
|
||||||
|
Kconv::kconv(self, out_code, in_code)
|
||||||
|
end
|
||||||
|
def tojis
|
||||||
|
NKF::nkf('-j', self)
|
||||||
|
end
|
||||||
|
def toeuc
|
||||||
|
NKF::nkf('-e', self)
|
||||||
|
end
|
||||||
|
def tosjis
|
||||||
|
NKF::nkf('-s', self)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
2
intern.h
2
intern.h
@ -82,7 +82,7 @@ VALUE rb_singleton_class _((VALUE));
|
|||||||
/* enum.c */
|
/* enum.c */
|
||||||
VALUE rb_enum_length _((VALUE));
|
VALUE rb_enum_length _((VALUE));
|
||||||
/* error.c */
|
/* error.c */
|
||||||
extern int ruby_nerrs;
|
EXTERN int ruby_nerrs;
|
||||||
VALUE rb_exc_new _((VALUE, const char*, long));
|
VALUE rb_exc_new _((VALUE, const char*, long));
|
||||||
VALUE rb_exc_new2 _((VALUE, const char*));
|
VALUE rb_exc_new2 _((VALUE, const char*));
|
||||||
VALUE rb_exc_new3 _((VALUE, VALUE));
|
VALUE rb_exc_new3 _((VALUE, VALUE));
|
||||||
|
6
io.c
6
io.c
@ -452,15 +452,15 @@ io_fread(ptr, len, f)
|
|||||||
int c;
|
int c;
|
||||||
|
|
||||||
while (n--) {
|
while (n--) {
|
||||||
|
if (!READ_DATA_PENDING(f)) {
|
||||||
|
rb_thread_wait_fd(fileno(f));
|
||||||
|
}
|
||||||
c = getc(f);
|
c = getc(f);
|
||||||
if (c == EOF) {
|
if (c == EOF) {
|
||||||
*ptr = '\0';
|
*ptr = '\0';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
*ptr++ = c;
|
*ptr++ = c;
|
||||||
if (!READ_DATA_PENDING(f)) {
|
|
||||||
rb_thread_wait_fd(fileno(f));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return len - n - 1;
|
return len - n - 1;
|
||||||
|
@ -172,20 +172,14 @@ The variable ruby-indent-level controls the amount of indentation.
|
|||||||
(defun ruby-indent-to (x)
|
(defun ruby-indent-to (x)
|
||||||
(if x
|
(if x
|
||||||
(let (shift top beg)
|
(let (shift top beg)
|
||||||
(and (< x 0)
|
(and (< x 0) (error "invalid nest"))
|
||||||
(error "invalid nest"))
|
|
||||||
(setq shift (current-column))
|
(setq shift (current-column))
|
||||||
(beginning-of-line)
|
(beginning-of-line)
|
||||||
(setq beg (point))
|
(setq beg (point))
|
||||||
(back-to-indentation)
|
(back-to-indentation)
|
||||||
(setq top (current-column))
|
(setq top (current-column))
|
||||||
(skip-chars-backward " \t")
|
(skip-chars-backward " \t")
|
||||||
(cond
|
(if (>= shift top) (setq shift (- shift top)))
|
||||||
((>= x shift)
|
|
||||||
(setq shift 0))
|
|
||||||
((>= shift top)
|
|
||||||
(setq shift (- shift top)))
|
|
||||||
(t (setq shift 0)))
|
|
||||||
(if (and (bolp)
|
(if (and (bolp)
|
||||||
(= x top))
|
(= x top))
|
||||||
(move-to-column (+ x shift))
|
(move-to-column (+ x shift))
|
||||||
|
8
node.h
8
node.h
@ -13,6 +13,10 @@
|
|||||||
#ifndef NODE_H
|
#ifndef NODE_H
|
||||||
#define NODE_H
|
#define NODE_H
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
enum node_type {
|
enum node_type {
|
||||||
NODE_METHOD,
|
NODE_METHOD,
|
||||||
NODE_FBODY,
|
NODE_FBODY,
|
||||||
@ -331,4 +335,8 @@ VALUE rb_gvar_get _((struct global_entry *));
|
|||||||
VALUE rb_gvar_set _((struct global_entry *, VALUE));
|
VALUE rb_gvar_set _((struct global_entry *, VALUE));
|
||||||
VALUE rb_gvar_defined _((struct global_entry *));
|
VALUE rb_gvar_defined _((struct global_entry *));
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
} /* extern "C" { */
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -644,7 +644,7 @@ rb_f_system(argc, argv)
|
|||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
rb_last_status = INT2FIX(0);
|
rb_last_status = INT2FIX(0);
|
||||||
return INT2FIX(0);
|
rb_raise(rb_eArgError, "wrong # of arguments");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TYPE(argv[0]) == T_ARRAY) {
|
if (TYPE(argv[0]) == T_ARRAY) {
|
||||||
@ -675,7 +675,7 @@ rb_f_system(argc, argv)
|
|||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
rb_last_status = INT2FIX(0);
|
rb_last_status = INT2FIX(0);
|
||||||
return INT2FIX(0);
|
rb_raise(rb_eArgError, "wrong # of arguments");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TYPE(argv[0]) == T_ARRAY) {
|
if (TYPE(argv[0]) == T_ARRAY) {
|
||||||
|
1
string.c
1
string.c
@ -2060,6 +2060,7 @@ rb_str_split_method(argc, argv, str)
|
|||||||
if (!NIL_P(limit) && lim <= ++i) break;
|
if (!NIL_P(limit) && lim <= ++i) break;
|
||||||
}
|
}
|
||||||
end++;
|
end++;
|
||||||
|
if (ismbchar(*ptr)) ptr++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
16
time.c
16
time.c
@ -152,13 +152,21 @@ rb_time_timeval(time)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
time_s_at(klass, time)
|
time_s_at(argc, argv, klass)
|
||||||
VALUE klass, time;
|
int argc;
|
||||||
|
VALUE *argv;
|
||||||
|
VALUE klass;
|
||||||
{
|
{
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
VALUE t;
|
VALUE time, t;
|
||||||
|
|
||||||
|
if (rb_scan_args(argc, argv, "11", &time, &t) == 2) {
|
||||||
|
tv.tv_sec = NUM2INT(time);
|
||||||
|
tv.tv_usec = NUM2INT(t);
|
||||||
|
}
|
||||||
|
else {
|
||||||
tv = rb_time_timeval(time);
|
tv = rb_time_timeval(time);
|
||||||
|
}
|
||||||
t = time_new_internal(klass, tv.tv_sec, tv.tv_usec);
|
t = time_new_internal(klass, tv.tv_sec, tv.tv_usec);
|
||||||
if (TYPE(time) == T_DATA) {
|
if (TYPE(time) == T_DATA) {
|
||||||
struct time_object *tobj, *tobj2;
|
struct time_object *tobj, *tobj2;
|
||||||
@ -978,7 +986,7 @@ Init_Time()
|
|||||||
|
|
||||||
rb_define_singleton_method(rb_cTime, "now", time_s_now, 0);
|
rb_define_singleton_method(rb_cTime, "now", time_s_now, 0);
|
||||||
rb_define_singleton_method(rb_cTime, "new", time_s_now, 0);
|
rb_define_singleton_method(rb_cTime, "new", time_s_now, 0);
|
||||||
rb_define_singleton_method(rb_cTime, "at", time_s_at, 1);
|
rb_define_singleton_method(rb_cTime, "at", time_s_at, -1);
|
||||||
rb_define_singleton_method(rb_cTime, "gm", time_s_timegm, -1);
|
rb_define_singleton_method(rb_cTime, "gm", time_s_timegm, -1);
|
||||||
rb_define_singleton_method(rb_cTime, "local", time_s_timelocal, -1);
|
rb_define_singleton_method(rb_cTime, "local", time_s_timelocal, -1);
|
||||||
rb_define_singleton_method(rb_cTime, "mktime", time_s_timelocal, -1);
|
rb_define_singleton_method(rb_cTime, "mktime", time_s_timelocal, -1);
|
||||||
|
@ -31,6 +31,7 @@ EXPORTS
|
|||||||
rb_eSystemCallError
|
rb_eSystemCallError
|
||||||
rb_eZeroDivError
|
rb_eZeroDivError
|
||||||
rb_mErrno
|
rb_mErrno
|
||||||
|
ruby_nerrs
|
||||||
;eval.c
|
;eval.c
|
||||||
rb_cProc
|
rb_cProc
|
||||||
ruby_frame
|
ruby_frame
|
||||||
|
Loading…
x
Reference in New Issue
Block a user