summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Rakefile7
-rw-r--r--build_config.rb3
-rw-r--r--include/mrbconf.h4
-rw-r--r--mgems/mruby-math/mrbgem.rake4
-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.c5
-rw-r--r--src/parse.y2
-rw-r--r--src/re.c42
-rw-r--r--tasks/mrbgems_test.rake6
-rw-r--r--tasks/mruby_build.rake2
11 files changed, 23 insertions, 61 deletions
diff --git a/Rakefile b/Rakefile
index 1c65321f5..33967b07b 100644
--- a/Rakefile
+++ b/Rakefile
@@ -32,7 +32,6 @@ load "#{MRUBY_ROOT}/tools/mirb/mirb.rake"
load "#{MRUBY_ROOT}/tasks/mrbgems_test.rake"
load "#{MRUBY_ROOT}/test/mrbtest.rake"
-
##############################
# generic build targets, rules
task :default => :all
@@ -42,7 +41,7 @@ depfiles = MRuby.targets['host'].bins.map do |bin|
source_path = MRuby.targets['host'].exefile("#{MRuby.targets['host'].build_dir}/bin/#{bin}")
file install_path => source_path do |t|
- FileUtils.cp t.prerequisites.first, t.name
+ FileUtils.cp t.prerequisites.first, t.name, { :verbose => $verbose }
end
install_path
@@ -72,8 +71,8 @@ end
desc "clean all built and in-repo installed artifacts"
task :clean do
MRuby.each_target do |t|
- FileUtils.rm_rf t.build_dir
+ FileUtils.rm_rf t.build_dir, { :verbose => $verbose }
end
- FileUtils.rm_f depfiles
+ FileUtils.rm_f depfiles, { :verbose => $verbose }
puts "Cleaned up build folder"
end
diff --git a/build_config.rb b/build_config.rb
index a296ce705..d2f9597a0 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 'mrbgems/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..fa2d5d305 100644
--- a/src/init.c
+++ b/src/init.c
@@ -22,7 +22,6 @@ void mrb_init_numeric(mrb_state*);
void mrb_init_range(mrb_state*);
void mrb_init_struct(mrb_state*);
void mrb_init_gc(mrb_state*);
-void mrb_init_regexp(mrb_state*);
void mrb_init_print(mrb_state*);
void mrb_init_math(mrb_state*);
void mrb_init_mrblib(mrb_state*);
@@ -53,13 +52,9 @@ mrb_init_core(mrb_state *mrb)
mrb_init_struct(mrb); DONE;
#endif
mrb_init_gc(mrb); DONE;
- 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
mrb_init_mrbgems(mrb); DONE;
diff --git a/src/parse.y b/src/parse.y
index 365bc5f18..2c5690ea3 100644
--- a/src/parse.y
+++ b/src/parse.y
@@ -4440,7 +4440,7 @@ parser_yylex(parser_state *p)
p->lex_strterm = new_strterm(p, str_regexp, term, paren);
#endif
p->regexp = 1;
- p->sterm = '/';
+ p->sterm = term;
return tREGEXP_BEG;
case 's':
diff --git a/src/re.c b/src/re.c
deleted file mode 100644
index 744732e58..000000000
--- a/src/re.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
-** re.c - Regexp class
-**
-** See Copyright Notice in mruby.h
-*/
-
-#include "mruby.h"
-#include <string.h>
-#include "mruby/string.h"
-#include "re.h"
-#include "mruby/array.h"
-#include "mruby/class.h"
-#include "error.h"
-
-/*
- * Document-class: RegexpError
- *
- * Raised when given an invalid regexp expression.
- *
- * Regexp.new("?")
- *
- * <em>raises the exception:</em>
- *
- * RegexpError: target of repeat operator is not specified: /?/
- */
-
-/*
- * Document-class: Regexp
- *
- * A <code>Regexp</code> holds a regular expression, used to match a pattern
- * against strings. Regexps are created using the <code>/.../</code> and
- * <code>%r{...}</code> literals, and by the <code>Regexp::new</code>
- * constructor.
- *
- * :include: doc/re.rdoc
- */
-
-void
-mrb_init_regexp(mrb_state *mrb)
-{
- //mrb_define_class(mrb, REGEXP_CLASS, mrb->object_class);
-}
diff --git a/tasks/mrbgems_test.rake b/tasks/mrbgems_test.rake
index 6d40d092a..6ca5eaef2 100644
--- a/tasks/mrbgems_test.rake
+++ b/tasks/mrbgems_test.rake
@@ -18,7 +18,11 @@ MRuby.each_target do
f.puts %Q[void GENERATED_TMP_mrb_#{g.funcname}_gem_test(mrb_state *mrb) {]
unless g.test_rbfiles.empty?
f.puts %Q[ mrb_state *mrb2;]
- f.puts %Q[ mrb_value val1, val2, ary1, ary2, test_args_hash;]
+ if g.test_args.empty?
+ f.puts %Q[ mrb_value val1, val2, ary1, ary2;]
+ else
+ f.puts %Q[ mrb_value val1, val2, ary1, ary2, test_args_hash;]
+ end
f.puts %Q[ int ai;]
g.test_rbfiles.count.times do |i|
f.puts %Q[ ai = mrb_gc_arena_save(mrb);]
diff --git a/tasks/mruby_build.rake b/tasks/mruby_build.rake
index 4d28b1d95..812e861a7 100644
--- a/tasks/mruby_build.rake
+++ b/tasks/mruby_build.rake
@@ -163,7 +163,7 @@ module MRuby
def run_test
puts ">>> Test #{name} <<<"
mrbtest = exefile("#{build_dir}/test/mrbtest")
- sh "#{filename mrbtest.relative_path}"
+ sh "#{filename mrbtest.relative_path}#{$verbose ? ' -v' : ''}"
puts
end