summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--LEGAL40
-rw-r--r--build_config.rb3
-rw-r--r--mrbgems/mruby-random/mrbgem.rake2
-rw-r--r--mrbgems/mruby-random/src/mt19937ar.c47
-rw-r--r--mrbgems/mruby-random/src/mt19937ar.h47
-rw-r--r--tasks/mruby_build.rake15
-rw-r--r--tasks/mruby_build_commands.rake20
-rw-r--r--tools/mirb/mirb.c4
-rw-r--r--tools/mruby/mruby.c8
9 files changed, 54 insertions, 132 deletions
diff --git a/LEGAL b/LEGAL
index a36f0bcc1..84929998c 100644
--- a/LEGAL
+++ b/LEGAL
@@ -4,43 +4,3 @@ LEGAL NOTICE INFORMATION
All the files in this distribution are covered under the MIT license
(see the file MITL) except some files mentioned below:
-
-mrbgems/mruby-random/src/mt19937ar.[ch]
-
- A C-program for MT19937, with initialization improved 2002/1/26.
- Coded by Takuji Nishimura and Makoto Matsumoto.
-
- Before using, initialize the state by using init_genrand(seed)
- or init_by_array(init_key, key_length).
-
- Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
- All rights reserved.
- Copyright (C) 2005, Mutsuo Saito,
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- 3. The names of its contributors may not be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/build_config.rb b/build_config.rb
index 5ea4aad4f..670721ee3 100644
--- a/build_config.rb
+++ b/build_config.rb
@@ -114,4 +114,7 @@ end
# conf.build_mrbtest_lib_only
#
# conf.gem 'examples/mrbgems/c_and_ruby_extension_example'
+#
+# conf.test_runner.command = 'env'
+#
# end
diff --git a/mrbgems/mruby-random/mrbgem.rake b/mrbgems/mruby-random/mrbgem.rake
index 7c2b2ddd5..38e93e4b1 100644
--- a/mrbgems/mruby-random/mrbgem.rake
+++ b/mrbgems/mruby-random/mrbgem.rake
@@ -1,4 +1,4 @@
MRuby::Gem::Specification.new('mruby-random') do |spec|
- spec.license = 'MIT, BSD New(mt19937ar)'
+ spec.license = 'MIT'
spec.authors = 'mruby developers'
end
diff --git a/mrbgems/mruby-random/src/mt19937ar.c b/mrbgems/mruby-random/src/mt19937ar.c
index 8e3295a82..3246909e8 100644
--- a/mrbgems/mruby-random/src/mt19937ar.c
+++ b/mrbgems/mruby-random/src/mt19937ar.c
@@ -1,46 +1,7 @@
-/*
- A C-program for MT19937, with initialization improved 2002/1/26.
- Coded by Takuji Nishimura and Makoto Matsumoto.
-
- Before using, initialize the state by using init_genrand(seed)
- or init_by_array(init_key, key_length).
-
- Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
- All rights reserved.
- Copyright (C) 2005, Mutsuo Saito,
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- 3. The names of its contributors may not be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
- Any feedback is very welcome.
- http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html
- email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space)
+/*
+** mt19937ar.c - MT Random functions
+**
+** See Copyright Notice in mruby.h
*/
#include <stdio.h>
diff --git a/mrbgems/mruby-random/src/mt19937ar.h b/mrbgems/mruby-random/src/mt19937ar.h
index 3f36cb1ff..d59bd8748 100644
--- a/mrbgems/mruby-random/src/mt19937ar.h
+++ b/mrbgems/mruby-random/src/mt19937ar.h
@@ -1,46 +1,7 @@
-/*
- A C-program for MT19937, with initialization improved 2002/1/26.
- Coded by Takuji Nishimura and Makoto Matsumoto.
-
- Before using, initialize the state by using init_genrand(seed)
- or init_by_array(init_key, key_length).
-
- Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
- All rights reserved.
- Copyright (C) 2005, Mutsuo Saito
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- 3. The names of its contributors may not be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
- Any feedback is very welcome.
- http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html
- email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space)
+/*
+** mt19937ar.h - MT Random functions
+**
+** See Copyright Notice in mruby.h
*/
#define N 624
diff --git a/tasks/mruby_build.rake b/tasks/mruby_build.rake
index e24a8ac61..dcb557bfd 100644
--- a/tasks/mruby_build.rake
+++ b/tasks/mruby_build.rake
@@ -194,10 +194,21 @@ module MRuby
end # Build
class CrossBuild < Build
+ attr_block %w(test_runner)
+
+ def initialize(name, &block)
+ @test_runner = Command::CrossTestRunner.new(self)
+ super
+ end
+
def run_test
mrbtest = exefile("#{build_dir}/test/mrbtest")
- puts "You should run #{mrbtest} on target device."
- puts
+ if (@test_runner.command == nil)
+ puts "You should run #{mrbtest} on target device."
+ puts
+ else
+ @test_runner.run(mrbtest)
+ end
end
end # CrossBuild
end # MRuby
diff --git a/tasks/mruby_build_commands.rake b/tasks/mruby_build_commands.rake
index b647ccf98..b968d07be 100644
--- a/tasks/mruby_build_commands.rake
+++ b/tasks/mruby_build_commands.rake
@@ -259,4 +259,24 @@ module MRuby
end
end
end
+
+ class Command::CrossTestRunner < Command
+ attr_accessor :runner_options
+ attr_accessor :verbose_flag
+ attr_accessor :flags
+
+ def initialize(build)
+ super
+ @command = nil
+ @runner_options = '%{flags} %{infile}'
+ @verbose_flag = ''
+ @flags = []
+ end
+
+ def run(testbinfile)
+ puts "TEST for " + @build.name
+ _run runner_options, { :flags => [flags, verbose_flag].flatten.join(' '), :infile => testbinfile }
+ end
+ end
+
end
diff --git a/tools/mirb/mirb.c b/tools/mirb/mirb.c
index 334f9359c..008829cfb 100644
--- a/tools/mirb/mirb.c
+++ b/tools/mirb/mirb.c
@@ -40,7 +40,7 @@ is_code_block_open(struct mrb_parser_state *parser)
int code_block_open = FALSE;
/* check for heredoc */
- if (parser->heredoc_starts_nextline) return TRUE;
+ if (parser->parsing_heredoc != NULL) return TRUE;
if (parser->heredoc_end_now) {
parser->heredoc_end_now = FALSE;
return FALSE;
@@ -339,9 +339,9 @@ main(int argc, char **argv)
}
ruby_code[0] = '\0';
last_code_line[0] = '\0';
- mrb_parser_free(parser);
mrb_gc_arena_restore(mrb, ai);
}
+ mrb_parser_free(parser);
}
mrbc_context_free(mrb, cxt);
mrb_close(mrb);
diff --git a/tools/mruby/mruby.c b/tools/mruby/mruby.c
index c52eb5e7b..f554ff4df 100644
--- a/tools/mruby/mruby.c
+++ b/tools/mruby/mruby.c
@@ -268,6 +268,7 @@ main(int argc, char **argv)
}
else {
mrbc_context *c = mrbc_context_new(mrb);
+ mrb_sym zero_sym = mrb_intern2(mrb, "$0", 2);
mrb_value v;
if (args.verbose)
@@ -276,13 +277,18 @@ main(int argc, char **argv)
c->no_exec = 1;
if (args.rfp) {
- mrbc_filename(mrb, c, args.cmdline ? args.cmdline : "-");
+ char *cmdline;
+ cmdline = args.cmdline ? args.cmdline : "-";
+ mrbc_filename(mrb, c, cmdline);
+ mrb_gv_set(mrb, zero_sym, mrb_str_new_cstr(mrb, cmdline));
v = mrb_load_file_cxt(mrb, args.rfp, c);
}
else {
mrbc_filename(mrb, c, "-e");
+ mrb_gv_set(mrb, zero_sym, mrb_str_new(mrb, "-e", 2));
v = mrb_load_string_cxt(mrb, args.cmdline, c);
}
+
mrbc_context_free(mrb, c);
if (mrb->exc) {
if (!mrb_undef_p(v)) {