hruby 0.3.1.2 → 0.3.1.3
raw patch · 6 files changed
+20/−6 lines, 6 files
Files
- Foreign/Ruby/Bindings.hsc +1/−2
- Foreign/Ruby/Helpers.hs +1/−2
- Foreign/Ruby/Safe.hs +1/−1
- cbits/shim.c +14/−0
- cbits/shim.h +2/−0
- hruby.cabal +1/−1
Foreign/Ruby/Bindings.hsc view
@@ -79,9 +79,8 @@ type RegisteredCB3 = RValue -> RValue -> RValue -> IO Int foreign import ccall "wrapper" mkRegisteredCB3 :: RegisteredCB3 -> IO (FunPtr RegisteredCB3) -foreign import ccall "ruby_init" ruby_init :: IO () foreign import ccall "ruby_finalize" ruby_finalize :: IO ()-foreign import ccall "ruby_init_loadpath" ruby_init_loadpath :: IO ()+foreign import ccall "ruby_initialization" ruby_initialization :: IO () #ifdef RUBY21 foreign import ccall "rb_str_new_cstr" c_rb_str_new2 :: CString -> IO RValue foreign import ccall "rb_ary_new_capa" rb_ary_new2 :: CLong -> IO RValue
Foreign/Ruby/Helpers.hs view
@@ -178,8 +178,7 @@ runscript :: String -> IO (Either String ()) runscript filename = do- ruby_init- ruby_init_loadpath+ ruby_initialization status <- rb_load_protect filename 0 if status == 0 then ruby_finalize >> return (Right ())
Foreign/Ruby/Safe.hs view
@@ -138,7 +138,7 @@ startRubyInterpreter :: IO RubyInterpreter startRubyInterpreter = do q <- newTQueueIO- void $ forkOS (ruby_init >> ruby_init_loadpath >> go q)+ void $ forkOS (ruby_initialization >> go q) return (RubyInterpreter q) {-| This is basically :
cbits/shim.c view
@@ -1,4 +1,18 @@ #include "shim.h"+#include <ruby/encoding.h>++void ruby_initialization(void) {+ RUBY_INIT_STACK;+ ruby_init();+ ruby_init_loadpath();+ VALUE encoding = rb_enc_from_encoding(rb_filesystem_encoding());+ rb_enc_set_default_internal(encoding);+ rb_enc_set_default_external(encoding);+ void rb_encdb_declare(const char *name);+ rb_encdb_declare("ASCII-8BIT");+ rb_encdb_declare("US-ASCII");+ rb_encdb_declare("UTF-8");+} VALUE safeCall(VALUE args) {
cbits/shim.h view
@@ -3,6 +3,8 @@ #include <ruby/intern.h> #endif +void ruby_initialization(void);+ struct s_dispatch { char * classname; char * methodname;
hruby.cabal view
@@ -2,7 +2,7 @@ -- see http://haskell.org/cabal/users-guide/ name: hruby-version: 0.3.1.2+version: 0.3.1.3 synopsis: Embed a Ruby intepreter in your Haskell program ! description: This doesn't work with Ruby 1.9. Everything you need should be in Foreign.Ruby.Safe. license: BSD3