Skip to content
Browse files

Add setjmp for mrb_raise

  • Loading branch information...
1 parent 147632c commit 5adf386620d82b1e00e2b313c9ea7877f2138217 @matsumoto-r committed Apr 4, 2013
Showing with 38 additions and 13 deletions.
  1. +29 −11 build_config.rb
  2. +8 −1 mod_mruby.c
  3. +1 −1 mruby
View
40 build_config.rb
@@ -11,23 +11,42 @@
# conf.gem :github => 'masuidrive/mrbgems-example', :branch => 'master'
# conf.gem :git => 'git@github.com:masuidrive/mrbgems-example.git', :branch => 'master', :options => '-v'
+ # Use standard Kernel#sprintf method
+ conf.gem "#{root}/mrbgems/mruby-sprintf"
+
+ # Use standard print/puts/p
+ conf.gem "#{root}/mrbgems/mruby-print"
+
# Use standard Math module
- conf.gem 'mrbgems/mruby-math'
+ conf.gem "#{root}/mrbgems/mruby-math"
# Use standard Time class
- conf.gem 'mrbgems/mruby-time'
+ conf.gem "#{root}/mrbgems/mruby-time"
# Use standard Struct class
- conf.gem 'mrbgems/mruby-struct'
+ conf.gem "#{root}/mrbgems/mruby-struct"
- # Use standard Kernel#sprintf method
- conf.gem 'mrbgems/mruby-sprintf'
+ # Use extensional Enumerable module
+ conf.gem "#{root}/mrbgems/mruby-enum-ext"
# Use extensional String class
- conf.gem 'mrbgems/mruby-string-ext'
+ conf.gem "#{root}/mrbgems/mruby-string-ext"
# Use extensional Numeric class
- conf.gem 'mrbgems/mruby-numeric-ext'
+ conf.gem "#{root}/mrbgems/mruby-numeric-ext"
+
+ # Use extensional Array class
+ conf.gem "#{root}/mrbgems/mruby-array-ext"
+
+ # Use extensional Hash class
+ conf.gem "#{root}/mrbgems/mruby-hash-ext"
+
+ # Use Random class
+ conf.gem "#{root}/mrbgems/mruby-random"
+
+ # No use eval method
+ # conf.gem "#{root}/mrbgems/mruby-eval"
+ #
conf.gem :git => 'git://github.com/iij/mruby-process.git'
conf.gem :git => 'git://github.com/iij/mruby-pack.git'
@@ -37,14 +56,13 @@
conf.gem :git => 'git://github.com/matsumoto-r/mruby-random.git'
conf.gem :git => 'git://github.com/matsumoto-r/mruby-discount.git'
conf.gem :git => 'git://github.com/matsumoto-r/mruby-redis.git'
+ conf.gem :git => 'git://github.com/matsumoto-r/mruby-capability.git'
+ conf.gem :git => 'git://github.com/matsumoto-r/mruby-cgroup.git'
- # linux only
- #conf.gem :git => 'git://github.com/matsumoto-r/mruby-capability.git'
- #conf.gem :git => 'git://github.com/matsumoto-r/mruby-cgroup.git'
# Generate binaries
# conf.bins = %w(mrbc mruby mirb)
-
+
# C compiler settings
# conf.cc do |cc|
# cc.command = ENV['CC'] || 'gcc'
View
9 mod_mruby.c
@@ -60,6 +60,7 @@
#include <unistd.h>
#include <sys/stat.h>
+#include <setjmp.h>
//#include <sys/prctl.h>
#include "mod_mruby.h"
@@ -1039,7 +1040,13 @@ static int ap_mruby_run(mrb_state *mrb, request_rec *r, mruby_config_t *conf, co
);
ap_mrb_set_status_code(OK);
- mrb_run(mrb, mrb_proc_new(mrb, mrb->irep[n]), mrb_top_self(mrb));
+ jmp_buf mod_mruby_jmp;
+ if (!setjmp(mod_mruby_jmp)) {
+ mrb->jmp = &mod_mruby_jmp;
+ mrb_run(mrb, mrb_proc_new(mrb, mrb->irep[n]), mrb_top_self(mrb));
+ } else {
+ mrb->jmp = 0;
+ }
mrb_gc_arena_restore(mrb, ai);
if (mrb->exc)
2 mruby
@@ -1 +1 @@
-Subproject commit 5fb12a990d4d30876ce21e6225acbef35f47b48a
+Subproject commit d8c4f6a08034225e0b02708c548495a2f2f300b5

0 comments on commit 5adf386

Please sign in to comment.
Something went wrong with that request. Please try again.