summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--MANIFEST1
-rw-r--r--class.c2
-rw-r--r--range.c29
4 files changed, 30 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 50f2ad8..b204e48 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Thu Mar 12 15:33:57 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * range.c (range_s_new): check values by `first <= last'.
+
+ * parse.y (lastline_set): fixed offset for $_ and $~ in the local
+ variable space.
+
Wed Mar 11 02:14:17 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
* io.c (io_gets): handle normal case specially for speed.
diff --git a/MANIFEST b/MANIFEST
index 67c7d6d..b14a50f 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -168,6 +168,7 @@ sample/freq.rb
sample/from.rb
sample/fullpath.rb
sample/getopts.test
+sample/goodfriday.rb
sample/less.rb
sample/list.rb
sample/list2.rb
diff --git a/class.c b/class.c
index 757f901..37d094f 100644
--- a/class.c
+++ b/class.c
@@ -444,7 +444,7 @@ rb_undef_method(klass, name)
VALUE klass;
char *name;
{
- rb_add_method(klass, rb_intern(name), 0, NOEX_PUBLIC);
+ rb_add_method(klass, rb_intern(name), 0, NOEX_UNDEF);
}
VALUE
diff --git a/range.c b/range.c
index 06fef09..a3f8865 100644
--- a/range.c
+++ b/range.c
@@ -18,19 +18,32 @@ extern VALUE cNumeric;
static ID upto;
static VALUE
+range_check(args)
+ VALUE *args;
+{
+ VALUE v = rb_funcall(args[0], rb_intern("<="), 1, args[1]);
+
+ if (!RTEST(v)) {
+ Fail(""); /* no ascending values */
+ }
+ return Qnil;
+}
+
+static VALUE
+range_failed()
+{
+ ArgError("bad value for range");
+}
+
+static VALUE
range_s_new(klass, first, last)
VALUE klass, first, last;
{
VALUE obj;
+ VALUE args[2];
- if (!(FIXNUM_P(first) && FIXNUM_P(last))
- && (TYPE(first) != TYPE(last)
- || CLASS_OF(first) != CLASS_OF(last)
- || !rb_respond_to(first, upto))
- && !(obj_is_kind_of(first, cNumeric)
- && obj_is_kind_of(last, cNumeric))) {
- ArgError("bad value for range");
- }
+ args[0] = first; args[1] = last;
+ rb_rescue(range_check, args, range_failed, 0);
obj = obj_alloc(klass);