summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--LEGAL40
-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--src/dump.c1
-rw-r--r--src/parse.y4
-rw-r--r--tasks/mrbgems.rake3
-rw-r--r--tools/mirb/mirb.c8
-rw-r--r--tools/mruby/mruby.c8
9 files changed, 26 insertions, 134 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/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/src/dump.c b/src/dump.c
index 4714278b0..9579dabd4 100644
--- a/src/dump.c
+++ b/src/dump.c
@@ -512,6 +512,7 @@ mrb_dump_irep_cfunc(mrb_state *mrb, size_t start_index, int debug_info, FILE *fp
result = mrb_dump_irep(mrb, start_index, debug_info, &bin, &bin_size);
if (result == MRB_DUMP_OK) {
+ fprintf(fp, "#include <stdint.h>\n"); // for uint8_t under at least Darwin
fprintf(fp, "const uint8_t %s[] = {", initname);
while (bin_idx < bin_size) {
if (bin_idx % 16 == 0 ) fputs("\n", fp);
diff --git a/src/parse.y b/src/parse.y
index 35bc18cd5..7972e87c4 100644
--- a/src/parse.y
+++ b/src/parse.y
@@ -38,6 +38,10 @@ static void yywarn(parser_state *p, const char *s);
static void yywarning(parser_state *p, const char *s);
static void backref_error(parser_state *p, node *n);
+#ifndef isascii
+#define isascii(c) (((c) & ~0x7f) == 0)
+#endif
+
#define identchar(c) (isalnum(c) || (c) == '_' || !isascii(c))
typedef unsigned int stack_type;
diff --git a/tasks/mrbgems.rake b/tasks/mrbgems.rake
index 1f3aa0811..c18a9a181 100644
--- a/tasks/mrbgems.rake
+++ b/tasks/mrbgems.rake
@@ -8,7 +8,7 @@ MRuby.each_target do
# loader all gems
self.libmruby << objfile("#{build_dir}/mrbgems/gem_init")
- file objfile("#{build_dir}/mrbgems/gem_init") => "#{build_dir}/mrbgems/gem_init.c"
+ file objfile("#{build_dir}/mrbgems/gem_init") => ["#{build_dir}/mrbgems/gem_init.c", "#{build_dir}/LEGAL"]
file "#{build_dir}/mrbgems/gem_init.c" => [MRUBY_CONFIG] do |t|
FileUtils.mkdir_p "#{build_dir}/mrbgems"
open(t.name, 'w') do |f|
@@ -42,7 +42,6 @@ MRuby.each_target do
end
# legal documents
- self.libmruby << "#{build_dir}/LEGAL"
file "#{build_dir}/LEGAL" => [MRUBY_CONFIG] do |t|
open(t.name, 'w+') do |f|
f.puts <<LEGAL
diff --git a/tools/mirb/mirb.c b/tools/mirb/mirb.c
index ed3b105b6..044d95faa 100644
--- a/tools/mirb/mirb.c
+++ b/tools/mirb/mirb.c
@@ -38,11 +38,8 @@ is_code_block_open(struct mrb_parser_state *parser)
{
int code_block_open = FALSE;
- /* check for unterminated string */
- if (parser->lex_strterm) return TRUE;
-
/* 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;
@@ -70,6 +67,9 @@ is_code_block_open(struct mrb_parser_state *parser)
return code_block_open;
}
+ /* check for unterminated string */
+ if (parser->lex_strterm) return TRUE;
+
switch (parser->lstate) {
/* all states which need more code */
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)) {