From ac22a63ae3c29ac3921f53ac63ae981ab0def744 Mon Sep 17 00:00:00 2001 From: dearblue Date: Fri, 31 Dec 2021 19:12:11 +0900 Subject: Call functions directly from `mrb_ensure_float_type()` ref. commit 7f40b645d2773c8f50c48ae4adf90488e164da55 Currently, the build configurations `MRB_USE_COMPLEX` and `MRB_USE_RATIONAL` are not listed in the documentation. In other words, they are hidden settings. They are defined in `mrbgems/mruby-{complex,rational}/mrbgem.rake`. So this patch assumes that it is safe to refer to these functions in core-gems directly from core functions. However, applications that link with `libmruby_core.a` will have compatibility issues. In fact, `mrbgems/mruby-bin-mrbc` links with `libmruby_core.a`, so I had to prepare a dummy function. --- mrbgems/mruby-bin-mrbc/tools/mrbc/mrbc.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'mrbgems/mruby-bin-mrbc/tools') diff --git a/mrbgems/mruby-bin-mrbc/tools/mrbc/mrbc.c b/mrbgems/mruby-bin-mrbc/tools/mrbc/mrbc.c index 8b0b6dc57..c3e37e0a6 100644 --- a/mrbgems/mruby-bin-mrbc/tools/mrbc/mrbc.c +++ b/mrbgems/mruby-bin-mrbc/tools/mrbc/mrbc.c @@ -366,3 +366,18 @@ mrb_final_mrbgems(mrb_state *mrb) { } #endif + +#ifdef MRB_USE_COMPLEX +mrb_value mrb_complex_to_f(mrb_state *mrb, mrb_value comp) +{ + mrb_raise(mrb, E_NOTIMP_ERROR, "unavailable for core only"); +} +#endif + +#ifdef MRB_USE_RATIONAL +mrb_value +mrb_rational_to_f(mrb_state *mrb, mrb_value rat) +{ + mrb_raise(mrb, E_NOTIMP_ERROR, "unavailable for core only"); +} +#endif -- cgit v1.2.3