summaryrefslogtreecommitdiff
path: root/compar.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-01-20 04:59:39 (GMT)
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-01-20 04:59:39 (GMT)
commit210367ec889f5910e270d6ea2c7ddb8a8d939e61 (patch)
treefeb35473da45947378fbc02defe39bcd79ef600e /compar.c
parent9c5b1986a36c7a700b4c76817e35aa874ba7907c (diff)
This commit was generated by cvs2svn to compensate for changes in r372,
which included commits to RCS files with non-trunk default branches. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@373 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compar.c')
-rw-r--r--compar.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/compar.c b/compar.c
index e852fb1..a6212a8 100644
--- a/compar.c
+++ b/compar.c
@@ -6,13 +6,13 @@
$Date$
created at: Thu Aug 26 14:39:48 JST 1993
- Copyright (C) 1993-1996 Yukihiro Matsumoto
+ Copyright (C) 1993-1998 Yukihiro Matsumoto
************************************************/
#include "ruby.h"
-VALUE mComparable;
+VALUE rb_mComparable;
static ID cmp;
@@ -23,8 +23,8 @@ cmp_eq(x, y)
VALUE c = rb_funcall(x, cmp, 1, y);
int t = NUM2INT(c);
- if (t == 0) return TRUE;
- return FALSE;
+ if (t == 0) return Qtrue;
+ return Qfalse;
}
static VALUE
@@ -34,8 +34,8 @@ cmp_gt(x, y)
VALUE c = rb_funcall(x, cmp, 1, y);
int t = NUM2INT(c);
- if (t > 0) return TRUE;
- return FALSE;
+ if (t > 0) return Qtrue;
+ return Qfalse;
}
static VALUE
@@ -45,8 +45,8 @@ cmp_ge(x, y)
VALUE c = rb_funcall(x, cmp, 1, y);
int t = NUM2INT(c);
- if (t >= 0) return TRUE;
- return FALSE;
+ if (t >= 0) return Qtrue;
+ return Qfalse;
}
static VALUE
@@ -56,8 +56,8 @@ cmp_lt(x, y)
VALUE c = rb_funcall(x, cmp, 1, y);
int t = NUM2INT(c);
- if (t < 0) return TRUE;
- return FALSE;
+ if (t < 0) return Qtrue;
+ return Qfalse;
}
static VALUE
@@ -67,8 +67,8 @@ cmp_le(x, y)
VALUE c = rb_funcall(x, cmp, 1, y);
int t = NUM2INT(c);
- if (t <= 0) return TRUE;
- return FALSE;
+ if (t <= 0) return Qtrue;
+ return Qfalse;
}
static VALUE
@@ -76,25 +76,25 @@ cmp_between(x, min, max)
VALUE x, min, max;
{
VALUE c = rb_funcall(x, cmp, 1, min);
- int t = NUM2INT(c);
- if (t < 0) return FALSE;
+ long t = NUM2LONG(c);
+ if (t < 0) return Qfalse;
c = rb_funcall(x, cmp, 1, max);
- t = NUM2INT(c);
- if (t > 0) return FALSE;
- return TRUE;
+ t = NUM2LONG(c);
+ if (t > 0) return Qfalse;
+ return Qtrue;
}
void
Init_Comparable()
{
- mComparable = rb_define_module("Comparable");
- rb_define_method(mComparable, "==", cmp_eq, 1);
- rb_define_method(mComparable, ">", cmp_gt, 1);
- rb_define_method(mComparable, ">=", cmp_ge, 1);
- rb_define_method(mComparable, "<", cmp_lt, 1);
- rb_define_method(mComparable, "<=", cmp_le, 1);
- rb_define_method(mComparable, "between?", cmp_between, 2);
+ rb_mComparable = rb_define_module("Comparable");
+ rb_define_method(rb_mComparable, "==", cmp_eq, 1);
+ rb_define_method(rb_mComparable, ">", cmp_gt, 1);
+ rb_define_method(rb_mComparable, ">=", cmp_ge, 1);
+ rb_define_method(rb_mComparable, "<", cmp_lt, 1);
+ rb_define_method(rb_mComparable, "<=", cmp_le, 1);
+ rb_define_method(rb_mComparable, "between?", cmp_between, 2);
cmp = rb_intern("<=>");
}