summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog24
-rw-r--r--Makefile.in9
-rw-r--r--enum.c2
-rw-r--r--eval.c3
-rw-r--r--ext/tk/lib/tk.rb4
-rw-r--r--marshal.c3
-rw-r--r--process.c2
-rw-r--r--signal.c39
-rw-r--r--string.c6
-rw-r--r--variable.c1
10 files changed, 65 insertions, 28 deletions
diff --git a/ChangeLog b/ChangeLog
index e2d120c219..7d0b2eca4e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+Mon Mar 11 14:44:38 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * marshal.c (w_object): module inclusion using extend() should
+ also be detected.
+
+ * eval.c (rb_eval_cmd): cbase should not be NULL; it should be
+ either ruby_wrapper or Object.
+
+Sun Mar 10 02:18:22 2002 Koji Arai <jca02266@nifty.ne.jp>
+
+ * enum.c (enum_each_with_index): should return self.
+
+ * process.c (proc_setpgrp): should return value for non-void function.
+
+ * process.c (proc_getpgid): should raise exception if getpgid() return -1.
+
+ * string.c (rb_str_ljust): should return a duplicated string.
+
+ * string.c (rb_str_rjust): ditto.
+
+ * string.c (rb_str_center): ditto.
+
Sat Mar 9 08:45:58 2002 Tanaka Akira <akr@m17n.org>
* ext/socket/extconf.rb (have_struct_member): don't print checked
@@ -52,7 +74,7 @@ Wed Mar 6 16:50:37 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
* class.c (rb_mod_clone): should not call rb_obj_clone(), since
Module does not provide "allocate".
- * class.c (rb_singleton_class): should crate new singleton class
+ * class.c (rb_singleton_class): should create new singleton class
if obj is a class or module and attached object is different,
which means metaclass of singleton class is sought.
diff --git a/Makefile.in b/Makefile.in
index a7f1afd142..5fad5c3a47 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -109,20 +109,23 @@ install: rbconfig.rb
clean-ext:; @-@MINIRUBY@ -Cext extmk.rb clean 2> /dev/null || true
-clean: clean-ext
+clean-local:
@rm -f $(OBJS) $(MAINOBJ) $(LIBRUBY_A) $(LIBRUBY_SO) $(LIBRUBY_ALIASES)
@rm -f ext/extinit.c ext/extinit.@OBJEXT@ dmyext.@OBJEXT@
- @-@MINIRUBY@ -Cext extmk.rb clean 2> /dev/null || true
@rm -f $(PROGRAM) miniruby$(EXEEXT)
+clean: clean-ext clean-local
+
distclean-ext:
@-@MINIRUBY@ -Cext extmk.rb distclean 2> /dev/null || true
-distclean: distclean-ext clean
+distclean-local: clean-local
@rm -f Makefile ext/extmk.rb config.h rbconfig.rb
@rm -f ext/config.cache config.cache config.log config.status
@rm -f *~ core *.core gmon.out y.tab.c y.output ruby.imp
+distclean: distclean-ext distclean-local
+
realclean: distclean
@rm -f parse.c
@rm -f lex.c
diff --git a/enum.c b/enum.c
index 9e0cf19fc0..82219e78d6 100644
--- a/enum.c
+++ b/enum.c
@@ -427,7 +427,7 @@ enum_each_with_index(obj)
rb_iterate(rb_each, obj, each_with_index_i, (VALUE)memo);
rb_gc_force_recycle((VALUE)memo);
- return Qnil;
+ return obj;
}
void
diff --git a/eval.c b/eval.c
index ec78879c65..2bd416fb93 100644
--- a/eval.c
+++ b/eval.c
@@ -1382,7 +1382,8 @@ rb_eval_cmd(cmd, arg, tcheck)
ruby_frame->last_func = 0;
ruby_frame->last_class = 0;
ruby_frame->self = ruby_top_self;
- ruby_frame->cbase = (VALUE)rb_node_newnode(NODE_CREF,ruby_wrapper,0,0);
+ ruby_frame->cbase = (VALUE)rb_node_newnode(NODE_CREF,0,0,0);
+ RNODE(ruby_frame->cbase)->nd_clss = ruby_wrapper ? ruby_wrapper : rb_cObject;
if (tcheck && OBJ_TAINTED(cmd)) {
ruby_safe_level = 4;
diff --git a/ext/tk/lib/tk.rb b/ext/tk/lib/tk.rb
index a935a55e16..bac2ae35f9 100644
--- a/ext/tk/lib/tk.rb
+++ b/ext/tk/lib/tk.rb
@@ -945,8 +945,8 @@ module Tk
def sizefrom(*args)
tk_call('wm', 'sizefrom', path, *args)
end
- def state
- tk_call 'wm', 'state', path
+ def state(state=None)
+ tk_call 'wm', 'state', path, state
end
def title(*args)
tk_call 'wm', 'title', path, *args
diff --git a/marshal.c b/marshal.c
index 17d3a6979b..4bd7a35ecb 100644
--- a/marshal.c
+++ b/marshal.c
@@ -485,11 +485,12 @@ w_object(obj, arg, limit)
VALUE klass = CLASS_OF(obj);
char *path;
- if (FL_TEST(klass, FL_SINGLETON)) {
+ while (FL_TEST(klass, FL_SINGLETON) || BUILTIN_TYPE(klass) == T_ICLASS) {
if (RCLASS(klass)->m_tbl->num_entries > 0 ||
RCLASS(klass)->iv_tbl->num_entries > 1) {
rb_raise(rb_eTypeError, "singleton can't be dumped");
}
+ klass = RCLASS(klass)->super;
}
path = rb_class2name(klass);
w_unique(path, arg);
diff --git a/process.c b/process.c
index e35308c0b5..4763a87631 100644
--- a/process.c
+++ b/process.c
@@ -998,6 +998,7 @@ proc_setpgrp()
rb_notimplement();
# endif
#endif
+ return INT2FIX(0);
}
static VALUE
@@ -1008,6 +1009,7 @@ proc_getpgid(obj, pid)
int i;
i = getpgid(NUM2INT(pid));
+ if (i < 0) rb_sys_fail(0);
return INT2NUM(i);
#else
rb_notimplement();
diff --git a/signal.c b/signal.c
index 2ff32e52dc..c643fd48c2 100644
--- a/signal.c
+++ b/signal.c
@@ -217,26 +217,33 @@ rb_f_kill(argc, argv)
goto str_signal;
case T_STRING:
- {
- s = RSTRING(argv[0])->ptr;
- if (s[0] == '-') {
- negative++;
- s++;
- }
- str_signal:
- if (strncmp("SIG", s, 3) == 0)
- s += 3;
- if((sig = signm2signo(s)) == 0)
- rb_raise(rb_eArgError, "unrecognized signal name `%s'", s);
-
- if (negative)
- sig = -sig;
+ s = RSTRING(argv[0])->ptr;
+ if (s[0] == '-') {
+ negative++;
+ s++;
}
+ str_signal:
+ if (strncmp("SIG", s, 3) == 0)
+ s += 3;
+ if((sig = signm2signo(s)) == 0)
+ rb_raise(rb_eArgError, "unsupported name `SIG%s'", s);
+
+ if (negative)
+ sig = -sig;
break;
default:
- rb_raise(rb_eArgError, "bad signal type %s",
- rb_class2name(CLASS_OF(argv[0])));
+ {
+ VALUE str;
+
+ str = rb_check_convert_type(argv[0], T_STRING, "String", "to_str");
+ if (!NIL_P(str)) {
+ s = RSTRING(str)->ptr;
+ goto str_signal;
+ }
+ rb_raise(rb_eArgError, "bad signal type %s",
+ rb_class2name(CLASS_OF(argv[0])));
+ }
break;
}
diff --git a/string.c b/string.c
index 25fd851d08..d83913c0ee 100644
--- a/string.c
+++ b/string.c
@@ -3050,7 +3050,7 @@ rb_str_ljust(str, w)
VALUE res;
char *p, *pend;
- if (width < 0 || RSTRING(str)->len >= width) return str;
+ if (width < 0 || RSTRING(str)->len >= width) return rb_str_dup(str);
res = rb_str_new5(str, 0, width);
memcpy(RSTRING(res)->ptr, RSTRING(str)->ptr, RSTRING(str)->len);
p = RSTRING(res)->ptr + RSTRING(str)->len; pend = RSTRING(res)->ptr + width;
@@ -3070,7 +3070,7 @@ rb_str_rjust(str, w)
VALUE res;
char *p, *pend;
- if (width < 0 || RSTRING(str)->len >= width) return str;
+ if (width < 0 || RSTRING(str)->len >= width) return rb_str_dup(str);
res = rb_str_new5(str, 0, width);
p = RSTRING(res)->ptr; pend = p + width - RSTRING(str)->len;
while (p < pend) {
@@ -3091,7 +3091,7 @@ rb_str_center(str, w)
char *p, *pend;
long n;
- if (width < 0 || RSTRING(str)->len >= width) return str;
+ if (width < 0 || RSTRING(str)->len >= width) return rb_str_dup(str);
res = rb_str_new5(str, 0, width);
n = (width - RSTRING(str)->len)/2;
p = RSTRING(res)->ptr; pend = p + n;
diff --git a/variable.c b/variable.c
index c63fd573f0..86a26103a5 100644
--- a/variable.c
+++ b/variable.c
@@ -1148,6 +1148,7 @@ rb_const_get(klass, id)
RSTRING(rb_class_path(klass))->ptr);
}
else {
+ global_uninitialized:
rb_name_error(id, "uninitialized constant %s",rb_id2name(id));
}
return Qnil; /* not reached */