1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@556 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 1999-10-29 09:25:48 +00:00
parent cd2af215d4
commit 0d684beafb
16 changed files with 119 additions and 35 deletions

View file

@ -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>
* ruby.c (moreswitches): function to process string option;

View file

@ -10,7 +10,7 @@ Ruby
によって,より分かりやすいプログラミングが出来ます.
* Rubyの特長
* Rubyの特長
+ シンプルな文法
+ 普通のオブジェクト指向機能(クラス,メソッドコールなど)

5
ToDo
View file

@ -2,6 +2,8 @@ Language Spec.
- def foo; .. rescue .. end
- compile time string concatenation, "hello" "world" => "helloworld"
* objectify symbols
* objectify characters
* ../... outside condition invokes operator method too.
* %w(a\ b\ c abc) => ["a b c", "abc"]
* package or access control for global variables
@ -46,6 +48,7 @@ Extension Libraries
- FastCGI ruby
* ptk.rb pTk wrapper that is compatible to tk.rb
* Berkeley DB extension
Ruby Libraries
@ -54,7 +57,7 @@ Ruby Libraries
Tools
* extension library maker like XS or SWIG
- extension library maker like XS or SWIG
* freeze or undump to bundle everything
Misc

20
array.c
View file

@ -934,6 +934,25 @@ rb_ary_sort(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
rb_ary_delete(ary, item)
VALUE ary;
@ -1494,6 +1513,7 @@ Init_Array()
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_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_at", rb_ary_delete_at, 1);
rb_define_method(rb_cArray, "delete_if", rb_ary_delete_if, 0);

2
configure vendored
View file

@ -4093,7 +4093,7 @@ echo "configure:4028: checking whether OS depend dynamic link works" >&5
rb_cv_dlopen=yes ;;
esac ;;
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 ;;
nextstep*) LDSHARED='cc -r -nostdlib'
LDFLAGS="-u libsys_s"

View file

@ -437,7 +437,7 @@ if test "$with_dln_a_out" != yes; then
rb_cv_dlopen=yes ;;
esac ;;
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 ;;
nextstep*) LDSHARED='cc -r -nostdlib'
LDFLAGS="-u libsys_s"

24
enum.c
View file

@ -152,18 +152,6 @@ collect_i(i, tmp)
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
enum_all(i, ary)
VALUE i, ary;
@ -184,6 +172,18 @@ enum_to_a(obj)
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
enum_sort(obj)
VALUE obj;

View file

@ -56,3 +56,18 @@ module Kconv
end
module_function :guess
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

View file

@ -82,7 +82,7 @@ VALUE rb_singleton_class _((VALUE));
/* enum.c */
VALUE rb_enum_length _((VALUE));
/* error.c */
extern int ruby_nerrs;
EXTERN int ruby_nerrs;
VALUE rb_exc_new _((VALUE, const char*, long));
VALUE rb_exc_new2 _((VALUE, const char*));
VALUE rb_exc_new3 _((VALUE, VALUE));

6
io.c
View file

@ -452,15 +452,15 @@ io_fread(ptr, len, f)
int c;
while (n--) {
if (!READ_DATA_PENDING(f)) {
rb_thread_wait_fd(fileno(f));
}
c = getc(f);
if (c == EOF) {
*ptr = '\0';
break;
}
*ptr++ = c;
if (!READ_DATA_PENDING(f)) {
rb_thread_wait_fd(fileno(f));
}
}
return len - n - 1;

View file

@ -172,20 +172,14 @@ The variable ruby-indent-level controls the amount of indentation.
(defun ruby-indent-to (x)
(if x
(let (shift top beg)
(and (< x 0)
(error "invalid nest"))
(and (< x 0) (error "invalid nest"))
(setq shift (current-column))
(beginning-of-line)
(setq beg (point))
(back-to-indentation)
(setq top (current-column))
(skip-chars-backward " \t")
(cond
((>= x shift)
(setq shift 0))
((>= shift top)
(setq shift (- shift top)))
(t (setq shift 0)))
(if (>= shift top) (setq shift (- shift top)))
(if (and (bolp)
(= x top))
(move-to-column (+ x shift))

8
node.h
View file

@ -13,6 +13,10 @@
#ifndef NODE_H
#define NODE_H
#if defined(__cplusplus)
extern "C" {
#endif
enum node_type {
NODE_METHOD,
NODE_FBODY,
@ -331,4 +335,8 @@ VALUE rb_gvar_get _((struct global_entry *));
VALUE rb_gvar_set _((struct global_entry *, VALUE));
VALUE rb_gvar_defined _((struct global_entry *));
#if defined(__cplusplus)
} /* extern "C" { */
#endif
#endif

View file

@ -644,7 +644,7 @@ rb_f_system(argc, argv)
fflush(stderr);
if (argc == 0) {
rb_last_status = INT2FIX(0);
return INT2FIX(0);
rb_raise(rb_eArgError, "wrong # of arguments");
}
if (TYPE(argv[0]) == T_ARRAY) {
@ -675,7 +675,7 @@ rb_f_system(argc, argv)
fflush(stderr);
if (argc == 0) {
rb_last_status = INT2FIX(0);
return INT2FIX(0);
rb_raise(rb_eArgError, "wrong # of arguments");
}
if (TYPE(argv[0]) == T_ARRAY) {

View file

@ -2060,6 +2060,7 @@ rb_str_split_method(argc, argv, str)
if (!NIL_P(limit) && lim <= ++i) break;
}
end++;
if (ismbchar(*ptr)) ptr++;
}
}
}

18
time.c
View file

@ -152,13 +152,21 @@ rb_time_timeval(time)
}
static VALUE
time_s_at(klass, time)
VALUE klass, time;
time_s_at(argc, argv, klass)
int argc;
VALUE *argv;
VALUE klass;
{
struct timeval tv;
VALUE t;
VALUE time, t;
tv = rb_time_timeval(time);
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);
}
t = time_new_internal(klass, tv.tv_sec, tv.tv_usec);
if (TYPE(time) == T_DATA) {
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, "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, "local", time_s_timelocal, -1);
rb_define_singleton_method(rb_cTime, "mktime", time_s_timelocal, -1);

View file

@ -31,6 +31,7 @@ EXPORTS
rb_eSystemCallError
rb_eZeroDivError
rb_mErrno
ruby_nerrs
;eval.c
rb_cProc
ruby_frame