summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog33
-rw-r--r--eval.c27
-rw-r--r--io.c10
-rw-r--r--lib/debug.rb16
-rw-r--r--lib/optparse.rb12
-rw-r--r--marshal.c2
6 files changed, 69 insertions, 31 deletions
diff --git a/ChangeLog b/ChangeLog
index d1c950a458..250ddaacb5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,11 @@ Fri May 30 22:28:04 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* ruby.h (NUM2UINT, FIX2INT): ditto.
+Fri May 30 15:01:05 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
+
+ * ext/syck/token.c: preserve any indentation passed an explicit
+ indentation.
+
Fri May 30 14:55:44 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* eval.c (rb_Array): exclude Kernel#to_a instead of Object#to_a.
@@ -18,12 +23,7 @@ Fri May 30 14:55:44 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* lib/optparse.rb (OptionParser::Switch::PlacedArgument#parse):
override next switch after argument conversion.
-Fri May 30 00:01:05 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
-
- * ext/syck/token.c: preserve any indentation passed an explicit
- indentation.
-
-Thu May 29 23:41:34 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
+Fri May 30 14:41:34 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
* ext/syck/handler.c, ext/syck/syck.h: removed syck_fold_format().
@@ -71,6 +71,12 @@ Thu May 29 09:11:01 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* lib/optparse.rb (OptionParser::Switch::PlacedArgument::parse):
do not treat unmatched argument as an option.
+Wed May 28 08:44:26 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (rb_f_syscall): type dispatch should be based on
+ rb_check_string_type(), not FIXNUM_P(), because values may be a
+ bignum. [ruby-talk:72257]
+
Tue May 27 20:33:18 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* eval.c, util.c: removed duplicated includes/defines.
@@ -78,6 +84,21 @@ Tue May 27 20:33:18 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* ext/socket/socket.c (sock_addrinfo): get rid of SEGV at NULL ptr
String. increase buffer size for 64bit platforms.
+Tue May 27 02:34:14 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_call0): should pass the current klass value to
+ block_invoke, which may be called via "super". [ruby-core:01077]
+
+ * eval.c (block_invoke): now takes 4th argument "klass".
+
+ * eval.c (block_alloc): should propagate BLOCK_PROC to
+ ruby_block.
+
+Mon May 26 23:51:38 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * marshal.c (r_object0): should not use "yield" method, use "call"
+ instead. (ruby-bugs-ja PR#476)
+
Mon May 26 21:39:46 2003 MoonWolf <moonwolf@moonwolf.com>
* lib/mkmf.rb, lib/optparse.rb, lib/tracer.rb: use Method#to_block
diff --git a/eval.c b/eval.c
index b8d9ef3d76..71213b0f64 100644
--- a/eval.c
+++ b/eval.c
@@ -95,7 +95,7 @@ char *strrchr _((const char*,const char));
VALUE rb_cBlock, rb_cProc;
static VALUE rb_cBinding;
-static VALUE block_invoke _((VALUE,VALUE,VALUE));
+static VALUE block_invoke _((VALUE,VALUE,VALUE,VALUE));
static VALUE block_new _((void));
static VALUE rb_f_binding _((VALUE));
static void rb_f_END _((void));
@@ -2255,7 +2255,7 @@ call_trace_func(event, node, self, id, klass)
id?ID2SYM(id):Qnil,
self?rb_f_binding(self):Qnil,
klass),
- Qundef);
+ Qundef, 0);
}
POP_TMPTAG(); /* do not propagate retval */
POP_FRAME();
@@ -4046,7 +4046,7 @@ rb_yield_0(val, self, klass, pcall, avalue)
/* FOR does not introduce new scope */
ruby_dyna_vars = block->dyna_vars;
}
- ruby_class = klass?klass:block->klass;
+ ruby_class = klass ? klass : block->klass;
if (!klass) self = block->self;
node = block->body;
@@ -4887,7 +4887,7 @@ rb_call0(klass, recv, id, oid, argc, argv, body, nosuper)
break;
case NODE_BMETHOD:
- result = block_invoke(body->nd_cval, rb_ary_new4(argc, argv), recv);
+ result = block_invoke(body->nd_cval, rb_ary_new4(argc, argv), recv, klass);
break;
case NODE_SCOPE:
@@ -6358,7 +6358,7 @@ call_end_proc(data)
ruby_frame->self = ruby_frame->prev->self;
ruby_frame->last_func = 0;
ruby_frame->last_class = 0;
- block_invoke(data, rb_ary_new2(0), Qundef);
+ block_invoke(data, rb_ary_new2(0), Qundef, 0);
POP_FRAME();
POP_ITER();
}
@@ -6824,9 +6824,9 @@ block_alloc(klass, proc)
if ((proc && (ruby_block->flags & BLOCK_PROC)) ||
(!proc && !(ruby_block->flags & BLOCK_PROC)))
return ruby_block->block_obj;
+ ruby_block->flags &= ~BLOCK_PROC;
}
block = Data_Make_Struct(klass, struct BLOCK, blk_mark, blk_free, data);
- ruby_block->block_obj = block;
*data = *ruby_block;
data->orig_thread = rb_thread_current();
@@ -6850,7 +6850,11 @@ block_alloc(klass, proc)
}
scope_dup(data->scope);
block_save_safe_level(block);
- if (proc) data->flags |= BLOCK_PROC;
+ if (proc) {
+ data->flags |= BLOCK_PROC;
+ ruby_block->flags |= BLOCK_PROC;
+ }
+ ruby_block->block_obj = block;
return block;
}
@@ -6911,9 +6915,9 @@ block_orphan(data)
}
static VALUE
-block_invoke(block, args, self)
+block_invoke(block, args, self, klass)
VALUE block, args; /* OK */
- VALUE self;
+ VALUE self, klass;
{
struct BLOCK * volatile old_block;
struct BLOCK _block;
@@ -6941,7 +6945,8 @@ block_invoke(block, args, self)
/* PUSH BLOCK from data */
old_block = ruby_block;
_block = *data;
- _block.frame.self = self;
+ if (self != Qundef) _block.frame.self = self;
+ if (klass) _block.frame.last_class = klass;
ruby_block = &_block;
PUSH_ITER(ITER_CUR);
@@ -6999,7 +7004,7 @@ static VALUE
block_call(block, args)
VALUE block, args; /* OK */
{
- return block_invoke(block, args, Qundef);
+ return block_invoke(block, args, Qundef, 0);
}
static VALUE bmcall _((VALUE, VALUE));
diff --git a/io.c b/io.c
index 1377595050..3aceb78cbb 100644
--- a/io.c
+++ b/io.c
@@ -3446,16 +3446,16 @@ rb_f_syscall(argc, argv)
rb_raise(rb_eArgError, "too few arguments for syscall");
arg[0] = NUM2LONG(argv[0]); argv++;
while (items--) {
- if (FIXNUM_P(*argv)) {
- arg[i] = (unsigned long)NUM2LONG(*argv);
- }
- else {
- VALUE v = *argv;
+ VALUE v = rb_check_string_type(*argv);
+ if (!NIL_P(v)) {
StringValue(v);
rb_str_modify(v);
arg[i] = (unsigned long)RSTRING(v)->ptr;
}
+ else {
+ arg[i] = (unsigned long)NUM2LONG(*argv);
+ }
argv++;
i++;
}
diff --git a/lib/debug.rb b/lib/debug.rb
index 1b558ab90f..0caeecb00c 100644
--- a/lib/debug.rb
+++ b/lib/debug.rb
@@ -781,8 +781,8 @@ class << DEBUGGER__
saved_crit = Thread.critical
Thread.critical = true
make_thread_list
- for th in @thread_list
- context(th[0]).set_trace arg
+ for th, in @thread_list
+ context(th).set_trace arg
end
Thread.critical = saved_crit
arg
@@ -796,9 +796,9 @@ class << DEBUGGER__
saved_crit = Thread.critical
Thread.critical = true
make_thread_list
- for th in @thread_list
- next if th[0] == Thread.current
- context(th[0]).set_suspend
+ for th, in @thread_list
+ next if th == Thread.current
+ context(th).set_suspend
end
Thread.critical = saved_crit
# Schedule other threads to suspend as soon as possible.
@@ -809,9 +809,9 @@ class << DEBUGGER__
saved_crit = Thread.critical
Thread.critical = true
make_thread_list
- for th in @thread_list
- next if th[0] == Thread.current
- context(th[0]).clear_suspend
+ for th, in @thread_list
+ next if th == Thread.current
+ context(th).clear_suspend
end
waiting.each do |th|
th.run
diff --git a/lib/optparse.rb b/lib/optparse.rb
index de88b648ec..a5905d2d4b 100644
--- a/lib/optparse.rb
+++ b/lib/optparse.rb
@@ -414,7 +414,11 @@ summary feature.
pat = t if t.respond_to?(:match)
end
unless block
+<<<<<<< optparse.rb
+ block = pat.method(:convert).to_block if pat.respond_to?(:convert)
+=======
block = pat.method(:convert).to_block if pat.respond_to?(:convert)
+>>>>>>> 1.19
end
@atype[t] = [pat, block]
end
@@ -949,7 +953,11 @@ Default options, which never appear in option summary.
# directly specified pattern(any object possible to match)
if !(String === o) and o.respond_to?(:match)
pattern = notwice(o, pattern, 'pattern')
+<<<<<<< optparse.rb
+ conv = (pattern.method(:convert).to_block if pattern.respond_to?(:convert))
+=======
conv = (pattern.method(:convert).to_block if pattern.respond_to?(:convert))
+>>>>>>> 1.19
next
end
@@ -962,7 +970,11 @@ Default options, which never appear in option summary.
when CompletingHash
when nil
pattern = CompletingHash.new
+<<<<<<< optparse.rb
+ conv = (pattern.method(:convert).to_block if pattern.respond_to?(:convert))
+=======
conv = (pattern.method(:convert).to_block if pattern.respond_to?(:convert))
+>>>>>>> 1.19
else
raise ArgumentError, "argument pattern given twice"
end
diff --git a/marshal.c b/marshal.c
index a7800a9887..a0c4680a1e 100644
--- a/marshal.c
+++ b/marshal.c
@@ -1248,7 +1248,7 @@ r_object0(arg, proc)
break;
}
if (proc) {
- rb_funcall(proc, rb_intern("yield"), 1, v);
+ rb_funcall(proc, rb_intern("call"), 1, v);
}
return v;
}