summaryrefslogtreecommitdiffhomepage
path: root/src/string.c
diff options
context:
space:
mode:
authorYAMAMOTO Masaya <[email protected]>2017-10-11 17:53:17 +0900
committerYAMAMOTO Masaya <[email protected]>2017-10-11 17:58:11 +0900
commitacdc2d1f242f2547ca842be5d62a2b06356b39ea (patch)
tree3479c21be76ce7edde6a5fcacb6f60c1a5698a8a /src/string.c
parent679dfd75a8aeb26ee4ff0d7c148e1f6e88e39c3d (diff)
downloadmruby-acdc2d1f242f2547ca842be5d62a2b06356b39ea.tar.gz
mruby-acdc2d1f242f2547ca842be5d62a2b06356b39ea.zip
Add MRB_WITHOUT_FLOAT
Diffstat (limited to 'src/string.c')
-rw-r--r--src/string.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/string.c b/src/string.c
index 2616d0e72..62dc4b583 100644
--- a/src/string.c
+++ b/src/string.c
@@ -8,7 +8,9 @@
# define _CRT_NONSTDC_NO_DEPRECATE
#endif
+#ifndef MRB_WITHOUT_FLOAT
#include <float.h>
+#endif
#include <limits.h>
#include <stddef.h>
#include <stdlib.h>
@@ -2284,6 +2286,7 @@ mrb_str_to_i(mrb_state *mrb, mrb_value self)
return mrb_str_to_inum(mrb, self, base, FALSE);
}
+#ifndef MRB_WITHOUT_FLOAT
MRB_API double
mrb_cstr_to_dbl(mrb_state *mrb, const char * p, mrb_bool badcheck)
{
@@ -2387,6 +2390,7 @@ mrb_str_to_f(mrb_state *mrb, mrb_value self)
{
return mrb_float_value(mrb, mrb_str_to_dbl(mrb, self, FALSE));
}
+#endif
/* 15.2.10.5.40 */
/*
@@ -2788,7 +2792,9 @@ mrb_init_string(mrb_state *mrb)
mrb_define_method(mrb, s, "slice", mrb_str_aref_m, MRB_ARGS_ANY()); /* 15.2.10.5.34 */
mrb_define_method(mrb, s, "split", mrb_str_split_m, MRB_ARGS_ANY()); /* 15.2.10.5.35 */
+#ifndef MRB_WITHOUT_FLOAT
mrb_define_method(mrb, s, "to_f", mrb_str_to_f, MRB_ARGS_NONE()); /* 15.2.10.5.38 */
+#endif
mrb_define_method(mrb, s, "to_i", mrb_str_to_i, MRB_ARGS_ANY()); /* 15.2.10.5.39 */
mrb_define_method(mrb, s, "to_s", mrb_str_to_s, MRB_ARGS_NONE()); /* 15.2.10.5.40 */
mrb_define_method(mrb, s, "to_str", mrb_str_to_s, MRB_ARGS_NONE());
@@ -2799,6 +2805,7 @@ mrb_init_string(mrb_state *mrb)
mrb_define_method(mrb, s, "bytes", mrb_str_bytes, MRB_ARGS_NONE());
}
+#ifndef MRB_WITHOUT_FLOAT
/*
* Source code for the "strtod" library procedure.
*
@@ -3043,3 +3050,4 @@ done:
}
return fraction;
}
+#endif