diff options
| author | mattn <[email protected]> | 2013-02-28 17:52:18 +0900 |
|---|---|---|
| committer | mattn <[email protected]> | 2013-02-28 17:52:18 +0900 |
| commit | 6bee2fd193b94f00c7f4025fc3d62282f867e60d (patch) | |
| tree | cd5117b9769e9f8c687c90d16522a1931c6e5b11 | |
| parent | fbe041768bf133268b63344957acb05962df41c7 (diff) | |
| download | mruby-6bee2fd193b94f00c7f4025fc3d62282f867e60d.tar.gz mruby-6bee2fd193b94f00c7f4025fc3d62282f867e60d.zip | |
Pluggable Math
| -rw-r--r-- | build_config.rb | 3 | ||||
| -rw-r--r-- | include/mrbconf.h | 4 | ||||
| -rw-r--r-- | mgems/mruby-math/mrbgem.rake | 4 | ||||
| -rw-r--r-- | mgems/mruby-math/src/math.c (renamed from src/math.c) | 9 | ||||
| -rw-r--r-- | mgems/mruby-math/test/math.rb (renamed from test/t/math.rb) | 0 | ||||
| -rw-r--r-- | src/init.c | 3 |
6 files changed, 13 insertions, 10 deletions
diff --git a/build_config.rb b/build_config.rb index a66dab6ac..99761a795 100644 --- a/build_config.rb +++ b/build_config.rb @@ -11,6 +11,9 @@ MRuby::Build.new do |conf| # conf.gem :github => 'masuidrive/mrbgems-example', :branch => 'master' # conf.gem :git => '[email protected]:masuidrive/mrbgems-example.git', :branch => 'master', :options => '-v' + # Use standard Math module + conf.gem 'mgems/mruby-math' + # Use standard Time class conf.gem 'mgems/mruby-time' diff --git a/include/mrbconf.h b/include/mrbconf.h index 092e02d11..45e3d6034 100644 --- a/include/mrbconf.h +++ b/include/mrbconf.h @@ -45,7 +45,6 @@ /* -DDISABLE_XXXX to drop following features */ //#define DISABLE_SPRINTF /* Kernel.sprintf method */ -//#define DISABLE_MATH /* Math functions */ //#define DISABLE_STRUCT /* Struct class */ //#define DISABLE_STDIO /* use of stdio */ @@ -85,9 +84,6 @@ typedef short mrb_sym; #ifndef DISABLE_SPRINTF #define ENABLE_SPRINTF #endif -#ifndef DISABLE_MATH -#define ENABLE_MATH -#endif #ifndef DISABLE_STRUCT #define ENABLE_STRUCT #endif diff --git a/mgems/mruby-math/mrbgem.rake b/mgems/mruby-math/mrbgem.rake new file mode 100644 index 000000000..4b0fa40fd --- /dev/null +++ b/mgems/mruby-math/mrbgem.rake @@ -0,0 +1,4 @@ +MRuby::Gem::Specification.new('mruby-math') do |spec| + spec.license = 'MIT' + spec.authors = 'mruby developers' +end diff --git a/src/math.c b/mgems/mruby-math/src/math.c index 782b75c97..9955d9862 100644 --- a/src/math.c +++ b/mgems/mruby-math/src/math.c @@ -7,7 +7,6 @@ #include "mruby.h" #include "mruby/array.h" -#ifdef ENABLE_MATH #include <math.h> #define domain_error(msg) \ @@ -630,7 +629,7 @@ math_erfc(mrb_state *mrb, mrb_value obj) /* ------------------------------------------------------------------------*/ void -mrb_init_math(mrb_state *mrb) +mrb_mruby_math_gem_init(mrb_state* mrb) { struct RClass *mrb_math; mrb_math = mrb_define_module(mrb, "Math"); @@ -685,4 +684,8 @@ mrb_init_math(mrb_state *mrb) mrb_define_module_function(mrb, mrb_math, "erf", math_erf, ARGS_REQ(1)); mrb_define_module_function(mrb, mrb_math, "erfc", math_erfc, ARGS_REQ(1)); } -#endif /* ENABLE_MATH */ + +void +mrb_mruby_math_gem_final(mrb_state* mrb) +{ +} diff --git a/test/t/math.rb b/mgems/mruby-math/test/math.rb index 780b805d2..780b805d2 100644 --- a/test/t/math.rb +++ b/mgems/mruby-math/test/math.rb diff --git a/src/init.c b/src/init.c index a5727561d..a630a3307 100644 --- a/src/init.c +++ b/src/init.c @@ -57,9 +57,6 @@ mrb_init_core(mrb_state *mrb) #ifdef ENABLE_STDIO mrb_init_print(mrb); DONE; #endif -#ifdef ENABLE_MATH - mrb_init_math(mrb); DONE; -#endif mrb_init_mrblib(mrb); DONE; #ifndef DISABLE_GEMS mrb_init_mrbgems(mrb); DONE; |
