summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro Matsumoto <[email protected]>2012-06-14 00:59:35 +0900
committerYukihiro Matsumoto <[email protected]>2012-06-14 00:59:35 +0900
commit764a791f439bb843838239909d98b26ac90a9e02 (patch)
tree81f6a5209fe9d28e151ce4f082878324f9708f39
parent91a665905a8781373480f003c2e15cef9fa3604c (diff)
downloadmruby-764a791f439bb843838239909d98b26ac90a9e02.tar.gz
mruby-764a791f439bb843838239909d98b26ac90a9e02.zip
make Math module optional
-rw-r--r--include/mrbconf.h13
-rw-r--r--src/init.c2
-rw-r--r--src/math.c3
3 files changed, 13 insertions, 5 deletions
diff --git a/include/mrbconf.h b/include/mrbconf.h
index 5848eee1a..3744c1827 100644
--- a/include/mrbconf.h
+++ b/include/mrbconf.h
@@ -20,21 +20,24 @@ typedef double mrb_float;
typedef int mrb_int;
typedef intptr_t mrb_sym;
-#undef PARSER_DUMP /* do not print out parser state */
//#define PARSER_DUMP /* print out parser state */
+#undef PARSER_DUMP /* do not print out parser state */
-#undef INCLUDE_ENCODING /* not use encoding classes (ascii only) */
//#define INCLUDE_ENCODING /* use UTF-8 encoding classes */
+#undef INCLUDE_ENCODING /* not use encoding classes (ascii only) */
-#undef INCLUDE_REGEXP /* not use regular expression classes */
//#define INCLUDE_REGEXP /* use regular expression classes */
+#undef INCLUDE_REGEXP /* not use regular expression classes */
#ifdef INCLUDE_REGEXP
# define INCLUDE_ENCODING /* Regexp depends Encoding */
#endif
-//#undef INCLUDE_KERNEL_SPRINTF /* not use Kernel.sprintf method. */
-#define INCLUDE_KERNEL_SPRINTF /* not use Kernel.sprintf method. */
+#define INCLUDE_KERNEL_SPRINTF /* not use Kernel.sprintf method */
+//#undef INCLUDE_KERNEL_SPRINTF /* not use Kernel.sprintf method */
+
+#define INCLUDE_MATH /* use (non ISO) Math module */
+//#undef INCLUDE_MATH /* not use (non ISO) Math module */
#ifdef MRUBY_DEBUG_BUILD
# define PARSER_DUMP
diff --git a/src/init.c b/src/init.c
index 17ce24313..1f7d4d364 100644
--- a/src/init.c
+++ b/src/init.c
@@ -57,7 +57,9 @@ mrb_init_core(mrb_state *mrb)
mrb_init_exception(mrb);
mrb_init_print(mrb);
mrb_init_time(mrb);
+#ifdef INCLUDE_MATH
mrb_init_math(mrb);
+#endif
mrb_init_mrblib(mrb);
diff --git a/src/math.c b/src/math.c
index 1de9c0d8f..3898146b6 100644
--- a/src/math.c
+++ b/src/math.c
@@ -5,6 +5,8 @@
*/
#include "mruby.h"
+
+#ifdef INCLUDE_MATH
#include <math.h>
#define domain_error(msg) \
@@ -679,3 +681,4 @@ 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 /* INCLUDE_MATH */