summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--[-rwxr-xr-x]mrbgems/mruby-bin-debugger/bintest/mrdb.rb0
-rw-r--r--[-rwxr-xr-x]mrbgems/mruby-bin-debugger/bintest/print.rb0
-rw-r--r--[-rwxr-xr-x]mrbgems/mruby-bin-debugger/mrbgem.rake0
-rw-r--r--[-rwxr-xr-x]mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.c0
-rw-r--r--[-rwxr-xr-x]mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.h0
-rw-r--r--[-rwxr-xr-x]mrbgems/mruby-bin-debugger/tools/mrdb/apilist.c0
-rw-r--r--[-rwxr-xr-x]mrbgems/mruby-bin-debugger/tools/mrdb/apilist.h0
-rw-r--r--[-rwxr-xr-x]mrbgems/mruby-bin-debugger/tools/mrdb/apiprint.c0
-rw-r--r--[-rwxr-xr-x]mrbgems/mruby-bin-debugger/tools/mrdb/apiprint.h0
-rw-r--r--[-rwxr-xr-x]mrbgems/mruby-bin-debugger/tools/mrdb/cmdbreak.c0
-rw-r--r--[-rwxr-xr-x]mrbgems/mruby-bin-debugger/tools/mrdb/cmdmisc.c0
-rw-r--r--[-rwxr-xr-x]mrbgems/mruby-bin-debugger/tools/mrdb/cmdprint.c0
-rw-r--r--[-rwxr-xr-x]mrbgems/mruby-bin-debugger/tools/mrdb/cmdrun.c0
-rw-r--r--[-rwxr-xr-x]mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.c0
-rw-r--r--[-rwxr-xr-x]mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.h0
-rw-r--r--[-rwxr-xr-x]mrbgems/mruby-bin-debugger/tools/mrdb/mrdbconf.h0
-rw-r--r--[-rwxr-xr-x]mrbgems/mruby-bin-debugger/tools/mrdb/mrdberror.h0
-rw-r--r--mrbgems/mruby-bin-mirb/tools/mirb/mirb.c53
-rw-r--r--mrbgems/mruby-compiler/core/node.h6
-rw-r--r--mrbgems/mruby-random/src/random.h4
20 files changed, 58 insertions, 5 deletions
diff --git a/mrbgems/mruby-bin-debugger/bintest/mrdb.rb b/mrbgems/mruby-bin-debugger/bintest/mrdb.rb
index ae40f0a46..ae40f0a46 100755..100644
--- a/mrbgems/mruby-bin-debugger/bintest/mrdb.rb
+++ b/mrbgems/mruby-bin-debugger/bintest/mrdb.rb
diff --git a/mrbgems/mruby-bin-debugger/bintest/print.rb b/mrbgems/mruby-bin-debugger/bintest/print.rb
index e9d85f333..e9d85f333 100755..100644
--- a/mrbgems/mruby-bin-debugger/bintest/print.rb
+++ b/mrbgems/mruby-bin-debugger/bintest/print.rb
diff --git a/mrbgems/mruby-bin-debugger/mrbgem.rake b/mrbgems/mruby-bin-debugger/mrbgem.rake
index 764f431af..764f431af 100755..100644
--- a/mrbgems/mruby-bin-debugger/mrbgem.rake
+++ b/mrbgems/mruby-bin-debugger/mrbgem.rake
diff --git a/mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.c b/mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.c
index 67b4e8422..67b4e8422 100755..100644
--- a/mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.c
+++ b/mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.c
diff --git a/mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.h b/mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.h
index 3c7e41e52..3c7e41e52 100755..100644
--- a/mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.h
+++ b/mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.h
diff --git a/mrbgems/mruby-bin-debugger/tools/mrdb/apilist.c b/mrbgems/mruby-bin-debugger/tools/mrdb/apilist.c
index 1c77d1ef8..1c77d1ef8 100755..100644
--- a/mrbgems/mruby-bin-debugger/tools/mrdb/apilist.c
+++ b/mrbgems/mruby-bin-debugger/tools/mrdb/apilist.c
diff --git a/mrbgems/mruby-bin-debugger/tools/mrdb/apilist.h b/mrbgems/mruby-bin-debugger/tools/mrdb/apilist.h
index 6c4107885..6c4107885 100755..100644
--- a/mrbgems/mruby-bin-debugger/tools/mrdb/apilist.h
+++ b/mrbgems/mruby-bin-debugger/tools/mrdb/apilist.h
diff --git a/mrbgems/mruby-bin-debugger/tools/mrdb/apiprint.c b/mrbgems/mruby-bin-debugger/tools/mrdb/apiprint.c
index a9c895b55..a9c895b55 100755..100644
--- a/mrbgems/mruby-bin-debugger/tools/mrdb/apiprint.c
+++ b/mrbgems/mruby-bin-debugger/tools/mrdb/apiprint.c
diff --git a/mrbgems/mruby-bin-debugger/tools/mrdb/apiprint.h b/mrbgems/mruby-bin-debugger/tools/mrdb/apiprint.h
index e256f6262..e256f6262 100755..100644
--- a/mrbgems/mruby-bin-debugger/tools/mrdb/apiprint.h
+++ b/mrbgems/mruby-bin-debugger/tools/mrdb/apiprint.h
diff --git a/mrbgems/mruby-bin-debugger/tools/mrdb/cmdbreak.c b/mrbgems/mruby-bin-debugger/tools/mrdb/cmdbreak.c
index 57c1d5682..57c1d5682 100755..100644
--- a/mrbgems/mruby-bin-debugger/tools/mrdb/cmdbreak.c
+++ b/mrbgems/mruby-bin-debugger/tools/mrdb/cmdbreak.c
diff --git a/mrbgems/mruby-bin-debugger/tools/mrdb/cmdmisc.c b/mrbgems/mruby-bin-debugger/tools/mrdb/cmdmisc.c
index b4aeb62d4..b4aeb62d4 100755..100644
--- a/mrbgems/mruby-bin-debugger/tools/mrdb/cmdmisc.c
+++ b/mrbgems/mruby-bin-debugger/tools/mrdb/cmdmisc.c
diff --git a/mrbgems/mruby-bin-debugger/tools/mrdb/cmdprint.c b/mrbgems/mruby-bin-debugger/tools/mrdb/cmdprint.c
index cca636711..cca636711 100755..100644
--- a/mrbgems/mruby-bin-debugger/tools/mrdb/cmdprint.c
+++ b/mrbgems/mruby-bin-debugger/tools/mrdb/cmdprint.c
diff --git a/mrbgems/mruby-bin-debugger/tools/mrdb/cmdrun.c b/mrbgems/mruby-bin-debugger/tools/mrdb/cmdrun.c
index 2030c08b6..2030c08b6 100755..100644
--- a/mrbgems/mruby-bin-debugger/tools/mrdb/cmdrun.c
+++ b/mrbgems/mruby-bin-debugger/tools/mrdb/cmdrun.c
diff --git a/mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.c b/mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.c
index a5cf3be54..a5cf3be54 100755..100644
--- a/mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.c
+++ b/mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.c
diff --git a/mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.h b/mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.h
index 5ac12c1cd..5ac12c1cd 100755..100644
--- a/mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.h
+++ b/mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.h
diff --git a/mrbgems/mruby-bin-debugger/tools/mrdb/mrdbconf.h b/mrbgems/mruby-bin-debugger/tools/mrdb/mrdbconf.h
index f17f9c57d..f17f9c57d 100755..100644
--- a/mrbgems/mruby-bin-debugger/tools/mrdb/mrdbconf.h
+++ b/mrbgems/mruby-bin-debugger/tools/mrdb/mrdbconf.h
diff --git a/mrbgems/mruby-bin-debugger/tools/mrdb/mrdberror.h b/mrbgems/mruby-bin-debugger/tools/mrdb/mrdberror.h
index c7812b0d6..c7812b0d6 100755..100644
--- a/mrbgems/mruby-bin-debugger/tools/mrdb/mrdberror.h
+++ b/mrbgems/mruby-bin-debugger/tools/mrdb/mrdberror.h
diff --git a/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c b/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c
index e73a1c14d..b802321c3 100644
--- a/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c
+++ b/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c
@@ -11,6 +11,9 @@
#include <stdio.h>
#include <ctype.h>
+#include <signal.h>
+#include <setjmp.h>
+
#ifdef ENABLE_READLINE
#include <readline/readline.h>
#include <readline/history.h>
@@ -29,6 +32,16 @@
#define MIRB_USING_HISTORY()
#endif
+#ifndef _WIN32
+#define MIRB_SIGSETJMP(env) sigsetjmp(env, 1)
+#define MIRB_SIGLONGJMP(env, val) siglongjmp(env, val)
+#define SIGJMP_BUF sigjmp_buf
+#else
+#define MIRB_SIGSETJMP(env) setjmp(env)
+#define MIRB_SIGLONGJMP(env, val) longjmp(env, val)
+#define SIGJMP_BUF jmp_buf
+#endif
+
#include <mruby.h>
#include <mruby/array.h>
#include <mruby/proc.h>
@@ -326,6 +339,23 @@ check_keyword(const char *buf, const char *word)
return 1;
}
+
+#ifndef ENABLE_READLINE
+volatile sig_atomic_t input_canceled = 0;
+void
+ctrl_c_handler(int signo)
+{
+ input_canceled = 1;
+}
+#else
+SIGJMP_BUF ctrl_c_buf;
+void
+ctrl_c_handler(int signo)
+{
+ MIRB_SIGLONGJMP(ctrl_c_buf, 1);
+}
+#endif
+
int
main(int argc, char **argv)
{
@@ -336,6 +366,7 @@ main(int argc, char **argv)
size_t char_index;
#else
char *history_path;
+ char* line;
#endif
mrbc_context *cxt;
struct mrb_parser_state *parser;
@@ -410,6 +441,7 @@ main(int argc, char **argv)
#ifndef ENABLE_READLINE
print_cmdline(code_block_open);
+ signal(SIGINT, ctrl_c_handler);
char_index = 0;
while ((last_char = getchar()) != '\n') {
if (last_char == EOF) break;
@@ -419,6 +451,15 @@ main(int argc, char **argv)
}
last_code_line[char_index++] = last_char;
}
+ signal(SIGINT, SIG_DFL);
+ if (input_canceled) {
+ ruby_code[0] = '\0';
+ last_code_line[0] = '\0';
+ code_block_open = FALSE;
+ puts("^C");
+ input_canceled = 0;
+ continue;
+ }
if (last_char == EOF) {
fputs("\n", stdout);
break;
@@ -427,7 +468,19 @@ main(int argc, char **argv)
last_code_line[char_index++] = '\n';
last_code_line[char_index] = '\0';
#else
+ if (MIRB_SIGSETJMP(ctrl_c_buf) == 0) {
+ ;
+ }
+ else {
+ ruby_code[0] = '\0';
+ last_code_line[0] = '\0';
+ code_block_open = FALSE;
+ puts("^C");
+ }
+ signal(SIGINT, ctrl_c_handler);
line = MIRB_READLINE(code_block_open ? "* " : "> ");
+ signal(SIGINT, SIG_DFL);
+
if (line == NULL) {
printf("\n");
break;
diff --git a/mrbgems/mruby-compiler/core/node.h b/mrbgems/mruby-compiler/core/node.h
index 532a8323a..4f3669aca 100644
--- a/mrbgems/mruby-compiler/core/node.h
+++ b/mrbgems/mruby-compiler/core/node.h
@@ -4,8 +4,8 @@
** See Copyright Notice in mruby.h
*/
-#ifndef NODE_H
-#define NODE_H
+#ifndef MRUBY_COMPILER_NODE_H
+#define MRUBY_COMPILER_NODE_H
enum node_type {
NODE_METHOD,
@@ -114,4 +114,4 @@ enum node_type {
NODE_LAST
};
-#endif /* NODE_H */
+#endif /* MRUBY_COMPILER_NODE_H */
diff --git a/mrbgems/mruby-random/src/random.h b/mrbgems/mruby-random/src/random.h
index af82d66ac..a4785ae5a 100644
--- a/mrbgems/mruby-random/src/random.h
+++ b/mrbgems/mruby-random/src/random.h
@@ -4,8 +4,8 @@
** See Copyright Notice in mruby.h
*/
-#ifndef RANDOM_H
-#define RANDOM_H
+#ifndef MRUBY_RANDOM_H
+#define MRUBY_RANDOM_H
void mrb_mruby_random_gem_init(mrb_state *mrb);