Commit 2eef8f25 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto

Merge pull request #910 from mattn/pluggable_math

Pluggable Math
parents fbe04176 6bee2fd1
......@@ -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'
......
......@@ -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
......
MRuby::Gem::Specification.new('mruby-math') do |spec|
spec.license = 'MIT'
spec.authors = 'mruby developers'
end
......@@ -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)
{
}
......@@ -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
......
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