1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@209 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 1998-05-13 07:26:47 +00:00
parent ad592443af
commit ae2fe781dd
42 changed files with 953 additions and 364 deletions

View file

@ -12,6 +12,7 @@
#include "ruby.h"
#include <math.h>
#include <stdio.h>
static ID coerce;
static ID to_i;
@ -42,12 +43,14 @@ num_coerce(x, y)
return assoc_new(rb_Float(x), rb_Float(y));
}
static VALUE
coerce_body(x)
VALUE *x;
{
return rb_funcall(x[1], coerce, 1, x[0]);
}
static VALUE
coerce_rescue(x)
VALUE *x;
{
@ -66,7 +69,7 @@ do_coerce(x, y)
VALUE a[2];
a[0] = *x; a[1] = *y;
ary = rb_rescue(coerce_body, a, coerce_rescue, a);
ary = rb_rescue(coerce_body, (VALUE)a, coerce_rescue, (VALUE)a);
if (TYPE(ary) != T_ARRAY || RARRAY(ary)->len != 2) {
TypeError("coerce must return [x, y]");
}