Commit 6bee2fd1 authored by mattn's avatar mattn

Pluggable Math

parent fbe04176
...@@ -11,6 +11,9 @@ MRuby::Build.new do |conf| ...@@ -11,6 +11,9 @@ MRuby::Build.new do |conf|
# conf.gem :github => 'masuidrive/mrbgems-example', :branch => 'master' # conf.gem :github => 'masuidrive/mrbgems-example', :branch => 'master'
# conf.gem :git => 'git@github.com:masuidrive/mrbgems-example.git', :branch => 'master', :options => '-v' # conf.gem :git => 'git@github.com:masuidrive/mrbgems-example.git', :branch => 'master', :options => '-v'
# Use standard Math module
conf.gem 'mgems/mruby-math'
# Use standard Time class # Use standard Time class
conf.gem 'mgems/mruby-time' conf.gem 'mgems/mruby-time'
......
...@@ -45,7 +45,6 @@ ...@@ -45,7 +45,6 @@
/* -DDISABLE_XXXX to drop following features */ /* -DDISABLE_XXXX to drop following features */
//#define DISABLE_SPRINTF /* Kernel.sprintf method */ //#define DISABLE_SPRINTF /* Kernel.sprintf method */
//#define DISABLE_MATH /* Math functions */
//#define DISABLE_STRUCT /* Struct class */ //#define DISABLE_STRUCT /* Struct class */
//#define DISABLE_STDIO /* use of stdio */ //#define DISABLE_STDIO /* use of stdio */
...@@ -85,9 +84,6 @@ typedef short mrb_sym; ...@@ -85,9 +84,6 @@ typedef short mrb_sym;
#ifndef DISABLE_SPRINTF #ifndef DISABLE_SPRINTF
#define ENABLE_SPRINTF #define ENABLE_SPRINTF
#endif #endif
#ifndef DISABLE_MATH
#define ENABLE_MATH
#endif
#ifndef DISABLE_STRUCT #ifndef DISABLE_STRUCT
#define ENABLE_STRUCT #define ENABLE_STRUCT
#endif #endif
......
MRuby::Gem::Specification.new('mruby-math') do |spec|
spec.license = 'MIT'
spec.authors = 'mruby developers'
end
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include "mruby.h" #include "mruby.h"
#include "mruby/array.h" #include "mruby/array.h"
#ifdef ENABLE_MATH
#include <math.h> #include <math.h>
#define domain_error(msg) \ #define domain_error(msg) \
...@@ -630,7 +629,7 @@ math_erfc(mrb_state *mrb, mrb_value obj) ...@@ -630,7 +629,7 @@ math_erfc(mrb_state *mrb, mrb_value obj)
/* ------------------------------------------------------------------------*/ /* ------------------------------------------------------------------------*/
void void
mrb_init_math(mrb_state *mrb) mrb_mruby_math_gem_init(mrb_state* mrb)
{ {
struct RClass *mrb_math; struct RClass *mrb_math;
mrb_math = mrb_define_module(mrb, "Math"); mrb_math = mrb_define_module(mrb, "Math");
...@@ -685,4 +684,8 @@ mrb_init_math(mrb_state *mrb) ...@@ -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, "erf", math_erf, ARGS_REQ(1));
mrb_define_module_function(mrb, mrb_math, "erfc", math_erfc, 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)
{
}
...@@ -56,9 +56,6 @@ mrb_init_core(mrb_state *mrb) ...@@ -56,9 +56,6 @@ mrb_init_core(mrb_state *mrb)
mrb_init_regexp(mrb); DONE; mrb_init_regexp(mrb); DONE;
#ifdef ENABLE_STDIO #ifdef ENABLE_STDIO
mrb_init_print(mrb); DONE; mrb_init_print(mrb); DONE;
#endif
#ifdef ENABLE_MATH
mrb_init_math(mrb); DONE;
#endif #endif
mrb_init_mrblib(mrb); DONE; mrb_init_mrblib(mrb); DONE;
#ifndef DISABLE_GEMS #ifndef DISABLE_GEMS
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment