diff options
| author | dearblue <[email protected]> | 2021-12-31 19:12:11 +0900 |
|---|---|---|
| committer | dearblue <[email protected]> | 2021-12-31 19:12:11 +0900 |
| commit | ac22a63ae3c29ac3921f53ac63ae981ab0def744 (patch) | |
| tree | 7dd90c5218796c16977c7dfbaa3fb8e8f05905fb /mrbgems/mruby-complex/src/complex.c | |
| parent | 5ca17c2dce47c637728ed03661465d0ada0a61a9 (diff) | |
| download | mruby-ac22a63ae3c29ac3921f53ac63ae981ab0def744.tar.gz mruby-ac22a63ae3c29ac3921f53ac63ae981ab0def744.zip | |
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.
Diffstat (limited to 'mrbgems/mruby-complex/src/complex.c')
| -rw-r--r-- | mrbgems/mruby-complex/src/complex.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/mrbgems/mruby-complex/src/complex.c b/mrbgems/mruby-complex/src/complex.c index 66176c3c1..6a2f5248e 100644 --- a/mrbgems/mruby-complex/src/complex.c +++ b/mrbgems/mruby-complex/src/complex.c @@ -105,8 +105,8 @@ complex_s_rect(mrb_state *mrb, mrb_value self) return complex_new(mrb, real, imaginary); } -static mrb_value -complex_to_f(mrb_state *mrb, mrb_value self) +mrb_value +mrb_complex_to_f(mrb_state *mrb, mrb_value self) { struct mrb_complex *p = complex_ptr(mrb, self); @@ -415,7 +415,7 @@ void mrb_mruby_complex_gem_init(mrb_state *mrb) mrb_define_method(mrb, mrb->kernel_module, "Complex", complex_s_rect, MRB_ARGS_REQ(1)|MRB_ARGS_OPT(1)); mrb_define_method(mrb, comp, "real", complex_real, MRB_ARGS_NONE()); mrb_define_method(mrb, comp, "imaginary", complex_imaginary, MRB_ARGS_NONE()); - mrb_define_method(mrb, comp, "to_f", complex_to_f, MRB_ARGS_NONE()); + mrb_define_method(mrb, comp, "to_f", mrb_complex_to_f, MRB_ARGS_NONE()); mrb_define_method(mrb, comp, "to_i", complex_to_i, MRB_ARGS_NONE()); mrb_define_method(mrb, comp, "to_c", complex_to_c, MRB_ARGS_NONE()); mrb_define_method(mrb, comp, "+", complex_add, MRB_ARGS_REQ(1)); |
