summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--doc/limitations.md2
-rw-r--r--include/mruby.h6
-rw-r--r--include/mruby/class.h2
-rw-r--r--include/mruby/numeric.h4
-rw-r--r--mrbgems/mruby-complex/mrblib/complex.rb2
-rw-r--r--mrbgems/mruby-io/mrblib/file.rb2
-rw-r--r--mrbgems/mruby-io/mrblib/io.rb4
-rw-r--r--mrbgems/mruby-io/test/io.rb4
-rw-r--r--mrbgems/mruby-kernel-ext/src/kernel.c2
-rw-r--r--mrbgems/mruby-math/src/math.c2
-rw-r--r--mrbgems/mruby-metaprog/test/metaprog.rb8
-rw-r--r--mrbgems/mruby-method/test/method.rb8
-rw-r--r--mrbgems/mruby-pack/src/pack.c8
-rw-r--r--mrbgems/mruby-random/test/random.rb4
-rw-r--r--mrbgems/mruby-range-ext/mrblib/range.rb2
-rw-r--r--mrbgems/mruby-rational/mrblib/rational.rb2
-rw-r--r--mrbgems/mruby-rational/src/rational.c2
-rw-r--r--mrbgems/mruby-rational/test/rational.rb12
-rw-r--r--mrbgems/mruby-socket/src/socket.c2
-rw-r--r--mrbgems/mruby-struct/src/struct.c4
-rw-r--r--mrblib/range.rb2
-rw-r--r--src/class.c6
-rw-r--r--src/gc.c2
-rw-r--r--src/kernel.c8
-rw-r--r--src/numeric.c78
-rw-r--r--src/string.c6
-rw-r--r--test/t/bs_literal.rb2
-rw-r--r--test/t/integer.rb2
-rw-r--r--test/t/kernel.rb2
-rw-r--r--test/t/module.rb2
-rw-r--r--test/t/vformat.rb6
31 files changed, 99 insertions, 99 deletions
diff --git a/doc/limitations.md b/doc/limitations.md
index 79979fd5a..7e58ca420 100644
--- a/doc/limitations.md
+++ b/doc/limitations.md
@@ -17,7 +17,7 @@ Please help to improve it by submitting your findings.
## `1/2` gives `0.5`
Since mruby does not have `Bignum`, bigger integers are represented
-by `Float` numbers. To enhance interoperability between `Fixnum`
+by `Float` numbers. To enhance interoperability between `Integer`
and `Float`, mruby provides `Float#upto` and other iterating
methods for the `Float` class. As a side effect, `1/2` gives `0.5`
not `0`.
diff --git a/include/mruby.h b/include/mruby.h
index 485a94d70..f07adbb13 100644
--- a/include/mruby.h
+++ b/include/mruby.h
@@ -248,7 +248,7 @@ typedef struct mrb_state {
#ifndef MRB_NO_FLOAT
struct RClass *float_class;
#endif
- struct RClass *fixnum_class;
+ struct RClass *integer_class;
struct RClass *true_class;
struct RClass *false_class;
struct RClass *nil_class;
@@ -890,8 +890,8 @@ MRB_API struct RClass* mrb_define_module_under_id(mrb_state *mrb, struct RClass
* | `s` | {String} | const char *, {mrb_int} | Receive two arguments; `s!` gives (`NULL`,`0`) for `nil` |
* | `z` | {String} | const char * | `NULL` terminated string; `z!` gives `NULL` for `nil` |
* | `a` | {Array} | {mrb_value} *, {mrb_int} | Receive two arguments; `a!` gives (`NULL`,`0`) for `nil` |
- * | `f` | {Fixnum}/{Float} | {mrb_float} | |
- * | `i` | {Fixnum}/{Float} | {mrb_int} | |
+ * | `f` | {Integer}/{Float} | {mrb_float} | |
+ * | `i` | {Integer}/{Float} | {mrb_int} | |
* | `b` | boolean | {mrb_bool} | |
* | `n` | {String}/{Symbol} | {mrb_sym} | |
* | `d` | data | void *, {mrb_data_type} const | 2nd argument will be used to check data type so it won't be modified; when `!` follows, the value may be `nil` |
diff --git a/include/mruby/class.h b/include/mruby/class.h
index a02c4ef17..b4b5454d5 100644
--- a/include/mruby/class.h
+++ b/include/mruby/class.h
@@ -36,7 +36,7 @@ mrb_class(mrb_state *mrb, mrb_value v)
case MRB_TT_SYMBOL:
return mrb->symbol_class;
case MRB_TT_FIXNUM:
- return mrb->fixnum_class;
+ return mrb->integer_class;
#ifndef MRB_NO_FLOAT
case MRB_TT_FLOAT:
return mrb->float_class;
diff --git a/include/mruby/numeric.h b/include/mruby/numeric.h
index 10b242688..b8cc5b50f 100644
--- a/include/mruby/numeric.h
+++ b/include/mruby/numeric.h
@@ -1,5 +1,5 @@
/**
-** @file mruby/numeric.h - Numeric, Integer, Float, Fixnum class
+** @file mruby/numeric.h - Numeric, Integer, Float class
**
** See Copyright Notice in mruby.h
*/
@@ -12,7 +12,7 @@
/**
* Numeric class and it's sub-classes.
*
- * Integer, Float and Fixnum
+ * Integer and Float
*/
MRB_BEGIN_DECL
diff --git a/mrbgems/mruby-complex/mrblib/complex.rb b/mrbgems/mruby-complex/mrblib/complex.rb
index 74c128a07..67f940865 100644
--- a/mrbgems/mruby-complex/mrblib/complex.rb
+++ b/mrbgems/mruby-complex/mrblib/complex.rb
@@ -104,7 +104,7 @@ class Complex < Numeric
alias_method :imag, :imaginary
- [Fixnum, Float].each do |cls|
+ [Integer, Float].each do |cls|
[:+, :-, :*, :/, :==].each do |op|
cls.instance_eval do
original_operator_name = :"__original_operator_#{op}_complex"
diff --git a/mrbgems/mruby-io/mrblib/file.rb b/mrbgems/mruby-io/mrblib/file.rb
index aa73252e1..9398acef6 100644
--- a/mrbgems/mruby-io/mrblib/file.rb
+++ b/mrbgems/mruby-io/mrblib/file.rb
@@ -2,7 +2,7 @@ class File < IO
attr_accessor :path
def initialize(fd_or_path, mode = "r", perm = 0666)
- if fd_or_path.kind_of? Fixnum
+ if fd_or_path.kind_of? Integer
super(fd_or_path, mode)
else
@path = fd_or_path
diff --git a/mrbgems/mruby-io/mrblib/io.rb b/mrbgems/mruby-io/mrblib/io.rb
index e597db886..034f88529 100644
--- a/mrbgems/mruby-io/mrblib/io.rb
+++ b/mrbgems/mruby-io/mrblib/io.rb
@@ -186,7 +186,7 @@ class IO
def read(length = nil, outbuf = "")
unless length.nil?
- unless length.is_a? Fixnum
+ unless length.is_a? Integer
raise TypeError.new "can't convert #{length.class} into Integer"
end
if length < 0
@@ -229,7 +229,7 @@ class IO
case arg
when String
rs = arg
- when Fixnum
+ when Integer
rs = "\n"
limit = arg
else
diff --git a/mrbgems/mruby-io/test/io.rb b/mrbgems/mruby-io/test/io.rb
index 2088a61e3..47c70cc60 100644
--- a/mrbgems/mruby-io/test/io.rb
+++ b/mrbgems/mruby-io/test/io.rb
@@ -7,7 +7,7 @@ $cr, $crlf, $cmd = MRubyIOTestUtil.win? ? [1, "\r\n", "cmd /c "] : [0, "\n", ""]
def assert_io_open(meth)
assert "assert_io_open" do
fd = IO.sysopen($mrbtest_io_rfname)
- assert_equal Fixnum, fd.class
+ assert_equal Integer, fd.class
io1 = IO.__send__(meth, fd)
begin
assert_equal IO, io1.class
@@ -433,7 +433,7 @@ assert('IO.popen') do
$? = nil
io = IO.popen("#{$cmd}echo mruby-io")
assert_true io.close_on_exec?
- assert_equal Fixnum, io.pid.class
+ assert_equal Integer, io.pid.class
out = io.read
assert_equal out.class, String
diff --git a/mrbgems/mruby-kernel-ext/src/kernel.c b/mrbgems/mruby-kernel-ext/src/kernel.c
index eaf8c6eb0..e738287db 100644
--- a/mrbgems/mruby-kernel-ext/src/kernel.c
+++ b/mrbgems/mruby-kernel-ext/src/kernel.c
@@ -84,7 +84,7 @@ mrb_f_method(mrb_state *mrb, mrb_value self)
* call-seq:
* Integer(arg,base=0) -> integer
*
- * Converts <i>arg</i> to a <code>Fixnum</code>.
+ * Converts <i>arg</i> to a <code>Integer</code>.
* Numeric types are converted directly (with floating point numbers
* being truncated). <i>base</i> (0, or between 2 and 36) is a base for
* integer string representation. If <i>arg</i> is a <code>String</code>,
diff --git a/mrbgems/mruby-math/src/math.c b/mrbgems/mruby-math/src/math.c
index fcde7e700..f2622109d 100644
--- a/mrbgems/mruby-math/src/math.c
+++ b/mrbgems/mruby-math/src/math.c
@@ -629,7 +629,7 @@ math_cbrt(mrb_state *mrb, mrb_value obj)
* Math.frexp(numeric) -> [ fraction, exponent ]
*
* Returns a two-element array containing the normalized fraction (a
- * <code>Float</code>) and exponent (a <code>Fixnum</code>) of
+ * <code>Float</code>) and exponent (a <code>Integer</code>) of
* <i>numeric</i>.
*
* fraction, exponent = Math.frexp(1234) #=> [0.6025390625, 11]
diff --git a/mrbgems/mruby-metaprog/test/metaprog.rb b/mrbgems/mruby-metaprog/test/metaprog.rb
index 82ba0a3a5..84f4e00a0 100644
--- a/mrbgems/mruby-metaprog/test/metaprog.rb
+++ b/mrbgems/mruby-metaprog/test/metaprog.rb
@@ -395,15 +395,15 @@ end
assert('alias_method and remove_method') do
begin
- Fixnum.alias_method :to_s_, :to_s
- Fixnum.remove_method :to_s
+ Integer.alias_method :to_s_, :to_s
+ Integer.remove_method :to_s
assert_nothing_raised do
# segfaults if mrb_cptr is used
1.to_s
end
ensure
- Fixnum.alias_method :to_s, :to_s_
- Fixnum.remove_method :to_s_
+ Integer.alias_method :to_s, :to_s_
+ Integer.remove_method :to_s_
end
end
diff --git a/mrbgems/mruby-method/test/method.rb b/mrbgems/mruby-method/test/method.rb
index 641979d71..123ae34be 100644
--- a/mrbgems/mruby-method/test/method.rb
+++ b/mrbgems/mruby-method/test/method.rb
@@ -77,7 +77,7 @@ end
assert 'instance' do
assert_kind_of Method, 1.method(:+)
- assert_kind_of UnboundMethod, Fixnum.instance_method(:+)
+ assert_kind_of UnboundMethod, Integer.instance_method(:+)
end
assert 'Method#call' do
@@ -404,9 +404,9 @@ assert 'UnboundMethod#arity' do
end
assert 'UnboundMethod#==' do
- assert_false(Fixnum.instance_method(:+) == Fixnum.instance_method(:-))
- assert_true(Fixnum.instance_method(:+) == Fixnum.instance_method(:+))
- assert_false(Fixnum.instance_method(:+) == Float.instance_method(:+))
+ assert_false(Integer.instance_method(:+) == Integer.instance_method(:-))
+ assert_true(Integer.instance_method(:+) == Integer.instance_method(:+))
+ assert_false(Integer.instance_method(:+) == Float.instance_method(:+))
assert_true(UnboundMethod.instance_method(:==) == UnboundMethod.instance_method(:eql?))
end
diff --git a/mrbgems/mruby-pack/src/pack.c b/mrbgems/mruby-pack/src/pack.c
index 45427afa0..f797b599b 100644
--- a/mrbgems/mruby-pack/src/pack.c
+++ b/mrbgems/mruby-pack/src/pack.c
@@ -290,7 +290,7 @@ unpack_l(mrb_state *mrb, const unsigned char *src, int srclen, mrb_value ary, un
#ifndef MRB_INT64
if (!FIXABLE(sl)) {
i32tostr(msg, sizeof(msg), sl);
- mrb_raisef(mrb, E_RANGE_ERROR, "cannot unpack to Fixnum: %s", msg);
+ mrb_raisef(mrb, E_RANGE_ERROR, "cannot unpack to Integer: %s", msg);
}
#endif
n = sl;
@@ -298,7 +298,7 @@ unpack_l(mrb_state *mrb, const unsigned char *src, int srclen, mrb_value ary, un
#ifndef MRB_INT64
if (!POSFIXABLE(ul)) {
u32tostr(msg, sizeof(msg), ul);
- mrb_raisef(mrb, E_RANGE_ERROR, "cannot unpack to Fixnum: %s", msg);
+ mrb_raisef(mrb, E_RANGE_ERROR, "cannot unpack to Integer: %s", msg);
}
#endif
n = ul;
@@ -411,13 +411,13 @@ unpack_q(mrb_state *mrb, const unsigned char *src, int srclen, mrb_value ary, un
int64_t sll = ull;
if (!FIXABLE(sll)) {
i64tostr(msg, sizeof(msg), sll);
- mrb_raisef(mrb, E_RANGE_ERROR, "cannot unpack to Fixnum: %s", msg);
+ mrb_raisef(mrb, E_RANGE_ERROR, "cannot unpack to Integer: %s", msg);
}
n = (mrb_int)sll;
} else {
if (!POSFIXABLE(ull)) {
u64tostr(msg, sizeof(msg), ull);
- mrb_raisef(mrb, E_RANGE_ERROR, "cannot unpack to Fixnum: %s", msg);
+ mrb_raisef(mrb, E_RANGE_ERROR, "cannot unpack to Integer: %s", msg);
}
n = (mrb_int)ull;
}
diff --git a/mrbgems/mruby-random/test/random.rb b/mrbgems/mruby-random/test/random.rb
index cf4a55141..f3067748b 100644
--- a/mrbgems/mruby-random/test/random.rb
+++ b/mrbgems/mruby-random/test/random.rb
@@ -32,8 +32,8 @@ assert("Random.srand") do
end
assert("return class of Kernel.rand") do
- assert_kind_of(Fixnum, rand(3))
- assert_kind_of(Fixnum, rand(1.5))
+ assert_kind_of(Integer, rand(3))
+ assert_kind_of(Integer, rand(1.5))
assert_kind_of(Float, rand)
assert_kind_of(Float, rand(0.5))
end
diff --git a/mrbgems/mruby-range-ext/mrblib/range.rb b/mrbgems/mruby-range-ext/mrblib/range.rb
index a213beb57..fadddc343 100644
--- a/mrbgems/mruby-range-ext/mrblib/range.rb
+++ b/mrbgems/mruby-range-ext/mrblib/range.rb
@@ -33,7 +33,7 @@ class Range
# fast path for numerics
if val.kind_of?(Numeric) && last.kind_of?(Numeric)
- raise TypeError if exclude_end? && !last.kind_of?(Fixnum)
+ raise TypeError if exclude_end? && !last.kind_of?(Integer)
return nil if val > last
return nil if val == last && exclude_end?
diff --git a/mrbgems/mruby-rational/mrblib/rational.rb b/mrbgems/mruby-rational/mrblib/rational.rb
index b65f77e2f..489d89ebd 100644
--- a/mrbgems/mruby-rational/mrblib/rational.rb
+++ b/mrbgems/mruby-rational/mrblib/rational.rb
@@ -92,7 +92,7 @@ module Kernel
[:+, :-, :*, :/, :<=>, :==, :<, :<=, :>, :>=].each do |op|
original_operator_name = :"__original_operator_#{op}_rational"
- Fixnum.instance_eval do
+ Integer.instance_eval do
alias_method original_operator_name, op
define_method op do |rhs|
if rhs.is_a? Rational
diff --git a/mrbgems/mruby-rational/src/rational.c b/mrbgems/mruby-rational/src/rational.c
index f9470de86..fcaba3df5 100644
--- a/mrbgems/mruby-rational/src/rational.c
+++ b/mrbgems/mruby-rational/src/rational.c
@@ -200,7 +200,7 @@ void mrb_mruby_rational_gem_init(mrb_state *mrb)
mrb_define_method(mrb, rat, "to_i", rational_to_i, MRB_ARGS_NONE());
mrb_define_method(mrb, rat, "to_r", rational_to_r, MRB_ARGS_NONE());
mrb_define_method(mrb, rat, "negative?", rational_negative_p, MRB_ARGS_NONE());
- mrb_define_method(mrb, mrb->fixnum_class, "to_r", fix_to_r, MRB_ARGS_NONE());
+ mrb_define_method(mrb, mrb->integer_class, "to_r", fix_to_r, MRB_ARGS_NONE());
}
void
diff --git a/mrbgems/mruby-rational/test/rational.rb b/mrbgems/mruby-rational/test/rational.rb
index a8ebb8ea2..3fb4e4e82 100644
--- a/mrbgems/mruby-rational/test/rational.rb
+++ b/mrbgems/mruby-rational/test/rational.rb
@@ -143,7 +143,7 @@ assert 'Rational#==, Rational#!=' do
assert_equal_rational(false, 1r, ComplexLikeNumeric.new(2))
end
-assert 'Fixnum#==(Rational), Fixnum#!=(Rational)' do
+assert 'Integer#==(Rational), Integer#!=(Rational)' do
assert_equal_rational(true, 2, Rational(4,2))
assert_equal_rational(true, -2, Rational(-4,2))
assert_equal_rational(true, -2, Rational(4,-2))
@@ -186,7 +186,7 @@ assert 'Rational#<=>' do
assert_raise(NoMethodError) { 1r <=> ComplexLikeNumeric.new(2) }
end
-assert 'Fixnum#<=>(Rational)' do
+assert 'Integer#<=>(Rational)' do
assert_cmp(-1, -2, Rational(-9,5))
assert_cmp(0, 5, 5r)
assert_cmp(1, 3, Rational(8,3))
@@ -210,7 +210,7 @@ assert 'Rational#<' do
assert_raise(ArgumentError) { 1r < "2" }
end
-assert 'Fixnum#<(Rational)' do
+assert 'Integer#<(Rational)' do
assert_not_operator(1, :<, Rational(2,3))
assert_not_operator(2, :<, 2r)
assert_operator(-3, :<, Rational(2,3))
@@ -234,7 +234,7 @@ assert 'Rational#<=' do
assert_raise(ArgumentError) { 1r <= "2" }
end
-assert 'Fixnum#<=(Rational)' do
+assert 'Integer#<=(Rational)' do
assert_not_operator(1, :<=, Rational(2,3))
assert_operator(2, :<=, 2r)
assert_operator(-3, :<=, Rational(2,3))
@@ -258,7 +258,7 @@ assert 'Rational#>' do
assert_raise(ArgumentError) { 1r > "2" }
end
-assert 'Fixnum#>(Rational)' do
+assert 'Integer#>(Rational)' do
assert_operator(1, :>, Rational(2,3))
assert_not_operator(2, :>, 2r)
assert_not_operator(-3, :>, Rational(2,3))
@@ -282,7 +282,7 @@ assert 'Rational#>=' do
assert_raise(ArgumentError) { 1r >= "2" }
end
-assert 'Fixnum#>=(Rational)' do
+assert 'Integer#>=(Rational)' do
assert_operator(1, :>=, Rational(2,3))
assert_operator(2, :>=, 2r)
assert_not_operator(-3, :>=, Rational(2,3))
diff --git a/mrbgems/mruby-socket/src/socket.c b/mrbgems/mruby-socket/src/socket.c
index 001021b81..6542c1603 100644
--- a/mrbgems/mruby-socket/src/socket.c
+++ b/mrbgems/mruby-socket/src/socket.c
@@ -145,7 +145,7 @@ mrb_addrinfo_getaddrinfo(mrb_state *mrb, mrb_value klass)
} else if (mrb_nil_p(service)) {
servname = NULL;
} else {
- mrb_raise(mrb, E_TYPE_ERROR, "service must be String, Fixnum, or nil");
+ mrb_raise(mrb, E_TYPE_ERROR, "service must be String, Integer, or nil");
}
memset(&hints, 0, sizeof(hints));
diff --git a/mrbgems/mruby-struct/src/struct.c b/mrbgems/mruby-struct/src/struct.c
index 4f50fe5dd..423cf99a5 100644
--- a/mrbgems/mruby-struct/src/struct.c
+++ b/mrbgems/mruby-struct/src/struct.c
@@ -604,8 +604,8 @@ mrb_struct_eql(mrb_state *mrb, mrb_value s)
/*
* call-seq:
- * struct.length -> Fixnum
- * struct.size -> Fixnum
+ * struct.length -> Integer
+ * struct.size -> Integer
*
* Returns number of struct members.
*/
diff --git a/mrblib/range.rb b/mrblib/range.rb
index 392cc2274..9f94f35d1 100644
--- a/mrblib/range.rb
+++ b/mrblib/range.rb
@@ -15,7 +15,7 @@ class Range
val = self.first
last = self.last
- if val.kind_of?(Fixnum) && last.kind_of?(Fixnum) # fixnums are special
+ if val.kind_of?(Integer) && last.kind_of?(Integer) # fixnums are special
lim = last
lim += 1 unless exclude_end?
i = val
diff --git a/src/class.c b/src/class.c
index 845246e97..df33feffb 100644
--- a/src/class.c
+++ b/src/class.c
@@ -638,8 +638,8 @@ void mrb_hash_check_kdict(mrb_state *mrb, mrb_value self);
z: String [const char*] NUL terminated string; z! gives NULL for nil
a: Array [mrb_value*,mrb_int] Receive two arguments; a! gives (NULL,0) for nil
c: Class/Module [strcut RClass*]
- f: Fixnum/Float [mrb_float]
- i: Fixnum/Float [mrb_int]
+ f: Integer/Float [mrb_float]
+ i: Integer/Float [mrb_int]
b: boolean [mrb_bool]
n: String/Symbol [mrb_sym]
d: data [void*,mrb_data_type const] 2nd argument will be used to check data type so it won't be modified; when ! follows, the value may be nil
@@ -1874,7 +1874,7 @@ mrb_module_new(mrb_state *mrb)
* called with an explicit receiver, as <code>class</code> is also a
* reserved word in Ruby.
*
- * 1.class #=> Fixnum
+ * 1.class #=> Integer
* self.class #=> Object
*/
diff --git a/src/gc.c b/src/gc.c
index 50269f95c..fd472217e 100644
--- a/src/gc.c
+++ b/src/gc.c
@@ -932,7 +932,7 @@ root_scan_phase(mrb_state *mrb, mrb_gc *gc)
#ifndef MRB_NO_FLOAT
mrb_gc_mark(mrb, (struct RBasic*)mrb->float_class);
#endif
- mrb_gc_mark(mrb, (struct RBasic*)mrb->fixnum_class);
+ mrb_gc_mark(mrb, (struct RBasic*)mrb->integer_class);
mrb_gc_mark(mrb, (struct RBasic*)mrb->true_class);
mrb_gc_mark(mrb, (struct RBasic*)mrb->false_class);
mrb_gc_mark(mrb, (struct RBasic*)mrb->nil_class);
diff --git a/src/kernel.c b/src/kernel.c
index 020bce226..699c681d7 100644
--- a/src/kernel.c
+++ b/src/kernel.c
@@ -209,7 +209,7 @@ mrb_f_block_given_p_m(mrb_state *mrb, mrb_value self)
* called with an explicit receiver, as <code>class</code> is also a
* reserved word in Ruby.
*
- * 1.class #=> Fixnum
+ * 1.class #=> Integer
* self.class #=> Object
*/
static mrb_value
@@ -341,7 +341,7 @@ init_copy(mrb_state *mrb, mrb_value dest, mrb_value obj)
* behavior will be documented under the #+initialize_copy+ method of
* the class.
*
- * Some Class(True False Nil Symbol Fixnum Float) Object cannot clone.
+ * Some Class(True False Nil Symbol Integer Float) Object cannot clone.
*/
MRB_API mrb_value
mrb_obj_clone(mrb_state *mrb, mrb_value self)
@@ -480,11 +480,11 @@ mrb_obj_frozen(mrb_state *mrb, mrb_value self)
* call-seq:
* obj.hash -> fixnum
*
- * Generates a <code>Fixnum</code> hash value for this object. This
+ * Generates a <code>Integer</code> hash value for this object. This
* function must have the property that <code>a.eql?(b)</code> implies
* <code>a.hash == b.hash</code>. The hash value is used by class
* <code>Hash</code>. Any hash value that exceeds the capacity of a
- * <code>Fixnum</code> will be truncated before being used.
+ * <code>Integer</code> will be truncated before being used.
*/
static mrb_value
mrb_obj_hash(mrb_state *mrb, mrb_value self)
diff --git a/src/numeric.c b/src/numeric.c
index f4ad116a4..40114c07d 100644
--- a/src/numeric.c
+++ b/src/numeric.c
@@ -1,5 +1,5 @@
/*
-** numeric.c - Numeric, Integer, Float, Fixnum class
+** numeric.c - Numeric, Integer, Float class
**
** See Copyright Notice in mruby.h
*/
@@ -378,7 +378,7 @@ flo_mod(mrb_state *mrb, mrb_value x)
* (1.0).eql?(1.0) #=> true
*/
static mrb_value
-fix_eql(mrb_state *mrb, mrb_value x)
+int_eql(mrb_state *mrb, mrb_value x)
{
mrb_value y = mrb_get_arg1(mrb);
@@ -771,8 +771,7 @@ flo_nan_p(mrb_state *mrb, mrb_value num)
/*
* Document-class: Integer
*
- * <code>Integer</code> is the basis for the two concrete classes that
- * hold whole numbers, <code>Bignum</code> and <code>Fixnum</code>.
+ * <code>Integer</code> is hold whole numbers.
*
*/
@@ -842,7 +841,7 @@ mrb_num_mul(mrb_state *mrb, mrb_value x, mrb_value y)
*/
static mrb_value
-fix_mul(mrb_state *mrb, mrb_value x)
+int_mul(mrb_state *mrb, mrb_value x)
{
mrb_value y = mrb_get_arg1(mrb);
@@ -888,7 +887,7 @@ fixdivmod(mrb_state *mrb, mrb_int x, mrb_int y, mrb_int *divp, mrb_int *modp)
*/
static mrb_value
-fix_mod(mrb_state *mrb, mrb_value x)
+int_mod(mrb_state *mrb, mrb_value x)
{
mrb_value y = mrb_get_arg1(mrb);
mrb_int a, b;
@@ -929,7 +928,7 @@ fix_mod(mrb_state *mrb, mrb_value x)
* See <code>Numeric#divmod</code>.
*/
static mrb_value
-fix_divmod(mrb_state *mrb, mrb_value x)
+int_divmod(mrb_state *mrb, mrb_value x)
{
mrb_value y = mrb_get_arg1(mrb);
@@ -992,7 +991,7 @@ flo_divmod(mrb_state *mrb, mrb_value x)
*/
static mrb_value
-fix_equal(mrb_state *mrb, mrb_value x)
+int_equal(mrb_state *mrb, mrb_value x)
{
mrb_value y = mrb_get_arg1(mrb);
@@ -1020,7 +1019,7 @@ fix_equal(mrb_state *mrb, mrb_value x)
*/
static mrb_value
-fix_rev(mrb_state *mrb, mrb_value num)
+int_rev(mrb_state *mrb, mrb_value num)
{
mrb_int val = mrb_fixnum(num);
@@ -1050,7 +1049,7 @@ static mrb_value flo_xor(mrb_state *mrb, mrb_value x);
*/
static mrb_value
-fix_and(mrb_state *mrb, mrb_value x)
+int_and(mrb_state *mrb, mrb_value x)
{
mrb_value y = mrb_get_arg1(mrb);
@@ -1066,7 +1065,7 @@ fix_and(mrb_state *mrb, mrb_value x)
*/
static mrb_value
-fix_or(mrb_state *mrb, mrb_value x)
+int_or(mrb_state *mrb, mrb_value x)
{
mrb_value y = mrb_get_arg1(mrb);
@@ -1082,7 +1081,7 @@ fix_or(mrb_state *mrb, mrb_value x)
*/
static mrb_value
-fix_xor(mrb_state *mrb, mrb_value x)
+int_xor(mrb_state *mrb, mrb_value x)
{
mrb_value y = mrb_get_arg1(mrb);
@@ -1160,7 +1159,7 @@ rshift(mrb_int val, mrb_int width)
*/
static mrb_value
-fix_lshift(mrb_state *mrb, mrb_value x)
+int_lshift(mrb_state *mrb, mrb_value x)
{
mrb_int width, val;
@@ -1185,7 +1184,7 @@ fix_lshift(mrb_state *mrb, mrb_value x)
*/
static mrb_value
-fix_rshift(mrb_state *mrb, mrb_value x)
+int_rshift(mrb_state *mrb, mrb_value x)
{
mrb_int width, val;
@@ -1212,7 +1211,7 @@ fix_rshift(mrb_state *mrb, mrb_value x)
#ifndef MRB_NO_FLOAT
static mrb_value
-fix_to_f(mrb_state *mrb, mrb_value num)
+int_to_f(mrb_state *mrb, mrb_value num)
{
return mrb_float_value(mrb, (mrb_float)mrb_fixnum(num));
}
@@ -1305,7 +1304,7 @@ mrb_num_plus(mrb_state *mrb, mrb_value x, mrb_value y)
* result.
*/
static mrb_value
-fix_plus(mrb_state *mrb, mrb_value self)
+int_plus(mrb_state *mrb, mrb_value self)
{
mrb_value other = mrb_get_arg1(mrb);
@@ -1362,7 +1361,7 @@ mrb_num_minus(mrb_state *mrb, mrb_value x, mrb_value y)
* result.
*/
static mrb_value
-fix_minus(mrb_state *mrb, mrb_value self)
+int_minus(mrb_state *mrb, mrb_value self)
{
mrb_value other = mrb_get_arg1(mrb);
@@ -1419,7 +1418,7 @@ mrb_fixnum_to_str(mrb_state *mrb, mrb_value x, mrb_int base)
*
*/
static mrb_value
-fix_to_s(mrb_state *mrb, mrb_value self)
+int_to_s(mrb_state *mrb, mrb_value self)
{
mrb_int base = 10;
@@ -1599,7 +1598,7 @@ flo_plus(mrb_state *mrb, mrb_value x)
void
mrb_init_numeric(mrb_state *mrb)
{
- struct RClass *numeric, *integer, *fixnum, *integral;
+ struct RClass *numeric, *integer, *integral;
#ifndef MRB_NO_FLOAT
struct RClass *fl;
#endif
@@ -1622,7 +1621,7 @@ mrb_init_numeric(mrb_state *mrb)
mrb_define_method(mrb, numeric, "infinite?",num_infinite_p, MRB_ARGS_NONE());
/* Integer Class */
- integer = mrb_define_class(mrb, "Integer", numeric); /* 15.2.8 */
+ mrb->integer_class = integer = mrb_define_class(mrb, "Integer", numeric); /* 15.2.8 */
MRB_SET_INSTANCE_TT(integer, MRB_TT_FIXNUM);
mrb_undef_class_method(mrb, integer, "new");
mrb_define_method(mrb, integer, "to_i", int_to_i, MRB_ARGS_NONE()); /* 15.2.8.3.24 */
@@ -1634,26 +1633,27 @@ mrb_init_numeric(mrb_state *mrb)
mrb_define_method(mrb, integer, "truncate", int_to_i, MRB_ARGS_NONE()); /* 15.2.8.3.15 (x) */
#endif
- /* Fixnum Class */
- mrb->fixnum_class = fixnum = mrb_define_class(mrb, "Fixnum", integer);
- mrb_define_method(mrb, fixnum, "+", fix_plus, MRB_ARGS_REQ(1)); /* 15.2.8.3.1 */
- mrb_define_method(mrb, fixnum, "-", fix_minus, MRB_ARGS_REQ(1)); /* 15.2.8.3.2 */
- mrb_define_method(mrb, fixnum, "*", fix_mul, MRB_ARGS_REQ(1)); /* 15.2.8.3.3 */
- mrb_define_method(mrb, fixnum, "%", fix_mod, MRB_ARGS_REQ(1)); /* 15.2.8.3.5 */
- mrb_define_method(mrb, fixnum, "==", fix_equal, MRB_ARGS_REQ(1)); /* 15.2.8.3.7 */
- mrb_define_method(mrb, fixnum, "~", fix_rev, MRB_ARGS_NONE()); /* 15.2.8.3.8 */
- mrb_define_method(mrb, fixnum, "&", fix_and, MRB_ARGS_REQ(1)); /* 15.2.8.3.9 */
- mrb_define_method(mrb, fixnum, "|", fix_or, MRB_ARGS_REQ(1)); /* 15.2.8.3.10 */
- mrb_define_method(mrb, fixnum, "^", fix_xor, MRB_ARGS_REQ(1)); /* 15.2.8.3.11 */
- mrb_define_method(mrb, fixnum, "<<", fix_lshift, MRB_ARGS_REQ(1)); /* 15.2.8.3.12 */
- mrb_define_method(mrb, fixnum, ">>", fix_rshift, MRB_ARGS_REQ(1)); /* 15.2.8.3.13 */
- mrb_define_method(mrb, fixnum, "eql?", fix_eql, MRB_ARGS_REQ(1)); /* 15.2.8.3.16 */
-#ifndef MRB_NO_FLOAT
- mrb_define_method(mrb, fixnum, "to_f", fix_to_f, MRB_ARGS_NONE()); /* 15.2.8.3.23 */
+ mrb_define_method(mrb, integer, "+", int_plus, MRB_ARGS_REQ(1)); /* 15.2.8.3.1 */
+ mrb_define_method(mrb, integer, "-", int_minus, MRB_ARGS_REQ(1)); /* 15.2.8.3.2 */
+ mrb_define_method(mrb, integer, "*", int_mul, MRB_ARGS_REQ(1)); /* 15.2.8.3.3 */
+ mrb_define_method(mrb, integer, "%", int_mod, MRB_ARGS_REQ(1)); /* 15.2.8.3.5 */
+ mrb_define_method(mrb, integer, "==", int_equal, MRB_ARGS_REQ(1)); /* 15.2.8.3.7 */
+ mrb_define_method(mrb, integer, "~", int_rev, MRB_ARGS_NONE()); /* 15.2.8.3.8 */
+ mrb_define_method(mrb, integer, "&", int_and, MRB_ARGS_REQ(1)); /* 15.2.8.3.9 */
+ mrb_define_method(mrb, integer, "|", int_or, MRB_ARGS_REQ(1)); /* 15.2.8.3.10 */
+ mrb_define_method(mrb, integer, "^", int_xor, MRB_ARGS_REQ(1)); /* 15.2.8.3.11 */
+ mrb_define_method(mrb, integer, "<<", int_lshift, MRB_ARGS_REQ(1)); /* 15.2.8.3.12 */
+ mrb_define_method(mrb, integer, ">>", int_rshift, MRB_ARGS_REQ(1)); /* 15.2.8.3.13 */
+ mrb_define_method(mrb, integer, "eql?", int_eql, MRB_ARGS_REQ(1)); /* 15.2.8.3.16 */
+#ifndef MRB_WITHOUT_FLOAT
+ mrb_define_method(mrb, integer, "to_f", int_to_f, MRB_ARGS_NONE()); /* 15.2.8.3.23 */
#endif
- mrb_define_method(mrb, fixnum, "to_s", fix_to_s, MRB_ARGS_OPT(1)); /* 15.2.8.3.25 */
- mrb_define_method(mrb, fixnum, "inspect", fix_to_s, MRB_ARGS_OPT(1));
- mrb_define_method(mrb, fixnum, "divmod", fix_divmod, MRB_ARGS_REQ(1)); /* 15.2.8.3.30 (x) */
+ mrb_define_method(mrb, integer, "to_s", int_to_s, MRB_ARGS_OPT(1)); /* 15.2.8.3.25 */
+ mrb_define_method(mrb, integer, "inspect", int_to_s, MRB_ARGS_OPT(1));
+ mrb_define_method(mrb, integer, "divmod", int_divmod, MRB_ARGS_REQ(1)); /* 15.2.8.3.30 (x) */
+
+ /* Fixnum Class for compatibility */
+ mrb_define_const(mrb, mrb->object_class, "Fixnum", mrb_obj_value(integer));
#ifndef MRB_NO_FLOAT
/* Float Class */
diff --git a/src/string.c b/src/string.c
index f15770403..a8dfb5503 100644
--- a/src/string.c
+++ b/src/string.c
@@ -1186,7 +1186,7 @@ range_arg:
break;
}
- mrb_raise(mrb, E_TYPE_ERROR, "can't convert to Fixnum");
+ mrb_raise(mrb, E_TYPE_ERROR, "can't convert to Integer");
}
}
return STR_OUT_OF_RANGE;
@@ -1230,8 +1230,8 @@ mrb_str_aref(mrb_state *mrb, mrb_value str, mrb_value indx, mrb_value alen)
* str.slice(range) => new_str or nil
* str.slice(other_str) => new_str or nil
*
- * Element Reference---If passed a single <code>Fixnum</code>, returns the code
- * of the character at that position. If passed two <code>Fixnum</code>
+ * Element Reference---If passed a single <code>Integer</code>, returns the code
+ * of the character at that position. If passed two <code>Integer</code>
* objects, returns a substring starting at the offset given by the first, and
* a length given by the second. If given a range, a substring containing
* characters at offsets given by the range is returned. In all three cases, if
diff --git a/test/t/bs_literal.rb b/test/t/bs_literal.rb
index c6c38140b..d60957f0b 100644
--- a/test/t/bs_literal.rb
+++ b/test/t/bs_literal.rb
@@ -34,5 +34,5 @@ assert('BS Literal 8') do
end
assert('BS Literal 9') do
- assert_equal Fixnum, 1234.class
+ assert_equal Integer, 1234.class
end
diff --git a/test/t/integer.rb b/test/t/integer.rb
index f9c44a64f..620ec94d3 100644
--- a/test/t/integer.rb
+++ b/test/t/integer.rb
@@ -156,7 +156,7 @@ assert('Integer#<<', '15.2.8.3.12') do
skip unless Object.const_defined?(:Float)
- # Overflow to Fixnum
+ # Overflow to Integer
assert_float 9223372036854775808.0, 1 << 63
assert_float(-13835058055282163712.0, -3 << 62)
end
diff --git a/test/t/kernel.rb b/test/t/kernel.rb
index 606150147..cab1ddd3d 100644
--- a/test/t/kernel.rb
+++ b/test/t/kernel.rb
@@ -76,7 +76,7 @@ assert('Kernel.raise', '15.3.1.2.12') do
end
assert('Kernel#__id__', '15.3.1.3.3') do
- assert_equal Fixnum, __id__.class
+ assert_equal Integer, __id__.class
end
assert('Kernel#__send__', '15.3.1.3.4') do
diff --git a/test/t/module.rb b/test/t/module.rb
index 12b7f1344..2957dec52 100644
--- a/test/t/module.rb
+++ b/test/t/module.rb
@@ -593,7 +593,7 @@ end
# to_f / other
# end
# end
- # Fixnum.send(:prepend, M)
+ # Integer.send(:prepend, M)
# assert_equal(0.5, 1 / 2, "#{bug7983}")
# }
# assert_equal(0, 1 / 2)
diff --git a/test/t/vformat.rb b/test/t/vformat.rb
index df6950ee6..f645351ee 100644
--- a/test/t/vformat.rb
+++ b/test/t/vformat.rb
@@ -17,7 +17,7 @@ assert('mrb_vformat') do
assert_equal '`t`: NilClass', vf.v('`t`: %t', nil)
assert_equal '`t`: FalseClass', vf.v('`t`: %t', false)
assert_equal '`t`: TrueClass', vf.v('`t`: %t', true)
- assert_equal '`t`: Fixnum', vf.v('`t`: %t', 0)
+ assert_equal '`t`: Integer', vf.v('`t`: %t', 0)
assert_equal '`t`: Hash', vf.v('`t`: %t', {k: "value"})
assert_match '#<Class:#<Class:#<Hash:0x*>>>', vf.v('%t', sclass({}))
assert_equal 'string and length', vf.l('string %l length', 'andante', 3)
@@ -29,13 +29,13 @@ assert('mrb_vformat') do
assert_equal '`T`: NilClass', vf.v('`T`: %T', nil)
assert_equal '`T`: FalseClass', vf.v('`T`: %T', false)
assert_equal '`T`: TrueClass', vf.v('`T`: %T', true)
- assert_equal '`T`: Fixnum', vf.v('`T`: %T', 0)
+ assert_equal '`T`: Integer', vf.v('`T`: %T', 0)
assert_equal '`T`: Hash', vf.v('`T`: %T', {k: "value"})
assert_match 'Class', vf.v('%T', sclass({}))
assert_equal '`Y`: nil', vf.v('`Y`: %Y', nil)
assert_equal '`Y`: false', vf.v('`Y`: %Y', false)
assert_equal '`Y`: true', vf.v('`Y`: %Y', true)
- assert_equal '`Y`: Fixnum', vf.v('`Y`: %Y', 0)
+ assert_equal '`Y`: Integer', vf.v('`Y`: %Y', 0)
assert_equal '`Y`: Hash', vf.v('`Y`: %Y', {k: "value"})
assert_equal 'Class', vf.v('%Y', sclass({}))
assert_match '#<Class:#<String:0x*>>', vf.v('%v', sclass(""))