diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-11-04 12:33:07 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-11-04 12:33:07 +0900 |
| commit | d6cb4f9cf2027eb20f67238aa6c051448602e7e6 (patch) | |
| tree | c025d53534298097aadc3d7699de964bd8a7225f /src/string.c | |
| parent | 388d26d77027feaa3e107abf7209e2681868bbe6 (diff) | |
| parent | a751f7f196e35cf85ac6f5c0d855edeb68b2bf53 (diff) | |
| download | mruby-d6cb4f9cf2027eb20f67238aa6c051448602e7e6.tar.gz mruby-d6cb4f9cf2027eb20f67238aa6c051448602e7e6.zip | |
Merge branch 'pandax381-mrb_without_float'
Diffstat (limited to 'src/string.c')
| -rw-r--r-- | src/string.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/string.c b/src/string.c index c1e248dd9..8f0db681c 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> @@ -2256,6 +2258,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) { @@ -2359,6 +2362,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 */ /* @@ -2760,7 +2764,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()); @@ -2771,6 +2777,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. * @@ -3015,3 +3022,4 @@ done: } return fraction; } +#endif |
