Browse files

19991029

git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@556 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information...
1 parent 419abc8 commit 9868574ae43c0fdc49a9d3fc0431bb0613507bfa matz committed Oct 29, 1999
Showing with 119 additions and 35 deletions.
  1. +34 −0 ChangeLog
  2. +1 −1 README.jp
  3. +4 −1 ToDo
  4. +20 −0 array.c
  5. +1 −1 configure
  6. +1 −1 configure.in
  7. +12 −12 enum.c
  8. +15 −0 ext/nkf/lib/kconv.rb
  9. +1 −1 intern.h
  10. +3 −3 io.c
  11. +2 −8 misc/ruby-mode.el
  12. +8 −0 node.h
  13. +2 −2 process.c
  14. +1 −0 string.c
  15. +13 −5 time.c
  16. +1 −0 win32/ruby.def
View
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>
* ruby.c (moreswitches): function to process string option;
View
2 README.jp
@@ -10,7 +10,7 @@ Ruby
�ˤ�äơ����ʬ����䤹���ץ�����ߥ󥰤�����ޤ���
-* Ruby������
+* Ruby����Ĺ
+ ����ץ��ʸˡ
+ ���̤Υ��֥������Ȼظ���ǽ(���饹���᥽�åɥ�����ʤ�)
View
5 ToDo
@@ -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
View
20 array.c
@@ -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);
View
2 configure
@@ -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
2 configure.in
@@ -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"
View
24 enum.c
@@ -153,18 +153,6 @@ collect_i(i, tmp)
}
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;
{
@@ -185,6 +173,18 @@ enum_to_a(obj)
}
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
15 ext/nkf/lib/kconv.rb
@@ -56,3 +56,18 @@ def guess(str)
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
2 intern.h
@@ -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));
View
6 io.c
@@ -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
10 misc/ruby-mode.el
@@ -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))
View
8 node.h
@@ -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
4 process.c
@@ -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
1 string.c
@@ -2060,6 +2060,7 @@ rb_str_split_method(argc, argv, str)
if (!NIL_P(limit) && lim <= ++i) break;
}
end++;
+ if (ismbchar(*ptr)) ptr++;
}
}
}
View
18 time.c
@@ -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
1 win32/ruby.def
@@ -31,6 +31,7 @@ EXPORTS
rb_eSystemCallError
rb_eZeroDivError
rb_mErrno
+ ruby_nerrs
;eval.c
rb_cProc
ruby_frame

0 comments on commit 9868574

Please sign in to comment.