Rename `MRB_TT_FIXNUM` to `MRB_TT_INTEGER`.

We still have `#define MRB_TT_FIXNUM MRB_TT_INTEGER` for compatibility.
parent 86726889
......@@ -104,7 +104,7 @@ mrb_val_union(mrb_value v)
#define SET_FALSE_VALUE(r) BOXNAN_SET_VALUE(r, MRB_TT_FALSE, i, 1)
#define SET_TRUE_VALUE(r) BOXNAN_SET_VALUE(r, MRB_TT_TRUE, i, 1)
#define SET_BOOL_VALUE(r,b) BOXNAN_SET_VALUE(r, b ? MRB_TT_TRUE : MRB_TT_FALSE, i, 1)
#define SET_INT_VALUE(r,n) BOXNAN_SET_VALUE(r, MRB_TT_FIXNUM, i, (uint32_t)(n))
#define SET_INT_VALUE(r,n) BOXNAN_SET_VALUE(r, MRB_TT_INTEGER, i, (uint32_t)(n))
#define SET_SYM_VALUE(r,v) BOXNAN_SET_VALUE(r, MRB_TT_SYMBOL, i, (uint32_t)(v))
#define SET_OBJ_VALUE(r,v) BOXNAN_SET_OBJ_VALUE(r, (((struct RObject*)(v))->tt), (v))
#ifdef MRB_64BIT
......
......@@ -42,7 +42,7 @@ typedef struct mrb_value {
#define SET_FALSE_VALUE(r) BOXNIX_SET_VALUE(r, MRB_TT_FALSE, value.i, 1)
#define SET_TRUE_VALUE(r) BOXNIX_SET_VALUE(r, MRB_TT_TRUE, value.i, 1)
#define SET_BOOL_VALUE(r,b) BOXNIX_SET_VALUE(r, b ? MRB_TT_TRUE : MRB_TT_FALSE, value.i, 1)
#define SET_INT_VALUE(r,n) BOXNIX_SET_VALUE(r, MRB_TT_FIXNUM, value.i, (n))
#define SET_INT_VALUE(r,n) BOXNIX_SET_VALUE(r, MRB_TT_INTEGER, value.i, (n))
#ifndef MRB_NO_FLOAT
#define SET_FLOAT_VALUE(mrb,r,v) BOXNIX_SET_VALUE(r, MRB_TT_FLOAT, value.f, (v))
#endif
......
......@@ -173,7 +173,7 @@ mrb_type(mrb_value o)
{
return !mrb_bool(o) ? MRB_TT_FALSE :
mrb_true_p(o) ? MRB_TT_TRUE :
mrb_fixnum_p(o) ? MRB_TT_FIXNUM :
mrb_fixnum_p(o) ? MRB_TT_INTEGER :
mrb_symbol_p(o) ? MRB_TT_SYMBOL :
mrb_undef_p(o) ? MRB_TT_UNDEF :
mrb_val_union(o).bp->tt;
......
......@@ -35,7 +35,7 @@ mrb_class(mrb_state *mrb, mrb_value v)
return mrb->true_class;
case MRB_TT_SYMBOL:
return mrb->symbol_class;
case MRB_TT_FIXNUM:
case MRB_TT_INTEGER:
return mrb->integer_class;
#ifndef MRB_NO_FLOAT
case MRB_TT_FLOAT:
......
......@@ -106,7 +106,7 @@ enum mrb_vtype {
MRB_TT_FALSE = 0,
MRB_TT_TRUE,
MRB_TT_FLOAT,
MRB_TT_FIXNUM,
MRB_TT_INTEGER,
MRB_TT_SYMBOL,
MRB_TT_UNDEF,
MRB_TT_CPTR,
......@@ -130,6 +130,9 @@ enum mrb_vtype {
MRB_TT_MAXDEFINE
};
/* for compatibility */
#define MRB_TT_FIXNUM MRB_TT_INTEGER
#include <mruby/object.h>
#ifdef MRB_DOCUMENTATION_BLOCK
......@@ -178,7 +181,7 @@ struct RCptr {
#define mrb_immediate_p(o) (mrb_type(o) < MRB_TT_FREE)
#endif
#ifndef mrb_fixnum_p
#define mrb_fixnum_p(o) (mrb_type(o) == MRB_TT_FIXNUM)
#define mrb_fixnum_p(o) (mrb_type(o) == MRB_TT_INTEGER)
#endif
#ifndef mrb_symbol_p
#define mrb_symbol_p(o) (mrb_type(o) == MRB_TT_SYMBOL)
......
......@@ -148,7 +148,7 @@ mrb_ary_slice_bang(mrb_state *mrb, mrb_value self)
else {
return mrb_nil_value();
}
case MRB_TT_FIXNUM:
case MRB_TT_INTEGER:
val = mrb_funcall_id(mrb, self, MRB_SYM(delete_at), 1, index);
return val;
default:
......
......@@ -543,7 +543,7 @@ new_lit(codegen_scope *s, mrb_value val)
}
break;
#endif
case MRB_TT_FIXNUM:
case MRB_TT_INTEGER:
for (i=0; i<s->irep->plen; i++) {
mrb_int v = mrb_fixnum(val);
pv = &s->pool[i];
......@@ -594,7 +594,7 @@ new_lit(codegen_scope *s, mrb_value val)
pv->u.f = mrb_float(val);
break;
#endif
case MRB_TT_FIXNUM:
case MRB_TT_INTEGER:
#ifdef MRB_INT64
pv->tt = IREP_TT_INT64;
pv->u.i64 = mrb_fixnum(val);
......
......@@ -338,7 +338,7 @@ option_to_fd(mrb_state *mrb, mrb_value hash, const char *key)
switch (mrb_type(opt)) {
case MRB_TT_DATA: /* IO */
return mrb_io_fileno(mrb, opt);
case MRB_TT_FIXNUM:
case MRB_TT_INTEGER:
return (int)mrb_fixnum(opt);
default:
mrb_raise(mrb, E_ARGUMENT_ERROR, "wrong exec redirect action");
......@@ -1076,7 +1076,7 @@ time2timeval(mrb_state *mrb, mrb_value time)
struct timeval t = { 0, 0 };
switch (mrb_type(time)) {
case MRB_TT_FIXNUM:
case MRB_TT_INTEGER:
t.tv_sec = (ftime_t)mrb_fixnum(time);
t.tv_usec = 0;
break;
......
......@@ -81,7 +81,7 @@ os_count_objects(mrb_state *mrb, mrb_value self)
COUNT_TYPE(T_FALSE);
COUNT_TYPE(T_FREE);
COUNT_TYPE(T_TRUE);
COUNT_TYPE(T_FIXNUM);
COUNT_TYPE(T_INTEGER);
COUNT_TYPE(T_SYMBOL);
COUNT_TYPE(T_UNDEF);
COUNT_TYPE(T_FLOAT);
......
......@@ -144,7 +144,7 @@ os_memsize_of_object(mrb_state* mrb, mrb_value obj)
* immediate VM stack values, contained within mrb_state, or on C stack */
case MRB_TT_TRUE:
case MRB_TT_FALSE:
case MRB_TT_FIXNUM:
case MRB_TT_INTEGER:
case MRB_TT_BREAK:
case MRB_TT_CPTR:
case MRB_TT_SYMBOL:
......
......@@ -872,7 +872,7 @@ retry:
case MRB_TT_STRING:
val = mrb_str_to_inum(mrb, val, 0, TRUE);
goto bin_retry;
case MRB_TT_FIXNUM:
case MRB_TT_INTEGER:
v = mrb_fixnum(val);
break;
default:
......
......@@ -252,7 +252,7 @@ mrb_to_time_t(mrb_state *mrb, mrb_value obj, time_t *usec)
break;
#endif /* MRB_NO_FLOAT */
default:
case MRB_TT_FIXNUM:
case MRB_TT_INTEGER:
{
mrb_int i = mrb_int(mrb, obj);
......
......@@ -885,7 +885,7 @@ mrb_ary_aget(mrb_state *mrb, mrb_value self)
else {
return mrb_nil_value();
}
case MRB_TT_FIXNUM:
case MRB_TT_INTEGER:
return mrb_ary_ref(mrb, self, mrb_fixnum(index));
default:
return mrb_ary_ref(mrb, self, aget_index(mrb, index));
......
......@@ -1342,7 +1342,7 @@ mrb_singleton_class_ptr(mrb_state *mrb, mrb_value v)
case MRB_TT_CPTR:
return mrb->object_class;
case MRB_TT_SYMBOL:
case MRB_TT_FIXNUM:
case MRB_TT_INTEGER:
#ifndef MRB_NO_FLOAT
case MRB_TT_FLOAT:
#endif
......
......@@ -114,7 +114,7 @@ mrb_obj_id(mrb_value obj)
return MakeID(2);
case MRB_TT_SYMBOL:
return MakeID(mrb_symbol(obj));
case MRB_TT_FIXNUM:
case MRB_TT_INTEGER:
#ifdef MRB_NO_FLOAT
return MakeID(mrb_fixnum_id(mrb_fixnum(obj)));
#else
......
......@@ -779,7 +779,7 @@ obj_free(mrb_state *mrb, struct RBasic *obj, int end)
switch (obj->tt) {
/* immediate - no mark */
case MRB_TT_TRUE:
case MRB_TT_FIXNUM:
case MRB_TT_INTEGER:
case MRB_TT_SYMBOL:
/* cannot happen */
return;
......
......@@ -64,7 +64,7 @@ ht_hash_func(mrb_state *mrb, htable *t, mrb_value key)
case MRB_TT_TRUE:
case MRB_TT_FALSE:
case MRB_TT_SYMBOL:
case MRB_TT_FIXNUM:
case MRB_TT_INTEGER:
#ifndef MRB_NO_FLOAT
case MRB_TT_FLOAT:
#endif
......@@ -95,7 +95,7 @@ ht_hash_equal(mrb_state *mrb, htable *t, mrb_value a, mrb_value b)
if (!mrb_symbol_p(b)) return FALSE;
return mrb_symbol(a) == mrb_symbol(b);
case MRB_TT_FIXNUM:
case MRB_TT_INTEGER:
if (!mrb_fixnum_p(b)) return FALSE;
return mrb_fixnum(a) == mrb_fixnum(b);
......
......@@ -35,7 +35,7 @@ MRB_API mrb_float
mrb_to_flo(mrb_state *mrb, mrb_value val)
{
switch (mrb_type(val)) {
case MRB_TT_FIXNUM:
case MRB_TT_INTEGER:
return (mrb_float)mrb_fixnum(val);
case MRB_TT_FLOAT:
break;
......@@ -450,7 +450,7 @@ flo_eq(mrb_state *mrb, mrb_value x)
mrb_value y = mrb_get_arg1(mrb);
switch (mrb_type(y)) {
case MRB_TT_FIXNUM:
case MRB_TT_INTEGER:
return mrb_bool_value(mrb_float(x) == (mrb_float)mrb_fixnum(y));
case MRB_TT_FLOAT:
return mrb_bool_value(mrb_float(x) == mrb_float(y));
......@@ -463,7 +463,7 @@ static int64_t
value_int64(mrb_state *mrb, mrb_value x)
{
switch (mrb_type(x)) {
case MRB_TT_FIXNUM:
case MRB_TT_INTEGER:
return (int64_t)mrb_fixnum(x);
case MRB_TT_FLOAT:
return (int64_t)mrb_float(x);
......@@ -1031,7 +1031,7 @@ int_equal(mrb_state *mrb, mrb_value x)
mrb_value y = mrb_get_arg1(mrb);
switch (mrb_type(y)) {
case MRB_TT_FIXNUM:
case MRB_TT_INTEGER:
return mrb_bool_value(mrb_fixnum(x) == mrb_fixnum(y));
#ifndef MRB_NO_FLOAT
case MRB_TT_FLOAT:
......@@ -1477,7 +1477,7 @@ cmpnum(mrb_state *mrb, mrb_value v1, mrb_value v2)
x = mrb_to_flo(mrb, v1);
#endif
switch (mrb_type(v2)) {
case MRB_TT_FIXNUM:
case MRB_TT_INTEGER:
#ifdef MRB_NO_FLOAT
y = mrb_fixnum(v2);
#else
......@@ -1584,7 +1584,7 @@ mrb_cmp(mrb_state *mrb, mrb_value obj1, mrb_value obj2)
mrb_value v;
switch (mrb_type(obj1)) {
case MRB_TT_FIXNUM:
case MRB_TT_INTEGER:
case MRB_TT_FLOAT:
return cmpnum(mrb, obj1, obj2);
case MRB_TT_STRING:
......@@ -1657,7 +1657,7 @@ mrb_init_numeric(mrb_state *mrb)
/* Integer Class */
mrb->integer_class = integer = mrb_define_class(mrb, "Integer", numeric); /* 15.2.8 */
MRB_SET_INSTANCE_TT(integer, MRB_TT_FIXNUM);
MRB_SET_INSTANCE_TT(integer, MRB_TT_INTEGER);
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 */
mrb_define_method(mrb, integer, "to_int", int_to_i, MRB_ARGS_NONE());
......
......@@ -19,7 +19,7 @@ mrb_obj_eq(mrb_state *mrb, mrb_value v1, mrb_value v2)
return TRUE;
case MRB_TT_FALSE:
case MRB_TT_FIXNUM:
case MRB_TT_INTEGER:
return (mrb_fixnum(v1) == mrb_fixnum(v2));
case MRB_TT_SYMBOL:
return (mrb_symbol(v1) == mrb_symbol(v2));
......@@ -322,7 +322,7 @@ static const struct types {
/* {MRB_TT_NIL, "nil"}, */
{MRB_TT_FALSE, "false"},
{MRB_TT_TRUE, "true"},
{MRB_TT_FIXNUM, "Fixnum"},
{MRB_TT_INTEGER,"Integer"},
{MRB_TT_SYMBOL, "Symbol"}, /* :symbol */
{MRB_TT_MODULE, "Module"},
{MRB_TT_OBJECT, "Object"},
......@@ -536,7 +536,7 @@ mrb_convert_to_integer(mrb_state *mrb, mrb_value val, mrb_int base)
return mrb_flo_to_fixnum(mrb, val);
#endif
case MRB_TT_FIXNUM:
case MRB_TT_INTEGER:
if (base != 0) goto arg_error;
return val;
......@@ -574,7 +574,7 @@ mrb_Float(mrb_state *mrb, mrb_value val)
mrb_raise(mrb, E_TYPE_ERROR, "can't convert nil into Float");
}
switch (mrb_type(val)) {
case MRB_TT_FIXNUM:
case MRB_TT_INTEGER:
return mrb_float_value(mrb, (mrb_float)mrb_fixnum(val));
case MRB_TT_FLOAT:
......
......@@ -24,10 +24,10 @@ r_check(mrb_state *mrb, mrb_value a, mrb_value b)
ta = mrb_type(a);
tb = mrb_type(b);
#ifdef MRB_NO_FLOAT
if (ta == MRB_TT_FIXNUM && tb == MRB_TT_FIXNUM ) {
if (ta == MRB_TT_INTEGER && tb == MRB_TT_INTEGER ) {
#else
if ((ta == MRB_TT_FIXNUM || ta == MRB_TT_FLOAT) &&
(tb == MRB_TT_FIXNUM || tb == MRB_TT_FLOAT)) {
if ((ta == MRB_TT_INTEGER || ta == MRB_TT_FLOAT) &&
(tb == MRB_TT_INTEGER || tb == MRB_TT_FLOAT)) {
#endif
return;
}
......
......@@ -1093,7 +1093,7 @@ mrb_str_to_str(mrb_state *mrb, mrb_value str)
return str;
case MRB_TT_SYMBOL:
return mrb_sym_str(mrb, mrb_symbol(str));
case MRB_TT_FIXNUM:
case MRB_TT_INTEGER:
return mrb_fixnum_to_str(mrb, str, 10);
case MRB_TT_SCLASS:
case MRB_TT_CLASS:
......@@ -1154,7 +1154,7 @@ str_convert_range(mrb_state *mrb, mrb_value str, mrb_value indx, mrb_value alen,
}
else {
switch (mrb_type(indx)) {
case MRB_TT_FIXNUM:
case MRB_TT_INTEGER:
*beg = mrb_fixnum(indx);
*len = 1;
return STR_CHAR_RANGE;
......
......@@ -2256,7 +2256,7 @@ RETRY_TRY_BLOCK:
} \
NEXT;
#define OP_MATH_CASE_FIXNUM(op_name) \
case TYPES2(MRB_TT_FIXNUM, MRB_TT_FIXNUM): \
case TYPES2(MRB_TT_INTEGER, MRB_TT_INTEGER): \
{ \
mrb_int x = mrb_fixnum(regs[a]), y = mrb_fixnum(regs[a+1]), z; \
if (mrb_int_##op_name##_overflow(x, y, &z)) \
......@@ -2289,7 +2289,7 @@ RETRY_TRY_BLOCK:
#define OP_MATH_OP_add +
#define OP_MATH_OP_sub -
#define OP_MATH_OP_mul *
#define OP_MATH_TT_fixnum MRB_TT_FIXNUM
#define OP_MATH_TT_fixnum MRB_TT_INTEGER
#define OP_MATH_TT_float MRB_TT_FLOAT
CASE(OP_ADD, B) {
......@@ -2311,7 +2311,7 @@ RETRY_TRY_BLOCK:
/* need to check if op is overridden */
switch (TYPES2(mrb_type(regs[a]),mrb_type(regs[a+1]))) {
case TYPES2(MRB_TT_FIXNUM,MRB_TT_FIXNUM):
case TYPES2(MRB_TT_INTEGER,MRB_TT_INTEGER):
{
mrb_int x = mrb_fixnum(regs[a]);
mrb_int y = mrb_fixnum(regs[a+1]);
......@@ -2345,11 +2345,11 @@ RETRY_TRY_BLOCK:
}
NEXT;
#ifndef MRB_NO_FLOAT
case TYPES2(MRB_TT_FIXNUM,MRB_TT_FLOAT):
case TYPES2(MRB_TT_INTEGER,MRB_TT_FLOAT):
x = (mrb_float)mrb_fixnum(regs[a]);
y = mrb_float(regs[a+1]);
break;
case TYPES2(MRB_TT_FLOAT,MRB_TT_FIXNUM):
case TYPES2(MRB_TT_FLOAT,MRB_TT_INTEGER):
x = mrb_float(regs[a]);
y = (mrb_float)mrb_fixnum(regs[a+1]);
break;
......@@ -2391,7 +2391,7 @@ RETRY_TRY_BLOCK:
} \
NEXT;
#define OP_MATHI_CASE_FIXNUM(op_name) \
case MRB_TT_FIXNUM: \
case MRB_TT_INTEGER: \
{ \
mrb_int x = mrb_fixnum(regs[a]), y = (mrb_int)b, z; \
if (mrb_int_##op_name##_overflow(x, y, &z)) \
......@@ -2427,7 +2427,7 @@ RETRY_TRY_BLOCK:
int result;\
/* need to check if - is overridden */\
switch (TYPES2(mrb_type(regs[a]),mrb_type(regs[a+1]))) {\
case TYPES2(MRB_TT_FIXNUM,MRB_TT_FIXNUM):\
case TYPES2(MRB_TT_INTEGER,MRB_TT_INTEGER):\
result = OP_CMP_BODY(op,mrb_fixnum,mrb_fixnum);\
break;\
default:\
......@@ -2447,13 +2447,13 @@ RETRY_TRY_BLOCK:
int result;\
/* need to check if - is overridden */\
switch (TYPES2(mrb_type(regs[a]),mrb_type(regs[a+1]))) {\
case TYPES2(MRB_TT_FIXNUM,MRB_TT_FIXNUM):\
case TYPES2(MRB_TT_INTEGER,MRB_TT_INTEGER):\
result = OP_CMP_BODY(op,mrb_fixnum,mrb_fixnum);\
break;\
case TYPES2(MRB_TT_FIXNUM,MRB_TT_FLOAT):\
case TYPES2(MRB_TT_INTEGER,MRB_TT_FLOAT):\
result = OP_CMP_BODY(op,mrb_fixnum,mrb_float);\
break;\
case TYPES2(MRB_TT_FLOAT,MRB_TT_FIXNUM):\
case TYPES2(MRB_TT_FLOAT,MRB_TT_INTEGER):\
result = OP_CMP_BODY(op,mrb_float,mrb_fixnum);\
break;\
case TYPES2(MRB_TT_FLOAT,MRB_TT_FLOAT):\
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment