Pluggable Math

This commit is contained in:
mattn
2013-02-28 17:52:18 +09:00
parent fbe041768b
commit 6bee2fd193
6 changed files with 13 additions and 10 deletions
+3
View File
@@ -11,6 +11,9 @@ MRuby::Build.new do |conf|
# conf.gem :github => 'masuidrive/mrbgems-example', :branch => 'master'
# 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
conf.gem 'mgems/mruby-time'
-4
View File
@@ -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
+4
View File
@@ -0,0 +1,4 @@
MRuby::Gem::Specification.new('mruby-math') do |spec|
spec.license = 'MIT'
spec.authors = 'mruby developers'
end
+6 -3
View File
@@ -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)
{
}
-3
View File
@@ -56,9 +56,6 @@ mrb_init_core(mrb_state *mrb)
mrb_init_regexp(mrb); DONE;
#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