* 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.

* 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.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2172 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2002-03-11 08:02:04 +00:00
Родитель 81930da895
Коммит 86c6af5873
10 изменённых файлов: 65 добавлений и 28 удалений

Просмотреть файл

@ -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.

Просмотреть файл

@ -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

2
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

3
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;

Просмотреть файл

@ -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

Просмотреть файл

@ -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);

Просмотреть файл

@ -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();

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;

Просмотреть файл

@ -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 */